immune-brain 4.6.0 → 5.1.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 (75) hide show
  1. package/README.md +374 -46
  2. package/README.zh-CN.md +384 -47
  3. package/package.json +2 -1
  4. package/plugins/immune-brain/.claude-plugin/plugin.json +1 -1
  5. package/plugins/immune-brain/.pi-extension/imm-canary-enroll.ts +42 -44
  6. package/plugins/immune-brain/.pi-extension/imm-canary-work.ts +143 -474
  7. package/plugins/immune-brain/.pi-extension/imm-unattended-batch.ts +78 -87
  8. package/plugins/immune-brain/.pi-extension/pi-canary-assurance-progression.ts +7 -2
  9. package/plugins/immune-brain/.pi-extension/tsconfig.json +2 -2
  10. package/plugins/immune-brain/agents/immune-brain-advisory-reviewer.md +23 -0
  11. package/plugins/immune-brain/agents/immune-brain-qa.md +42 -0
  12. package/plugins/immune-brain/agents/immune-brain-reviewer.md +90 -1
  13. package/plugins/immune-brain/agents/immune-brain-ui-review.md +21 -0
  14. package/plugins/immune-brain/dist/BASELINE.md +4 -4
  15. package/plugins/immune-brain/dist/claude/mcp-server.mjs +8601 -6975
  16. package/plugins/immune-brain/dist/docs/reference/immune-brain-config.md +27 -0
  17. package/plugins/immune-brain/dist/docs/reference/planning-quality-gate.md +3 -3
  18. package/plugins/immune-brain/dist/docs/reference/subagent-dispatch-protocol.md +30 -1
  19. package/plugins/immune-brain/dist/imm-brainstorm.md +1 -1
  20. package/plugins/immune-brain/dist/imm-doc-prune.md +2 -2
  21. package/plugins/immune-brain/dist/{imm-agent-doc-maintain.md → imm-doc-slim.md} +9 -9
  22. package/plugins/immune-brain/dist/imm-planner.md +23 -8
  23. package/plugins/immune-brain/dist/imm-pr-fix.md +1 -1
  24. package/plugins/immune-brain/dist/{imm-review-retro.md → imm-retro.md} +26 -13
  25. package/plugins/immune-brain/dist/{imm-loop.md → imm-run.md} +231 -10
  26. package/plugins/immune-brain/dist/registry.yaml +9 -9
  27. package/plugins/immune-brain/dist/role-prompts/code-review.md +7 -0
  28. package/plugins/immune-brain/dist/role-prompts/executor.md +35 -2
  29. package/plugins/immune-brain/dist/role-prompts/lane-steward.md +44 -0
  30. package/plugins/immune-brain/runtime/assurance/coordinator.ts +83 -67
  31. package/plugins/immune-brain/runtime/assurance/host_port.ts +20 -0
  32. package/plugins/immune-brain/runtime/assurance/qa.ts +2 -2
  33. package/plugins/immune-brain/runtime/assurance/verdict_authority.ts +347 -0
  34. package/plugins/immune-brain/runtime/claude/interaction.ts +6 -0
  35. package/plugins/immune-brain/runtime/claude/kernel_ports.ts +78 -373
  36. package/plugins/immune-brain/runtime/claude/mcp_server.ts +26 -2
  37. package/plugins/immune-brain/runtime/claude/review_host.ts +48 -16
  38. package/plugins/immune-brain/runtime/claude/role_agents.ts +84 -0
  39. package/plugins/immune-brain/runtime/commands/kernel.ts +3 -6
  40. package/plugins/immune-brain/runtime/kernel/application.ts +6 -3
  41. package/plugins/immune-brain/runtime/kernel/assurance_projection.ts +15 -8
  42. package/plugins/immune-brain/runtime/kernel/canary_application.ts +5 -3
  43. package/plugins/immune-brain/runtime/kernel/enrollment.ts +149 -5
  44. package/plugins/immune-brain/runtime/kernel/index.ts +3 -1
  45. package/plugins/immune-brain/runtime/kernel/storage.ts +170 -11
  46. package/plugins/immune-brain/runtime/kernel/storage_paths.ts +13 -0
  47. package/plugins/immune-brain/runtime/local_initiative.ts +94 -0
  48. package/plugins/immune-brain/runtime/loop_contract.ts +77 -24
  49. package/plugins/immune-brain/runtime/plugin_version.ts +1 -1
  50. package/plugins/immune-brain/runtime/prompts/code-review.md +7 -0
  51. package/plugins/immune-brain/runtime/prompts/executor.md +35 -2
  52. package/plugins/immune-brain/runtime/prompts/lane-steward.md +44 -0
  53. package/plugins/immune-brain/runtime/role_prompt_bridge.ts +42 -2
  54. package/plugins/immune-brain/runtime/unattended/batch_git.ts +57 -27
  55. package/plugins/immune-brain/runtime/unattended/batch_integration.ts +387 -0
  56. package/plugins/immune-brain/runtime/unattended/batch_kernel_port.ts +106 -0
  57. package/plugins/immune-brain/runtime/unattended/batch_lanes.ts +909 -0
  58. package/plugins/immune-brain/runtime/unattended/batch_plan.ts +36 -11
  59. package/plugins/immune-brain/runtime/unattended/batch_preflight.ts +53 -36
  60. package/plugins/immune-brain/runtime/unattended/batch_reconfirmation.ts +34 -29
  61. package/plugins/immune-brain/runtime/unattended/batch_runner.ts +46 -91
  62. package/plugins/immune-brain/runtime/unattended/batch_schedule.ts +162 -0
  63. package/plugins/immune-brain/runtime/unattended/batch_state.ts +356 -8
  64. package/plugins/immune-brain/runtime/unattended/types.ts +21 -2
  65. package/plugins/immune-brain/runtime/workspace_scope.ts +34 -0
  66. package/plugins/immune-brain/skills/BASELINE.md +4 -4
  67. package/plugins/immune-brain/skills/imm-doc-prune/SKILL.md +1 -1
  68. package/plugins/immune-brain/skills/{imm-agent-doc-maintain → imm-doc-slim}/SKILL.md +9 -9
  69. package/plugins/immune-brain/skills/imm-planner/SKILL.md +4 -2
  70. package/plugins/immune-brain/skills/imm-pr-fix/SKILL.md +1 -1
  71. package/plugins/immune-brain/skills/{imm-review-retro → imm-retro}/SKILL.md +7 -7
  72. package/plugins/immune-brain/skills/{imm-review-retro → imm-retro}/scripts/review_retro.ts +46 -21
  73. package/plugins/immune-brain/skills/{imm-loop → imm-run}/SKILL.md +11 -7
  74. package/plugins/immune-brain/skills/registry.yaml +9 -9
  75. package/plugins/immune-brain/.pi-extension/runtime-stub.ts +0 -581
