agentleFS
OneDro1dOneDro1d/dark-factory/skills/df-context-store/SKILL.md

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".

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
  1. Very specific:

    Leave FINDINGS.md/DECISIONS.md as clean skeletons that accumulate as the repo is worked.

    line 31
  2. Very specific:

    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 …

    line 46
  3. Very specific:

    Verify (acceptance): Run bash substrate-template/verify-substrate.sh (from this skill dir) against the template, and for an emitted repo …

    line 52

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Emit the payload. Copy substrate-template/dotclaude/ into the target repo as .claude/ (agents + context store + hooks/ + contract-check + commit-sync
    • AGENT-CONTRACTS.md). Don't overwrite an existing populated store — merge.
  2. Populate from source, don't invent.
    • .claude/context/SERVICE-MAP.md — the structural map (services/db/queue/API + flows), generated from the real codebase (use service-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 (LOCAL reject / GLOBAL reconcile). Populate nodes + authority from source; leave rules you can't yet cite as marked skeletons.
    • Leave FINDINGS.md/DECISIONS.md as clean skeletons that accumulate as the repo is worked. Fill per-service <service>/CLAUDE.md stubs only where verified (file:line).
  3. Wire the always-on carrier. Merge substrate-template/CLAUDE-stanza.md into the repo's root CLAUDE.md (read-first/dispatch/verify rules) — this is what binds every session, not the one-time scaffold.
  4. 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 SessionStart hook from substrate-template/dotclaude/settings.json into the repo's .claude/settings.json (create it if absent; if it exists, add the SessionStart entry — do not clobber existing hooks). This runs ensure-gate.sh on every session so a fresh clone activates the gate with no manual step. (core.hooksPath is 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.hooksPath and no husky, run git config core.hooksPath .claude/hooks (or just run bash .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.local under the existing path (it chains). Say which path you took.
  5. 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 in SERVICE-MAP/DATA-FLOW (they're populated), the contract-check suite 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; clean FINDINGS.md/DECISIONS.md skeletons.
  • An armed pre-commit staleness gate (core.hooksPath set, or chained via .local), self-arming on future clones via the SessionStart → ensure-gate.sh hook merged into .claude/settings.json.

Rules

  • Populate, don't fabricate — SERVICE-MAP entries 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/DECISIONS ledger.
  • 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-build as 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.