immune-brain 4.6.0 → 5.0.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.
- package/README.md +154 -37
- package/README.zh-CN.md +160 -40
- package/package.json +1 -1
- package/plugins/immune-brain/.claude-plugin/plugin.json +1 -1
- package/plugins/immune-brain/.pi-extension/imm-canary-enroll.ts +42 -44
- package/plugins/immune-brain/.pi-extension/imm-canary-work.ts +142 -474
- package/plugins/immune-brain/.pi-extension/imm-unattended-batch.ts +54 -84
- package/plugins/immune-brain/.pi-extension/pi-canary-assurance-progression.ts +7 -2
- package/plugins/immune-brain/.pi-extension/tsconfig.json +2 -2
- package/plugins/immune-brain/agents/immune-brain-advisory-reviewer.md +23 -0
- package/plugins/immune-brain/agents/immune-brain-qa.md +42 -0
- package/plugins/immune-brain/agents/immune-brain-reviewer.md +90 -1
- package/plugins/immune-brain/agents/immune-brain-ui-review.md +21 -0
- package/plugins/immune-brain/dist/BASELINE.md +4 -4
- package/plugins/immune-brain/dist/claude/mcp-server.mjs +7369 -7016
- package/plugins/immune-brain/dist/docs/reference/planning-quality-gate.md +3 -3
- package/plugins/immune-brain/dist/docs/reference/subagent-dispatch-protocol.md +30 -1
- package/plugins/immune-brain/dist/imm-brainstorm.md +1 -1
- package/plugins/immune-brain/dist/imm-doc-prune.md +2 -2
- package/plugins/immune-brain/dist/{imm-agent-doc-maintain.md → imm-doc-slim.md} +9 -9
- package/plugins/immune-brain/dist/imm-planner.md +23 -8
- package/plugins/immune-brain/dist/imm-pr-fix.md +1 -1
- package/plugins/immune-brain/dist/{imm-review-retro.md → imm-retro.md} +26 -13
- package/plugins/immune-brain/dist/{imm-loop.md → imm-run.md} +33 -7
- package/plugins/immune-brain/dist/registry.yaml +9 -9
- package/plugins/immune-brain/dist/role-prompts/code-review.md +7 -0
- package/plugins/immune-brain/dist/role-prompts/executor.md +35 -2
- package/plugins/immune-brain/runtime/assurance/coordinator.ts +83 -67
- package/plugins/immune-brain/runtime/assurance/host_port.ts +20 -0
- package/plugins/immune-brain/runtime/assurance/qa.ts +2 -2
- package/plugins/immune-brain/runtime/assurance/verdict_authority.ts +347 -0
- package/plugins/immune-brain/runtime/claude/kernel_ports.ts +62 -369
- package/plugins/immune-brain/runtime/claude/mcp_server.ts +2 -0
- package/plugins/immune-brain/runtime/claude/review_host.ts +48 -16
- package/plugins/immune-brain/runtime/claude/role_agents.ts +83 -0
- package/plugins/immune-brain/runtime/commands/kernel.ts +3 -6
- package/plugins/immune-brain/runtime/kernel/application.ts +6 -3
- package/plugins/immune-brain/runtime/kernel/assurance_projection.ts +15 -8
- package/plugins/immune-brain/runtime/kernel/canary_application.ts +5 -3
- package/plugins/immune-brain/runtime/kernel/enrollment.ts +149 -5
- package/plugins/immune-brain/runtime/kernel/index.ts +3 -1
- package/plugins/immune-brain/runtime/kernel/storage.ts +170 -11
- package/plugins/immune-brain/runtime/kernel/storage_paths.ts +13 -0
- package/plugins/immune-brain/runtime/loop_contract.ts +22 -22
- package/plugins/immune-brain/runtime/plugin_version.ts +1 -1
- package/plugins/immune-brain/runtime/prompts/code-review.md +7 -0
- package/plugins/immune-brain/runtime/prompts/executor.md +35 -2
- package/plugins/immune-brain/runtime/role_prompt_bridge.ts +27 -0
- package/plugins/immune-brain/runtime/unattended/batch_git.ts +57 -27
- package/plugins/immune-brain/runtime/unattended/batch_kernel_port.ts +106 -0
- package/plugins/immune-brain/runtime/unattended/batch_preflight.ts +12 -14
- package/plugins/immune-brain/runtime/unattended/batch_reconfirmation.ts +34 -29
- package/plugins/immune-brain/runtime/unattended/batch_runner.ts +26 -90
- package/plugins/immune-brain/runtime/workspace_scope.ts +34 -0
- package/plugins/immune-brain/skills/BASELINE.md +4 -4
- package/plugins/immune-brain/skills/imm-doc-prune/SKILL.md +1 -1
- package/plugins/immune-brain/skills/{imm-agent-doc-maintain → imm-doc-slim}/SKILL.md +9 -9
- package/plugins/immune-brain/skills/imm-planner/SKILL.md +4 -2
- package/plugins/immune-brain/skills/imm-pr-fix/SKILL.md +1 -1
- package/plugins/immune-brain/skills/{imm-review-retro → imm-retro}/SKILL.md +7 -7
- package/plugins/immune-brain/skills/{imm-review-retro → imm-retro}/scripts/review_retro.ts +46 -21
- package/plugins/immune-brain/skills/{imm-loop → imm-run}/SKILL.md +7 -7
- package/plugins/immune-brain/skills/registry.yaml +9 -9
- package/plugins/immune-brain/.pi-extension/runtime-stub.ts +0 -581
package/README.md
CHANGED
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
Immune-Brain brings a structured engineering workflow to AI coding assistants (**Pi** and **Claude Code**):
|
|
12
12
|
|
|
13
13
|
- **Zero overhead for normal chat & coding** — Ordinary questions, quick edits, and exploratory chat stay 100% host-native. Immune-Brain never interrupts normal conversation.
|
|
14
|
-
- **Explicit trigger when rigor matters** — When you want engineering discipline, invoke `imm-brainstorm`, `imm-planner`, or `imm-
|
|
14
|
+
- **Explicit trigger when rigor matters** — When you want engineering discipline, invoke `imm-brainstorm`, `imm-planner`, or `imm-run`.
|
|
15
15
|
- **Plans become trackable tasks** (`TaskIntent` + `TaskRecord`) — Progress lives on disk (Git + `.imm/`), surviving restarts and context wipes.
|
|
16
16
|
- **Quality is enforced by code, not promises** — Automated QA and isolated review subagents must pass before a task can complete.
|
|
17
|
-
- **Ready Initiatives can run as a batch** — One confirmed batch authorization lets `imm-
|
|
17
|
+
- **Ready Initiatives can run as a batch** — One confirmed batch authorization lets `imm-run` work through a published Initiative's children serially, while every child is still enrolled, QA'd, reviewed, and settled on its own.
|
|
18
18
|
|
|
19
19
|
Pi and Claude Code are the supported hosts. Undeclared adapters remain unsupported. Minimum Claude Code is `2.1.236`, the lowest version verified with interactive server-initiated MCP elicitation. Current real-Host evidence is recorded in [Claude native elicitation conformance](docs/verification/claude-native-elicitation-authority-conformance.md); historical reports remain under [docs/verification/archive/](docs/verification/archive/). Either host can use the model provider you configure — Immune-Brain works on top of Kernel authority, not a vendor chat.
|
|
20
20
|
|
|
@@ -25,6 +25,7 @@ Pi and Claude Code are the supported hosts. Undeclared adapters remain unsupport
|
|
|
25
25
|
- [Installation](#installation)
|
|
26
26
|
- [Quick Start](#quick-start)
|
|
27
27
|
- [How to Use](#how-to-use)
|
|
28
|
+
- [Core Philosophy: Turn "Judgment" into "Table Lookup"](#core-philosophy-turn-judgment-into-table-lookup-harnessing-multi-model-tiers-with-determinism)
|
|
28
29
|
- [The 7 Skills](#the-7-skills)
|
|
29
30
|
- [Lifecycle](#lifecycle)
|
|
30
31
|
- [Unattended Batch Runs](#unattended-batch-runs)
|
|
@@ -51,7 +52,7 @@ Pi discovers Skills and extensions from `package.json` (or your global Pi config
|
|
|
51
52
|
}
|
|
52
53
|
```
|
|
53
54
|
|
|
54
|
-
No extra server config is needed. Installing the package via Pi makes all
|
|
55
|
+
No extra server config is needed. Installing the package via Pi makes all 7 Skills available automatically.
|
|
55
56
|
|
|
56
57
|
### In Claude Code
|
|
57
58
|
|
|
@@ -95,8 +96,8 @@ Planner authors a `TaskIntent` and living Spec (scoped files, risk tier, accepta
|
|
|
95
96
|
|
|
96
97
|
Review the scope and confirm enrollment. No code or authority writes happen before your explicit confirmation.
|
|
97
98
|
|
|
98
|
-
**3. Run and verify with `imm-
|
|
99
|
-
Run `/imm-
|
|
99
|
+
**3. Run and verify with `imm-run`**:
|
|
100
|
+
Run `/imm-run` (or say "Start imm-run"). The engine will:
|
|
100
101
|
- Dispatch an Executor to write code strictly within the frozen scope.
|
|
101
102
|
- Run deterministic QA acceptance checks.
|
|
102
103
|
- Dispatch an isolated Review subagent for material/critical changes.
|
|
@@ -113,18 +114,18 @@ Immune-Brain provides two clean modes: **Host-native** for daily coding, and **M
|
|
|
113
114
|
| Daily coding, quick fix, general Q&A | Normal conversation ("Fix typo in README", "Explain this function") | **Host-native**: Standard Pi / Claude Code behavior. Zero workflow overhead. |
|
|
114
115
|
| Fuzzy idea, needs scoping & risk analysis | `/imm-brainstorm` "Help me think through webhook support" | → `imm-brainstorm` frames requirements, constraints, and risks (read-only, no code edits) |
|
|
115
116
|
| Clear goal, want formal plan & specs | `/imm-planner` "Plan the webhook feature" | → `imm-planner` writes `TaskIntent` + Specs with testable acceptance checks |
|
|
116
|
-
| Plan confirmed, ready to build & verify | `/imm-
|
|
117
|
-
| Session interrupted or resuming a task | `/imm-
|
|
117
|
+
| Plan confirmed, ready to build & verify | `/imm-run` | → Executor builds within scope → deterministic QA verifies → isolated Review checks → task settles |
|
|
118
|
+
| Session interrupted or resuming a task | `/imm-run` | → Resumes existing task seamlessly from on-disk state (`.imm/`) |
|
|
118
119
|
| Ready Initiative to run unattended | "Run initiative `<slug>` unattended" | → Host's `start_unattended_batch`: one native confirmation covers ordered plan digest, children run serially |
|
|
119
|
-
| Cross-host workflow (Claude plan + Pi code) | Run `/imm-planner` in Claude Code, switch to Pi and run `/imm-
|
|
120
|
+
| Cross-host workflow (Claude plan + Pi code) | Run `/imm-planner` in Claude Code, switch to Pi and run `/imm-run` | → Staged Spec & TaskIntent are shared on disk; Pi confirms via native TUI and executes loop |
|
|
120
121
|
| PR has review comments or failing CI | `/imm-pr-fix` on that PR | → Standalone repair: minimal scoped fix in place, no managed task created |
|
|
121
122
|
| Project docs out of date | `/imm-doc-prune` | → Read-only audit; deletes only user-approved stale docs from manifest |
|
|
122
|
-
| Agent instructions bloated | `/imm-
|
|
123
|
-
| Which model's edits keep coming back for review | `/imm-
|
|
123
|
+
| Agent instructions bloated | `/imm-doc-slim` | → Minimizes tracked `AGENTS.md` / `CLAUDE.md` to essential non-discoverable rules |
|
|
124
|
+
| Which model's edits keep coming back for review | `/imm-retro` | → Ranks models by review load and reports project usage from session logs |
|
|
124
125
|
|
|
125
126
|
> **Core Principle: Skill-Explicit Entry**
|
|
126
127
|
> - **Ordinary input stays host-native**: Natural language queries never automatically start planning or task enrollment. You choose when to turn on engineering rigor.
|
|
127
|
-
> - **Managed work starts with explicit skills**: Use `imm-brainstorm` to clarify, `imm-planner` to plan, and `imm-
|
|
128
|
+
> - **Managed work starts with explicit skills**: Use `imm-brainstorm` to clarify, `imm-planner` to plan, and `imm-run` to execute and resume.
|
|
128
129
|
|
|
129
130
|
### Cross-Host Workflow: Plan in Claude Code, Build in Pi
|
|
130
131
|
|
|
@@ -135,7 +136,7 @@ This enables a best-of-both-worlds workflow: **leverage Claude Code's deep reaso
|
|
|
135
136
|
```text
|
|
136
137
|
┌───────────────────────────────────┐ Git-Tracked Artifacts on Disk ┌───────────────────────────────────┐
|
|
137
138
|
│ Claude Code │ ─────────────────────────────────> │ Pi │
|
|
138
|
-
│ 1. /imm-brainstorm (Clarify) │ docs/specs/*.spec.md │ 1. /imm-
|
|
139
|
+
│ 1. /imm-brainstorm (Clarify) │ docs/specs/*.spec.md │ 1. /imm-run (Native TUI Modal) │
|
|
139
140
|
│ 2. /imm-planner (Spec/Intent) │ docs/plans/*.intent.json │ 2. Executor (Code) + QA Engine │
|
|
140
141
|
└───────────────────────────────────┘ └───────────────────────────────────┘
|
|
141
142
|
```
|
|
@@ -150,7 +151,7 @@ This enables a best-of-both-worlds workflow: **leverage Claude Code's deep reaso
|
|
|
150
151
|
- **Stage in Git**: Stage the generated artifacts (`git add docs/`). You can stop before Enrollment without executing.
|
|
151
152
|
2. **Phase 2: Code Implementation & Execution in Pi**
|
|
152
153
|
- **Launch Pi**: Open Pi in the same repository workspace.
|
|
153
|
-
- **Enroll & run**: Enter `/imm-
|
|
154
|
+
- **Enroll & run**: Enter `/imm-run`. Pi discovers the staged `TaskIntent` and opens its native TUI modal confirmation for Enrollment.
|
|
154
155
|
- **Automated loop**:
|
|
155
156
|
- **Executor** writes implementation code strictly inside `scope_hint`.
|
|
156
157
|
- **Deterministic QA engine** directly runs acceptance commands against exit codes.
|
|
@@ -158,7 +159,114 @@ This enables a best-of-both-worlds workflow: **leverage Claude Code's deep reaso
|
|
|
158
159
|
- Upon pass, Kernel atomically settles terminal audit records in `.imm/audit/<task-id>/` and releases the workspace claim.
|
|
159
160
|
3. **Why Cross-Host Switching Works Seamlessly**
|
|
160
161
|
- **Session-neutral state**: All contracts and authority records live in the repository and local SQLite CAS, completely independent of any individual AI chat session.
|
|
161
|
-
- **Bidirectional resumption**: Interrupted tasks can be resumed at any point in either Pi or Claude Code with `/imm-
|
|
162
|
+
- **Bidirectional resumption**: Interrupted tasks can be resumed at any point in either Pi or Claude Code with `/imm-run`.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Core Philosophy: Turn "Judgment" into "Table Lookup", Harnessing Multi-Model Tiers with Determinism
|
|
167
|
+
|
|
168
|
+
Large language models—especially lightweight, cost-effective Fast Tier models—fail in real-world software engineering not because of syntax, but because of **semantic ambiguity, scope creep, and evasive verification**.
|
|
169
|
+
|
|
170
|
+
Immune-Brain's foundational thesis is: **Never ask weak models to make architectural design decisions; turn them into deterministic table-lookup executors. Enforce all critical gates, verification, and reviews via code-level invariants and flagship models.**
|
|
171
|
+
|
|
172
|
+
```text
|
|
173
|
+
┌────────────────────────────────────────────────────────────────────────────────────────┐
|
|
174
|
+
│ 1. Architecture Exploration (Brainstorm) & 2. Plan Authoring (Planner) │
|
|
175
|
+
│ Host: Claude Code | Model: Flagship Reasoning Model (Strong Tier) │
|
|
176
|
+
│ Role: Clarify constraints, distill "judgment" into line-pinned Living Specs & intents │
|
|
177
|
+
└───────────────────────────────────────────┬────────────────────────────────────────────┘
|
|
178
|
+
│ Git-Tracked Shared Artifacts (docs/specs, docs/plans)
|
|
179
|
+
▼
|
|
180
|
+
┌────────────────────────────────────────────────────────────────────────────────────────┐
|
|
181
|
+
│ 3. Implementation (Executor) │
|
|
182
|
+
│ Host: Pi | Model: High-Throughput / Cost-Effective Model (Fast / Mid Tier) │
|
|
183
|
+
│ Role: Follow the recipe inside a frozen Scope envelope, mirroring established patterns │
|
|
184
|
+
└───────────────────────────────────────────┬────────────────────────────────────────────┘
|
|
185
|
+
│ Local code changes & state delivery
|
|
186
|
+
▼
|
|
187
|
+
┌────────────────────────────────────────────────────────────────────────────────────────┐
|
|
188
|
+
│ 4. Deterministic QA (Verification) │
|
|
189
|
+
│ Host: Pi / Kernel Native │
|
|
190
|
+
│ Role: Zero-LLM involvement; natively runs Verification Descriptor v2 commands (Pass/Fail)│
|
|
191
|
+
└───────────────────────────────────────────┬────────────────────────────────────────────┘
|
|
192
|
+
│ Triggered only after live tests pass
|
|
193
|
+
▼
|
|
194
|
+
┌────────────────────────────────────────────────────────────────────────────────────────┐
|
|
195
|
+
│ 5. Isolated Code Review │
|
|
196
|
+
│ Host: Pi Subagent | Model: High-Intelligence Reviewer Model (Strong Tier) │
|
|
197
|
+
│ Role: Audits immutable Git blob ReviewBundles against Devil's Advocate red lines │
|
|
198
|
+
└────────────────────────────────────────────────────────────────────────────────────────┘
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### 1. Turn "Judgment" into "Table Lookup": Eliminate Ambiguity for Weak Models
|
|
202
|
+
|
|
203
|
+
The most effective constraint for cost-effective models is eliminating all room for ambiguity at the Spec stage:
|
|
204
|
+
|
|
205
|
+
- **Coordinate-Level Pinning**: Specs pin exact existing code patterns (e.g., `kernel.ts:1219`), instructing the model to *"mirror this exact shape"*.
|
|
206
|
+
- **Zero-Freedom Machine Contracts**: Error messages, status codes, and error exceptions must mirror existing conventions exactly (e.g., re-using `throw new VerificationDescriptorError(...)` with only command names swapped), leaving no leeway for ad-hoc abstraction.
|
|
207
|
+
- **Explicit Negative Scope (Exclusion List)**: The Scope section mandates clear negative boundaries (which directories must never be touched, which receipt paths cannot be re-used). Weak models need zero architecture guessing—they simply follow the recipe.
|
|
208
|
+
|
|
209
|
+
### 2. "Done" Is Executable, Not Prose Promises
|
|
210
|
+
|
|
211
|
+
Textual declarations ("I have implemented this and all tests pass") are the primary vector for hallucinations. Immune-Brain enforces execution by code:
|
|
212
|
+
|
|
213
|
+
- **Verification Descriptor v2 Machine Contracts**:
|
|
214
|
+
Every Acceptance Criterion (AC) in a `TaskIntent` is bound to a strict machine descriptor (`assurance_kernel/verification_descriptor/v2`):
|
|
215
|
+
```json
|
|
216
|
+
{
|
|
217
|
+
"contract": "assurance_kernel/verification_descriptor/v2",
|
|
218
|
+
"command": {
|
|
219
|
+
"executable": "bun",
|
|
220
|
+
"argv": ["test", "tests/kernel-migrate-to-vnext.test.ts"],
|
|
221
|
+
"cwd": ".",
|
|
222
|
+
"timeout_ms": 30000,
|
|
223
|
+
"max_output_bytes": 262144
|
|
224
|
+
},
|
|
225
|
+
"environment": { "prepare": null, "writable_paths": [] }
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
Kernel executes verification commands in sandboxed child processes, validating authentic exit codes, stdout, and execution timeouts.
|
|
229
|
+
- **Physical Scope Freezing**:
|
|
230
|
+
At Enrollment, Kernel captures baseline Git snapshots (`captureGitWorkspaceSnapshot`). If dirty files exist prior to enrollment, or if Executor touches files outside `scope_hint` (`assertNoEnvelopeEscape`), Kernel fails-closed and blocks execution.
|
|
231
|
+
- **Mandatory QA and Isolated Review Subagents**:
|
|
232
|
+
Local CLI verification runs deterministically. For `material` and `critical` tasks, isolated Reviewer subagents are code-enforced gates that prevent drift.
|
|
233
|
+
|
|
234
|
+
### 3. Devil's Advocate Audit: Closing the Shortcut Loopholes
|
|
235
|
+
|
|
236
|
+
Under optimization pressure, models naturally take paths of least resistance. Immune-Brain installs structural defenses:
|
|
237
|
+
|
|
238
|
+
- **Preventing Verification Vanity**:
|
|
239
|
+
Devil's Advocate audits explicitly rule that *"`--check` passing does not equal execution success"*. Dry runs or typechecks cannot substitute for test assertions.
|
|
240
|
+
- **Preventing Spec Dilution**:
|
|
241
|
+
Models are barred from silently pruning hard requirements or fabricating fake compatibility layers (e.g., *"never fabricate v1→v2 migration logic without authentic v1 test fixtures"*).
|
|
242
|
+
- **Deterministic Risk-Tier Floor**:
|
|
243
|
+
Models cannot weaken scrutiny by self-grading a task as `routine`. In `kernel/intent.ts`, the Kernel enforces a strict floor:
|
|
244
|
+
> Touching `kernel/`, `assurance/`, `claude/`, or `.pi-extension` automatically clamps the risk tier to at least `material`, regardless of author claims, physically forcing isolated subagent review.
|
|
245
|
+
- **Objective Refutation via Counterevidence**:
|
|
246
|
+
Subjective Reviewer hallucinations cannot hold up delivery. If a Reviewer claims an acceptance failure, but fresh deterministic QA evidence exists for the current `diff_hash` and `intent_hash`, Kernel marks the finding as `refuted` and allows settlement; once edits dirty the diff, the finding re-blocks automatically.
|
|
247
|
+
|
|
248
|
+
### 4. Token Economics and Cost Levers: Without Levers, Costs Compound
|
|
249
|
+
|
|
250
|
+
Without explicit cost levers, multi-agent workflows compound expenses exponentially:
|
|
251
|
+
|
|
252
|
+
- **Plan First, Implement Second ("Measure Twice, Cut Once")**:
|
|
253
|
+
A tight, line-pinned spec costs a fraction of the tokens wasted on wrong directions and circular debugging.
|
|
254
|
+
- **Scope Freezing Eliminates Token Sinks**:
|
|
255
|
+
Barring unprompted refactorings and whole-project restyling prevents explosive diff expansion and token burn.
|
|
256
|
+
- **Model Tier Pipeline (`subagent-model-tier-pipeline`)**:
|
|
257
|
+
- **Fast Tier** (e.g., Flash / 4o-mini): High-throughput, zero-decision mechanical implementation and focused test fixes.
|
|
258
|
+
- **Mid Tier**: Reliability reviews (`reliability-reviewer`) and standard code auditing.
|
|
259
|
+
- **Strong Tier** (e.g., Sonnet / Opus): Strategic planning, architecture formulation, and high-risk security audits (`security-reviewer`).
|
|
260
|
+
|
|
261
|
+
### 5. Multi-Tool & Multi-Model Workflow Pipeline
|
|
262
|
+
|
|
263
|
+
| Phase | Host / Tool | Recommended Tier | Responsibility & Guarantees |
|
|
264
|
+
|---|---|---|---|
|
|
265
|
+
| **1. Brainstorming** | Claude Code (`/imm-brainstorm`) | **Strong Tier** | Long-context dialogue, uncovering latent constraints and pruning pseudo-requirements. |
|
|
266
|
+
| **2. Planning** | Claude Code (`/imm-planner`) | **Strong Tier** | Line-pinned Living Specs, `VerificationDescriptor` bindings, and Devil's Advocate audits. |
|
|
267
|
+
| **3. Implementation** | Pi (`imm-run`) | **Fast / Mid Tier** | Native modal enrollment, mechanical coding within frozen scopes, adhering to YAGNI gates. |
|
|
268
|
+
| **4. Verification** | Local Process / Kernel Native | **Zero LLM (Native)** | Deterministic test execution (`bun test`), producing tamper-proof test attestations. |
|
|
269
|
+
| **5. Code Review** | Pi Subagent (`immune-brain-reviewer`) | **Strong Tier** | Adversarial review over immutable Git blob `ReviewBundle`s before final Kernel settlement. |
|
|
162
270
|
|
|
163
271
|
---
|
|
164
272
|
|
|
@@ -168,15 +276,15 @@ This enables a best-of-both-worlds workflow: **leverage Claude Code's deep reaso
|
|
|
168
276
|
|---|---|---|---|
|
|
169
277
|
| `imm-brainstorm` | Managed entry | Requirements are ambiguous | Frames the problem, surfaces open questions, no code edits |
|
|
170
278
|
| `imm-planner` | Managed entry | Goal is clear | Authors / revises `TaskIntent` and specs; does not enroll or build |
|
|
171
|
-
| `imm-
|
|
279
|
+
| `imm-run` | Managed coordinator | Plan is validated | Drives execution → QA → Review → completion via foreground tools |
|
|
172
280
|
| `imm-pr-fix` | Standalone | CI failed / review comments on a PR | Repairs one PR in place, no managed authority |
|
|
173
281
|
| `imm-doc-prune` | Standalone | Stale current docs | Deletes only the hash-approved manifest entries |
|
|
174
|
-
| `imm-
|
|
175
|
-
| `imm-
|
|
282
|
+
| `imm-doc-slim` | Standalone | Bloated agent instructions | Minimizes tracked AGENTS/CLAUDE/GEMINI.md to necessary context |
|
|
283
|
+
| `imm-retro` | Standalone | Compare models by review load | Ranks authors of reviewed code and reports project usage |
|
|
176
284
|
|
|
177
|
-
Internal roles (Executor, QA, Review, Compounder) are dispatched by `imm-
|
|
285
|
+
Internal roles (Executor, QA, Review, Compounder) are dispatched by `imm-run` — you never invoke them directly.
|
|
178
286
|
|
|
179
|
-
All 7 skills are invoked explicitly. For new features, start with `imm-brainstorm` (if requirements are uncertain) or `imm-planner` (if requirements are clear), then proceed to `imm-
|
|
287
|
+
All 7 skills are invoked explicitly. For new features, start with `imm-brainstorm` (if requirements are uncertain) or `imm-planner` (if requirements are clear), then proceed to `imm-run` once enrolled.
|
|
180
288
|
|
|
181
289
|
### Managed Path entries (brainstorm → planner → loop)
|
|
182
290
|
|
|
@@ -196,9 +304,9 @@ The three Managed skills form one continuous pipeline with a single authority mo
|
|
|
196
304
|
- **What it never does:** implements code, overwrites an enrolled TaskIntent without a revision flow, or grants execution authority — only the native Enrollment gate can.
|
|
197
305
|
- **Exit:** Git-tracked `TaskIntent` awaiting enrollment confirmation.
|
|
198
306
|
|
|
199
|
-
#### `imm-
|
|
307
|
+
#### `imm-run` — managed execution & assurance
|
|
200
308
|
|
|
201
|
-
- **Trigger:** explicit `/imm-
|
|
309
|
+
- **Trigger:** explicit `/imm-run` (start, resume, or check a managed task).
|
|
202
310
|
- **What it does:** drives one task end to end through foreground tools — Executor edits inside the frozen scope, deterministic QA executes every acceptance descriptor, an isolated Review subagent audits material/critical tasks, and the Kernel settles terminal evidence. Interrupted workflows resume from on-disk state; the Kernel projection is authoritative.
|
|
203
311
|
- **What it never does:** skips or weakens a failing check, runs without your Enrollment/revision/authorization gates, or continues after lineage or authority drift — it fails closed.
|
|
204
312
|
- **Finding evidence:** every Review finding carries machine-checkable provenance (`trigger`, `caller_chain`, `violated`). A claim that fresh passing QA evidence already contradicts is recorded as `refuted` and only blocks again if that evidence goes stale.
|
|
@@ -219,12 +327,12 @@ The three repair/maintenance skills are host-native: they never create a managed
|
|
|
219
327
|
- **Trigger:** explicit request to prune stale current documentation.
|
|
220
328
|
- **What it does:** audits documentation staleness read-only, then deletes only entries you approved in an exact hash-bound manifest, with immediate revalidation after each mutation.
|
|
221
329
|
|
|
222
|
-
#### `imm-
|
|
330
|
+
#### `imm-doc-slim` — agent instruction minimization
|
|
223
331
|
|
|
224
332
|
- **Trigger:** explicit request to minimize tracked `AGENTS.md` / `CLAUDE.md` / `GEMINI.md`.
|
|
225
333
|
- **What it does:** keeps only the necessary non-discoverable rules in agent instruction files, under the same read-only-audit + hash-bound-manifest-approval model as `imm-doc-prune`.
|
|
226
334
|
|
|
227
|
-
#### `imm-
|
|
335
|
+
#### `imm-retro` — review load and project usage
|
|
228
336
|
|
|
229
337
|
- **Trigger:** explicit request for a cross-model review retro or project usage look-back.
|
|
230
338
|
- **What it does:** ranks models by how much review their own edits triggered, plus sessions/turns/edits/tool mix, from pi session logs. Read-only. Not a diff review.
|
|
@@ -245,7 +353,7 @@ flowchart TD
|
|
|
245
353
|
EG -->|Confirm| KS[(".imm/state/kernel.sqlite<br/>Atomic TaskRecord<br/>Exclusive Workspace Claim")]
|
|
246
354
|
end
|
|
247
355
|
|
|
248
|
-
subgraph Loop ["3. Execution & Assurance Loop (imm-
|
|
356
|
+
subgraph Loop ["3. Execution & Assurance Loop (imm-run)"]
|
|
249
357
|
KS --> EX["Executor Role<br/>Edit code strictly inside scope_hint"]
|
|
250
358
|
EX --> FRZ["advance_assurance<br/>Artifacts frozen (active:frozen)"]
|
|
251
359
|
FRZ --> QA["Deterministic QA Engine<br/>Run acceptance verification commands<br/>Generate QA Attestation"]
|
|
@@ -268,25 +376,28 @@ flowchart TD
|
|
|
268
376
|
end
|
|
269
377
|
```
|
|
270
378
|
|
|
271
|
-
### Core
|
|
379
|
+
### Core Architecture & Deterministic Guarantees
|
|
272
380
|
|
|
273
381
|
1. **Two Paths**
|
|
274
382
|
- **Host-native Path**: Daily conversation, code inspections, and ad-hoc fixes stay 100% native with zero workflow overhead.
|
|
275
|
-
- **Managed Path**: Explicitly entered via `imm-brainstorm`, `imm-planner`, or `imm-
|
|
383
|
+
- **Managed Path**: Explicitly entered via `imm-brainstorm`, `imm-planner`, or `imm-run`, strictly governed by the Assurance Kernel.
|
|
276
384
|
|
|
277
385
|
2. **Authority & Contract**
|
|
278
|
-
- **TaskIntent (`.intent.json`)**: Machine-readable behavioral contract locking `scope_hint` (file boundaries), `risk` tier, and `acceptance` descriptors.
|
|
386
|
+
- **TaskIntent (`.intent.json`)**: Machine-readable behavioral contract locking `scope_hint` (file boundaries), `risk` tier, and deterministic `acceptance` descriptors (Verification Descriptor v2).
|
|
279
387
|
- **Native Gate (Enrollment)**: The single human-authority confirmation gate; Kernel atomically acquires exclusive workspace ownership (`.imm/state/kernel.sqlite` CAS) to prevent concurrency conflicts and scope drift.
|
|
388
|
+
- **Physical Git Baseline Snapshot**: Enrollment captures repository HEAD and dirty files (`enrollment-baseline.json`); any physical envelope escape (`assertNoEnvelopeEscape`) immediately halts execution.
|
|
280
389
|
|
|
281
|
-
3. **Deterministic Assurance**
|
|
282
|
-
- **QA-First**: The Kernel directly
|
|
283
|
-
- **Risk-Tiered Gates**: `routine` tasks complete upon QA pass; `material` and `critical` tasks require an isolated Review subagent to
|
|
390
|
+
3. **Deterministic Assurance & Immutable Evidence Trail**
|
|
391
|
+
- **QA-First & Real Process Execution**: The Kernel directly launches sandboxed child processes to run test commands and evaluates exit codes, stdout, and byte bounds; never relies on conversational claims.
|
|
392
|
+
- **Risk-Tiered Gates with Enforcement Floors**: `routine` tasks complete upon QA pass; `material` and `critical` tasks require an isolated Review subagent. Touching kernel or authority paths is forced to at least `material`.
|
|
393
|
+
- **Live Refutation**: Subjective Review findings can be refuted by fresh, passing QA evidence; any new edits invalidate counterevidence and re-block the finding.
|
|
394
|
+
- **Immutable Audit Trail**: Terminal task completion atomically writes signed `TaskRecord`s, Git blob `ReviewBundle`s, and QA Attestations to `.imm/audit/<task-id>/`, fully tracked in Git.
|
|
284
395
|
- **Unattended Batch**: Serial execution driven by GitHub Issues and bound by `plan_digest`, where each child independently completes its own Enrollment → QA → Review → Commit cycle.
|
|
285
396
|
|
|
286
397
|
Key invariants:
|
|
287
398
|
|
|
288
399
|
- **One active step at a time**, edits only inside that step's boundary.
|
|
289
|
-
- **Scope (`scope_hint`) is frozen at enrollment** — out-of-scope files are
|
|
400
|
+
- **Scope (`scope_hint`) is frozen at enrollment** — out-of-scope files are physically denied and intercepted.
|
|
290
401
|
- **Evidence before closure** — QA is the only authority that can close a step.
|
|
291
402
|
- **Findings carry evidence** — a refuted Review finding suppresses work only while the QA evidence bound to it stays fresh for the current revision, intent hash, and diff; when that evidence goes stale the finding blocks again, and nothing stored is rewritten by the invalidation.
|
|
292
403
|
- **Batches are opt-in and bounded** — an unattended batch exists only after you confirm the Host's `start_unattended_batch`; each child keeps its own enrollment, QA, review, and settlement.
|
|
@@ -298,7 +409,7 @@ Key invariants:
|
|
|
298
409
|
|
|
299
410
|
When an Initiative has several ready children, you can run them as one serial batch instead of task by task.
|
|
300
411
|
|
|
301
|
-
- **Entry is explicit:** the Host's privileged `start_unattended_batch` tool, taking the Initiative slug. Nothing batch-related exists until it is called — without it, `imm-
|
|
412
|
+
- **Entry is explicit:** the Host's privileged `start_unattended_batch` tool, taking the Initiative slug. Nothing batch-related exists until it is called — without it, `imm-run` behaves exactly like per-task enrollment and creates no batch state, branch, or authorization.
|
|
302
413
|
- **One confirmation, one digest:** the native gate (Pi TUI dialog or Claude MCP elicitation) shows the ordered child list and the shared plan digest; that single literal-user act is the whole Batch Authorization.
|
|
303
414
|
- **Per-child authority survives:** every child is still enrolled, frozen, QA'd, reviewed, and settled by the Kernel on its own `TaskRecord`. The batch is the scope of one authorization, never a new authority layer.
|
|
304
415
|
- **Closeout is automatic:** when a child reaches `done` in the foreground, the same call commits it and enrolls the next child, or marks the batch `completed`, with no new gate. A parked or stopped child is never committed for you, and a failed continuation is reported beside the result with `start_unattended_batch` as the retry. A fast-forward commit you add to the batch branch is adopted; any other HEAD movement still stops the run.
|
|
@@ -352,19 +463,25 @@ docs/specs/ # Living specs (updated in place)
|
|
|
352
463
|
|
|
353
464
|
## FAQ
|
|
354
465
|
|
|
355
|
-
**Do I need to learn all
|
|
466
|
+
**Do I need to learn all 7 skills?** No. Most of the time you only need `/imm-planner` (to plan and enroll a task) and `/imm-run` (to build and verify it). Use `imm-brainstorm` when requirements need clarifying first, and the maintenance skills (`imm-pr-fix`, etc.) only when specific repair needs arise. Ordinary chat and simple edits don't need any skills at all.
|
|
356
467
|
|
|
357
|
-
**What if I interrupt or close the session mid-task?** State is safely stored on disk (`.imm/` + TaskIntent). In Pi or Claude Code, simply re-enter `/imm-
|
|
468
|
+
**What if I interrupt or close the session mid-task?** State is safely stored on disk (`.imm/` + TaskIntent). In Pi or Claude Code, simply re-enter `/imm-run` to resume — the Kernel projection is authoritative.
|
|
358
469
|
|
|
359
470
|
**Why does enrollment show a confirmation dialog?** All risk levels (`routine`/`material`/`critical`) require explicit human confirmation before execution authority is granted. In Pi, this is a native TUI modal dialog; in Claude Code, it is a native MCP elicitation gate. It binds the staged digest so you see exactly what will be tracked.
|
|
360
471
|
|
|
361
|
-
**QA failed — what now?** QA returns `rework` or `replan_required`. `imm-
|
|
472
|
+
**QA failed — what now?** QA returns `rework` or `replan_required`. `imm-run` routes back to the executor or to `imm-planner` for scope changes. No manual reset needed.
|
|
362
473
|
|
|
363
474
|
**A review finding stopped blocking — why?** It was refuted: fresh deterministic QA evidence shows the acceptance it names passes. The refutation is bound to that exact evidence, so the finding blocks again the moment the evidence goes stale for the current revision, intent hash, or diff.
|
|
364
475
|
|
|
365
476
|
**Can it run a whole Initiative without me?** Only as far as you authorize. Confirm `start_unattended_batch` with the Initiative slug and the runner works through the published, non-`critical` children serially on one batch branch — parking as soon as a child needs a human decision or the run hits a budget, authorization, or commit failure. A parked run waits for you indefinitely: neither the confirmation dialog nor the authorization it grants times out. It never pushes, opens PRs, or settles user decisions for you.
|
|
366
477
|
|
|
367
|
-
**Can I switch between hosts (e.g. plan in Claude Code, code in Pi)?** Yes. Immune-Brain's contracts and state live entirely on disk in the repository, decoupled from conversation sessions. You can leverage Claude Code for deep architectural thinking and Spec planning, then switch to Pi to run `imm-
|
|
478
|
+
**Can I switch between hosts (e.g. plan in Claude Code, code in Pi)?** Yes. Immune-Brain's contracts and state live entirely on disk in the repository, decoupled from conversation sessions. You can leverage Claude Code for deep architectural thinking and Spec planning, then switch to Pi to run `imm-run` for code execution and deterministic QA. Interrupted tasks can be resumed in either host at any time.
|
|
479
|
+
|
|
480
|
+
**What if the task discovers the scope is insufficient mid-execution?** The Executor adheres strictly to a fail-closed YAGNI red-line and is physically barred from modifying out-of-scope files. When an expansion is truly required, the Executor aborts and yields a `replan_required` route; `imm-planner` then revises the Spec and `TaskIntent`, presenting a new native confirmation dialog before execution resumes.
|
|
481
|
+
|
|
482
|
+
**Where is the terminal Audit Trail stored and how is it verified?** Settled records are saved to `.imm/audit/<task-id>/` and tracked in Git. Each directory contains the immutable `TaskRecord`, the bound `diff_hash`, raw QA process exit-code attestations, and the Reviewer's signed verdict bundle.
|
|
483
|
+
|
|
484
|
+
**Why are preferences kept in AGENTS.md / CLAUDE.md instead of an external config.toml?** Immune-Brain embraces host-native simplicity with zero external configuration files. Declaring preferences (such as Initiative carriers and communication instructions) in tracked agent instruction files ensures that configuration is version-controlled, visible across all collaborators, and free from environment drift.
|
|
368
485
|
|
|
369
486
|
**Which AI coding assistants are supported?** Pi and Claude Code are the supported hosts (Claude Code version >= `2.1.236`). Both hosts run on the exact same Kernel authority, assurance guarantees, and multi-skill pipeline.
|
|
370
487
|
|
|
@@ -392,7 +509,7 @@ npm publish --access public # requires npm login / NPM_TOKEN
|
|
|
392
509
|
# or
|
|
393
510
|
bun run changeset:publish
|
|
394
511
|
```
|
|
395
|
-
The package publishes to npm as `immune-brain` (current release `
|
|
512
|
+
The package publishes to npm as `immune-brain` (current release `4.6.0`) with `publishConfig.access=public` already set. After the initial publish, all future releases go through changesets.
|
|
396
513
|
|
|
397
514
|
See `CHANGELOG.md` and `.changeset/config.json` (changelog: `@changesets/changelog-github`, repo: `dereknex/immune-brain`).
|
|
398
515
|
|