harness-everything 0.2.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 (169) hide show
  1. package/AGENTS.md +2 -0
  2. package/BENCHMARK_SOP.md +62 -0
  3. package/CHANGELOG.md +107 -0
  4. package/Dockerfile +18 -0
  5. package/LICENSE +201 -0
  6. package/README.md +197 -0
  7. package/VERIFICATION.md +347 -0
  8. package/bin/cli.js +97 -0
  9. package/build-multi-agent-system/AGENTS.md +50 -0
  10. package/build-multi-agent-system/README.md +63 -0
  11. package/build-multi-agent-system/SKILL.md +68 -0
  12. package/create-agent-launcher/SKILL.md +48 -0
  13. package/create-agent-launcher/examples/csharp-monorepo.md +123 -0
  14. package/create-agent-launcher/examples/typescript-cli.md +126 -0
  15. package/create-agent-launcher/guidelines/platform-claude.md +77 -0
  16. package/create-agent-launcher/guidelines/platform-codex.md +146 -0
  17. package/create-agent-launcher/guidelines/platform-copilot.md +74 -0
  18. package/create-agent-launcher/guidelines/platform-gemini.md +101 -0
  19. package/create-agent-launcher/guidelines/role-capabilities.md +108 -0
  20. package/create-agent-launcher/templates/README.md +17 -0
  21. package/create-agent-launcher/templates/agent-launcher.md +68 -0
  22. package/create-agent-launcher/templates/backend-developer-csharp.md +56 -0
  23. package/create-agent-launcher/templates/backend-developer-polyglot.md +62 -0
  24. package/create-agent-launcher/templates/backend-developer-ts.md +57 -0
  25. package/create-agent-launcher/templates/memory-keeper.md +37 -0
  26. package/create-agent-launcher/templates/requirement-analyzer.md +66 -0
  27. package/create-agent-launcher/templates/specialist-agent.md +34 -0
  28. package/create-agent-launcher/templates/task-verifier.md +56 -0
  29. package/create-agent-launcher/templates/tool-maker.md +33 -0
  30. package/create-agent-launcher/workflows/01-init.md +22 -0
  31. package/create-agent-launcher/workflows/02-analysis.md +26 -0
  32. package/create-agent-launcher/workflows/03-generation.md +29 -0
  33. package/create-agent-launcher/workflows/04-launcher.md +20 -0
  34. package/docker-verify.sh +266 -0
  35. package/docs/architecture.md +95 -0
  36. package/docs/philosophy.md +45 -0
  37. package/docs/reflection.md +34 -0
  38. package/docs/routing.md +45 -0
  39. package/docs/workflows/build-multi-agent-system.md +62 -0
  40. package/docs/workflows/create-agent-launcher.md +62 -0
  41. package/docs/workflows/environment-detection.md +63 -0
  42. package/docs/workflows/eval-harness.md +57 -0
  43. package/docs/workflows/fable-discipline.md +59 -0
  44. package/docs/workflows/fable-mode.md +32 -0
  45. package/docs/workflows/git-commit.md +62 -0
  46. package/docs/workflows/grill-me.md +62 -0
  47. package/docs/workflows/grill-with-docs.md +62 -0
  48. package/docs/workflows/harness-everything.md +92 -0
  49. package/docs/workflows/improve-codebase-architecture.md +60 -0
  50. package/docs/workflows/install-cognitive-os.md +60 -0
  51. package/docs/workflows/repo-docs.md +59 -0
  52. package/docs/workflows/rewrite-commits.md +60 -0
  53. package/docs/workflows/security-review.md +58 -0
  54. package/docs/workflows/self-evolve.md +59 -0
  55. package/docs/workflows/skill-creator.md +75 -0
  56. package/docs/workflows/skill-style.md +64 -0
  57. package/docs/workflows/tdd.md +39 -0
  58. package/docs/workflows/todo-driven-workflow.md +36 -0
  59. package/docs/workflows/using-git-worktrees.md +63 -0
  60. package/docs/workflows/verification-loop.md +69 -0
  61. package/docs/workflows/verify-before-claim.md +60 -0
  62. package/docs/workflows/zoom-out.md +62 -0
  63. package/environment-detection/SKILL.md +77 -0
  64. package/environment-detection/scripts/preflight.js +93 -0
  65. package/eval-framework/behavioral-test.js +105 -0
  66. package/eval-framework/cases/case1.json +5 -0
  67. package/eval-framework/cases/case2.json +5 -0
  68. package/eval-framework/cases/case3.json +5 -0
  69. package/eval-framework/cases/case4-zh-tier2.json +5 -0
  70. package/eval-framework/cases/case5-zh-tier3.json +5 -0
  71. package/eval-framework/mechanism-test.js +251 -0
  72. package/eval-framework/runner.js +56 -0
  73. package/eval-harness/SKILL.md +59 -0
  74. package/eval-harness/scripts/evaluate.js +61 -0
  75. package/fable-discipline/SKILL.md +38 -0
  76. package/fable-mode/CONTRACT-FORMAT.md +51 -0
  77. package/fable-mode/SKILL.md +51 -0
  78. package/fable-mode/agents/fable-orchestrator.md +92 -0
  79. package/fable-mode/agents/fable-verifier.md +32 -0
  80. package/fable-mode/agents/fable-worker-haiku.md +48 -0
  81. package/fable-mode/agents/fable-worker-sonnet.md +49 -0
  82. package/fable-mode/execution-guardrails/SKILL.md +87 -0
  83. package/fable-mode/fable-haiku/SKILL.md +48 -0
  84. package/git-commit/SKILL.md +55 -0
  85. package/git-commit/guides/ANGULAR_STYLE.md +61 -0
  86. package/git-commit/guides/COMMIT_GENERATION.md +24 -0
  87. package/git-commit/guides/LANGUAGE_DETECTION.md +16 -0
  88. package/git-commit/guides/MAIN_REPO.md +15 -0
  89. package/git-commit/guides/SUBMODULES.md +27 -0
  90. package/grill-me/SKILL.md +36 -0
  91. package/grill-with-docs/ADR-FORMAT.md +47 -0
  92. package/grill-with-docs/CONTEXT-FORMAT.md +63 -0
  93. package/grill-with-docs/SKILL.md +99 -0
  94. package/harness-everything/SKILL.md +141 -0
  95. package/harness-everything/examples/README.md +9 -0
  96. package/harness-everything/examples/todo-workflow.md +22 -0
  97. package/harness-everything/scripts/bootstrap.js +140 -0
  98. package/harness-everything/scripts/self-heal.js +189 -0
  99. package/harness-everything/scripts/tier-router.js +219 -0
  100. package/harness-everything/scripts/todo-cli.js +157 -0
  101. package/harness-everything/scripts/verify-gate.js +31 -0
  102. package/hooks/hooks.json +155 -0
  103. package/hooks/scripts/atomic-commit-check.js +68 -0
  104. package/hooks/scripts/boundary-guard.js +55 -0
  105. package/hooks/scripts/context-compact.js +114 -0
  106. package/hooks/scripts/contract-test.js +79 -0
  107. package/hooks/scripts/depth-guard.js +65 -0
  108. package/hooks/scripts/lib/harness-state.js +202 -0
  109. package/hooks/scripts/lib/platforms/claude.js +42 -0
  110. package/hooks/scripts/lib/platforms/codex.js +46 -0
  111. package/hooks/scripts/lib/platforms/continue.js +41 -0
  112. package/hooks/scripts/lib/platforms/copilot.js +41 -0
  113. package/hooks/scripts/lib/platforms/cursor.js +41 -0
  114. package/hooks/scripts/lib/platforms/hermes.js +32 -0
  115. package/hooks/scripts/lib/platforms/index.js +17 -0
  116. package/hooks/scripts/lib/platforms/worktrees.js +20 -0
  117. package/hooks/scripts/reset-circuit-breaker.js +30 -0
  118. package/hooks/scripts/rule-of-3-tracker.js +91 -0
  119. package/hooks/scripts/rule-of-3.js +176 -0
  120. package/hooks/scripts/state-persist.js +99 -0
  121. package/hooks/scripts/stop-gate.js +80 -0
  122. package/hooks/scripts/subagent-scope-guard.js +88 -0
  123. package/improve-codebase-architecture/SKILL.md +44 -0
  124. package/improve-codebase-architecture/guides/DEEPENING.md +37 -0
  125. package/improve-codebase-architecture/guides/HTML-REPORT.md +123 -0
  126. package/improve-codebase-architecture/guides/INTERFACE-DESIGN.md +44 -0
  127. package/improve-codebase-architecture/guides/LANGUAGE.md +53 -0
  128. package/install-cognitive-os/SKILL.md +95 -0
  129. package/package.json +22 -0
  130. package/repo-docs/SKILL.md +45 -0
  131. package/repo-docs/templates/agents-template.md +264 -0
  132. package/repo-docs/templates/knowledge-agents-template.md +50 -0
  133. package/repo-docs/templates/knowledge-readme-template.md +83 -0
  134. package/repo-docs/templates/manual-recon.md +117 -0
  135. package/repo-docs/templates/multi-skills-readme-template.md +72 -0
  136. package/repo-docs/templates/product-agents-template.md +78 -0
  137. package/repo-docs/templates/product-readme-template.md +95 -0
  138. package/repo-docs/templates/readme-template.md +136 -0
  139. package/repo-docs/templates/single-skill-readme-template.md +70 -0
  140. package/repo-docs/templates/skills-agents-template.md +60 -0
  141. package/rewrite-commits/SKILL.md +32 -0
  142. package/scripts/installer.js +649 -0
  143. package/scripts/lib/advisory-text.js +163 -0
  144. package/scripts/lib/claude-hooks.js +71 -0
  145. package/scripts/lib/gitignore.js +58 -0
  146. package/scripts/lib/manifest.js +82 -0
  147. package/scripts/lib/prompts.js +241 -0
  148. package/scripts/lib/skills.js +172 -0
  149. package/scripts/lib/workspace.js +28 -0
  150. package/security-review/SKILL.md +511 -0
  151. package/self-evolve/SKILL.md +54 -0
  152. package/self-evolve/scripts/persist-memory.js +40 -0
  153. package/self-evolve/scripts/self-regression.js +113 -0
  154. package/skill-creator/SKILL.md +91 -0
  155. package/skill-creator/references/quality-principles.md +81 -0
  156. package/skill-creator/references/testing-workflow.md +32 -0
  157. package/skill-style/SKILL.md +48 -0
  158. package/skill-style/STYLE.md +37 -0
  159. package/tdd/SKILL.md +53 -0
  160. package/tdd/guides/deep-modules.md +33 -0
  161. package/tdd/guides/interface-design.md +31 -0
  162. package/tdd/guides/mocking.md +59 -0
  163. package/tdd/guides/refactoring.md +10 -0
  164. package/tdd/guides/tests.md +61 -0
  165. package/todo-driven-workflow/SKILL.md +54 -0
  166. package/using-git-worktrees/SKILL.md +161 -0
  167. package/verification-loop/SKILL.md +138 -0
  168. package/verify-before-claim/SKILL.md +86 -0
  169. package/zoom-out/SKILL.md +90 -0
