Summary
Replace the materialized hot-context managed block in CLAUDE.md / AGENTS.md with Claude Code @import lines pointing at the hot files. Today the block inlines a verbatim copy of codev/resources/arch-critical.md + lessons-critical.md into both root docs — three copies of the same content (source + CLAUDE.md + AGENTS.md), a DRY violation, with a real drift footgun: edit a hot file, forget codev update, and the committed block silently goes stale (no test/doctor guard catches it).
Claude Code expands @path imports into context at session launch (transcluded, always-on — not lazy), so two import lines give the same always-on guarantee with a single source of truth and no copy to drift.
Decision is locked (maintainer): use @import. Do NOT add a drift-check, and do NOT worry about whether non-Claude AGENTS.md tools expand @import — out of scope.
Prescribed implementation
lib/managed-block.ts → renderHotContextBlock: emit the two import lines instead of inlining file contents:
@codev/resources/arch-critical.md
@codev/resources/lessons-critical.md
- Keep the existing
<!-- BEGIN/END CODEV HOT CONTEXT --> markers around them. This is deliberate: it preserves the idempotent upsertHotContextBlock, so an existing adopter's old inlined block is auto-migrated to the @import form on their next codev init/codev update.
- Keep the "generated — do not edit; edit the hot files" comment + the short intro lines.
- Keep returning
'' when neither hot file resolves (callers leave the doc untouched).
- Only import a given file if it resolves (don't emit an
@import for a hot file that isn't present).
- Keep
copyHotTierDefaults materializing the hot files into codev/resources/ on init/adopt/update, and keep them user-data-protected — the @import only resolves if the file is on disk at that path. Paths are relative to the importing doc's dir (repo root), so @codev/resources/... is correct for both our repo and adopters.
- Do NOT change porch injection.
commands/porch/prompts.ts (readHotTierFiles → inline) must keep inlining the live hot content: porch prompts go straight to the model (consult/agent SDK), which does NOT expand @import. That path is already DRY-safe (reads source live) — leave it.
- Regenerate our own root docs: run the updated sync so
CLAUDE.md + AGENTS.md carry the @import block; keep them byte-identical (governance-sweep invariant).
- Mirror in BOTH trees + all templates:
codev/ and codev-skeleton/, plus the six template docs ({codev-skeleton,codev,packages/codev/skeleton}/templates/{CLAUDE,AGENTS}.md). Grep both trees before claiming done.
- Tests: update
managed-block.test.ts + hot-tier-materialization.test.ts so the rendered block asserts the @import lines (and NOT the inlined hot content); add a case proving an old inlined block upserts to the @import form (adopter migration). governance-sweep.test.ts marker checks stay.
Out of scope
Drift-detection tooling; AGENTS.md non-Claude @import support; cold-tier (arch.md/lessons-learned.md) changes; porch injection changes.
Acceptance
CLAUDE.md / AGENTS.md (both trees + all six templates) contain the two @codev/resources/*-critical.md @import lines inside the managed markers, and no verbatim copy of the hot content.
codev update migrates a pre-existing inlined block to the @import form (idempotently).
- Porch phase prompts still inline the live hot content (unchanged).
- Our
CLAUDE.md and AGENTS.md remain byte-identical. Full suite green.
Summary
Replace the materialized hot-context managed block in
CLAUDE.md/AGENTS.mdwith Claude Code@importlines pointing at the hot files. Today the block inlines a verbatim copy ofcodev/resources/arch-critical.md+lessons-critical.mdinto both root docs — three copies of the same content (source + CLAUDE.md + AGENTS.md), a DRY violation, with a real drift footgun: edit a hot file, forgetcodev update, and the committed block silently goes stale (no test/doctorguard catches it).Claude Code expands
@pathimports into context at session launch (transcluded, always-on — not lazy), so two import lines give the same always-on guarantee with a single source of truth and no copy to drift.Decision is locked (maintainer): use
@import. Do NOT add a drift-check, and do NOT worry about whether non-Claude AGENTS.md tools expand@import— out of scope.Prescribed implementation
lib/managed-block.ts→renderHotContextBlock: emit the two import lines instead of inlining file contents:<!-- BEGIN/END CODEV HOT CONTEXT -->markers around them. This is deliberate: it preserves the idempotentupsertHotContextBlock, so an existing adopter's old inlined block is auto-migrated to the@importform on their nextcodev init/codev update.''when neither hot file resolves (callers leave the doc untouched).@importfor a hot file that isn't present).copyHotTierDefaultsmaterializing the hot files intocodev/resources/on init/adopt/update, and keep them user-data-protected — the@importonly resolves if the file is on disk at that path. Paths are relative to the importing doc's dir (repo root), so@codev/resources/...is correct for both our repo and adopters.commands/porch/prompts.ts(readHotTierFiles→ inline) must keep inlining the live hot content: porch prompts go straight to the model (consult/agent SDK), which does NOT expand@import. That path is already DRY-safe (reads source live) — leave it.CLAUDE.md+AGENTS.mdcarry the@importblock; keep them byte-identical (governance-sweep invariant).codev/andcodev-skeleton/, plus the six template docs ({codev-skeleton,codev,packages/codev/skeleton}/templates/{CLAUDE,AGENTS}.md). Grep both trees before claiming done.managed-block.test.ts+hot-tier-materialization.test.tsso the rendered block asserts the@importlines (and NOT the inlined hot content); add a case proving an old inlined block upserts to the@importform (adopter migration).governance-sweep.test.tsmarker checks stay.Out of scope
Drift-detection tooling; AGENTS.md non-Claude
@importsupport; cold-tier (arch.md/lessons-learned.md) changes; porch injection changes.Acceptance
CLAUDE.md/AGENTS.md(both trees + all six templates) contain the two@codev/resources/*-critical.md@importlines inside the managed markers, and no verbatim copy of the hot content.codev updatemigrates a pre-existing inlined block to the@importform (idempotently).CLAUDE.mdandAGENTS.mdremain byte-identical. Full suite green.