df-context-store
Skill4 starsChanged 2 months agoApache-2.0View on GitHub
Dark Factory Stage 0.5 — scaffold a repo's in-repo agent inner-loop substrate (read-first context store + single-responsibility agents + checkable hand-off contracts + commit gate) from the proven template, populate it from the real codebase, and verify it. Use when bootstrapping a repo for DF work, running a DF build, or adding the agent substrate to an existing repo. Triggers on "context store", "agent substrate", "inner loop", "bootstrap agents", "df stage 0.5".
In this repository43 other files it gives its agents.
- skills/vercel-react-best-practices/AGENTS.mdAGENTS.md
- agent-notepadSkill
- architecture-reviewerSkill
- backend-service-auditorSkill
- channel-listenerSkill
- code-reviewerSkill
- coder-file-transferSkill
- cold-start-generatorSkill
- creating-skillsSkill
- critical-thinkingSkill
- dark-factory-buildSkill
- dependency-risk-auditorSkill
- df-adversary-gateSkill
- df-app-walkthroughSkill
- df-data-transform-lensSkill
- df-dispatch-subagentsSkill
- df-infrastructureSkill
- df-observabilitySkill
- df-product-ownerSkill
- df-qaSkill
- df-solution-architectSkill
- df-tdd-developerSkill
- df-ui-verifySkill
- df-video-intakeSkill
- dx-maintainability-reviewerSkill
- frontend-auditorSkill
- handoffSkill
- microservices-architectSkill
- production-readiness-reviewerSkill
- repo-docsSkill
- requirements-discoverySkill
- sc-auditSkill
- sc-devSkill
- scope-initSkill
- scope-retireSkill
- security-threat-modelerSkill
- service-mapperSkill
- test-quality-gatekeeperSkill
- vercel-react-best-practicesSkill
- vinculum-loopSkill
- vinculum-mapSkill
- web-design-guidelinesSkill
- work-autonomouslySkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
Leave FINDINGS.md/DECISIONS.md as clean skeletons that accumulate as the repo is worked.
- Very specific: line 46
Arm it now (non-destructive): if the repo has no existing core.hooksPath and no husky, run git config core.hooksPath .claude/hooks (or just …
- Very specific: line 52
Verify (acceptance): Run bash substrate-template/verify-substrate.sh (from this skill dir) against the template, and for an emitted repo …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
df-context-store — plant the inner-loop substrate (DF Stage 0.5)
Goal: give the repo a persistent, in-repo, read-first agent substrate so analysis is done once and reused, hand-offs can't silently degrade, and nothing ships unverified. This is the inner-loop complement to the heavy DF build stages — the build injects rigor at the seams; this is what lives in the repo and binds every future session. It runs between Stage 0 (Frame) and Stage 1 (PO), and again on demand to refresh.
Template (source of truth): the substrate-template/ directory bundled alongside
this skill (skills/df-context-store/substrate-template/).
Procedure
- Emit the payload. Copy
substrate-template/dotclaude/into the target repo as.claude/(agents + context store +hooks/+contract-check+commit-syncAGENT-CONTRACTS.md). Don't overwrite an existing populated store — merge.
- Populate from source, don't invent.
.claude/context/SERVICE-MAP.md— the structural map (services/db/queue/API + flows), generated from the real codebase (useservice-mapper)..claude/context/DATA-FLOW.md— the data-transform view: data nodes (schema/origin/authority/class), the transform graph (pure|effect), and the validation rules (LOCALreject /GLOBALreconcile). Populate nodes + authority from source; leave rules you can't yet cite as marked skeletons.- Leave
FINDINGS.md/DECISIONS.mdas clean skeletons that accumulate as the repo is worked. Fill per-service<service>/CLAUDE.mdstubs only where verified (file:line).
- Wire the always-on carrier. Merge
substrate-template/CLAUDE-stanza.mdinto the repo's rootCLAUDE.md(read-first/dispatch/verify rules) — this is what binds every session, not the one-time scaffold. - Arm the lockstep gate + make it self-arming (the every-commit half). The gate
can't drift code from the context store silently:
chmod +x .claude/hooks/pre-commit .claude/hooks/ensure-gate.sh- Self-arm carrier: merge the
SessionStarthook fromsubstrate-template/dotclaude/settings.jsoninto the repo's.claude/settings.json(create it if absent; if it exists, add theSessionStartentry — do not clobber existing hooks). This runsensure-gate.shon every session so a fresh clone activates the gate with no manual step. (core.hooksPathis local git config and never travels in a commit — the SessionStart hook is what carries the every-clone half.) - Arm it now (non-destructive): if the repo has no existing
core.hooksPathand no husky, rungit config core.hooksPath .claude/hooks(or just runbash .claude/hooks/ensure-gate.sh, which does exactly this safely). If one already exists, do not overwrite it — install the gate as.claude/hooks/pre-commit.localunder the existing path (it chains). Say which path you took.
- Verify (acceptance). Run
bash substrate-template/verify-substrate.sh(from this skill dir) against the template, and for an emitted repo confirm: required files present, no leftover template placeholders inSERVICE-MAP/DATA-FLOW(they're populated), thecontract-checksuite is green, the gate is executable + actually blocks an undocumented structural change, and the CLAUDE.md stanza is merged. Green is the bar; report the literal check counts.
Outputs
.claude/{agents,context,hooks,skills/contract-check,skills/commit-sync}in the target repo.- A read-first stanza merged into the repo's
CLAUDE.md. - A populated
SERVICE-MAP.md+DATA-FLOW.md; cleanFINDINGS.md/DECISIONS.mdskeletons. - An armed
pre-commitstaleness gate (core.hooksPathset, or chained via.local), self-arming on future clones via theSessionStart→ensure-gate.shhook merged into.claude/settings.json.
Rules
- Populate, don't fabricate —
SERVICE-MAPentries cite real code; unknowns are marked, not guessed (same discipline the agents enforce). - Idempotent — re-running merges/refreshes; it must not duplicate entries or
clobber an accumulated
FINDINGS/DECISIONSledger. - Generic-in, specific-out — the template is project-neutral; the emitted substrate is tailored to THIS repo. Don't ship template placeholders into a repo.
- Referenced by
dark-factory-buildas Stage 0.5. An organisation layer may also call this as the substrate step of its own cold-start generator where that toolchain is present — optional integration, not required.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

