@mmnto/cli 1.121.0 → 1.122.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/artifact-vocabulary.d.ts +23 -0
  2. package/dist/artifact-vocabulary.d.ts.map +1 -0
  3. package/dist/artifact-vocabulary.js +23 -0
  4. package/dist/artifact-vocabulary.js.map +1 -0
  5. package/dist/commands/config-drift.test.js +16 -0
  6. package/dist/commands/config-drift.test.js.map +1 -1
  7. package/dist/commands/init-templates.d.ts +2 -2
  8. package/dist/commands/init-templates.d.ts.map +1 -1
  9. package/dist/commands/init-templates.js +2 -2
  10. package/dist/commands/install-hooks.d.ts.map +1 -1
  11. package/dist/commands/install-hooks.js +183 -17
  12. package/dist/commands/install-hooks.js.map +1 -1
  13. package/dist/commands/install-hooks.test.js +559 -18
  14. package/dist/commands/install-hooks.test.js.map +1 -1
  15. package/dist/commands/spec-cli-wiring.test.d.ts +19 -0
  16. package/dist/commands/spec-cli-wiring.test.d.ts.map +1 -0
  17. package/dist/commands/spec-cli-wiring.test.js +90 -0
  18. package/dist/commands/spec-cli-wiring.test.js.map +1 -0
  19. package/dist/commands/spec-templates.d.ts +18 -0
  20. package/dist/commands/spec-templates.d.ts.map +1 -1
  21. package/dist/commands/spec-templates.js +21 -0
  22. package/dist/commands/spec-templates.js.map +1 -1
  23. package/dist/commands/spec.d.ts +168 -1
  24. package/dist/commands/spec.d.ts.map +1 -1
  25. package/dist/commands/spec.js +448 -7
  26. package/dist/commands/spec.js.map +1 -1
  27. package/dist/commands/spec.test.js +903 -20
  28. package/dist/commands/spec.test.js.map +1 -1
  29. package/dist/index.js +7 -2
  30. package/dist/index.js.map +1 -1
  31. package/dist/services/run-artifacts.d.ts +12 -1
  32. package/dist/services/run-artifacts.d.ts.map +1 -1
  33. package/dist/services/run-artifacts.js +48 -3
  34. package/dist/services/run-artifacts.js.map +1 -1
  35. package/dist/services/run-artifacts.test.js +97 -1
  36. package/dist/services/run-artifacts.test.js.map +1 -1
  37. package/dist/utils.d.ts +22 -3
  38. package/dist/utils.d.ts.map +1 -1
  39. package/dist/utils.js +4 -0
  40. package/dist/utils.js.map +1 -1
  41. package/dist/utils.test.js +65 -1
  42. package/dist/utils.test.js.map +1 -1
  43. package/package.json +2 -2
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The run artifact's closed vocabularies, re-exported for the CLI's
3
+ * SYNCHRONOUS sites (mmnto-ai/totem#2700).
4
+ *
5
+ * Two of them cannot reach these values through the `await
6
+ * import('@mmnto/totem')` form that `packages/cli/src/commands/**` is held to
7
+ * (compiled lesson 2266fc0dfe824f24 — the core barrel must not land on a
8
+ * command module's static graph):
9
+ *
10
+ * - `buildPreCommitHook` renders the anchor kinds and the prompt-source
11
+ * spelling into the strict evidence reader's `node -e` body. It is
12
+ * synchronous by contract: `tools/pre-commit` parity, `doctor`'s canonical
13
+ * regeneration and every installer call site render it inline.
14
+ * - `resolveGroundingAnchor` classifies an anchor as a pure, synchronous
15
+ * function so it can be unit-tested without a command harness.
16
+ *
17
+ * This module is the ONE static seam, in the `git.ts` shape: a pure re-export
18
+ * and nothing else, so every spelling still has exactly one definition — the
19
+ * core schema's. Re-spelling any of them here would recreate the drift the
20
+ * constants exist to prevent.
21
+ */
22
+ export { GROUNDING_ANCHOR_FREE_TEXT, GROUNDING_ANCHOR_ISSUE, GROUNDING_ANCHOR_MIXED, GROUNDING_ANCHOR_RECORD, PROMPT_SOURCE_BUILTIN, PROMPT_SOURCE_OVERRIDE, } from '@mmnto/totem';
23
+ //# sourceMappingURL=artifact-vocabulary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-vocabulary.d.ts","sourceRoot":"","sources":["../src/artifact-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,cAAc,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The run artifact's closed vocabularies, re-exported for the CLI's
3
+ * SYNCHRONOUS sites (mmnto-ai/totem#2700).
4
+ *
5
+ * Two of them cannot reach these values through the `await
6
+ * import('@mmnto/totem')` form that `packages/cli/src/commands/**` is held to
7
+ * (compiled lesson 2266fc0dfe824f24 — the core barrel must not land on a
8
+ * command module's static graph):
9
+ *
10
+ * - `buildPreCommitHook` renders the anchor kinds and the prompt-source
11
+ * spelling into the strict evidence reader's `node -e` body. It is
12
+ * synchronous by contract: `tools/pre-commit` parity, `doctor`'s canonical
13
+ * regeneration and every installer call site render it inline.
14
+ * - `resolveGroundingAnchor` classifies an anchor as a pure, synchronous
15
+ * function so it can be unit-tested without a command harness.
16
+ *
17
+ * This module is the ONE static seam, in the `git.ts` shape: a pure re-export
18
+ * and nothing else, so every spelling still has exactly one definition — the
19
+ * core schema's. Re-spelling any of them here would recreate the drift the
20
+ * constants exist to prevent.
21
+ */
22
+ export { GROUNDING_ANCHOR_FREE_TEXT, GROUNDING_ANCHOR_ISSUE, GROUNDING_ANCHOR_MIXED, GROUNDING_ANCHOR_RECORD, PROMPT_SOURCE_BUILTIN, PROMPT_SOURCE_OVERRIDE, } from '@mmnto/totem';
23
+ //# sourceMappingURL=artifact-vocabulary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-vocabulary.js","sourceRoot":"","sources":["../src/artifact-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,cAAc,CAAC"}
@@ -84,6 +84,22 @@ describe('agent instruction files match consumer AI_PROMPT_BLOCK', () => {
84
84
  expect(REFLEX_VERSION).toBeGreaterThanOrEqual(1); // totem-ignore — version floor check, not a set count
85
85
  expect(AI_PROMPT_BLOCK).toContain(`totem:reflexes:version:${REFLEX_VERSION}`);
86
86
  });
87
+ // The managed block is what a consumer's CLAUDE.md TELLS the agent the
88
+ // pre-commit gate does. Before mmnto-ai/totem#2700 it described the
89
+ // pre-rule gate ("a spec run happened"), so an agent following it verbatim
90
+ // would have been blocked by a rule its own instructions did not name.
91
+ // These lock the three load-bearing halves of the rewritten clause.
92
+ it('the gate clause states the ANCHORED rule, both cures included', () => {
93
+ expect(AI_PROMPT_BLOCK).toContain('ANCHORED');
94
+ expect(AI_PROMPT_BLOCK).toContain('grounded on an ISSUE');
95
+ expect(AI_PROMPT_BLOCK).toContain('totem spec --from <record>');
96
+ });
97
+ it('the gate clause says a free-text topic run is NOT evidence', () => {
98
+ expect(AI_PROMPT_BLOCK).toContain('A free-text topic run is NOT evidence');
99
+ });
100
+ it('the gate clause names --fresh as the cure for a cached response', () => {
101
+ expect(AI_PROMPT_BLOCK).toContain('--fresh');
102
+ });
87
103
  });
88
104
  // ─── `totem review` billing honesty (mmnto-ai/totem#2536) ─
89
105
  describe('product surfaces bill `totem review` as an advisory sensor', () => {
@@ -1 +1 @@
1
- {"version":3,"file":"config-drift.test.js","sourceRoot":"","sources":["../../src/commands/config-drift.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,q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C,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,wDAAwD;AAExD,QAAQ,CAAC,oCAAoC,EAAE,GAAG,EAAE;IAClD,MAAM,YAAY,GAAG;QACnB,WAAW;QACX,WAAW;QACX,WAAW;QACX,sBAAsB;QACtB,qBAAqB;QACrB,uBAAuB;KACxB,CAAC;IAEF,MAAM,eAAe,GAAG;QACtB,qBAAqB,EAAE,uBAAuB;QAC9C,0BAA0B,EAAE,4BAA4B;QACxD,qBAAqB,EAAE,iBAAiB;QACxC,uBAAuB,EAAE,iBAAiB;QAC1C,2BAA2B,EAAE,oBAAoB;KAClD,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;QAChC,EAAE,CAAC,GAAG,IAAI,gCAAgC,EAAE,GAAG,EAAE;YAC/C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACvC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;gBAAE,OAAO,CAAC,iCAAiC;YACvE,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACnD,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE,CAAC;gBACtC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACvC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import type { IngestTarget } from '@mmnto/totem';
2
2
  import type { ConfigFormat, EmbeddingTier } from './init-detect.js';
3
- export declare const REFLEX_VERSION = 11;
3
+ export declare const REFLEX_VERSION = 12;
4
4
  export declare const REFLEX_START = "<!-- totem:reflexes:start -->";
5
5
  export declare const REFLEX_END = "<!-- totem:reflexes:end -->";
6
6
  export declare const REFLEX_VERSION_RE: RegExp;
7
7
  export declare const LEGACY_SENTINEL = "## Totem AI Integration (Auto-Generated)";
8
- export declare const AI_PROMPT_BLOCK = "\n<!-- totem:reflexes:start -->\n<!-- totem:reflexes:version:11 -->\n\n## Totem AI Integration (Auto-Generated)\nYou have access to the Totem MCP for long-term project memory. You MUST operate with the following reflexes:\n\n### Memory Reflexes\n1. **BLOCKING \u2014 Pull Before Coding:** Before writing or modifying code that touches more than one file, you MUST call `search_knowledge` with a query describing what you're about to change. This is not optional. The vector DB contains traps, edge cases, and architectural constraints that prevent rework. Skip this and you risk repeating a mistake that's already been solved.\n2. **Pull Before Planning:** Before writing specs, architecture, or fixing complex bugs, use `search_knowledge` to retrieve domain constraints and past traps.\n3. **Pull on Session Start:** At the beginning of every session, call `search_knowledge` with a broad query about the current task or area of work. The vector DB is your institutional memory \u2014 use it before relying on your own context window.\n4. **Proactive Anchoring (The 3 Triggers):** You must autonomously call `add_lesson` when any of the following occur \u2014 do NOT wait for the user to ask:\n - **The Trap Trigger:** If you spend >2 turns fixing a bug caused by a framework quirk, unexpected API response, or edge case. (Anchor the symptom + fix).\n - **The Pivot Trigger:** If the user introduces a new architectural pattern or deprecates an old one. (Anchor the rule).\n - **The Handoff Trigger:** At the end of a session or when wrapping up a complex feature, extract the non-obvious lessons learned and anchor them.\n5. **Tool Preference (MCP over CLI):** Always prioritize using dedicated MCP tools (e.g., GitHub, Supabase, Vercel) over executing generic shell commands (like `gh issue view` or `curl`). MCP tools provide structured, un-truncated data optimized for your context window. Only fall back to bash execution if an MCP tool is unavailable or fails.\n\nLessons are automatically re-indexed in the background after each `add_lesson` call \u2014 no manual sync needed.\n\n### Memory Classification\nWhen deciding where to store information or rules, use this decision tree:\n- If forgetting this causes a mistake on an UNRELATED task (Core Safety): Store in your root agent memory file (e.g., CLAUDE.md or GEMINI.md).\n- If it's a stable, project-wide workflow rule: Store in project config (e.g., CLAUDE.md).\n- If it's a stable syntax/style pattern: Store in the project's styleguide or linter rules.\n- If it's domain knowledge, an edge case, or a past trap: You MUST use the Totem `add_lesson` tool to anchor it into the project's LanceDB.\n\n### Workflow Orchestrator Rituals\n[FOR LOCAL CLI/TERMINAL AGENTS ONLY] Do not attempt to run these commands if you are a headless bot or operating in a cloud PR environment (e.g., Gemini Code Assist on GitHub).\nTotem provides CLI commands that map to your development lifecycle. Use them at these moments:\n1. **Start of Session:** The SessionStart hook automatically runs `totem describe` to emit the project-orientation banner (project, tier, rule/lesson counts, targets, hooks). For richer derived project state (recent merged PRs, current branch + uncommitted files, latest strategy journal pointer, package versions, rule/lesson counts), call the MCP `describe_project` tool \u2014 the derived view replaces the retired `docs/active_work.md` convention (state is observed, not declared). For a freshness check (manifest staleness, shield drift, review state), run `totem status`. Run `totem triage` if you need to pick a new task. On a seat without the SessionStart hook (a cold start, or a vehicle that doesn't run hooks), run `totem orient` to derive in-flight and parked project state from primitives.\n2. **Before Implementation:** Run `totem spec <issue-url-or-topic>` to retrieve related context (lessons, specs, code) before writing code. Treat any generated plan as one retrieval input, never the contract \u2014 derive the actual design from primary sources (the issue, the code, project doctrine). Under the strict hook tier \u2014 which AI agents get automatically \u2014 this is REQUIRED, not optional: the pre-commit hook blocks until the checkout carries a `totem spec` run artifact (`.totem/artifacts/runs/*.json` whose top-level `admission.runMetadata.caller` is `spec`) and prints the evidence it found (mmnto-ai/totem#2690).\n3. **Before Push:** Run `totem lint` \u2014 the deterministic enforcement floor (zero LLM, ~2s). **Before PR:** `totem review` runs supplementary AI lanes over the diff (~18s) \u2014 advisory sensors, not a merge gate; known limits are disclosed in the run output (LLM window truncation on large diffs; non-code files skipped). Your team's own review discipline decides what constitutes the review of record.\n4. **End of Session:** Run `totem handoff` to generate a snapshot for the next agent session with current progress and open threads.\n5. **Managed hooks self-repair:** `totem init` distributes `.totem/prepare.cjs` and wires `package.json` `prepare` to it only when no `prepare` script exists. The wrapper runs `totem hook install` on every `pnpm install`, drift-repairing the managed Claude/Gemini hooks \u2014 no manual re-install needed.\n\n### Cloud / PR Review Bots\n[FOR CLOUD BOTS ONLY \u2014 e.g., Gemini Code Assist, GitHub Copilot PR Review]\nYou do NOT have access to the local CLI. Instead, use the Totem MCP tools directly:\n1. **Before reviewing a PR:** Call `search_knowledge` with queries about the files and patterns being changed to check for known traps and architectural constraints.\n2. **Before suggesting changes:** Call `search_knowledge` to verify your suggestion aligns with established project patterns and past lessons.\n3. **When you spot a recurring issue:** Call `add_lesson` to persist the trap so future reviews catch it automatically.\n\n### Context Management Guardrail\nYou must be highly defensive of your own context window \u2014 and you are the ONLY party holding the denominator (your model's window size and current occupancy); no Totem tool can measure it for you. Large Totem tool responses may carry a self-closing `<size-disclosure ... />` line stating that payload's measured size and cumulative session totals \u2014 a measurement, never a risk claim. Weigh it against your own occupancy and escalate to the user only when the pressure is genuinely material, suggesting `totem handoff` to capture mid-task state before clearing the chat. If you receive a `<totem_system_warning>` tag in a tool response (e.g. index staleness or degraded retrieval), read it silently and act on it or surface it naturally. Do NOT echo raw XML tags to the user.\n<!-- totem:reflexes:end -->\n";
8
+ export declare const AI_PROMPT_BLOCK = "\n<!-- totem:reflexes:start -->\n<!-- totem:reflexes:version:12 -->\n\n## Totem AI Integration (Auto-Generated)\nYou have access to the Totem MCP for long-term project memory. You MUST operate with the following reflexes:\n\n### Memory Reflexes\n1. **BLOCKING \u2014 Pull Before Coding:** Before writing or modifying code that touches more than one file, you MUST call `search_knowledge` with a query describing what you're about to change. This is not optional. The vector DB contains traps, edge cases, and architectural constraints that prevent rework. Skip this and you risk repeating a mistake that's already been solved.\n2. **Pull Before Planning:** Before writing specs, architecture, or fixing complex bugs, use `search_knowledge` to retrieve domain constraints and past traps.\n3. **Pull on Session Start:** At the beginning of every session, call `search_knowledge` with a broad query about the current task or area of work. The vector DB is your institutional memory \u2014 use it before relying on your own context window.\n4. **Proactive Anchoring (The 3 Triggers):** You must autonomously call `add_lesson` when any of the following occur \u2014 do NOT wait for the user to ask:\n - **The Trap Trigger:** If you spend >2 turns fixing a bug caused by a framework quirk, unexpected API response, or edge case. (Anchor the symptom + fix).\n - **The Pivot Trigger:** If the user introduces a new architectural pattern or deprecates an old one. (Anchor the rule).\n - **The Handoff Trigger:** At the end of a session or when wrapping up a complex feature, extract the non-obvious lessons learned and anchor them.\n5. **Tool Preference (MCP over CLI):** Always prioritize using dedicated MCP tools (e.g., GitHub, Supabase, Vercel) over executing generic shell commands (like `gh issue view` or `curl`). MCP tools provide structured, un-truncated data optimized for your context window. Only fall back to bash execution if an MCP tool is unavailable or fails.\n\nLessons are automatically re-indexed in the background after each `add_lesson` call \u2014 no manual sync needed.\n\n### Memory Classification\nWhen deciding where to store information or rules, use this decision tree:\n- If forgetting this causes a mistake on an UNRELATED task (Core Safety): Store in your root agent memory file (e.g., CLAUDE.md or GEMINI.md).\n- If it's a stable, project-wide workflow rule: Store in project config (e.g., CLAUDE.md).\n- If it's a stable syntax/style pattern: Store in the project's styleguide or linter rules.\n- If it's domain knowledge, an edge case, or a past trap: You MUST use the Totem `add_lesson` tool to anchor it into the project's LanceDB.\n\n### Workflow Orchestrator Rituals\n[FOR LOCAL CLI/TERMINAL AGENTS ONLY] Do not attempt to run these commands if you are a headless bot or operating in a cloud PR environment (e.g., Gemini Code Assist on GitHub).\nTotem provides CLI commands that map to your development lifecycle. Use them at these moments:\n1. **Start of Session:** The SessionStart hook automatically runs `totem describe` to emit the project-orientation banner (project, tier, rule/lesson counts, targets, hooks). For richer derived project state (recent merged PRs, current branch + uncommitted files, latest strategy journal pointer, package versions, rule/lesson counts), call the MCP `describe_project` tool \u2014 the derived view replaces the retired `docs/active_work.md` convention (state is observed, not declared). For a freshness check (manifest staleness, shield drift, review state), run `totem status`. Run `totem triage` if you need to pick a new task. On a seat without the SessionStart hook (a cold start, or a vehicle that doesn't run hooks), run `totem orient` to derive in-flight and parked project state from primitives.\n2. **Before Implementation:** Run `totem spec <issue-url-or-topic>` to retrieve related context (lessons, specs, code) before writing code. Treat any generated plan as one retrieval input, never the contract \u2014 derive the actual design from primary sources (the issue, the code, project doctrine). Under the strict hook tier \u2014 which AI agents get automatically \u2014 this is REQUIRED, not optional: the pre-commit hook blocks until the checkout carries an ANCHORED `totem spec` run artifact, and prints the evidence it found. ANCHORED means the run was grounded on an ISSUE, or on a hand-authored design record bound with `totem spec --from <record>` \u2014 and that its SUBJECT carries the shape the command promises: for an issue run, every required heading with a non-empty body (or, when your project overrides the spec system prompt, just one heading with a body \u2014 a custom prompt is not held to the built-in skeleton); for a bound record, at least one heading with a body in the RECORD's own bytes, re-read from disk at commit time. A free-text topic run is NOT evidence (that is the confabulation surface the rule exists for), and neither is an artifact written before this rule \u2014 re-run it anchored. A response served from the cache writes no artifact, so add `--fresh` when the gate says there is nothing new (mmnto-ai/totem#2690, mmnto-ai/totem#2700).\n3. **Before Push:** Run `totem lint` \u2014 the deterministic enforcement floor (zero LLM, ~2s). **Before PR:** `totem review` runs supplementary AI lanes over the diff (~18s) \u2014 advisory sensors, not a merge gate; known limits are disclosed in the run output (LLM window truncation on large diffs; non-code files skipped). Your team's own review discipline decides what constitutes the review of record.\n4. **End of Session:** Run `totem handoff` to generate a snapshot for the next agent session with current progress and open threads.\n5. **Managed hooks self-repair:** `totem init` distributes `.totem/prepare.cjs` and wires `package.json` `prepare` to it only when no `prepare` script exists. The wrapper runs `totem hook install` on every `pnpm install`, drift-repairing the managed Claude/Gemini hooks \u2014 no manual re-install needed.\n\n### Cloud / PR Review Bots\n[FOR CLOUD BOTS ONLY \u2014 e.g., Gemini Code Assist, GitHub Copilot PR Review]\nYou do NOT have access to the local CLI. Instead, use the Totem MCP tools directly:\n1. **Before reviewing a PR:** Call `search_knowledge` with queries about the files and patterns being changed to check for known traps and architectural constraints.\n2. **Before suggesting changes:** Call `search_knowledge` to verify your suggestion aligns with established project patterns and past lessons.\n3. **When you spot a recurring issue:** Call `add_lesson` to persist the trap so future reviews catch it automatically.\n\n### Context Management Guardrail\nYou must be highly defensive of your own context window \u2014 and you are the ONLY party holding the denominator (your model's window size and current occupancy); no Totem tool can measure it for you. Large Totem tool responses may carry a self-closing `<size-disclosure ... />` line stating that payload's measured size and cumulative session totals \u2014 a measurement, never a risk claim. Weigh it against your own occupancy and escalate to the user only when the pressure is genuinely material, suggesting `totem handoff` to capture mid-task state before clearing the chat. If you receive a `<totem_system_warning>` tag in a tool response (e.g. index staleness or degraded retrieval), read it silently and act on it or surface it naturally. Do NOT echo raw XML tags to the user.\n<!-- totem:reflexes:end -->\n";
9
9
  export declare const TOTEM_FILE_MARKER = "// [totem] auto-generated";
10
10
  /**
11
11
  * The end marker that CLOSES every managed whole-file session hook template
@@ -1 +1 @@
1
- {"version":3,"file":"init-templates.d.ts","sourceRoot":"","sources":["../../src/commands/init-templates.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMpE,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,YAAY,kCAAkC,CAAC;AAC5D,eAAO,MAAM,UAAU,gCAAgC,CAAC;AACxD,eAAO,MAAM,iBAAiB,QAA0C,CAAC;AACzE,eAAO,MAAM,eAAe,6CAA6C,CAAC;AAE1E,eAAO,MAAM,eAAe,mmNA6C3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,8BAA8B,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,kCAAkC,CAAC;AAE9D;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAIxE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAQ9F;AAgBD,eAAO,MAAM,qBAAqB,6CAA6C,CAAC;AAwBhF;;;;;;GAMG;AACH,eA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AM,yBAAyB;;;;;;;;;;;;EAK5B,CAAC;AAIX,wBAAsB,cAAc,CAClC,OAAO,EAAE,YAAY,EAAE,EACvB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CAyCjB;AAoDD;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,YAAY,EAAE,EACvB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CAIjB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,YAAY,EAAE,EACvB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CAIjB;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,YAAY,EAAE,EACvB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBhD"}
@@ -3,7 +3,7 @@
3
3
  // ─── Reflex versioning ────────────────────────────────────
4
4
  // Bump REFLEX_VERSION whenever the AI_PROMPT_BLOCK content changes materially.
5
5
  // This allows `totem init` to detect stale blocks and offer upgrades.
6
- export const REFLEX_VERSION = 11;
6
+ export const REFLEX_VERSION = 12;
7
7
  export const REFLEX_START = '<!-- totem:reflexes:start -->';
8
8
  export const REFLEX_END = '<!-- totem:reflexes:end -->';
9
9
  export const REFLEX_VERSION_RE = /<!-- totem:reflexes:version:(\d+) -->/;
@@ -38,7 +38,7 @@ When deciding where to store information or rules, use this decision tree:
38
38
  [FOR LOCAL CLI/TERMINAL AGENTS ONLY] Do not attempt to run these commands if you are a headless bot or operating in a cloud PR environment (e.g., Gemini Code Assist on GitHub).
39
39
  Totem provides CLI commands that map to your development lifecycle. Use them at these moments:
40
40
  1. **Start of Session:** The SessionStart hook automatically runs \`totem describe\` to emit the project-orientation banner (project, tier, rule/lesson counts, targets, hooks). For richer derived project state (recent merged PRs, current branch + uncommitted files, latest strategy journal pointer, package versions, rule/lesson counts), call the MCP \`describe_project\` tool — the derived view replaces the retired \`docs/active_work.md\` convention (state is observed, not declared). For a freshness check (manifest staleness, shield drift, review state), run \`totem status\`. Run \`totem triage\` if you need to pick a new task. On a seat without the SessionStart hook (a cold start, or a vehicle that doesn't run hooks), run \`totem orient\` to derive in-flight and parked project state from primitives.
41
- 2. **Before Implementation:** Run \`totem spec <issue-url-or-topic>\` to retrieve related context (lessons, specs, code) before writing code. Treat any generated plan as one retrieval input, never the contract — derive the actual design from primary sources (the issue, the code, project doctrine). Under the strict hook tier — which AI agents get automatically — this is REQUIRED, not optional: the pre-commit hook blocks until the checkout carries a \`totem spec\` run artifact (\`.totem/artifacts/runs/*.json\` whose top-level \`admission.runMetadata.caller\` is \`spec\`) and prints the evidence it found (mmnto-ai/totem#2690).
41
+ 2. **Before Implementation:** Run \`totem spec <issue-url-or-topic>\` to retrieve related context (lessons, specs, code) before writing code. Treat any generated plan as one retrieval input, never the contract — derive the actual design from primary sources (the issue, the code, project doctrine). Under the strict hook tier — which AI agents get automatically — this is REQUIRED, not optional: the pre-commit hook blocks until the checkout carries an ANCHORED \`totem spec\` run artifact, and prints the evidence it found. ANCHORED means the run was grounded on an ISSUE, or on a hand-authored design record bound with \`totem spec --from <record>\` — and that its SUBJECT carries the shape the command promises: for an issue run, every required heading with a non-empty body (or, when your project overrides the spec system prompt, just one heading with a body — a custom prompt is not held to the built-in skeleton); for a bound record, at least one heading with a body in the RECORD's own bytes, re-read from disk at commit time. A free-text topic run is NOT evidence (that is the confabulation surface the rule exists for), and neither is an artifact written before this rule — re-run it anchored. A response served from the cache writes no artifact, so add \`--fresh\` when the gate says there is nothing new (mmnto-ai/totem#2690, mmnto-ai/totem#2700).
42
42
  3. **Before Push:** Run \`totem lint\` — the deterministic enforcement floor (zero LLM, ~2s). **Before PR:** \`totem review\` runs supplementary AI lanes over the diff (~18s) — advisory sensors, not a merge gate; known limits are disclosed in the run output (LLM window truncation on large diffs; non-code files skipped). Your team's own review discipline decides what constitutes the review of record.
43
43
  4. **End of Session:** Run \`totem handoff\` to generate a snapshot for the next agent session with current progress and open threads.
44
44
  5. **Managed hooks self-repair:** \`totem init\` distributes \`.totem/prepare.cjs\` and wires \`package.json\` \`prepare\` to it only when no \`prepare\` script exists. The wrapper runs \`totem hook install\` on every \`pnpm install\`, drift-repairing the managed Claude/Gemini hooks — no manual re-install needed.
@@ -1 +1 @@
1
- {"version":3,"file":"install-hooks.d.ts","sourceRoot":"","sources":["../../src/commands/install-hooks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AAInD,eAAO,MAAM,iBAAiB,4BAA4B,CAAC;AAC3D,eAAO,MAAM,cAAc,2BAA2B,CAAC;AACvD,eAAO,MAAM,qBAAqB,+BAA+B,CAAC;AAClE,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAC9D,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAChE,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAC5D,eAAO,MAAM,oBAAoB,0BAA0B,CAAC;AAC5D,eAAO,MAAM,iBAAiB,yBAAyB,CAAC;AAMxD;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA2B9D;AAyBD;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG;IACtD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAOA;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAOtD;AAED,4FAA4F;AAC5F,wBAAgB,iBAAiB,CAAC,GAA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AsB,6BAA6B,CACjD,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,OAAO,GACd,OAAO,CAAC,wBAAwB,EAAE,CAAC,CA2CrC;AAuDD,MAAM,WAAW,yBAAyB;IACxC,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb;mFAC+E;IAC/E,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;IAC5C;;;;;;;;;;;0EAWsE;IACtE,MAAM,CAAC,EACH,sBAAsB,GACtB,mBAAmB,GACnB,mBAAmB,GACnB,sBAAsB,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,MAAM,EACX,KAAK,CAAC,EAAE,OAAO,GACd,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAsEtC;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CA4D7F;AAiDD;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAsF9E"}
@@ -3,7 +3,9 @@ import * as fs from 'node:fs';
3
3
  import * as path from 'node:path';
4
4
  import { stdin as input, stdout as output } from 'node:process';
5
5
  import * as readline from 'node:readline/promises';
6
+ import { GROUNDING_ANCHOR_ISSUE, GROUNDING_ANCHOR_RECORD, PROMPT_SOURCE_OVERRIDE, } from '../artifact-vocabulary.js';
6
7
  import { resolveGitRoot } from '../git.js';
8
+ import { SPEC_REQUIRED_SECTIONS } from './spec-templates.js';
7
9
  export const TOTEM_HOOK_MARKER = '[totem] post-merge hook';
8
10
  export const TOTEM_HOOK_END = '[totem] end post-merge';
9
11
  export const TOTEM_CHECKOUT_MARKER = '[totem] post-checkout hook';
@@ -12,6 +14,12 @@ export const TOTEM_PRECOMMIT_MARKER = '[totem] pre-commit hook';
12
14
  export const TOTEM_PRECOMMIT_END = '[totem] end pre-commit';
13
15
  export const TOTEM_PREPUSH_MARKER = '[totem] pre-push hook';
14
16
  export const TOTEM_PREPUSH_END = '[totem] end pre-push';
17
+ /**
18
+ * Hex characters of each sha256 the strict reader's record SENSOR shows when
19
+ * a bound record has been revised (mmnto-ai/totem#2700). Identity at a glance,
20
+ * not a full digest — the comparison itself is over the whole hash.
21
+ */
22
+ const RECORD_HASH_DISPLAY_PREFIX = 8;
15
23
  // ─── Hooks-directory resolution (mmnto-ai/totem#2418) ─────────
16
24
  /**
17
25
  * Resolve the git hooks directory for `gitRoot`. In a plain checkout this is
@@ -634,34 +642,91 @@ export function buildPreCommitHook(options) {
634
642
  // The run store the strict arm reads, rendered from the CONFIGURED totemDir so
635
643
  // the reader names the tree `totem spec` actually writes (mmnto-ai/totem#2692).
636
644
  const runsDir = `${totemDir}/artifacts/runs`;
637
- // Strict-tier evidence (mmnto-ai/totem#2690): the gate names `totem spec`,
638
- // so it must pass on what `totem spec` actually writes the grounded run
639
- // artifact under .totem/artifacts/runs/ (mmnto-ai/totem#2100; written on
640
- // every successful run, --fresh included) whose TOP-LEVEL
645
+ // Strict-tier evidence (mmnto-ai/totem#2690, tightened by
646
+ // mmnto-ai/totem#2700): the gate names `totem spec`, so it must pass on what
647
+ // `totem spec` actually writes the grounded run artifact under
648
+ // <totemDir>/artifacts/runs/ (mmnto-ai/totem#2100; written on every
649
+ // successful run, --fresh included) whose TOP-LEVEL
641
650
  // admission.runMetadata.caller is "spec". The read is JSON-aware on purpose:
642
651
  // the run store is written by every orchestrator caller, and a `review`
643
652
  // artifact's inputBundle embeds the reviewed diff — a substring grep would
644
653
  // pass the gate on a review of any text that merely QUOTES the key (this
645
654
  // very test fixture). node is already assumed by the pre-push template's
646
655
  // format-check block; ~50 ms, no CLI boot, nothing written (Tenet 13). The
647
- // former .totem/cache/.spec-completed marker is NOT honored: no CLI path ever
648
- // wrote it, so "compatibility" with it would be compatibility with a hand
649
- // hack (operator ruling 2026-08-29 — no legacy shims while there is no hard
650
- // consumer, Tenet 19). The evidence line makes a stale pass VISIBLE (age
656
+ // former <totemDir>/cache/.spec-completed marker is NOT honored: no CLI path
657
+ // ever wrote it, so "compatibility" with it would be compatibility with a
658
+ // hand hack (operator ruling 2026-08-29 — no legacy shims while there is no
659
+ // hard consumer, Tenet 19).
660
+ //
661
+ // #2700 adds the second half of the rule: an artifact is EVIDENCE only when
662
+ // it is ANCHORED (`grounding.anchor.kind` of "issue" or "record" — a
663
+ // "free-text" or "mixed" run is the confabulation surface the rule exists
664
+ // for) and its SUBJECT carries a real shape. The SUBJECT depends on the
665
+ // anchor: for an `issue` run it is the draft (`output.content`); for a
666
+ // `record` run it is the RECORD'S OWN BYTES, re-read from disk at commit
667
+ // time — the draft is discarded on that path, so checking it would check
668
+ // nothing. The record's sha256 is compared and REPORTED (matches / revised
669
+ // since binding) but never blocks: blocking on revision would price every
670
+ // fold of a design record at one LLM call, the friction this slice retires.
671
+ // Exit vocabulary: 0 evidence · 2 no spec artifact · 3 the newest spec
672
+ // artifact is NOT evidence (reason on stdout) · anything else = the reader
673
+ // itself could not run. The evidence line makes a stale pass VISIBLE (age
651
674
  // from the artifact's own createdAt); a freshness rule is a separate policy,
652
675
  // deliberately not here. This is the ONLY reader of the rule — the repo's
653
676
  // pre-managed-era `.gemini/hooks/BeforeTool.js` (unregistered, inert) was
654
677
  // deleted with the marker rather than kept in step.
678
+ //
679
+ // Every value the reader compares against is RENDERED from the one canonical
680
+ // constant via JSON.stringify (the runsDir precedent): the required section
681
+ // headings from `SPEC_REQUIRED_SECTIONS`, the anchor kinds and the
682
+ // prompt-source spelling from the core schema's exported constants. The hook
683
+ // text can never drift from the writer's vocabulary by re-spelling it.
684
+ //
685
+ // The artifact is a plain JSON file a seat can hand-edit, and its NAME comes
686
+ // off the filesystem, so nothing echoed is trusted as text: EVERY value that
687
+ // reaches stdout — the artifact's path, its `createdAt`, `anchor.kind`,
688
+ // `anchor.ref` and each required heading — passes through `safe()` first. A
689
+ // newline in any of them would otherwise forge a second `[Totem]` line in the
690
+ // hook's own output; `safe()` collapses C0 (0x00–0x1f) AND the DEL/C1 band
691
+ // (0x7f–0x9f), because U+0085 (NEL) breaks a line on some terminals.
692
+ // Containment is decided by RESOLUTION, not by inspecting one segment, and
693
+ // it is decided TWICE. Lexically first: a `record` ref that is absolute
694
+ // (either path flavor) or whose `path.resolve` against `process.cwd()` — the
695
+ // worktree top git runs hooks from — lands outside it is refused, so
696
+ // `sub/../../x.md` and `./../x.md` are caught where a first-segment test let
697
+ // them through, while a mid-path `..` that stays inside stays legal. Then by
698
+ // REALPATH, once the ref is known to exist and before its bytes are read: an
699
+ // in-repo SYMLINK whose target lives outside the tree is lexically contained
700
+ // and would otherwise be read and judged, so the resolved pair is compared
701
+ // too and the block names both spellings. A `record` anchor whose `sha256` is
702
+ // missing and one whose `sha256` is not a 64-hex digest are refused with
703
+ // their OWN reasons — "no sha256" and "not a 64-hex digest" are different
704
+ // repairs — rather than as one malformed sensor line. Every reason and the
705
+ // pass line go out through `fs.writeSync(1, …)`: `process.stdout.write` is
706
+ // asynchronous on a pipe (macOS), so `process.exit` could truncate the text
707
+ // the `sh` arm is about to echo.
655
708
  const strictBlock = `
656
- # Strict mode: require spec EVIDENCE before commit (mmnto-ai/totem#2690).
709
+ # Strict mode: require spec EVIDENCE before commit (mmnto-ai/totem#2690, mmnto-ai/totem#2700).
657
710
  # Evidence = a totem spec run artifact (${runsDir}/*.json with a
658
711
  # top-level admission.runMetadata.caller of "spec"), read JSON-aware — a
659
- # substring match would accept a review artifact that merely quotes the key.
712
+ # substring match would accept a review artifact that merely quotes the key
713
+ # that is ANCHORED on an issue or a bound design record, and whose subject
714
+ # carries a real shape: the required headings each with a body (an issue run
715
+ # drafted by the built-in prompt), or at least one heading with a body (a
716
+ # record run, or an issue run drafted under a custom prompt). A record run is
717
+ # judged on the bytes of the record at grounding.anchor.ref, re-read here from
718
+ # the worktree top; its sha256 is REPORTED, never enforced.
660
719
  # The former ${totemDir}/cache/.spec-completed marker is not honored (no CLI wrote it).
661
720
  if [ "$is_agent" = "1" ] || [ "$TOTEM_HOOK_TIER" = "strict" ]; then
662
721
  spec_evidence=$(node -e '
663
722
  const fs = require("fs");
723
+ const crypto = require("crypto");
724
+ const nodePath = require("path");
664
725
  const dir = ${JSON.stringify(runsDir)};
726
+ const REQUIRED = ${JSON.stringify(SPEC_REQUIRED_SECTIONS)};
727
+ const KIND_ISSUE = ${JSON.stringify(GROUNDING_ANCHOR_ISSUE)};
728
+ const KIND_RECORD = ${JSON.stringify(GROUNDING_ANCHOR_RECORD)};
729
+ const PROMPT_OVERRIDE = ${JSON.stringify(PROMPT_SOURCE_OVERRIDE)};
665
730
  let names = [];
666
731
  try { names = fs.readdirSync(dir); } catch (err) { names = []; }
667
732
  let best = null;
@@ -672,19 +737,120 @@ for (const name of names) {
672
737
  const caller = a && a.admission && a.admission.runMetadata && a.admission.runMetadata.caller;
673
738
  if (["spec"].indexOf(caller) < 0) continue;
674
739
  const at = ["string"].indexOf(typeof a.createdAt) < 0 ? "" : a.createdAt;
675
- if (!best || at > best.at) best = { name: name, at: at };
740
+ if (!best || at > best.at) best = { name: name, at: at, art: a };
676
741
  }
677
742
  if (!best) process.exit(2);
678
- const parsed = best.at ? Date.parse(best.at) : NaN;
679
- const days = Number.isNaN(parsed) ? -1 : Math.floor((Date.now() - parsed) / 86400000);
680
- process.stdout.write(dir + "/" + best.name + " (" + (best.at || "undated") + (days >= 0 ? ", " + days + " days old" : "") + ")");
743
+ const file = dir + "/" + best.name;
744
+ // fs.writeSync, not process.stdout.write: stdout is a PIPE here (the sh arm
745
+ // captures it) and a piped write is asynchronous on macOS, so process.exit
746
+ // below could truncate the very text the sh arm is about to echo.
747
+ function emit(text) { fs.writeSync(1, text); }
748
+ function block(reason) { emit(reason); process.exit(3); }
749
+ function safe(text) {
750
+ let out = "";
751
+ for (let i = 0; i < text.length; i++) {
752
+ const code = text.charCodeAt(i);
753
+ const control = code < 32 || (code >= 127 && code <= 159);
754
+ out = out + (control ? "?" : text.charAt(i));
755
+ }
756
+ return out;
757
+ }
758
+ const shownFile = safe(file);
759
+ const shownAt = safe(best.at);
760
+ function isHeading(line) {
761
+ let n = 0;
762
+ while (n < line.length && ["#"].indexOf(line.charAt(n)) > -1) n = n + 1;
763
+ if (n < 1 || n > 6) return false;
764
+ if ([" ", "\\t"].indexOf(line.charAt(n)) < 0) return false;
765
+ return line.slice(n + 1).trim().length > 0;
766
+ }
767
+ function escapesTop(rel) {
768
+ const norm = rel.split("\\\\").join("/");
769
+ if (nodePath.win32.isAbsolute(norm) || nodePath.posix.isAbsolute(norm)) return true;
770
+ return [".."].indexOf(norm) > -1 || ["../"].indexOf(norm.slice(0, 3)) > -1;
771
+ }
772
+ function outsideWorktree(r) {
773
+ const norm = r.split("\\\\").join("/");
774
+ if (nodePath.win32.isAbsolute(norm) || nodePath.posix.isAbsolute(norm)) return true;
775
+ const top = process.cwd();
776
+ return escapesTop(nodePath.relative(top, nodePath.resolve(top, norm)));
777
+ }
778
+ const art = best.art;
779
+ const grounding = art.grounding;
780
+ const anchor = grounding && grounding.anchor;
781
+ if (!anchor || ["string"].indexOf(typeof anchor.kind) < 0) block("the newest spec run artifact (" + shownFile + ") predates the anchored-evidence rule (no grounding.anchor)");
782
+ const kind = anchor.kind;
783
+ const ref = ["string"].indexOf(typeof anchor.ref) < 0 ? "(no ref)" : anchor.ref;
784
+ const shownKind = safe(kind);
785
+ const shownRef = safe(ref);
786
+ if (kind !== KIND_ISSUE && kind !== KIND_RECORD) block("the newest spec run artifact (" + shownFile + ") is anchored " + shownKind + " (" + shownRef + "), which is not gate evidence");
787
+ let subject = "";
788
+ let shape = "";
789
+ let recordStatus = "";
790
+ if (kind !== KIND_RECORD) {
791
+ const content = art.output && art.output.content;
792
+ if (["string"].indexOf(typeof content) < 0) block("the newest spec run artifact (" + shownFile + ") is not evidence: the draft is not text");
793
+ subject = content;
794
+ const meta = art.admission && art.admission.runMetadata;
795
+ const source = meta && meta.promptSource;
796
+ shape = source !== PROMPT_OVERRIDE ? "TEMPLATE" : "DOCUMENT";
797
+ } else {
798
+ if (outsideWorktree(ref)) block("the bound record ref is outside the worktree: " + shownRef);
799
+ const bound = ["string"].indexOf(typeof anchor.sha256) < 0 ? "" : anchor.sha256;
800
+ if (bound.length < 1) block("the record anchor carries no sha256 — not evidence (" + shownFile + ")");
801
+ if (!/^[0-9a-f]{64}$/.test(bound)) block("the record anchor sha256 is not a 64-hex digest (" + safe(bound) + ") — not evidence (" + shownFile + ")");
802
+ const missingRecord = "the bound record is missing at " + shownRef + " (bound by " + shownFile + ")";
803
+ if (!fs.existsSync(ref)) block(missingRecord);
804
+ const realRef = fs.realpathSync.native(ref);
805
+ if (escapesTop(nodePath.relative(fs.realpathSync.native(process.cwd()), realRef))) block("the bound record resolves outside the worktree: " + shownRef + " -> " + safe(realRef));
806
+ let bytes = null;
807
+ let read = false;
808
+ try { bytes = fs.readFileSync(ref); read = true; } catch (err) { read = false; }
809
+ if (!read) block(missingRecord);
810
+ subject = bytes.toString("utf8");
811
+ shape = "DOCUMENT";
812
+ const now = crypto.createHash("sha256").update(bytes).digest("hex");
813
+ recordStatus = now !== bound ? "record revised since binding (bound " + bound.slice(0, ${RECORD_HASH_DISPLAY_PREFIX}) + ", now " + now.slice(0, ${RECORD_HASH_DISPLAY_PREFIX}) + ")" : "record sha256 matches";
814
+ }
815
+ if ([65279].indexOf(subject.charCodeAt(0)) > -1) subject = subject.slice(1);
816
+ const lines = subject.split("\\n");
817
+ function hasBodyAfter(start) {
818
+ for (let i = start + 1; i < lines.length; i++) {
819
+ if (isHeading(lines[i])) return false;
820
+ if (lines[i].trim().length > 0) return true;
821
+ }
822
+ return false;
823
+ }
824
+ if (shape !== "DOCUMENT") {
825
+ for (const heading of REQUIRED) {
826
+ let at = -1;
827
+ for (let i = 0; i < lines.length; i++) { if ([heading].indexOf(lines[i].trimEnd()) > -1) { at = i; break; } }
828
+ if (at < 0) block("the draft in " + shownFile + " is missing heading " + safe(heading));
829
+ if (!hasBodyAfter(at)) block("the draft in " + shownFile + " has an empty heading " + safe(heading));
830
+ }
831
+ } else {
832
+ let bodied = false;
833
+ for (let i = 0; i < lines.length; i++) { if (isHeading(lines[i]) && hasBodyAfter(i)) { bodied = true; break; } }
834
+ if (!bodied && kind !== KIND_RECORD) block("the draft in " + shownFile + " has no heading with a body (custom prompt: the built-in template skeleton is not required)");
835
+ if (!bodied) block("the bound record at " + shownRef + " has no heading with a body");
836
+ }
837
+ const stamp = best.at ? Date.parse(best.at) : NaN;
838
+ const days = Number.isNaN(stamp) ? -1 : Math.floor((Date.now() - stamp) / 86400000);
839
+ let out = shownFile + " (" + (shownAt || "undated") + (days >= 0 ? ", " + days + " days old" : "") + ")";
840
+ out = out + " · anchor " + shownKind + " " + shownRef + " · shape " + shape;
841
+ if (recordStatus.length > 0) out = out + " · " + recordStatus;
842
+ emit(out);
681
843
  ' 2>/dev/null)
682
- # Reader status: 0 = evidence found · 2 = none found · anything else = the
683
- # reader itself could not run (node missing from PATH, a crash) reported
684
- # distinctly, never as "no evidence", and still fail-closed.
844
+ # Reader status: 0 = evidence found · 2 = no spec artifact at all · 3 = the
845
+ # newest spec artifact is NOT evidence (the reason is on stdout) · anything
846
+ # else = the reader itself could not run (node missing from PATH, a crash)
847
+ # each reported distinctly, never as "no evidence", and all fail-closed.
685
848
  reader_status=$?
686
849
  if [ "$reader_status" = "0" ] && [ -n "$spec_evidence" ]; then
687
850
  echo "[Totem] spec evidence: $spec_evidence"
851
+ elif [ "$reader_status" = "3" ]; then
852
+ echo "[Totem] BLOCKED: $spec_evidence — run 'totem spec <issue>' or 'totem spec --from <record>' (add --fresh if the response is cached) (strict mode)"
853
+ exit 1
688
854
  elif [ "$reader_status" != "2" ]; then
689
855
  echo "[Totem] BLOCKED: the spec-evidence reader could not run (node exit status $reader_status — node missing from PATH, or ${runsDir}/ unreadable); fix the runtime and retry (strict mode)"
690
856
  exit 1