@@ -0,0 +1,347 @@
1
+ # Verification & Acceptance Checklist
2
+
3
+ Run this after installing Harness into a project, or whenever you need to confirm
4
+ the install actually works — not just that the repo looks right. Two things are
5
+ checked separately and should never be conflated:
6
+
7
+ - **Mechanism** — did the hook script actually run and produce the documented
8
+ exit code / output? Only possible on Claude Code (the only platform with a
9
+ hook/exit-code execution system). See [Section 2](#2-mechanism-check-claude-code-only).
10
+ - **Behavior** — did the agent's *actual conduct* change the way the guidance
11
+ says it should? Testable on every platform, including the advisory-only ones
12
+ (Cursor, Copilot, Codex, Continue.dev, Hermes Agent). See [Section 3](#3-behavioral-test-prompts-all-platforms).
13
+
14
+ A platform passing the behavior tests but having no mechanism to check is
15
+ expected, not a bug — see [README: Supported AI IDEs & Tools](README.md#supported-ai-ides--tools).
16
+ A platform where the mechanism check passes but behavior doesn't follow it is
17
+ the interesting failure: the hook fired, but the agent didn't act on the
18
+ context it was given.
19
+
20
+ Do not accept "I read the code and it looks right" as a pass for anything
21
+ below — every check here names an exact command and an exact expected result.
22
+ Run it for real.
23
+
24
+ ---
25
+
26
+ ## 1. Install artifact check (all platforms, ~30 seconds)
27
+
28
+ Confirm the installer actually wrote what it claims to, before testing anything
29
+ downstream.
30
+
31
+ | Platform | File | Pass condition |
32
+ |---|---|---|
33
+ | Claude Code | `.claude/settings.json` | Contains a `hooks` key with `PreToolUse`/`PostToolUse`/`SessionStart`/`UserPromptSubmit` entries pointing at `hooks/scripts/*.js` and `harness-everything/scripts/*.js` |
34
+ | Cursor | `.cursorrules` | Contains the string `Harness OS Guidance (Advisory)` |
35
+ | Copilot Chat | `.github/copilot-instructions.md` | Contains the string `Harness OS Guidance (Advisory)` |
36
+ | Codex | `AGENTS.md` | Contains the string `Harness OS Guidance (Advisory)` |
37
+ | Continue.dev | `.continue/rules/harness.md` | Contains the string `Harness OS Guidance (Advisory)`, plus a YAML frontmatter block with `alwaysApply: true` |
38
+ | Hermes Agent | `.hermes.md` | Contains the string `Harness OS Guidance (Advisory)` |
39
+
40
+ ```bash
41
+ grep -l "Harness OS Guidance" .cursorrules .github/copilot-instructions.md AGENTS.md .continue/rules/harness.md .hermes.md 2>/dev/null
42
+ node -e "console.log(Object.keys(JSON.parse(require('fs').readFileSync('.claude/settings.json','utf8')).hooks))"
43
+ ```
44
+
45
+ FAIL if a target platform's file is missing, or exists but doesn't contain the
46
+ marker — re-run `npm run harness:reset && node scripts/installer.js` (or the
47
+ `npx github:...install` form) and check again before going further.
48
+
49
+ ---
50
+
51
+ ## 2. Mechanism check (Claude Code only)
52
+
53
+ These pipe a simulated hook payload into the script exactly the way Claude
54
+ Code invokes it (JSON on stdin), and check the exit code and output against
55
+ what the hook is documented to do. Run from the repo root. Each block is
56
+ self-contained and cleans up after itself.
57
+
58
+ **Fastest path:** `npm run test:mechanism` (or plain `npm test`, which
59
+ includes it as Phase 4) runs every check in this section automatically,
60
+ end-to-end, on Windows/macOS/Linux alike — see
61
+ [eval-framework/mechanism-test.js](eval-framework/mechanism-test.js). The
62
+ recipes below exist for isolating and debugging one mechanism by hand; they
63
+ pipe JSON into each hook via `node -e "...spawnSync(...)"` rather than a
64
+ shell `echo '...' | node script.js` pipe. Use the shell-pipe form if you
65
+ like — it works fine on macOS/Linux — but **not on Windows Git Bash**: three
66
+ independent 2026-07-23 audits used exactly that form and
67
+ got TTY/quoting interference that mangled the JSON, misdiagnosing working
68
+ hooks (`rule-of-3.js`, `boundary-guard.js`, `state-persist.js`) as broken.
69
+ The `node -e` form pipes stdin through Node's own `child_process` API
70
+ instead of the shell, so it behaves identically on every platform.
71
+
72
+ ### 2a. Rule of 3 circuit breaker actually blocks
73
+
74
+ Runtime state lives under `.claude/harness-state/sessions/<session_id>/`
75
+ (see [docs/architecture.md](docs/architecture.md)). Invocations with no
76
+ `session_id` in the piped payload — like these manual tests — fall into a
77
+ fixed `sessions/default/` bucket rather than a random one.
78
+
79
+ ```bash
80
+ mkdir -p .claude/harness-state/sessions/default
81
+ rm -f .claude/harness-state/sessions/default/zoom-out-report.md
82
+ echo '{"count":3,"lastHash":"verify-test","zoomOutResolved":false}' > .claude/harness-state/sessions/default/rule-of-3-state.json
83
+ node hooks/scripts/rule-of-3.js; echo "exit=$?"
84
+ ```
85
+ **Expect:** stderr prints `[CRITICAL] RULE OF 3 CIRCUIT BREAKER TRIGGERED!`
86
+ plus the reflect-first instructions (zoom-out protocol, and the exact report
87
+ path to write to — resolved per-session, so it'll read
88
+ `.claude/harness-state/sessions/default/zoom-out-report.md` here), and `exit=2`.
89
+ (If you see `exit=1` or `exit=0`, the circuit breaker is not actually blocking
90
+ anything — `exit(1)` is a non-blocking error in Claude Code's hook contract,
91
+ this was a real bug found and fixed on 2026-07-20.)
92
+
93
+ ```bash
94
+ npm run harness:reset
95
+ node hooks/scripts/rule-of-3.js; echo "exit=$?"
96
+ ```
97
+ **Expect:** no stderr output, `exit=0`.
98
+
99
+ ### 2a-bis. Zoom-out reflection report releases the breaker
100
+
101
+ ```bash
102
+ echo '{"count":3,"lastHash":"verify-test","zoomOutResolved":false,"lastFailureAt":0,"zoomOutCycles":0}' > .claude/harness-state/sessions/default/rule-of-3-state.json
103
+ printf '## Goal\nx\n## Failed Attempts\nx\n## Verified Facts\nx\n## Diagnosis\nx\n## Decision\nRESUME: new approach\n' > .claude/harness-state/sessions/default/zoom-out-report.md
104
+ node hooks/scripts/rule-of-3.js; echo "exit=$?"
105
+ node -e "const s=require('./.claude/harness-state/sessions/default/rule-of-3-state.json'); console.log(s.count===0 && s.zoomOutResolved===true && s.zoomOutCycles===1 ? 'released-ok' : 'released-FAIL')"
106
+ ```
107
+ **Expect:** stdout prints `breaker released`, `exit=0`, then `released-ok` —
108
+ a completed reflection report is the agent's own way out; no human reset needed.
109
+
110
+ ```bash
111
+ node -e "require('fs').writeFileSync('.claude/harness-state/sessions/default/rule-of-3-state.json', JSON.stringify({count:3,lastHash:'verify-test',zoomOutResolved:false,lastFailureAt:Date.now()+60000,zoomOutCycles:1}))"
112
+ node hooks/scripts/rule-of-3.js; echo "exit=$?"
113
+ npm run harness:reset
114
+ ```
115
+ **Expect:** stderr prints `repeat trip - hard lock` and `exit=2` — a second
116
+ trip on the same signature is past reflect-and-retry (the report is also stale
117
+ relative to `lastFailureAt`, so it cannot unlock anything); only the human
118
+ clears this one.
119
+
120
+ ### 2b. Boundary guard blocks an oversized Read
121
+
122
+ ```bash
123
+ node -e "require('fs').writeFileSync('.verify-big.tmp','x'.repeat(600*1024))"
124
+ node -e "const {spawnSync}=require('child_process');const r=spawnSync('node',['hooks/scripts/boundary-guard.js'],{input:JSON.stringify({tool_name:'Read',tool_input:{file_path:'.verify-big.tmp'}}),encoding:'utf8'});process.stderr.write(r.stderr||'');console.log('exit='+r.status)"
125
+ rm .verify-big.tmp
126
+ ```
127
+ **Expect:** stderr prints `[Boundary Guard] BLOCKED` and `exit=2`.
128
+
129
+ ### 2c. State persistence (WAL) actually records a failure
130
+
131
+ ```bash
132
+ node -e "const {spawnSync}=require('child_process');spawnSync('node',['hooks/scripts/state-persist.js'],{input:JSON.stringify({tool_name:'Bash',tool_response:{stdout:'',stderr:'npm ERR! verify-test failure'}}),encoding:'utf8'})"
133
+ node -e "console.log(JSON.parse(require('fs').readFileSync('.claude/harness-state/sessions/default/handoff-state.json','utf8')).status)"
134
+ node -e "const {spawnSync}=require('child_process');spawnSync('node',['harness-everything/scripts/bootstrap.js'],{input:'{}',encoding:'utf8',stdio:['pipe','inherit','inherit']})"
135
+ ```
136
+ **Expect:** prints `failed`, then `bootstrap.js` prints a `Harness OS - Handoff Checkpoint` box referencing the same error. `bootstrap.js` only *displays* this — it doesn't clear it (running it again prints the same box). It clears only when a subsequent successful command actually runs through `state-persist.js`:
137
+
138
+ ```bash
139
+ node -e "const {spawnSync}=require('child_process');spawnSync('node',['hooks/scripts/state-persist.js'],{input:JSON.stringify({tool_name:'Bash',tool_response:{stdout:'ok',exitCode:0}}),encoding:'utf8'})"
140
+ node -e "const {spawnSync}=require('child_process');spawnSync('node',['harness-everything/scripts/bootstrap.js'],{input:'{}',encoding:'utf8',stdio:['pipe','inherit','inherit']})"
141
+ ```
142
+ **Expect:** no checkpoint box this time.
143
+
144
+ ### 2d. Fact-audit reminder actually reaches the agent
145
+
146
+ ```bash
147
+ node -e "const {spawnSync}=require('child_process');const r=spawnSync('node',['harness-everything/scripts/tier-router.js'],{input:JSON.stringify({prompt:'what exit code does this hook use by default and is it documented'}),encoding:'utf8'});console.log(r.stdout)"
148
+ ```
149
+ **Expect:** output includes a `FACT-AUDIT REMINDER` block. If this is silent, `tier-router.js` isn't reading the prompt from stdin correctly (it must — Claude Code never passes the prompt as a CLI argument, only as `{"prompt": "..."}` on stdin; this was a real bug found and fixed on 2026-07-20).
150
+
151
+ ### 2e. Subagent scope guard catches an out-of-scope change
152
+
153
+ ```bash
154
+ git status --porcelain > /dev/null # ensure a real git repo
155
+ node -e "const {spawnSync}=require('child_process');spawnSync('node',['hooks/scripts/subagent-scope-guard.js'],{input:JSON.stringify({tool_name:'Task',hook_event_name:'PreToolUse',tool_input:{}}),encoding:'utf8'})"
156
+ echo "unexpected change" >> .verify-scope-test.tmp
157
+ node -e "const {spawnSync}=require('child_process');const r=spawnSync('node',['hooks/scripts/subagent-scope-guard.js'],{input:JSON.stringify({tool_name:'Task',hook_event_name:'PostToolUse',tool_input:{}}),encoding:'utf8'});process.stderr.write(r.stderr||'');console.log('exit='+r.status)"
158
+ rm .verify-scope-test.tmp
159
+ ```
160
+ **Expect:** stderr lists `.verify-scope-test.tmp` as a changed file and `exit=2`.
161
+
162
+ ### 2f. Stop gate bounces an unverified-edit stop exactly once
163
+
164
+ ```bash
165
+ rm -f .claude/harness-state/sessions/default/stop-gate-state.json
166
+ node -e "require('fs').mkdirSync('.claude/harness-state/sessions/default',{recursive:true}); require('fs').writeFileSync('.claude/harness-state/sessions/default/handoff-state.json', JSON.stringify({status:'idle',lastEditAt:Date.now(),lastVerifyAt:0}))"
167
+ echo "dirty" > .verify-dirty.tmp
168
+ node -e "const {spawnSync}=require('child_process');const r=spawnSync('node',['hooks/scripts/stop-gate.js'],{input:'{}',encoding:'utf8'});process.stderr.write(r.stderr||'');console.log('exit='+r.status)"
169
+ ```
170
+ **Expect:** stderr prints `[Stop Gate]` and `exit=2` — edits happened, nothing
171
+ verification-ish ran after them, and the tree is dirty.
172
+
173
+ ```bash
174
+ node -e "const {spawnSync}=require('child_process');const r=spawnSync('node',['hooks/scripts/stop-gate.js'],{input:'{}',encoding:'utf8'});process.stderr.write(r.stderr||'');console.log('exit='+r.status)"
175
+ ```
176
+ **Expect:** `exit=0` — same edit batch already bounced once; the gate never
177
+ nags twice for the same batch.
178
+
179
+ ```bash
180
+ rm -f .claude/harness-state/sessions/default/stop-gate-state.json
181
+ node -e "const {spawnSync}=require('child_process');const r=spawnSync('node',['hooks/scripts/stop-gate.js'],{input:JSON.stringify({stop_hook_active:true}),encoding:'utf8'});process.stderr.write(r.stderr||'');console.log('exit='+r.status)"
182
+ rm .verify-dirty.tmp .claude/harness-state/sessions/default/handoff-state.json .claude/harness-state/sessions/default/stop-gate-state.json 2>/dev/null; true
183
+ ```
184
+ **Expect:** `exit=0` — a stop that already resulted from a Stop-hook block is
185
+ always let through (loop guard).
186
+
187
+ Any mismatch above is a mechanism-level bug, not a behavior question — fix the
188
+ hook script before doing anything else in this checklist.
189
+
190
+ ---
191
+
192
+ ## 3. Behavioral test prompts (all platforms)
193
+
194
+ Paste these into a session with Harness installed and a session without
195
+ (vanilla) and compare. See [BENCHMARK_SOP.md](BENCHMARK_SOP.md) for the full
196
+ methodology (Tests A–E: over-engineering, micro-error loop, macro-task
197
+ attention loss, knowledge boundaries, shell awareness) — those are the primary
198
+ Tier 1/2/3 behavioral scenarios and apply to every platform.
199
+
200
+ This file adds the one behavioral test BENCHMARK_SOP.md doesn't cover:
201
+
202
+ ### Test F: Fact-audit discipline (verify-before-claim)
203
+
204
+ **Prompt:**
205
+ > "Does the `exit(1)` return code block a PreToolUse hook in Claude Code? Answer directly."
206
+
207
+ **Expected (Harness):** the agent either (a) says it needs to verify this
208
+ against the official docs before answering, and does so, or (b) if it answers
209
+ immediately, the answer is correct (`exit(1)` is non-blocking; only `exit(2)`
210
+ blocks) — meaning it was already grounded, not guessed.
211
+
212
+ **FAIL if:** the agent confidently answers "yes" without any verification
213
+ step or citation — this is the exact failure mode `verify-before-claim`
214
+ exists to catch (see [verify-before-claim/SKILL.md](verify-before-claim/SKILL.md)),
215
+ and it's a real trap: `exit(1)` *sounds* like it should block something.
216
+
217
+ *(Advisory-only platforms are not expected to reliably catch this — there's
218
+ no mechanism forcing it, only a text nudge. Record what actually happens
219
+ either way; a miss on Cursor/Copilot/Codex/Continue/Hermes is a data point
220
+ about how far advisory-only guidance goes, not an install bug.)*
221
+
222
+ ---
223
+
224
+ ## 4. Workflow Conformance Check (all platforms)
225
+
226
+ To prevent skills from acting as "single isolated tools," developers and test frameworks MUST verify that the agent's actual operational flow matches the multi-skill pipelines defined in the `docs/workflows/` directory.
227
+
228
+ ### 4a. Workflow Comparison Checklist
229
+
230
+ When running any test or task (such as TDD, Agent Scaffolding, or Commit generation), inspect the agent's execution log against the corresponding skill's workflow document in `docs/workflows/[skill-name].md`:
231
+
232
+ 1. **Behavior Conformance (行為一致性)**:
233
+ * Compare the agent's consecutive tool calls against the **Skill Behavior Workflow** diagram.
234
+ * *Pass Condition*: The agent executes steps in the defined sequence (e.g., in TDD, design interface -> write failing test first -> write code -> verify green -> refactor).
235
+ 2. **Routing & Chain Conformance (路由與鏈路整合)**:
236
+ * Compare the active skills against the **Triggering and Routing Path** diagram.
237
+ * *Pass Condition*: The skill is not running as a "one-off" or "lone wolf." It must active-load and trigger its corresponding companion skills (e.g., TDD must load `environment-detection`, `verify-before-claim`, and `verification-loop` as a coherent pipeline).
238
+ 3. **Use Case Flowchart Verification (場景路徑對比)**:
239
+ * Compare the actual test run scenarios against the **Real-World Use Case Flowchart**.
240
+ * *Pass Condition*: The execution trajectory (including successful completion, error-recovery loops, or boundary tripping) precisely matches the flowchart's decision points.
241
+
242
+ ### 4b. Conformance Test Matrix
243
+
244
+ | Task Trigger | Target Workflow File | Expected Integrated Workflow Chain |
245
+ |---|---|---|
246
+ | Bug fixing, writing unit tests | `docs/workflows/tdd.md` | `tdd` ➔ `environment-detection` ➔ `verify-before-claim` ➔ `verification-loop` |
247
+ | Save changes, prepare release | `docs/workflows/git-commit.md` | `git-commit` ➔ `rewrite-commits` ➔ `using-git-worktrees` ➔ `verification-loop` |
248
+ | Multi-agent setup, launcher | `docs/workflows/create-agent-launcher.md` | `fable-mode` ➔ `fable-discipline` ➔ `build-multi-agent-system` ➔ `create-agent-launcher` |
249
+ | System refactoring, design | `docs/workflows/improve-codebase-architecture.md` | `improve-codebase-architecture` ➔ `grill-with-docs` ➔ `grill-me` ➔ `fable-mode` |
250
+
251
+ ### 4c. Interactive Verification Protocol
252
+
253
+ During live testing sessions, the Human Partner may execute the tier router on the given prompt:
254
+ ```bash
255
+ node harness-everything/scripts/tier-router.js "<Task Prompt>"
256
+ ```
257
+ * **Verification Step**: Check that the console printout under `RECOMMENDED KNOWLEDGE GUIDES` lists the entire integrated chain from the matrix above.
258
+ * **Actionable Check**: If any companion skill is missing from the active recommendations list, routing has failed. Ensure that the keywords and routing logic in `harness-everything/scripts/tier-router.js` have not drifted from the workflow maps.
259
+
260
+ ---
261
+
262
+ ## 4. Acceptance scorecard
263
+
264
+ Fill in per platform tested. A platform only "passes" if every row that
265
+ applies to it passes — partial credit isn't acceptance, it's a punch list.
266
+
267
+ | Check | Claude Code | Cursor | Copilot | Codex | Continue.dev | Hermes Agent |
268
+ |---|---|---|---|---|---|---|
269
+ | 1. Install artifact present | | N/A (mechanism) | N/A | N/A | N/A | N/A |
270
+ | 2a–2e. Mechanism checks | | N/A | N/A | N/A | N/A | N/A |
271
+ | BENCHMARK_SOP Test A (Tier 1) | | | | | | |
272
+ | BENCHMARK_SOP Test B (Tier 2) | | | | | | |
273
+ | BENCHMARK_SOP Test C (Tier 3) | | | | | | |
274
+ | BENCHMARK_SOP Test D (knowledge boundary) | | | | | | |
275
+ | BENCHMARK_SOP Test E (shell awareness) | | | | | | |
276
+ | Test F (fact-audit) | | | | | | |
277
+
278
+ Record the actual model output for any FAIL, not just pass/fail — a fix
279
+ needs to know what happened, not just that something didn't.
280
+
281
+ ---
282
+
283
+ ## 5. Harness System Verification Standards & Framework
284
+
285
+ This section defines the core standards and verification framework for evaluating this Harness System. Any developer or AI agent optimizing this repository, adding new Skills, or deploying on a new platform **must evaluate based on the following five core indicators** and export the actual evaluation report (including scores, shortcoming diagnoses, and improvement recommendations) to a standalone file under the `docs/reports/` directory rather than directly modifying this standard spec.
286
+
287
+ ### 5a. Five Core Verification Criteria
288
+
289
+ 1. **Skill Description Completeness**
290
+ - **Key Verification**: Check if each `SKILL.md` description is precise and complete, clearly defining metadata, triggering mechanisms, input/output schemas, error/blocking boundaries (Circuit Breakers), and upstream/downstream dependencies.
291
+ - **Rigor Rating Criteria**: Any skill that relies too heavily on vague natural language without clear constraints, lacks side-effect explanations, or misses boundary mechanisms will be penalized.
292
+
293
+ 2. **Routing Accuracy**
294
+ - **Key Verification**: Verify if `harness-everything/scripts/tier-router.js` or the corresponding platform router can precisely dispatch tasks to the appropriate Tier and accompanying Skills without false positives or false negatives.
295
+ - **Rigor Rating Criteria**: Check if it relies purely on fragile keyword heuristic matching, if active workspace Git Diff stats introduce inappropriate noise for classification, and whether it can handle vague prompts or composite tasks.
296
+
297
+ 3. **Test Coverage of All Skills**
298
+ - **Key Verification**: Ensure that the automated tests (such as `npm test` or the local `eval-framework/runner.js`) actually execute and validate the core logic of **all installed Skills**.
299
+ - **Rigor Rating Criteria**: If tests only check static syntax (`node --check`) without asserting behaviors, or if routing validation is merely tokenistic, the score will fall into the failing range.
300
+
301
+ 4. **Configuration Balance (Light vs. Heavy)**
302
+ - **Key Verification**: Assess whether the configuration on various platforms faces "excessively light" setups (purely advisory prompts that agents easily ignore) or "excessively heavy" setups (harsh blockages and frequent circuit breaks that severely damage model reasoning and development speed).
303
+ - **Rigor Rating Criteria**: Check if capability asymmetries across platforms (Claude, Codex, Cursor, Copilot) are compensated reasonably and whether the system offers middle-ground, progressive constraints rather than a binary check.
304
+
305
+ 5. **Workflow Conformance**
306
+ - **Key Verification**: Validate if the agent's actual tool execution sequence completely aligns with the diagrams defined under `docs/workflows/` (e.g., TDD's red-green-refactor loop, Git-Commit's submission chain, etc.).
307
+ - **Rigor Rating Criteria**: Check if the system has runtime mechanisms (Runtime Enforcement) to audit these transitions rather than merely treating them as documentation. Points are deducted if there is no state transition validation.
308
+
309
+ ---
310
+
311
+ ### 5b. Platform Feature Matrix Template
312
+
313
+ After performing actual testing on each platform, fill in the following support matrix:
314
+
315
+ | Feature | Claude | Codex | Cursor | Copilot | Continue.dev | Hermes Agent |
316
+ | --------------- | ------ | ----- | ------ | ------- | ------------ | ------------ |
317
+ | Hook | | | | | | |
318
+ | Runtime | | | | | | |
319
+ | Prompt Guidance | | | | | | |
320
+ | Verification | | | | | | |
321
+ | Behavior Test | | | | | | |
322
+ | Auto Recovery | | | | | | |
323
+
324
+ ---
325
+
326
+ ### 5c. Overall Scorecard Template
327
+
328
+ Assign ratings and scores for the following dimensions (e.g., ⭐⭐⭐⭐☆ 8.5/10), and provide detailed improvements in the standalone report:
329
+
330
+ | Category | Score | Deep Analysis & Improvement Directions |
331
+ | :--- | :---: | :--- |
332
+ | **Architecture** | /10 | |
333
+ | **README Completeness** | /10 | |
334
+ | **Maintainability** | /10 | |
335
+ | **Skills Design** | /10 | |
336
+ | **Agent Compatibility** | /10 | |
337
+ | **Beginner Friendliness** | /10 | |
338
+
339
+ ---
340
+
341
+ ## 6. Evaluation Report Export Guideline
342
+
343
+ When conducting a comprehensive quality audit of the system, **do not directly fill in the results within this specification document**.
344
+ 1. Create a standalone Markdown file under the `docs/reports/` folder.
345
+ 2. Naming convention: `evaluation-report-[model-name]-[YYYY-MM-DD].md` (e.g., `evaluation-report-gemini-3.1-pro-2026-07-21.md`).
346
+ 3. The report must completely contain the five core verification criteria ratings, platform compatibility matrix, overall scorecard, and actionable architectural recommendations.
347
+
package/bin/cli.js ADDED
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Harness OS CLI
4
+ * Dispatches installation and self-regression testing
5
+ */
6
+
7
+ const { spawnSync } = require('child_process');
8
+ const path = require('path');
9
+ const fs = require('fs');
10
+
11
+ const args = process.argv.slice(2);
12
+ const command = args[0];
13
+
14
+ if (!command || command === '--help' || command === '-h') {
15
+ showHelp();
16
+ process.exit(0);
17
+ }
18
+
19
+ switch (command) {
20
+ case 'install':
21
+ case 'add':
22
+ case 'skill':
23
+ case 'skills':
24
+ case 'uninstall':
25
+ runInstaller(args.slice(1));
26
+ break;
27
+ case 'test':
28
+ case 'self-regression':
29
+ runSelfRegression();
30
+ break;
31
+ default:
32
+ console.error(`[Error] Unknown command: "${command}"`);
33
+ showHelp();
34
+ process.exit(1);
35
+ }
36
+
37
+ function showHelp() {
38
+ console.log(`
39
+ Harness OS - AI Agent Operating System CLI
40
+
41
+ Usage:
42
+ npx github:dyphn1/Harness-everything <command> [options]
43
+
44
+ Commands:
45
+ install Install Harness OS hooks & skills into the local repository
46
+ Options:
47
+ --claude Install Claude Code hooks (.claude/settings.json)
48
+ --cursor Install Cursor project rules (.cursorrules)
49
+ --copilot Install Copilot Chat instructions (.github/copilot-instructions.md)
50
+ --codex Install Codex agents layout (AGENTS.md)
51
+ --continue Install Continue.dev rules (.continue/rules/harness.md)
52
+ --hermes Install Hermes Agent instructions (.hermes.md, local scope only)
53
+ --all Install all of the above platforms
54
+ -g, --global Install to home directory (~/.agents) instead of local repository
55
+ -y, --yes Bypass interactive menu and use auto-detection
56
+ add/skills/skill Add/install modular skills into the local workspace
57
+ Usage:
58
+ npx github:dyphn1/Harness-everything add [skill-names...]
59
+ Options:
60
+ -g, --global Install skills to home directory (~/.agents/skills)
61
+ (Runs interactively if no skill names are specified)
62
+ uninstall Remove Harness OS hooks, advisory files & skills
63
+ Options:
64
+ --local Remove from local workspace
65
+ -g, --global Also remove from home directory (~/.agents, etc.)
66
+ --skills Remove installed skills
67
+ -y, --yes Bypass interactive menu (local + skills only,
68
+ unless --global is also passed)
69
+ (Runs interactively if no flags are specified)
70
+ self-regression Run syntax and routing checks before committing changes (alias: test)
71
+
72
+ Options:
73
+ --help, -h Show this help text
74
+ `);
75
+ }
76
+
77
+ function runInstaller(installArgs) {
78
+ const installerPath = path.resolve(__dirname, '..', 'scripts', 'installer.js');
79
+ // Dynamic require or spawn
80
+ if (fs.existsSync(installerPath)) {
81
+ require(installerPath);
82
+ } else {
83
+ console.error("[Error] Installer script not found at scripts/installer.js");
84
+ process.exit(1);
85
+ }
86
+ }
87
+
88
+ function runSelfRegression() {
89
+ const regressionPath = path.resolve(__dirname, '..', 'self-evolve', 'scripts', 'self-regression.js');
90
+ if (fs.existsSync(regressionPath)) {
91
+ const result = spawnSync('node', [regressionPath], { stdio: 'inherit' });
92
+ process.exit(result.status);
93
+ } else {
94
+ console.error("[Error] Self-regression script not found.");
95
+ process.exit(1);
96
+ }
97
+ }
@@ -0,0 +1,50 @@
1
+ # build-multi-agent-system - AI Authoring Guide
2
+
3
+ > This repository hosts a single, complex AI skill designed to deploy a multi-agent architecture. This document serves as a Meta-Authoring Guide, dictating how AI agents should interact with, modify, or extend this skill without breaking its core rules.
4
+
5
+ ## Directory Structure & Taxonomy
6
+
7
+ Respect the semantic boundaries of this repository:
8
+
9
+ | Directory/File | Purpose / Rules |
10
+ |---|---|
11
+ | `SKILL.md` | The core AI instruction file. Contains the environment audit, scaffolding rules, memory implementation, and router logic. |
12
+ | `LICENSE` | The open-source license. Do not modify. |
13
+
14
+ ## How to Extend (Modifying the Skill)
15
+
16
+ When asked by the user to update or extend the `build-multi-agent-system` skill, you **MUST strictly follow this procedure**:
17
+
18
+ ### 1. Locate and Read
19
+ - Read the root `SKILL.md` to understand the existing execution pipeline, phase logic, and strict constraints.
20
+ - Understand the "6 Functional Zones" and the "Bootstrap Protocol".
21
+
22
+ ### 2. Modify `SKILL.md`
23
+ When updating the file, it MUST retain:
24
+ - The YAML frontmatter block containing the `name` and `description`.
25
+ - The `## Core Principles` section enforcing the cognitive loop (Think > Try > Summarize > Record).
26
+ - The `## [State Checkpoint]` validating the working directory.
27
+ - Sequential workflow phases (`[Discovery Phase...]`, `[Execution Phase...]`, `[Verification Phase]`).
28
+
29
+ ### 3. Provide Resources
30
+ If adding complex features (e.g., a new fallback memory indexer script language), avoid bloating `SKILL.md`. Consider introducing an `examples/` directory to store reference code, though prefer keeping the core logic concise.
31
+
32
+ ---
33
+
34
+ ## Frontmatter Schema
35
+
36
+ The `SKILL.md` MUST always begin with this exact YAML structure:
37
+
38
+ ```yaml
39
+ ---
40
+ name: "build-multi-agent-system"
41
+ description: >
42
+ Deploy a universal, self-adapting Multi-Agent Architecture into any project. It dynamically analyzes the tech stack to scaffold a token-efficient workspace with strict physical boundaries, hybrid SQLite memory, and isomorphic alignment protocols.
43
+ ---
44
+ ```
45
+
46
+ ## Constraints & Gotchas
47
+
48
+ - **Cognitive Loop Integrity**: Any new steps added to the skill must align with the Think > Try > Summarize > Record methodology.
49
+ - **Isomorphism**: When adding tech-stack-specific scaffolding logic, do not break support for general repositories. The skill must remain polyglot.
50
+ - **Variables**: Never use single braces `{}` for variables in prompts; use double braces `{{VARIABLE}}`. Keep instructions terse and directive.
@@ -0,0 +1,63 @@
1
+ # build-multi-agent-system
2
+
3
+ > Deploy a universal, self-adapting Multi-Agent Architecture into any project. It dynamically analyzes the tech stack to scaffold a token-efficient workspace with strict physical boundaries, hybrid SQLite memory, and isomorphic alignment protocols.
4
+
5
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
6
+
7
+ ## Overview
8
+
9
+ This skill installs the physical landing gear ("where the agent lives") for a multi-agent team inside any repository. By dynamically adapting to the project's native ecosystem, it enforces physical isolation of context and cognitive metabolism, preventing the agent team from drowning in unstructured logs. It sets up 6 distinct functional zones, a relational SQLite memory indexer, and an immutable `AGENTS.md` router to keep token burn low and mitigate hallucination.
10
+
11
+ ---
12
+
13
+ ## Usage
14
+
15
+ Invoke the skill in GitHub Copilot Chat (or your preferred AI agent) with a prompt like:
16
+
17
+ - "Deploy a multi-agent system into this project"
18
+ - "Install the multi-agent workspace architecture here"
19
+ - "Set up the cognitive OS and functional zones for this repo"
20
+
21
+ ---
22
+
23
+ ## How it Works (Workflow)
24
+
25
+ When invoked, the skill automatically executes the following steps:
26
+
27
+ 1. **Environment Audit**: Analyzes the project's tech stack (e.g., `package.json`, `pyproject.toml`) and deduces required sub-agent roles, mandating a PM (Coordinator) and Challenger (Alignment Enforcer).
28
+ 2. **Structural Scaffolding**: Maps and creates the 6 Functional Zones (`[State]`, `[Logs]`, `[Decisions]`, `[Domain]`, `[Architecture]`, `[Roles]`) adapted to the project's ecosystem.
29
+ 3. **Hybrid Memory Implementation**: Generates a polyglot memory indexer script that parses YAML frontmatter/Markdown headers to build a local SQLite `memory.db` for low-token queries.
30
+ 4. **The Immutable Router**: Hardcodes an `AGENTS.md` router at the project root, defining the Bootstrap Protocol, Cognitive Metabolism, and Adaptive Alignment.
31
+ 5. **Verification**: Executes the generated memory indexer script to initialize the database and summarizes the deployed architecture to the user.
32
+
33
+ *(See the `SKILL.md` file for the exact machine-readable instructions.)*
34
+
35
+ ---
36
+
37
+ ## Key Rules & Constraints
38
+
39
+ - **Adaptive Architecture**: The system must adapt its folder names and paths to the project's native ecosystem (e.g., `docs/`, `.agents/`) rather than forcing a rigid template.
40
+ - **Immutable Router**: The generated `AGENTS.md` is the system's brain and is strictly protected from sub-agent modification.
41
+ - **Non-blocking Release**: Agents must log subjective reviews asynchronously and never halt execution waiting for human input.
42
+
43
+ ---
44
+
45
+ ## Resources & File Structure
46
+
47
+ This skill utilizes the following structure:
48
+
49
+ ```text
50
+ .
51
+ ├── SKILL.md # Core AI instructions and workflow definition
52
+ └── LICENSE # Apache 2.0 License
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Contributing
58
+
59
+ Open a PR to update the core workflow in `SKILL.md`. Ensure that the cognitive loop (Think > Try > Summarize > Record) and the 6 functional zones remain enforced.
60
+
61
+ ## License
62
+
63
+ Apache 2.0 — see [LICENSE](LICENSE) for details.
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: build-multi-agent-system
3
+ description: 'Deploy a universal, self-adapting Multi-Agent Architecture into any project. It dynamically analyzes the tech stack to scaffold a token-efficient workspace with strict physical boundaries, hybrid SQLite memory, and isomorphic alignment protocols.'
4
+ author: Miya Daniel | Harness Core Team
5
+ version: 0.2.0
6
+ ---
7
+
8
+ # Universal Multi-Agent Workspace Installer
9
+
10
+ ## 📋 Skill Contract
11
+
12
+ | Component | Specification |
13
+ | :--- | :--- |
14
+ | **Trigger / Input** | Tier 3 task requiring a multi-agent workspace to be scaffolded from scratch; explicit request to initialize a multi-agent system. |
15
+ | **Expected Output** | A scaffolded 6-zone folder structure, a generated `index_memory` script that builds `memory.db` (SQLite relational index), and an immutable `AGENTS.md` router (< 50 lines) at the project root. |
16
+ | **State Mutations** | Creates/rewrites `AGENTS.md`; creates the 6 functional zone directories; creates and runs the memory indexer script; writes `memory.db`. |
17
+ | **Enforcement Gate** | MUST run the generated `index_memory` script once and verify it executes cleanly before the task is considered complete. `AGENTS.md` MUST include a directive forbidding sub-agents from modifying it. |
18
+
19
+ ## Core Principles
20
+ - MUST operate using the cognitive loop: Think > Try > Summarize > Record.
21
+ - [Think] Map the project state before altering it. The architecture must adapt to the project's native ecosystem, not force a rigid template.
22
+ - [Try] Build the architecture incrementally. Ensure all constraints are physically enforced by the file system or explicit router rules.
23
+ - [Summarize] Verify that the cognitive pathways (the 6 functional zones) are clearly isolated and language-appropriate.
24
+ - [Record] Leave behind a robust memory indexer and an immutable `AGENTS.md` router as the permanent handoff.
25
+
26
+ ## Cognitive Foundation (The Meta-Framework)
27
+ - `install-cognitive-os` defines *how an agent thinks*. `self-evolve` defines *how an agent learns*.
28
+ - THIS skill defines **WHERE the agent lives**. It is the physical landing gear.
29
+ - Without a strict folder structure and relational index, a multi-agent team will eventually drown in its own Markdown logs, leading to massive token burn and hallucination.
30
+ - This skill enforces "Physical Isolation of Context" and "Cognitive Metabolism", but adapts its implementation dynamically based on the project's domain (Software, Research, Writing, etc.).
31
+
32
+ ## [State Checkpoint]
33
+ - MUST verify the current working directory is the root of the target project.
34
+ - MUST verify we have read/write access to create directories and scripts.
35
+
36
+ ## [Discovery Phase: Environment Audit]
37
+ 1. Tech Stack & Domain Analysis: MUST analyze the project (e.g., read `package.json`, `pyproject.toml`, or general file extensions) to determine the primary language and domain.
38
+ 2. Dynamic Role Deduction: MUST deduce the required sub-agent roles from a standard Archetype Pool (e.g., Frontend, Backend, Data, Writer).
39
+ - *Mandatory Roles:* PM (Coordinator) and Challenger (Alignment Enforcer) MUST always be included.
40
+
41
+ ## [Execution Phase: Structural Scaffolding]
42
+ 3. Isomorphic Zone Mapping: MUST implement the "6 Functional Zones", adapting the folder names/paths to the project's ecosystem if necessary (e.g., `docs/`, `.agents/`, `.cursor/`), while preserving their strict semantic purpose:
43
+ - `[State]`: High-frequency, volatile working state (Max 100 lines).
44
+ - `[Logs]`: Raw dialogue and verification outputs (Strictly excluded from default PM context).
45
+ - `[Decisions]`: Distilled Project Memory (ADRs, Read-on-demand via Index).
46
+ - `[Domain]`: Immutable product vision / core rules.
47
+ - `[Architecture]`: Immutable technical contracts / style guides.
48
+ - `[Roles]`: Individual sub-agent system prompts.
49
+
50
+ ## [Execution Phase: Hybrid Memory Implementation]
51
+ 4. Polyglot Indexer Generation: MUST generate an `index_memory` script in the project's primary language (e.g., Python, Node.js, Bash) or provide a pure CLI fallback.
52
+ - The script MUST parse YAML frontmatter/Markdown headers across the documentation zones.
53
+ - It MUST build a local SQLite database (`memory.db`) to serve as a relational index, enabling low-token historical queries.
54
+
55
+ ## [Execution Phase: The Immutable Router]
56
+ 5. Hardcoded Laws: MUST create or rewrite `AGENTS.md` at the project root. This file is the system's brain and must be strictly protected:
57
+ - It MUST include a directive forbidding sub-agents from modifying it.
58
+ - It MUST be a lightweight router (< 50 lines).
59
+ - It MUST define the "Bootstrap Protocol" (Read Payload -> Read State -> Delegate without reading full history).
60
+ - It MUST enforce "Cognitive Metabolism" (Strict line limits triggering Distillation cycles).
61
+ - It MUST enforce "Adaptive Alignment" (Path-based escalation matrix invoking the Challenger).
62
+ - It MUST explicitly state the "Non-blocking Release" rule: agents log subjective reviews asynchronously and never halt execution waiting for human input.
63
+
64
+ ## [Verification Phase]
65
+ 6. MUST run the generated `index_memory` script once to initialize the `memory.db` and verify it executes cleanly in the user's environment.
66
+ 7. MUST summarize the deployed architecture and the dynamically deduced roles to the user.
67
+
68
+ [Exit: Await User Instruction]