@@ -53,6 +53,33 @@ with a batch retry action and does not invalidate the authored planning files,
53
53
  but it blocks Enrollment and execution handoff for that Initiative until the same
54
54
  complete batch succeeds. It never silently switches carrier.
55
55
 
56
+ ## Lane Preferences
57
+
58
+ Four optional directives hold standing lane-mode choices. The Parent resolves
59
+ them before the first `start_unattended_batch` call for an Initiative; the batch
60
+ runner reads none of them. None has a built-in default.
61
+
62
+ ```md
63
+ ## Immune-Brain Preferences
64
+
65
+ - Lane max parallel: 4
66
+ - Lane Executor Host: claude-code
67
+ - Lane Executor model: <model id>
68
+ - Lane Executor effort: high
69
+ ```
70
+
71
+ - `Lane max parallel` is passed as `max_parallel` and turns lane mode on.
72
+ Without it a batch stays serial unless you ask for lanes in that request. A
73
+ resumed batch keeps the value it recorded.
74
+ - `Lane Executor Host` is `claude-code` or `pi`. Every Lane uses it, with no
75
+ fallback to the other Host. Without it the Parent prefers its own Host type.
76
+ - `Lane Executor model` and `Lane Executor effort` apply only when
77
+ `Lane Executor Host` is set, because a model ID belongs to one Host. Without
78
+ them each Executor Host uses its own default.
79
+
80
+ Lane-mode agents only create: they close no tab, stop no session and remove no
81
+ Lane. The full contract is `plugins/immune-brain/dist/imm-run.md#lane-preferences`.
82
+
56
83
  ## Other Preferences
57
84
 
58
85
  - Set reply-language preferences as ordinary `AGENTS.md` communication
@@ -16,16 +16,16 @@ Apply the gate when the task touches one or more of these surfaces:
16
16
 
17
17
  - **contract surface**: name the files, skills, runtime modules, generated outputs, or docs whose behavior is part of the promised result.
18
18
  - **compatibility**: state whether existing plans, state files, Pi runtime contracts, or users need migration or backwards-compatible behavior.
19
- - **interruption recovery**: describe what should remain true if execution stops midway and how the next `imm-loop` run should continue.
19
+ - **interruption recovery**: describe what should remain true if execution stops midway and how the next `imm-run` run should continue.
20
20
  - **rollback path**: name the smallest coherent set of files or state entries to revert if the step fails.
21
21
  - **verification strength**: prefer parser, contract-test, unit-test, or executable command evidence over simple file-existence checks.
22
22
  - **design-depth classification**: for a change with a Technical Design concern, record why it is Low, Medium, or High risk. Every new or revised Spec records `**Design risk**: Low|Medium|High` with an adjacent rationale. Medium/High risk requires a Technical Design baseline in the Spec; Low risk may remain concise only when it has no contract, ownership, security, persistence, compatibility, or multi-component concern.
23
23
  - **Technical Design baseline**: keep the Spec as the single design authority and make each Plan Step reference the applicable decision or invariant instead of duplicating design prose.
24
24
  - **design-view selection**: for Medium/High risk, select every materially relevant technical-design view from architecture layers, service/component interfaces, data flow, state transitions, and temporal sequence. Record selected views and why omitted views cannot affect the design. Low risk remains concise.
