code-context-map
Skill10 starsChanged 34 days agoMITView on GitHub
Generate and re-sync an AI-readable code context map (ranked, token-budgeted Markdown of files, imports, signatures, and typed boundary calls) for a target project (or, from a seed file, its import chain). Opt-in; not part of default task init. Use when fast structural orientation is needed before editing, when onboarding to an unfamiliar repo, or when an existing map is stale. Do not use to locate one behavior (use code-locate), for blast radius (use impact-analysis), for a database schema (use db-context-supabase), or without a target codebase path.
In this repository98 other files it gives its agents.
- AGENTS.mdAGENTS.md
- a11y-auditSkill
- ai-feature-eval-harnessSkill
- api-contract-reviewSkill
- api-runtime-verifySkill
- apply-sweep-triageSkill
- approve-planSkill
- approve-proposedSkill
- app-runtime-verifySkill
- atom-audit-fleetSkill
- atom-auditSkill
- autonomous-boardSkill
- autonomous-readinessSkill
- autonomous-runSkill
- backend-system-designSkill
- branch-commitSkill
- capture-observationSkill
- capture-referencesSkill
- code-locateSkill
- color-contrast-architectSkill
- compact-task-memorySkill
- component-specSkill
- contract-signoffSkill
- db-context-postgresSkill
- db-context-supabaseSkill
- decision-interviewSkill
- delivery-assetSkill
- design-bootstrapSkill
- design-spec-reviewSkill
- direction-adjustSkill
- external-research-fleetSkill
- external-researchSkill
- extract-foundations-from-screensSkill
- feature-library-scout-fleetSkill
- feature-library-scoutSkill
- foundation-auditSkill
- frontend-architecture-reviewSkill
- frontend-system-designSkill
- godot-runtime-verifySkill
- godot-scene-planSkill
- graphql-contract-reviewSkill
- harvest-session-learningsSkill
- image-to-specSkill
- impact-analysisSkill
- implement-approved-sliceSkill
- implementation-planSkill
- implement-fleetSkill
- implement-slice-complementSkill
- im-stuckSkill
- incident-triageSkill
- invariants-and-non-goalsSkill
- inventory-snapshotSkill
- journey-mapSkill
- jtbd-switch-interviewerSkill
- mcp-server-vetSkill
- migration-safety-stewardSkill
- pattern-docSkill
- performance-budgetSkill
- portfolio-reviewSkill
- post-deploy-verifierSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 1 is distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
Read these sections in WORKFLOW_OPERATING_SYSTEM.md first:
- Distinctive: line 43
Read additional sections only when relevant to this command's role.
- Very specific: line 71
Do not implement or modify production code.
- Very specific: line 74
Regenerate-on-invoke (D-6): always regenerate from the live working tree.
- Very specific: line 89
Do not fabricate files, symbols, imports, or boundary edges.
- Very specific: line 91
Treat task-memory write policy per WORKFLOW_OPERATING_SYSTEM.md: write the file and mark it APPLIED.
- Very specific: line 129
Follow ## Global output contract in WORKFLOW_OPERATING_SYSTEM.md for APPLIED / PROPOSED / SKIP rules.
- Very specific: line 139
When html is set, MAP.html is a single self-contained file in the gitignored folder, renders only already-extracted edges, is node-capped …
- Very specific: line 142
Every file, symbol, import, invoke edge, and boundary edge traces to a real file:line.
- Very specific: line 144
No production source is modified.
- Very specific: line 145
When a task is active, at most a single ## Code context map cross-link is added to SOURCE_OF_TRUTH.md.
- Very specific: line 149
Before declaring this output done, confirm it satisfies the shared Definition of done (command outputs) and Gate conditions in …
≈ “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
Output contract, in brief. This body is over the per-skill re-injection cap, so after a compaction the sections below are truncated away while this summary survives. They remain authoritative in full; re-read this file before emitting if you need them.
Standard output layout (required): Produce the command output using this structure (English only):Artifact changes: Follow## Global output contractinWORKFLOW_OPERATING_SYSTEM.mdforAPPLIED/PROPOSED/SKIPrules. Every listed file...Command transcript: Brief audit trail (max 4 lines; max 3 in no-op runs withNO_OP_TRACE).Handoff: Use the adaptive ending format ofWORKFLOW_OPERATING_SYSTEM.md## Global output contract. Every Handoff is one fencedtextb...Definition of done (command output): The artifact is written only inside<target-codebase>/.code-context-map/(MAP.md, and MAP.html whenhtmlis set), and `.code-c...
Act as a senior/staff engineer producing a durable, AI-readable structural map of a codebase.
Goal:
Generate a ranked, token-budgeted, layered Markdown "code context map" of a target project (files, imports, signatures, invoke edges, and typed external boundary calls), write it to a gitignored folder inside that project, and regenerate it on invoke so an AI assistant reads the map first and knows precisely what to read, index, and test before changing code. A chain:<seed-file> scope additionally walks one file's import chain by direction with a hop cap, extracting with ripgrep by default and with a parser when one is already present (ADR-0057 D-2, D-5). The map ORIENTS; it is a seed for grep, not a replacement for reading the code. Follows templates/CODE_CONTEXT_MAP.template.md.
This command is opt-in, not part of default task init (use it for structural orientation, onboarding, or a stale map). The governing decision is docs/adr/0027-code-context-map-and-product-repo-artifacts.md.
Mandatory context bootstrap (before any output):
- Read these sections in
WORKFLOW_OPERATING_SYSTEM.mdfirst:## LLM execution contract## Editor mode policy(mode definitions only; the tool mapping table is lazy-loaded inwos/editor-mode-mappings.mdand needed only for non-Claude-Code tools)## Global output contract(including Adaptive handoff and Mode selection rule)## Cross-cutting workflow guardrails
- Bootstrap tiers: the light-weight commands (
branch-commit,what-next,where-we-at,slice-closure,compact-task-memory) plus the high-frequencyimplement-approved-sliceandsync-task-state(v3 wave1 item D) read the four sections above with two subsections of## Cross-cutting workflow guardrailsskipped:### External web access (centralized)and### Sequencing heuristics (by phase). Everything else is read at every tier, including### Proposal vs approved persistenceand### Substrate peer ownership (per ADR-0034), since all seven write substrate sections and reason about PROPOSED (state-reconcilestays on the full tier for cross-artifact judgment). The full tier is measured at 12109 tokens, the four always-read sections combined; the two skipped subsections are 1,034 of those (measured 2026-09-28), so the reduced tier is about 11,074. The leaf-reviewer tier (verify-against-rubric, ADR-0226) reads only## Global output contract, measured at 5215 tokens, plus its rubric. - Session bootstrap reuse (skip-if-unchanged; v3 wave1 item D): WHEN this conversation already read the bootstrap sections in an earlier turn still VISIBLE in the context window AND
WORKFLOW_OPERATING_SYSTEM.mdhas not changed since, the command MAY skip the re-read and cite the earlier one, emitting one Command transcript line:Bootstrap: reusing turn <N> read, WOS unchanged. Scoped exception to the context-budget re-fetch rule (wos/context-budget.md, "The re-fetch rule"), because these sections are one large, static, byte-identical read repeated every turn; every other tool result still re-fetches. VISIBLE means the section text itself is still present and quotable now, not merely that a record of the earlier read exists: a harness that clears a tool result while the record survives (ADR-0114) has not satisfied VISIBLE, and self-declared memory after a compaction never qualifies. A stateless-per-turn harness is excluded. The transcript line is mandatory; a silent skip is invalid output. - Resolving the spec and
wos/<topic>.md: canonical repository FIRST. Otherwise use active-adapter docs:~/.claude/workflow-docs(CLAUDE_WORKFLOW_DOCS_DIR),~/.cursor/workflow-docs(WORKFLOW_DOCS_DIR; project.cursor/workflow-docson project installs),~/.codex/workflow-docs(CODEX_WORKFLOW_DOCS_DIR), or<kimi-home>/workflow-docs(KIMI_WORKFLOW_DOCS_DIR). Nonempty overrides win. Kimi home:KIMI_CODE_HOME, else existing~/.kimi-code, else existing~/.kimi, default~/.kimi-code. Use one root for both paths; try other adapters if absent or unknown. Report resolved root, fallback to other adapters, or missing mandatory context in### Command transcript. Installed snapshots refresh and prune retired topics only on sync. - Read additional sections only when relevant to this command's role.
- Align all routing recommendations and next-command suggestions with the current command set.
- Official next-command names only: recommendations, including
Run now, use registered names fromcommands/<name>.mdorcommands/<name>/SKILL.md; installed mode uses the available Fhorja command or skill inventory. No invented aliases.Run now: nonewithMode: N/Aends only if no honest next step exists, defined under### Official command names (routing integrity)(ADR-0126). Required inputs: - target codebase path (the project to map; the map is written inside this path). When a task is active and
SOURCE_OF_TRUTH.mdnames the workspace, default to that. - scope, one of:
digest(default): Layer 1 only (repo digest + module-to-file import adjacency + boundary summary). Cheapest; always safe for a whole repo.module:<path/glob>: Layer 1 plus Layer 2 detail (ranked signatures, invoke edges, typed boundary edges) for the named module(s). Use for the area the current task touches.chain:<seed-file>: Layer 1 plus a seed-anchored import-chain walk from<seed-file>(ADR-0057 D-5). Answers "what does this file pull in, and in what order does the wiring run". Walks by direction with a hop cap and a cycle guard.
- optional (chain scope only):
directionone ofimports(default),dependents, orboth;max-hops(default 4, orallfor an unbounded walk until no new files are reached) caps the radius; cycle edges are recorded once and not re-walked. For a whole-repo view prefer thedigestormodule:scopes; achain:withmax-hops:allon a large repo trips the consent-gated fleet (D-4) by design. - optional: token budget for Layer 2 (default 1200 tokens per module; raise only when justified). Layer 1 is always generated regardless of budget.
- optional:
keywords:<comma-separated-terms>(task-scoped) to rerank Layer 2 symbols toward the current task. WHEN set, Layer 2 symbols are reranked by ripgrep term-frequency of these terms blended with the existing import fan-in via reciprocal rank fusion (RRF), and that Layer 2's ranking source is labeledstructural + keyword. WHEN unset, ranking is import fan-in only, the source is labeledstructural, and the output is byte-identical to prior behavior. Ripgrep-only: no embeddings and no vector index (ADR-0072, activating the optional rerank ADR-0027 D-8 deferred). - optional:
--explain-rankingflag to show, per Layer 2 symbol, its fan-in rank, its keyword-frequency rank, and the fused RRF score, so a reranked order is auditable. Off by default; WHEN off, the symbol-line format is unchanged, and WHENkeywords:is absent the flag adds nothing beyond the fan-in rank. - optional: language hint (defaults to auto-detect by file extension; v1 ships pattern sets for TS/JS first and degrades gracefully elsewhere).
- optional: refresh flag (
refreshto regenerate an existing map; default behavior is regenerate-on-invoke, so a non-stale identical map yieldsNO_OPrather than a rewrite). - optional:
--skip-secret-scanto bypass the pre-emit secret gate (ADR-0060); the command never auto-skips, so this is the explicit human override after a confirmed false positive. - optional flags, host-rendered with no new dependency (full behavior in Operating rules below):
diagram(append a Mermaid import-adjacency and invoke flowchart, node-capped, ADR-0047);sequence:<flow>(append a Mermaid sequenceDiagram for one named runtime flow);exemplars(1 to 3 blessed in-repo reference snippets a greenfield slice should mirror, ranked by fan-in);html(also emit a self-contained interactiveMAP.htmlin the same gitignored folder, ADR-0057 D-3).
Files to read (in the target codebase, read-only):
- source files in scope, via
rgqueries for imports, definitions/signatures, invoke sites, and boundary call-sites (db/http/queue). Never modify source, because this command produces a read-only orientation aid; writing to the target would turn a navigation map into an unreviewed code change.
Files to create or update:
<target-codebase>/.code-context-map/MAP.md(the artifact; create or fully regenerate, never partial-merge).<target-codebase>/.code-context-map/MAP.html(only when thehtmlflag is set: the self-contained human projection; create or fully regenerate, never partial-merge).<target-codebase>/.gitignore(append-only: ensure.code-context-map/is ignored if not already; the only product-repo file outside.code-context-map/that this command may touch).- active task
SOURCE_OF_TRUTH.md, when a task is active (append-only: add a single## Code context mapsection pointing to the artifact path, if not already present).
Operating rules:
- Do not implement or modify production code. This command reads code and writes only the gitignored map artifacts (MAP.md, and MAP.html when
htmlis set) plus a.gitignoreentry. - Gitignored artifact (D-1, ADR-0027): the map lives in
<target-codebase>/.code-context-map/and MUST be gitignored. Before writing, ensure.code-context-map/is present in the target repo's.gitignore; if not, append it. Never commit the map; never write it outside the gitignored folder. - Pre-emit secret gate (ADR-0060): before writing MAP.md (and MAP.html), run
scripts/secret-scan-gate.sh <target-codebase-path>over the in-scope path, because the map summarizes a repo that may hold credentials and the gate is a hard stop, not advisory text. It is presence-gated (ADR-0027): gitleaks if present (a finding BLOCKS the write, exit 1), else trufflehog--no-verification(offline; a finding BLOCKS), else a built-in rg pattern scan that WARNS only (coarse regex is too false-positive-prone to gate on). On a BLOCK, do NOT write the map: surface the findings, tell the user to revoke or whitelist (gitleaks:allow), and require the explicit--skip-secret-scaninput to proceed. The command never auto-skips. Resolvescripts/secret-scan-gate.shagainst the WORKFLOW ROOT (the clone, or the installed docs directory, which ships it per ADR-0224), never against the target codebase. WHEN it is in neither, or exits 3 (NOT scanned: no gitleaks, trufflehog or rg on PATH), the source was NOT scanned: the map may still be written (the no-install posture), but MAP.md's header and### Command transcriptboth carrysecret scan: NOT scanned (<reason>), and neither says or implies the source was checked. - Regenerate-on-invoke (D-6): always regenerate from the live working tree. Record
Last generated: YYYY-MM-DD on <branch>@<short-sha>in the artifact. If the freshly generated map is byte-identical to the existing one, reportNO_OPand do not rewrite. - Layering (D-7, D-11): always generate Layer 1 (repo digest + module import adjacency + boundary summary). Generate Layer 2 detail only for in-scope module(s) and only within the token budget. Never emit a flat signature-level dump of an entire large repo (it blows the budget and causes context rot).
- Extraction (D-10, amended by ADR-0057 D-2): use ripgrep-based extraction (imports, definitions/signatures, invoke sites, boundary call-sites) assembled by reasoning. Do NOT require or install an AST parser, vector DB, or embedding model. Optional, only-if-already-present augmentation:
npx madge/dependency-cruiser, or a tree-sitter already present, for a precise JS/TS file-import graph. For thechain:scope, WHERE such a parser is already present use it to resolve barrels, default and dynamic imports, and aliases in the chain; WHILE only ripgrep is available, label the chaingrep-seed (non-authoritative)and do not present it as a faithful import chain. Never install a parser; the ripgrep walk is always the working default. - Layer 2 compression (presence-gated, ADR-0027 no-install + ADR-0057 D-2): WHERE
repomixis already present in the target repo, runnpx repomix --compressto source Layer 2 from its tree-sitter signatures-only extraction (function and method signatures, interface and type definitions, class shapes; implementations, loop and conditional bodies, and internal variables stripped; roughly 70% fewer tokens than full files) and label that Layer 2source: repomix --compress. WHILErepomixis absent, fall back to the ripgrep signature heuristics labeledsource: ripgrep (heuristic). Never install repomix; this is opt-in augmentation and the labeled fallback keeps the default path unchanged. - Chain walk (ADR-0057 D-5): for
chain:<seed-file>, start at the seed and follow imports breadth-first bydirectionup tomax-hops(or until no new files are reached whenmax-hops:all); record each file once (cycle guard), rank modules within a hop by import fan-in, and stop at the cap. The import chain is additive to Layer 1; never emit a flat whole-repo signature dump for a chain scope. - Generation path (ADR-0057 D-4; Workflow tool, ADR-0038): generate the map in a single pass by default. WHERE the traversal needed to satisfy the scope is estimated to exceed a single context window (starting heuristic, adjustable: more than ~150 in-scope files to read, or a
chain:walk that would pull more than ~80 files or ~25k tokens of source in one pass), produce the single-pass bounded map by default: cap the traversal at the budget, label itbounded (partial)in the artifact, and state in one line the scope, the estimated worker count a full pass would need, and what the cap left out. Do NOT stop for consent before generating: a bounded map is useful output and the estimate is a cost warning, not a gate (D-6). The Workflow fan-out (ADR-0038) stays available and stays opt-in: dispatch it only when the user asks for the full map in that turn, onemechanicalworker (ADR-0236,wos/model-routing.md ## Dispatch roles) per disjoint sub-tree or module-group, each writing a partial, merged into the single MAP.md (and MAP.html whenhtmlis set) by this command as the sole writer. Never fan out without that explicit request. - Ranking (D-12, extended by ADR-0072): rank symbols and modules by internal import fan-in, most-relevant-first. WHEN no
keywords:are provided, this fan-in-only order is the default, that Layer 2 is labeled ranking sourcestructural, and the output is byte-identical to prior behavior (no keyword rerank runs). WHENkeywords:are provided, rerank Layer 2 symbols by blending fan-in with ripgrep keyword term-frequency via reciprocal rank fusion (see the keyword rerank rule below) and label that Layer 2 ranking sourcestructural + keyword. Import fan-in stays the primary structural signal; the keyword signal only reorders within the same candidate set, it never adds or removes symbols. No embeddings and no vector index (ADR-0027 D-8, extended by ADR-0072); the only lexical signal is a ripgrep term-frequency count. - Keyword rerank blend (ADR-0072, priority corrected by ADR-0195, optional): this fires only WHEN
keywords:are provided and touches Layer 2 symbol ordering only (Layer 1 and module ranking stay fan-in). Build two ranked lists over the same in-scope symbols: (1) the existing import fan-in order, and (2) a keyword order by ripgrep term-frequency, counting case-insensitivergmatches of the supplied terms across each symbol's citedfile:linespan (sum across terms; ties broken by fan-in). Fuse the two ranks with reciprocal rank fusion:score(sym) = 1/(k + rank_fanin(sym)) + 1/(k + rank_keyword(sym))withk = 60, then sort by descending score. A symbol with zero keyword hits is absent from list (2) and keeps only its fan-in term. Apply the same descending-score order to all candidates, including zero-hit symbols; do not group matching symbols ahead of them. This is ripgrep-only: no embeddings, no vector index, and no persisted keyword index. WHEN nokeywords:are provided, skip this rule entirely and emit the fan-in-only order unchanged. Under--explain-ranking, show each symbol'srank_fanin,rank_keyword(ornone), and fused score. - Typed boundary edges: detect db/http/queue/cache/external-api call-sites by pattern and record each as
kind | target | file:line. Do not infer dataflow; record call-sites only. - No flow-graphs, no embeddings (D-7, D-8): control/data-flow graphs and any vector/semantic layer are out of v1 scope. Do not add them.
- Mermaid diagram emit (optional, ADR-0047): when a diagram flag is set, render the ALREADY-EXTRACTED edges as Mermaid text appended to MAP.md.
diagramrenders module import adjacency and invoke edges as a flowchart (transitive-reduced, node-capped; collapse to module level above the cap rather than dumping).sequence:<flow>orders the extracted invoke and boundary edges for one named flow into a sequenceDiagram. This renders extracted edges only; it does not compute a control or data-flow graph (D-7/D-8 hold) and carries the grep-seed framing (a seed to verify; ripgrep is weakest on dynamic dispatch and async, so a sequence may be incomplete). - Exemplar retrieval (optional, W-18): when
exemplarsis set, surface 1 to 3 blessed in-repo reference snippets (each a real file:line) an implementer should mirror, chosen by import fan-in and convention fit. It names the precedent a slice should follow whether or not the implementer believes one exists; the case that needs it most is the one where precedent exists and has not been found yet. This is "copy this concrete in-repo pattern", distinct fromstack-currency-check(external framework currency); the implementer cites the chosen exemplar in slice notes. - Human HTML projection (optional, ADR-0057 D-3): when
htmlis set, also writeMAP.html, a single self-contained interactive HTML file (graph data and rendering inline; prefer no view-time external network dependency) into the gitignored.code-context-map/folder. It renders the ALREADY-EXTRACTED module/import edges (and, forchain:scope, the seed-anchored import chain) as a directed node-link graph with zoom, filter, hover-highlight, and click-to-open; node-cap large graphs (collapse to module level above the cap) so it stays readable. Regenerate on invoke like MAP.md (byte-identical yieldsNO_OP). It renders extracted edges and is a navigation seed, not authoritative (D-7/D-8 still hold), and lives only in the gitignored folder per the D-1 rule above. - Grep-seed framing: the artifact must state that it orients the reader and that
grep/reading the citedfile:lineis the source of truth; the code wins over the map on any disagreement. - Honesty about extraction limits: ripgrep heuristics can miss dynamic imports, re-exports, and aliased calls. Record this in the artifact's limitations section; never present the map as exhaustive.
- Do not fabricate files, symbols, imports, or boundary edges. Every entry must trace to a real
file:linein the target codebase. - Cross-link policy: when a task is active,
SOURCE_OF_TRUTH.mdgets at most one## Code context mapsection with a single pointer to the artifact path. Do not duplicate map content into task memory. - Treat task-memory write policy per
WORKFLOW_OPERATING_SYSTEM.md: write the file and mark itAPPLIED. The map artifact itself is a product-repo file and follows repo reality, not the task-memory write policy. - Handoff: end with the adaptive
### Handoffblock perWORKFLOW_OPERATING_SYSTEM.md## Global output contract(Mode A compact or Mode B full). DefaultRun now: when a task is active, route toimpact-analysis(use the map to scope a change) orcode-locate(find a specific behavior); when no task is active, default towhat-next.
Map format (canonical):
- Follow
templates/CODE_CONTEXT_MAP.template.mdexactly: header (generated-by,Last generatedfreshness withbranch@sha, scope, token budget, grep-seed framing), Layer 1 (repo digest, module import adjacency, boundary summary), Layer 2 (per in-scope module: ranked signatures with the ranking-source labelstructuralorstructural + keyword, plus optional per-symbol scores under--explain-ranking, invoke edges, typed boundary edges), the typed boundary-edges table, an Excluded section, and a Known limitations section. - For
chain:<seed-file>scope, emit the## Import chainsection from the template (seed, per-hop import edges, the fidelity label, the cycle-guard note) in addition to Layer 1. - Sections with no content for the chosen scope (for example Layer 2 when scope is
digest, or the import chain when scope isdigestormodule:) must be omitted rather than left empty.
Required output:
- Resolved target codebase path and resolved scope (
digest,module:<...>, orchain:<seed-file>with itsdirection/max-hops), token budget, and, when supplied, the resolvedkeywords:with the resulting Layer 2 ranking source (structuralorstructural + keyword). - Whether this is a
create, arefresh, or aNO_OP(freshly generated map identical to the existing one), and whether it was generated single-pass or, with explicit consent, via a fleet. - Gitignore status: whether
.code-context-map/was already ignored or an entry was appended. - Exact content for
.code-context-map/MAP.mdusing the canonical map format (or the delta summary on refresh); whenhtmlis set, confirmMAP.htmlwas (re)generated in the same gitignored folder. - Exact patch to the active task
SOURCE_OF_TRUTH.mdadding the## Code context mapcross-link, orSKIPif none is active or it is already present. - Recommended next command (must exist as
commands/<name>.mdorcommands/<name>/SKILL.md; verify against directory listing before output). In installed mode use the available Fhorja inventory. - Recommended editor mode for that next command.
- Why that is the correct next step.
Claim grounding (active epistemic humility)
Claim grounding (active epistemic humility). This block governs what you may assert and how you record it. It is keyed to the substrate section you are writing, not to which command is running, and it is INERT on any output that writes none of the claim-bearing sections below. Full contract and rationale: wos/active-epistemic-humility.md.
- When this applies. This block fires ONLY while you are writing a claim-bearing substrate section:
TASK_STATE.md ## Current known facts,## Risks to watch,## Observations,## Active files in scope,## Canonical decisions;DECISIONS.md ## Locked decisions;IMPLEMENTATION_PLAN.md ## Current gaps,## Risks and mitigations;IMPACT_ANALYSIS.md;EXTERNAL_RESEARCH.md;REFERENCES.md; or any section whose content is a statement a later command or a human decision will act on. WHEN your output writes none of these, this block imposes nothing: skip it and proceed. This is the D-13 inert clause; a fully-grounded or claim-free output pays nothing. - The unit is the load-bearing claim. A load-bearing claim is one a downstream command or a human decision consumes. A passing aside is not load-bearing; a statement someone will act on is. Apply the rest of this block per load-bearing claim, not per sentence.
- Ground it or abstain. Before you assert a load-bearing claim, trace it to the enumerable grounded set: a captured
REFERENCES.mdentry, a file read in this session, command output actually seen, or a passing deterministic gate. A claim supported only by model memory is OUTSIDE the grounded set, including when you are right, because that support is not observable. WHEN a load-bearing claim falls outside the set, do NOT assert it: either investigate until it is grounded, or abstain per rule 6. - Status records provenance, never confidence. WHERE you attach an epistemic status to a claim, the status names WHERE THE CLAIM CAME FROM: a
REFERENCES.mdentry title, a file path plus line, or the gate output it came from. It SHALL NOT express a degree of certainty. Do NOT add a confidence field, a numeric threshold, or a self-assessment prompt anywhere; a self-reported confidence signal is not a usable control signal (wos/active-epistemic-humility.mdPart 1.3). A status whose referent slot is empty is read as UNKNOWN, not as a weak yes. - Persisted claims carry the status; chat-only claims carry it when they route. Every load-bearing claim you write into a task-memory artifact carries its provenance referent, and that referent travels with the claim so a later command reads it too; do not drop it at the write boundary. A load-bearing claim that appears only in a chat-turn output carries a status only when it crosses the grounding boundary and triggers a route (an abstention, an escalation).
- Abstain as a routed continuation, never a bare refusal. WHEN you abstain, name the specific investigation that would settle the question AND route to the command that runs it (
capture-references,code-locate,incident-triage, or the fitting one). A withholding that stalls the work is invalid output. Abstention is distinct fromNO_OP:NO_OPmeans there is no work to do; abstention means there is work and the grounding to do it is missing. - An unfired gate is not evidence. The absence of a fired check does not mean grounding existed. Do not read silence here as a pass.
Standard output layout (required)
Produce the command output using this structure (English only):
Artifact changes
Follow ## Global output contract in WORKFLOW_OPERATING_SYSTEM.md for APPLIED / PROPOSED / SKIP rules. Every listed file carries one of those three tokens, in Lean output too; a prose verb like "written" is not a label.
Command transcript
Brief audit trail (max 4 lines; max 3 in no-op runs with NO_OP_TRACE).
Handoff
Use the adaptive ending format of WORKFLOW_OPERATING_SYSTEM.md ## Global output contract. Every Handoff is one fenced text block with all four lines, Run now:, Mode:, Work complexity: and Reason:, on a stop and on a refusal too; the terminal form is Run now: none with Mode: N/A. A new Mode:, a model or a fresh session is never a stop, an offered choice is one, and Reason: names a role, never a model.
Definition of done (command output)
- The artifact is written only inside
<target-codebase>/.code-context-map/(MAP.md, and MAP.html whenhtmlis set), and.code-context-map/is confirmed present in the target repo's.gitignore(or appended). - Layer 1 is always present; Layer 2 appears only for in-scope module(s) and respects the token budget; no flat whole-repo signature dump is produced.
- When
htmlis set,MAP.htmlis a single self-contained file in the gitignored folder, renders only already-extracted edges, is node-capped for readability, and is never written outside.code-context-map/. - Generation is single-pass and bounded by default: the traversal is capped at the budget, the artifact is labeled
bounded (partial), and one line states the scope, the worker count a full pass would need, and what the cap left out. A fleet is dispatched only when the user asks for the full map in that turn. The fleet never runs without consent. - For
chain:scope, the import chain respectsmax-hopsand the cycle guard, ranks within a hop by fan-in, and is labeled either faithful (with the parser named) orgrep-seed (non-authoritative)when only ripgrep was used. - Every file, symbol, import, invoke edge, and boundary edge traces to a real
file:line; nothing is fabricated; extraction limits are stated in the artifact. - The artifact records
Last generatedwithbranch@sha, the grep-seed framing, and the Known limitations section. - No production source is modified; the only product-repo writes are the map and (at most) one
.gitignoreline. - When a task is active, at most a single
## Code context mapcross-link is added toSOURCE_OF_TRUTH.md; otherwiseSKIP. ### Artifact changesmarks task-memory patches asAPPLIED.- The basename in the
Run now:line corresponds to a real file incommands/<name>.mdorcommands/<name>/SKILL.md. In installed mode use the available Fhorja inventory. - Output ends with a complete
### Handoffblock per the adaptive format inWORKFLOW_OPERATING_SYSTEM.md## Global output contract. - Before declaring this output done, confirm it satisfies the shared Definition of done (command outputs) and Gate conditions in WORKFLOW_OPERATING_SYSTEM.md.
Quality bar:
Optimize for token economy (ranked, layered, budgeted), fidelity to real file:line evidence, zero new runtime dependencies, and a map that is honestly a navigation seed rather than an authoritative or exhaustive index.
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.