25
- - **TaskIntent decomposition**: use Technical Design boundaries as one retain/split criterion with outcome, Verification, dependency, risk, rollback, compatibility, and authority. Split a successor TaskIntent only when a service, state-machine owner, migration, independently promotable layer, or sequence dependency needs independent verification, rollback, authorization, or settlement. A TaskIntent should normally change one primary trust-boundary invariant, but traversing several boundaries or updating both sides of one authority chain does not itself require a split. Split independently verifiable, reversible, authorizable, migratable, or settleable trust invariants. Keep multiple trust-boundary changes together only for one atomic security outcome whose split would create an unsafe or unusable intermediate state, and record that rationale in the Spec. Treat this as Planner judgment rather than a schema field or Enrollment counting rule. Do not split merely because the design names several layers, files, or services, and do not revive prose Plan authority.
25
+ - **TaskIntent decomposition**: use Technical Design boundaries as one retain/split criterion with outcome, Verification, dependency, risk, rollback, compatibility, and authority. Split a successor TaskIntent only when a service, state-machine owner, migration, independently promotable layer, or sequence dependency needs independent verification, rollback, authorization, or settlement. A TaskIntent should normally change one primary trust-boundary invariant, but traversing several boundaries or updating both sides of one authority chain does not itself require a split. Split independently verifiable, reversible, authorizable, migratable, or settleable trust invariants. Keep multiple trust-boundary changes together only for one atomic security outcome whose split would create an unsafe or unusable intermediate state, and record that rationale in the Spec. Treat this as Planner judgment rather than a schema field or Enrollment counting rule. Do not split merely because the design names several layers, files, or services, and do not revive prose Plan authority. For a multi-TaskIntent Initiative only, require each Slice to state what is observable and verifiable when that Slice alone has landed, and no acceptance may require another unfinished Slice's work to pass; a Slice with no such statement is a horizontal layer slice and is re-cut. Record the exception for a wide mechanical refactor whose blast radius prevents any green vertical slice, with the rationale and a final integrate-and-verify Slice that the batches block.
26
26
  - **Mermaid intent**: use Mermaid only when it clarifies structure, sequence, data flow, or state transitions; it is not a universal gate or a second source of truth. Medium/High risk Specs record `**Diagram decision**: required|not_required` and a non-empty `**Diagram reason**:`. A `required` decision must include Mermaid; `not_required` explains why prose is sufficient. Low-risk Specs omit the empty ceremony and record neither field.
27
27
  - **Design Conformance**: before final closure, require Spec-to-implementation evidence. A local implementation mismatch routes to `rework`; a structural or intended design change routes to `replan` through Planner. QA cannot silently approve a design change.
28
- - **Brainstorm traceability**: ensure every `BR-*` item listed in `Brainstorm manifest` is mapped in `Brainstorm Trace`.
28
+ - **Brainstorm traceability**: ensure every `BR-*` item listed in `Brainstorm manifest` is mapped in `Brainstorm Trace`. Every Spec decision and every acceptance names exactly one source — an upstream `BR-*` ID, repository evidence, or a delegated technical choice — with or without an upstream manifest, and a user-owned decision that names no source is a defect the Planner removes or returns for clarification.
29
29
  - **roadmap information preservation**: for large or multi-phase work, distinguish the Roadmap from the current executable slice, preserve deferred phase goals, open questions, promotion criteria, and candidate next Plans.
30
30
  - **executable-slice discipline**: the Plan promises only the current executable slice — one coherent set of Steps sharing acceptance, review, rollback, and authority boundaries. Future-phase logic, speculative architecture, and unvalidated assumptions belong in the Roadmap or as explicitly Deferred items, never as active Steps. Do not enforce a fixed Step count: multiple Steps inside one shared boundary are fine, and a single Step that smuggles in unvalidated future architecture is still over-planning.
31
31
  - **Plan boundary cohesion**: treat Plan granularity separately from Step and Roadmap Phase granularity. Confirm the current Plan contains one coherent executable slice and explain why its outcome, authority, risk, verification, review, and rollback boundaries belong together. Promote an independent boundary into a sequential Plan instead of hiding it inside a large Step. One Phase may therefore span multiple Plans.
@@ -1,6 +1,35 @@
1
1
  # Pi Subagent Dispatch Protocol
2
2
 
3
- 本文档定义 Immune-Brain workflow role 在 Pi 中调度 advisory child 的唯一可执行协议。公共 `imm-brainstorm`、`imm-planner`、`imm-loop` 和 runtime 内部 roles 引用本协议,不内联另一套宿主分支。
3
+ 本文档定义 Immune-Brain workflow role 在 Pi 中调度 advisory child 的唯一可执行协议。公共 `imm-brainstorm`、`imm-planner`、`imm-run` 和 runtime 内部 roles 引用本协议,不内联另一套宿主分支。Claude Host 的 read-only role 派发见 [Claude Host Read-Only Agent Dispatch](#claude-host-read-only-agent-dispatch);Pi 的调度规则不因该节改变。
4
+
5
+ ## Claude Host Read-Only Agent Dispatch
6
+
7
+ On the Claude Host a read-only internal role is dispatched through the `Agent`
8
+ tool by its plugin agent type, not by prompt text alone:
9
+
10
+ | Internal role | Claude agent type | Tool allowlist |
11
+ |---|---|---|
12
+ | `qa` | `immune-brain:immune-brain-qa` | `Read, Grep, Glob` |
13
+ | `ui-review` | `immune-brain:immune-brain-ui-review` | `Read, Grep, Glob` |
14
+ | `advisory-reviewer` | `immune-brain:immune-brain-advisory-reviewer` | `Read, Grep, Glob` |
15
+ | `arch-explorer` | the Host's `Explore` agent | whatever the Host grants |
16
+
17
+ Each shipped definition is generated from the matching `runtime/prompts/` source
18
+ by the plugin build, so its body states the same role contract a Pi child
19
+ receives. The agent definition, not prompt text, bounds the role's tools: a
20
+ write, shell or dispatch tool absent from the allowlist is unavailable to the
21
+ child whatever its prompt asks for. `arch-explorer` ships no definition because
22
+ architecture exploration uses the Host's own read-only research agent, and a
23
+ second definition would fork a boundary the Host owns.
24
+
25
+ `code-review` is not in this table: the authoritative Review authority ships
26
+ `immune-brain:immune-brain-reviewer`, whose allowlist adds `Bash` because it must
27
+ run read-only Git commands against the immutable revision.
28
+
29
+ On Pi the agent configuration belongs to the Pi user, and the read-only boundary
30
+ remains prompt text plus the `tool_policy` the delegation packet declares; Pi's
31
+ `Agent` has no `readonly` parameter. The Pi invocation and scheduling rules below
32
+ are unchanged.
4
33
 
5
34
  ## Eligibility
6
35
 
@@ -158,7 +158,7 @@ Agreement becomes framing evidence. Disagreement becomes decision criteria or an
158
158
 
159
159
  - **Allowed**: Clarify framing, inspect read-only context, ask narrowing questions, perform inline gap analysis.
160
160
  - **Blocked**: Implementation edits, test changes, plan writes, and runtime state updates. Do not edit implementation files, tests, specs, plans, or `.imm/memory/`.
161
- - **Workflow guard**: implementation continuations must go through `imm-planner` or `imm-loop`. `imm-brainstorm` frames the problem; it is not the default post-framing stage once the task is already stable enough to route forward. The `adversarial` mode remains available as an opt-in high-pressure gate for high-risk scenarios but is not a default route target.
161
+ - **Workflow guard**: implementation continuations must go through `imm-planner` or `imm-run`. `imm-brainstorm` frames the problem; it is not the default post-framing stage once the task is already stable enough to route forward. The `adversarial` mode remains available as an opt-in high-pressure gate for high-risk scenarios but is not a default route target.
162
162
 
163
163
  ## Output artifact
164
164
 
@@ -9,14 +9,14 @@ Prune stale current documentation from one Git repository through explicit
9
9
  invocation, comprehensive inventory, evidence-based candidate narrowing,
10
10
  one exact user-approved manifest, and bounded current-only mutation. This is
11
11
  a standalone host-native maintenance entry, not a Managed Path continuation
12
- and not an `imm-loop` internal-role dispatch.
12
+ and not an `imm-run` internal-role dispatch.
13
13
 
14
14
  ## Authority Boundary
15
15
 
16
16
  This Skill prunes documentation
17
17
  without creating or mutating
18
18
  TaskIntent, TaskRecord, Kernel, Spec, or Plan authority. An already active
19
- Managed task remains owned by `imm-loop`. Read-only inventory and manifest
19
+ Managed task remains owned by `imm-run`. Read-only inventory and manifest
20
20
  production remain available. Classify each candidate overlapping the active
21
21
  TaskIntent `scope_hint` as `BLOCKED_ACTIVE_SCOPE` and continue auditing
22
22
  unaffected candidates. If the routing owner or scope cannot be read reliably,
@@ -1,20 +1,20 @@
1
1
  ---
2
- name: imm-agent-doc-maintain
2
+ name: imm-doc-slim
3
3
  description: Use when the user explicitly requests Immune-Brain minimization of tracked AGENTS.md, CLAUDE.md, or GEMINI.md.
4
4
  ---
5
5
 
6
- # Immune-Brain: Agent Doc Maintain
6
+ # Immune-Brain: Doc Slim
7
7
 
8
8
  Minimize tracked agent instruction files in one Git repository to the smallest
9
9
  set of persistent rules that are non-obvious, repeatable, stable, and costly to
10
10
  violate. This is a standalone host-native maintenance entry, not a Managed Path
11
- continuation and not an `imm-loop` internal-role dispatch.
11
+ continuation and not an `imm-run` internal-role dispatch.
12
12
 
13
13
  ## Authority Boundary
14
14
 
15
15
  This Skill maintains agent instruction files without creating or mutating
16
16
  TaskIntent, TaskRecord, Kernel, Spec, or Plan authority. An already active
17
- Managed task remains owned by `imm-loop`. Read-only inventory and manifest
17
+ Managed task remains owned by `imm-run`. Read-only inventory and manifest
18
18
  production remain available. Classify each candidate overlapping the active
19
19
  TaskIntent `scope_hint` as `BLOCKED_ACTIVE_SCOPE` and continue auditing
20
20
  unaffected candidates. If the routing owner or scope cannot be read reliably,
@@ -23,12 +23,12 @@ deletion of evidence-proven content remains that Skill's separate job.
23
23
 
24
24
  ## Invocation
25
25
 
26
- Requires explicit invocation: `imm-agent-doc-maintain` or
27
- `/imm-agent-doc-maintain`. Ordinary "is this AGENTS.md too long?" questions stay
26
+ Requires explicit invocation: `imm-doc-slim` or
27
+ `/imm-doc-slim`. Ordinary "is this AGENTS.md too long?" questions stay
28
28
  host-native and do not enter this Skill.
29
29
 
30
- - `imm-agent-doc-maintain audit`: read-only. Produce the manifest and stop.
31
- - `imm-agent-doc-maintain`: produce the manifest, then wait for exact manifest
30
+ - `imm-doc-slim audit`: read-only. Produce the manifest and stop.
31
+ - `imm-doc-slim`: produce the manifest, then wait for exact manifest
32
32
  approval before any mutation.
33
33
 
34
34
  No automatic invocation. No daemon, no telemetry, no automatic learning, no
@@ -52,7 +52,7 @@ commit.
52
52
 
53
53
  2. **Resolve Managed ownership.** Read the existing routing projection without
54
54
  creating authority. An already active Managed task remains owned by
55
- `imm-loop`. A candidate overlapping its `scope_hint` is
55
+ `imm-run`. A candidate overlapping its `scope_hint` is
56
56
  `BLOCKED_ACTIVE_SCOPE`; continue auditing unaffected candidates. If the
57
57
  routing owner or scope cannot be read reliably, fail closed for mutation.
58
58
 
@@ -12,7 +12,7 @@ This skill adheres to the **[BASELINE.md](BASELINE.md)**.
12
12
  `imm-planner` is entered explicitly by the user for a clear repository mutation.
13
13
  Ordinary host input does not invoke this Skill through natural-language routing.
14
14
  An active Assurance projection remains authoritative and is resumed only through
15
- an explicit `imm-loop` entry; explicit Planner entry owns planning and the later
15
+ an explicit `imm-run` entry; explicit Planner entry owns planning and the later
16
16
  native Enrollment gate.
17
17
 
18
18
  Plan-only output remains non-authoritative. Planner creates or validates a
@@ -91,7 +91,7 @@ resolved wrapper and use the resolved `imm-kernel` wrapper for every Kernel
91
91
  command below. Do not assume either bare command is available on shell `PATH`.
92
92
  Then route deterministically:
93
93
 
94
- - an active Kernel claim remains with `imm-loop` for foreground Kernel Tool
94
+ - an active Kernel claim remains with `imm-run` for foreground Kernel Tool
95
95
  coordination, except a Loop-requested revision follows Enrolled Intent Revision
96
96
  below to prepare a non-authoritative proposal for that same owner;
97
97
  - an active or otherwise nonterminal v3 Plan remains on its existing v3 route;
@@ -409,7 +409,7 @@ it, and structural Enrollment readiness is not proof that a descriptor executed.
409
409
  - **Design-Depth Classification**: Classify change design risk with the smallest sufficient tier: **Low risk** (copy, configuration, trivial rename, or contained local fix) may omit a separate Technical Design; **Medium risk** (non-trivial single-module behavior or internal contract) records affected components, decisions, invariants, failure behavior, and verification implications; **High risk** (cross-module/API/data-flow/state-machine, security, migration, concurrency, architecture ownership, cross-runtime/package-contract, or persisted-state work) records boundaries, interfaces or flow, alternatives, invariants, rollback/compatibility, and verification implications. Medium and High risk require Technical Design in the Spec. Do not classify a change as Low risk when it has a contract, ownership, security, persistence, compatibility, or multi-component concern. Every new or revised Spec records `**Design risk**: Low|Medium|High` with an adjacent rationale.
410
410
  - **Design-view selection**: For Medium and High risk, select every materially relevant technical-design view from architecture layers, service/component interfaces, data flow, state transitions, and temporal sequence. Record a short `Design views` statement naming the selected views and why any omitted view cannot affect the design. Do not write empty architecture, interface, data-flow, state, or sequence sections. Low risk remains concise and may omit Technical Design. When a selected view is recorded, also record its required decision content: architecture layers need layer responsibilities, dependency direction, ownership, and prohibited coupling; service/component interfaces need inputs, outputs, errors, compatibility/versioning, and caller/callee ownership; data flow needs source, transformations, validation, destination, and failure handling; state transitions need states, legal transitions, trigger, invariant, terminal ownership, and recovery; temporal sequence needs ordered interactions, authority at each point, interruption behavior, and idempotency.
411
411
  - **Technical Design Authority**: The Spec is the single Technical Design baseline. TaskIntent acceptance and scope reference the applicable design decisions or invariants without copying Technical Design prose. If discovery invalidates the baseline, stop execution and return to Planner to update the Spec and decide whether `replan` is required. TaskIntent and Initiative text do not duplicate Technical Design prose or become a prose Plan substitute.
412
- - **TaskIntent decomposition**: Use the selected design boundaries as one retain/split criterion for TaskIntent slices. Keep work in one TaskIntent when the selected views describe one coherent executable slice with shared acceptance, risk treatment, rollback, and authority. Split a successor TaskIntent when a service boundary, state-machine owner, migration/compatibility boundary, independently promotable layer, or sequence dependency needs independent verification, rollback, authorization, or settlement. Do not split merely because the design names several layers, files, or services. Treat trust-boundary changes as the same kind of decomposition evidence: a TaskIntent should normally change one primary trust-boundary invariant, while merely traversing several boundaries or updating both sides of one end-to-end authority chain does not require a split. Split separate trust invariants when they can be independently verified, rolled back, authorized, migrated, or settled. Keep multiple trust-boundary changes together only when they form one atomic security outcome and splitting would create an unsafe or unusable intermediate state; record that reason in the Spec. This is Planner judgment, not a TaskIntent schema field or an Enrollment counting rule. This does not revive prose Plan, Roadmap, or Phase authority.
412
+ - **TaskIntent decomposition**: Use the selected design boundaries as one retain/split criterion for TaskIntent slices. Keep work in one TaskIntent when the selected views describe one coherent executable slice with shared acceptance, risk treatment, rollback, and authority. Split a successor TaskIntent when a service boundary, state-machine owner, migration/compatibility boundary, independently promotable layer, or sequence dependency needs independent verification, rollback, authorization, or settlement. Do not split merely because the design names several layers, files, or services. Treat trust-boundary changes as the same kind of decomposition evidence: a TaskIntent should normally change one primary trust-boundary invariant, while merely traversing several boundaries or updating both sides of one end-to-end authority chain does not require a split. Split separate trust invariants when they can be independently verified, rolled back, authorized, migrated, or settled. Keep multiple trust-boundary changes together only when they form one atomic security outcome and splitting would create an unsafe or unusable intermediate state; record that reason in the Spec. This is Planner judgment, not a TaskIntent schema field or an Enrollment counting rule. This does not revive prose Plan, Roadmap, or Phase authority. For a multi-TaskIntent Initiative only, each Slice also states what is observable and verifiable when that Slice alone has landed, and no acceptance may require another unfinished Slice's work to pass; the Initiative review table's existing `result` column carries that statement. A Slice with no such result is a horizontal layer slice and is re-cut. Exception: a wide mechanical refactor whose blast radius prevents any green vertical slice may be batched, with the rationale recorded and the batches blocking one final integrate-and-verify Slice.
413
413
  - **Mermaid Use**: Mermaid is required only when a medium/high-risk design contains structure, sequence, data flow, or state transition relationships that a diagram materially clarifies. Mermaid is not a universal gate; a diagram supplements adjacent prose and never becomes a second design authority. Medium/High risk Specs record `**Diagram decision**: required|not_required` and a non-empty `**Diagram reason**:`. A `required` decision must have a Mermaid block; `not_required` explains why prose is sufficient. Low-risk Specs omit the empty ceremony and record neither field.
414
414
  - **Verification**: Every acceptance assertion has a concrete focused descriptor that can fail on the intended regression, and every named invariant has positive, negative, and bound controls at an observable seam. Hypothetical evidence is not execution-ready; a check that matches zero tests, is skipped, or lacks its prerequisite is a failure rather than a pass.
415
415
  - **Executable Scope**: `scope_hint` is the mutation envelope, not discovery context. Close references across callers, tests, generated mirrors, and state-machine owners before authoring. Simple tasks are TaskIntent-only. A complex task binds at most one active Spec by content identity; do not add archive paths for freeze, and do not relocate artifacts. Collect all known scope gaps in one revision request; ask again only when new evidence changes the boundary.
@@ -484,7 +484,7 @@ preparation does not apply the revision or authorize expanded execution.
484
484
 
485
485
  ## Planning Rules
486
486
 
487
- - **Entry Contract**: Use when Spec/TaskIntent planning is needed. An already enrolled owner remains on its current Kernel authority and resumes only through explicit `imm-loop`; a validated candidate still needs native Enrollment.
487
+ - **Entry Contract**: Use when Spec/TaskIntent planning is needed. An already enrolled owner remains on its current Kernel authority and resumes only through explicit `imm-run`; a validated candidate still needs native Enrollment.
488
488
  - **Output Language Gate**: Before writing or revising any Spec or Plan, read the project output language policy from `AGENTS.md`, `IMMUNE.md`, or Immune-Brain plugin config. Default Spec and Plan prose to English unless the current user request, project instructions, or host/user preference contains an explicit document-language instruction. A reply-language instruction does not change document language. Keep schema fields, CLI commands, file paths, code identifiers, enum values, JSON keys, and canonical terms such as `Step`, `Plan`, `Spec`, `Verification`, `Discovery cache`, and `Devil's Advocate Audit` literal.
489
489
  - **Clarification Supplement**: If an upstream `imm-brainstorm` manifest exists, verify that every `BR-Q-*` item is resolved and every confirmed framing decision is represented; must not repeat, reopen, or rewrite confirmed decisions. Ask only a focused omission, repository-conflict, or invalidated-assumption delta tied to concrete evidence. Resolve a local delta here; return to `imm-brainstorm` when it reopens multiple product branches or changes the overall goal or Scope. Finalization requires no unresolved supplement and no unconfirmed decision introduced by Planner.
490
490
  - **Planning Bootstrap**: When no upstream `imm-brainstorm` manifest exists, preserve Direct Planner entry by resolving repository facts and deriving ordinary technical choices. An already-clear request takes the zero-question fast path to a non-blocking correction summary. Discovery of an unresolved user-owned goal, user, scope, behavior, compatibility preference, risk acceptance, or success criterion returns to `imm-brainstorm`; Planner does not convert product uncertainty into a silent assumption or duplicate Brainstorm's interview.
@@ -502,7 +502,16 @@ preparation does not apply the revision or authorize expanded execution.
502
502
  explain how the selected seam catches the intended regression. This is a
503
503
  planning heuristic: it must not weaken acceptance-specific focused
504
504
  verification descriptors or add a mandatory user confirmation.
505
- - **Review Mapping**: In-scope rework stays with the enrolled TaskIntent and explicit `imm-loop` entry. Cross-scope findings become a Planner decision delta with concrete missing paths and verification evidence; do not create a successor prose Plan.
505
+ **Agreed seam recording.** Record, for each acceptance, the agreed seam: the
506
+ existing or new test file and the observable boundary it exercises. Complex
507
+ work records it in the Spec's verification and acceptance mapping; simple work
508
+ names it in the acceptance assertion. Because the seam is part of the
509
+ candidate, present it in the native Enrollment gate, and the Initiative review
510
+ table when one exists, without any added confirmation. Tests the Executor adds
511
+ exercise the agreed seams, and replacing a seam is an acceptance change and
512
+ follows Enrolled Intent Revision.
513
+ - **Review Mapping**: In-scope rework stays with the enrolled TaskIntent and explicit `imm-run` entry. Cross-scope findings become a Planner decision delta with concrete missing paths and verification evidence; do not create a successor prose Plan.
514
+ - **Decision Provenance**: Every Spec decision and every acceptance names exactly one source: an upstream `BR-*` ID, repository evidence with a concrete path, or a delegated technical choice as defined by Clarification supplement. The rule applies with or without an upstream Brainstorm manifest, and the source does not have to be a `BR-DEC` item: Direct Planner entry and delegated technical choices stay legitimate sources. A user-owned decision — goal, user, scope, observable behavior, compatibility preference, risk acceptance, or success criterion — that names no source is a defect the Planner removes or returns for clarification under the existing Clarification supplement routes. Simple TaskIntent-only work satisfies the rule when each acceptance traces to the request text and adds no table.
506
515
  - **Brainstorm Manifest Mapping**: Record every upstream `BR-*` item in a Spec `Brainstorm Trace` when the work is complex, otherwise on the TaskIntent, mapped to acceptance, a captured decision, or an explicit reason for deferral or exclusion. Resolve every `BR-Q-*` item before handoff. Do not silently narrow confirmed framing.
507
516
  - **Handoff Completeness Check**: Before reporting a candidate as handoff-ready, confirm every upstream item and required phase is mapped exactly once, that required phases are delivered rather than excused by a reason, and that no confirmed outcome was conserved as a smaller deliverable. Reject a narrowed deliverable as a completeness failure; ask again only for a new material delta, never to reconfirm an unchanged clear request or an already-confirmed decision.
508
517
  - **Session Lifecycle Ownership**: The user chooses the current or a new session. Tokens, compactions, tool counts, elapsed time, and review rounds never trigger automatic session creation or termination. Recovery uses TaskRecord and the fresh Kernel projection.
@@ -535,7 +544,12 @@ Use the invoking Host's read-only role-boundary route for bounded
535
544
  exactly. The Parent owns Spec/TaskIntent synthesis, Brainstorm traceability,
536
545
  acceptance, and scope; children return evidence only. On Pi the `arch-explorer` envelope
537
546
  uses `subagent_type: "Explore"`; invoke the returned envelope rather than
538
- constructing another Agent call. Do not invoke retired Planner runtime helpers
547
+ constructing another Agent call. On the Claude Host a read-only role is dispatched
548
+ through the `Agent` tool by its plugin agent type —
549
+ `immune-brain:immune-brain-advisory-reviewer` — and architecture exploration uses
550
+ the Host's own `Explore` agent; the agent definition, not prompt text, bounds
551
+ that role's tools. On Pi the agent configuration belongs to the Pi user and the
552
+ read-only boundary remains prompt text. Do not invoke retired Planner runtime helpers
539
553
  or write child-owned planning artifacts.
540
554
 
541
555
  An optional planner ensemble is advisory-only; the Parent owns the final Spec and TaskIntent.
@@ -551,7 +565,7 @@ optional advisory dispatch fails, continue inline and record the reason.
551
565
 
552
566
  - **Allowed**: Write a TaskIntent. Add a Spec only for complex work. Activate an absent routing policy under Kernel TaskIntent Routing. Initiative planning carriers and necessary domain vocabulary.
553
567
  - **Blocked**: Implementation edits, direct Kernel-store writes, enrolled intent overwrites, and QA/Review decisions.
554
- - **Workflow guard**: Execution continues through native Enrollment and explicit `imm-loop`. Planner owns design and decomposition, not execution authority.
568
+ - **Workflow guard**: Execution continues through native Enrollment and explicit `imm-run`. Planner owns design and decomposition, not execution authority.
555
569
 
556
570
  ## Output artifact
557
571
 
@@ -588,6 +602,7 @@ a State Ledger. Keep historical Plan validation strictly read-only.
588
602
  - A required check matches zero tests or is skipped and the run is reported as passing.
589
603
  - New work depends on a prose Plan validator, Step activation, or State Ledger.
590
604
  - A Brainstorm manifest lacks complete `BR-*` coverage on the Spec (complex) or TaskIntent (simple).
605
+ - A user-owned Spec decision or acceptance names no source, or names one nobody made.
591
606
  - The handoff completeness check passed while a required phase or upstream item is unmapped, or while the plan delivers only part of the confirmed outcome.
592
607
  - A Medium/High risk Spec lacks a `Devil's Advocate Audit` covering rollback resilience, verification vanity, and spec dilution detection.
593
608
  - New Spec prose ignores the document-language policy.
@@ -603,6 +618,6 @@ a State Ledger. Keep historical Plan validation strictly read-only.
603
618
  ## Next Action
604
619
 
605
620
  - Gate: Reference closure and clarification are complete; every upstream `BR-*` item is represented; no unresolved user decision remains; Planner-introduced decision deltas are confirmed; the candidate is Git-tracked and validates with `valid: true` and `enrollment_ready: true`; each acceptance has concrete focused verification. Plan-only requests stop here.
606
- - If gates pass: for Kernel-managed work, invoke the current Host's native Enrollment Tool directly without chat pre-confirmation. Its single literal-user gate binds the TaskIntent revision, content hash, and preparation digest, validates Enrollment preconditions without executing acceptance descriptors, and enrolls the task to continue through `imm-loop`.
621
+ - If gates pass: for Kernel-managed work, invoke the current Host's native Enrollment Tool directly without chat pre-confirmation. Its single literal-user gate binds the TaskIntent revision, content hash, and preparation digest, validates Enrollment preconditions without executing acceptance descriptors, and enrolls the task to continue through `imm-run`.
607
622
  - If the native gate fails: preserve candidate artifacts and report the stable reason plus exactly one same-Host recovery action. Do not suggest another Host, worktree, Direct Path, unmanaged implementation, or automatic retry.
608
623
  - If gates are not met: state which validation failures, unresolved verification paths, or material decision deltas remain; do not name a next skill.
@@ -9,7 +9,7 @@ description: Use when the user explicitly requests Immune-Brain repair of GitHub
9
9
 
10
10
  Repair blockers on one GitHub pull request without creating or mutating
11
11
  TaskIntent, TaskRecord, Kernel, Spec, or Plan authority. An already active
12
- Managed task remains owned by `imm-loop`; stop and direct the user there when
12
+ Managed task remains owned by `imm-run`; stop and direct the user there when
13
13
  the target PR is part of that task.
14
14
 
15
15
  ## Workflow
@@ -1,14 +1,14 @@
1
1
  ---
2
- name: imm-review-retro
2
+ name: imm-retro
3
3
  description: Use when the user explicitly requests Immune-Brain ranking of models by cross-model review load or a project usage retro.
4
4
  ---
5
5
 
6
- # Immune-Brain: Review Retro
6
+ # Immune-Brain: Retro
7
7
 
8
8
  Rank models by how much code review their own edits triggered, and report
9
9
  basic project usage over a look-back window the user supplies in days. This
10
10
  is a standalone host-native analysis entry, not a Managed Path continuation
11
- and not an `imm-loop` internal-role dispatch. It reviews no diff — a diff
11
+ and not an `imm-run` internal-role dispatch. It reviews no diff — a diff
12
12
  review is `code-review`.
13
13
 
14
14
  ## Boundary
@@ -20,12 +20,12 @@ Blocked: code, test, Spec, Plan, or `.imm/` edits; session-log writes;
20
20
  Kernel, TaskIntent, or TaskRecord mutation; Compounder or scheduled runs;
21
21
  `.imm/audit/` lifecycle statistics.
22
22
 
23
- An already active Managed task remains owned by `imm-loop`. This Skill does
23
+ An already active Managed task remains owned by `imm-run`. This Skill does
24
24
  not create or resume Managed authority.
25
25
 
26
26
  ## Invocation
27
27
 
28
- Requires explicit invocation: `imm-review-retro` or `/imm-review-retro`.
28
+ Requires explicit invocation: `imm-retro` or `/imm-retro`.
29
29
  Ordinary questions such as "which model is worse" stay host-native and do
30
30
  not enter this Skill.
31
31
 
@@ -42,23 +42,36 @@ No daemon, no cron, no CI, no automatic commit.
42
42
  These rules keep numbers comparable across runs. Read the analyzer header
43
43
  aloud in the report so the 口径 stays visible.
44
44
 
45
- - `review` = an `Agent` tool call with `subagent_type` equal to `Review`.
46
- - Attribution = the model behind the most recent `edit`, `write`, or
47
- `multiedit` in that session. If none, the row is `no-edit (review-only)`.
45
+ - `review` = an `Agent` tool call with `subagent_type` equal to `Review`,
46
+ compared case-insensitively.
47
+ - Attribution = the model behind the most recent `edit`, `write`,
48
+ `multiedit`, or `apply_patch` in that session. If none, the row is
49
+ `no-edit (review-only)`. Edits made through `bash` or `codemode` are not
50
+ attributed.
48
51
  - `uniq` counts distinct (session, description+prompt prefix) pairs. A wide
49
52
  gap versus `reviews` is the same review re-run on the same code.
50
53
  - `rev/100ed` is `100 * reviews / devEdits`. Rank on both absolute `reviews`
51
54
  and this intensity. A model can lead one axis and sit mid-pack on the
52
55
  other.
53
- - `avgSc` / `pass%` parse `[SCORE: …]` and `[VERDICT: …]` tags from the
54
- matching Review `toolResult`. Untagged reviews show `-`.
56
+ - `avgSc` parses the `[SCORE: …]` tag from the matching Review `toolResult`.
57
+ The `assurance_verdict` contract carries no score, so untagged reviews show
58
+ `-` and are left out of the average.
59
+ - `pass%` is PASS over judged reviews. A review is judged by the `decision`
60
+ of the `assurance_kernel/assurance_verdict` contract in its `toolResult`
61
+ (`pass` counts as PASS); without a contract, by the `[VERDICT: …]` tag. A
62
+ review with neither is unjudged and left out of the denominator.
63
+ - The quality table (`PASS` / `REVISE` / `REJECT` / `highRisk`) covers tagged
64
+ reviews only, so its `PASS` count can differ from `pass%`.
55
65
  - `registr` counts the Kernel `submit_review` registration in the session log.
56
66
  It is the registration of the same review and is never added into `reviews`.
57
67
  - `rounds/task` is registrations per distinct `(cwd, task_id)`. High values
58
68
  can be canary/QA harness re-registration, not human-visible rework.
59
- - Findings are `record_finding` calls, deduped per session. Summaries that
60
- match `recorded cleanly`, `receipt recorded`, `round recorded`, or
61
- `no finding(s)` are `bookkeep` / `noisy`, excluded from `block`/`advis`.
69
+ - Findings are the `verdict.findings` entries of `submit_review` calls plus
70
+ legacy `record_finding` calls, deduped per session by summary, so a finding
71
+ re-submitted across rounds counts once. The Review `toolResult` copy of the
72
+ same verdict is not counted. Summaries that match `recorded cleanly`,
73
+ `receipt recorded`, `round recorded`, or `no finding(s)` are `bookkeep` /
74
+ `noisy`, excluded from `block`/`advis`.
62
75
 
63
76
  Usage counters on the same pass: sessions with activity, assistant turns,
64
77
  edit counts, a tool-call name histogram, and the project × author table.