immune-brain 3.6.5 → 3.6.7

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 (49) hide show
  1. package/README.md +69 -3
  2. package/README.zh-CN.md +23 -3
  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-work.ts +60 -21
  6. package/plugins/immune-brain/.pi-extension/imm-unattended-batch.ts +932 -0
  7. package/plugins/immune-brain/.pi-extension/pi-canary-interaction.ts +38 -10
  8. package/plugins/immune-brain/.pi-extension/runtime-stub.ts +200 -2
  9. package/plugins/immune-brain/dist/BASELINE.md +48 -15
  10. package/plugins/immune-brain/dist/claude/mcp-server.mjs +3415 -228
  11. package/plugins/immune-brain/dist/docs/reference/planning-quality-gate.md +1 -1
  12. package/plugins/immune-brain/dist/docs/reference/subagent-dispatch-protocol.md +1 -1
  13. package/plugins/immune-brain/dist/imm-agent-doc-maintain.md +9 -1
  14. package/plugins/immune-brain/dist/imm-brainstorm.md +49 -35
  15. package/plugins/immune-brain/dist/imm-doc-prune.md +7 -1
  16. package/plugins/immune-brain/dist/imm-loop.md +45 -11
  17. package/plugins/immune-brain/dist/imm-planner.md +65 -28
  18. package/plugins/immune-brain/dist/imm-pr-fix.md +6 -2
  19. package/plugins/immune-brain/dist/role-prompts/code-review.md +9 -1
  20. package/plugins/immune-brain/dist/role-prompts/executor.md +18 -10
  21. package/plugins/immune-brain/dist/role-prompts/pr-fix.md +5 -2
  22. package/plugins/immune-brain/runtime/assurance/coordinator.ts +101 -3
  23. package/plugins/immune-brain/runtime/assurance/verification.ts +13 -2
  24. package/plugins/immune-brain/runtime/claude/interaction.ts +16 -3
  25. package/plugins/immune-brain/runtime/claude/kernel_ports.ts +840 -17
  26. package/plugins/immune-brain/runtime/claude/mcp_server.ts +72 -10
  27. package/plugins/immune-brain/runtime/github_issue_tracker.ts +1018 -17
  28. package/plugins/immune-brain/runtime/kernel/canary_application.ts +16 -1
  29. package/plugins/immune-brain/runtime/kernel/completion.ts +19 -1
  30. package/plugins/immune-brain/runtime/kernel/reducer.ts +165 -12
  31. package/plugins/immune-brain/runtime/kernel/refutation.ts +82 -0
  32. package/plugins/immune-brain/runtime/kernel/types.ts +34 -1
  33. package/plugins/immune-brain/runtime/kernel/validation.ts +202 -9
  34. package/plugins/immune-brain/runtime/plugin_version.ts +1 -1
  35. package/plugins/immune-brain/runtime/prompts/code-review.md +9 -1
  36. package/plugins/immune-brain/runtime/prompts/executor.md +18 -10
  37. package/plugins/immune-brain/runtime/prompts/pr-fix.md +5 -2
  38. package/plugins/immune-brain/runtime/unattended/batch_git.ts +775 -0
  39. package/plugins/immune-brain/runtime/unattended/batch_plan.ts +203 -0
  40. package/plugins/immune-brain/runtime/unattended/batch_runner.ts +1224 -0
  41. package/plugins/immune-brain/runtime/unattended/batch_state.ts +360 -0
  42. package/plugins/immune-brain/runtime/unattended/types.ts +60 -0
  43. package/plugins/immune-brain/skills/BASELINE.md +48 -15
  44. package/plugins/immune-brain/skills/imm-agent-doc-maintain/SKILL.md +20 -4
  45. package/plugins/immune-brain/skills/imm-brainstorm/SKILL.md +24 -64
  46. package/plugins/immune-brain/skills/imm-doc-prune/SKILL.md +18 -3
  47. package/plugins/immune-brain/skills/imm-loop/SKILL.md +21 -6
  48. package/plugins/immune-brain/skills/imm-planner/SKILL.md +35 -8
  49. package/plugins/immune-brain/skills/imm-pr-fix/SKILL.md +17 -3
@@ -23,7 +23,7 @@ Apply the gate when the task touches one or more of these surfaces:
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
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.
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. Every new or revised Spec records `**Diagram decision**: required|not_required` and a non-empty `**Diagram reason**:`. A `required` decision must include Mermaid; `not_required` explains why prose is sufficient.
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
28
  - **Brainstorm traceability**: ensure every `BR-*` item listed in `Brainstorm manifest` is mapped in `Brainstorm Trace`.
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.
@@ -104,7 +104,7 @@ Parent workflow role 必须:
104
104
  4. 把 partial/error 标记为 `degraded`。
105
105
  5. 保留自身 baseline review,不把最终判断权交给 child。
106
106
 
107
- 普通 advisory/discovery 的每次启动都消耗一个 candidate budget slot;失败、取消、timeout 或 result_untrusted 均丢弃该输出且不得自动重试。Parent 仅在剩余候选仍独立有用且 evidence budget 仍需要时继续,否则转 solo/fail-closed fallback,并记录 `dispatch_failed` 或 `child_timeout`。该规则不改变 Kernel authority Review 的显式恢复协议。Child 永远不获得实现、Plan write、workflow mutation 或 QA closure authority。
107
+ 普通 advisory/discovery 的每次启动都消耗一个 candidate budget slot;失败、取消、timeout 或 result_untrusted 均丢弃该输出且不得自动重试。Parent 仅在剩余候选仍独立有用且 evidence budget 仍需要时继续,否则转 solo/fail-closed fallback,并记录 `dispatch_failed` 或 `child_timeout`。Read-only eligibility 与 Pi 的 one-foreground-child 调度限制是两回事:只读调查可同时存在多个待派发候选,但实际执行仍逐个 foreground child 串行消费,不得把多个 foreground Agent 假定为并发 batch。该规则不改变 Kernel authority Review 的显式恢复协议。Child 永远不获得实现、Plan write、workflow mutation 或 QA closure authority。
108
108
 
109
109
  If Kernel Review dispatch fails, the Parent does not call `submit_review`; the existing Review reservation and immutable evidence remain available for a later foreground retry. A malformed verdict may be corrected and resubmitted. A stale snapshot, explicit release, successful settlement, or session shutdown removes the reservation and evidence. There is no retry counter, dispatch receipt state machine, or provider-specific recovery path.
110
110
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: imm-agent-doc-maintain
3
- description: Use to minimize tracked AGENTS.md, CLAUDE.md, and GEMINI.md files to necessary non-discoverable context after an explicit, hash-bound, user-approved manifest; never installs or validates project contracts.
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
6
  # Immune-Brain: Agent Doc Maintain
@@ -37,6 +37,8 @@ commit.
37
37
 
38
38
  ## Ordered Maintenance Protocol
39
39
 
40
+ ### Inventory and Manifest
41
+
40
42
  1. **Establish repository safety.** Mutation requires a Git worktree. Only
41
43
  tracked regular files named exactly `AGENTS.md`, `CLAUDE.md`, or `GEMINI.md`,
42
44
  at the repository root or in nested tracked directories, are candidates.
@@ -100,6 +102,8 @@ commit.
100
102
  repository scope or declared precedence are `BLOCKED`. Filename convention,
101
103
  nesting, or guessed host behavior alone may not resolve a conflict.
102
104
 
105
+ ### Manifest Approval and Recovery
106
+
103
107
  7. **Produce one exact manifest.** `audit` mode stops after the manifest.
104
108
  Mutation mode also stops until the literal user approves exact manifest
105
109
  entries (for example, "all recommendations except 4 and 7"). Broad approval
@@ -107,6 +111,8 @@ commit.
107
111
  no manifest is persisted. No fixed line, byte, percentage, or Token target
108
112
  authorizes removal.
109
113
 
114
+ ### Approved Mutation
115
+
110
116
  8. **Revalidate and mutate minimally.** Re-read candidate bytes, Git status,
111
117
  content hash, references, precedence evidence, and active scope immediately
112
118
  before each approved change. Drift blocks that item. Never execute commands
@@ -116,6 +122,8 @@ commit.
116
122
  basics, and explicit user requirements are never simplified away for
117
123
  brevity.
118
124
 
125
+ ### Verify and Report
126
+
119
127
  9. **Verify and report.** Re-scan modified instruction relationships, local
120
128
  pointer targets, duplicate retained meanings, unresolved conflicts,
121
129
  source/package public-surface parity, existing focused documentation
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: imm-brainstorm
3
- description: Use when clarifying scope.
3
+ description: Use when the user explicitly requests Immune-Brain requirement clarification.
4
4
  ---
5
5
 
6
6
  # Immune-Brain: Brainstormer
@@ -17,46 +17,47 @@ This skill adheres to the **[BASELINE.md](BASELINE.md)**.
17
17
 
18
18
  ## Invocation modes
19
19
 
20
- `imm-brainstorm` is the canonical exhaustive clarification owner. Its modes share
21
- one interaction protocol:
20
+ `imm-brainstorm` owns proportionate clarification. Its modes share decision
21
+ provenance and authority constraints:
22
22
 
23
- - `default`: traverse the full sourced design tree.
23
+ - `default`: resolve facts and delegated choices; ask only material unresolved decisions.
24
24
  - `roundtable`: add bounded multi-role perspectives, visible agreement and
25
25
  disagreement, and decision criteria.
26
26
  - `adversarial`: add high-pressure security, migration, rollback, verification,
27
27
  audit, and cross-boundary analysis.
28
28
 
29
- All modes produce the same `brainstorm_framing` shape and use the same
30
- exhaustive frontier protocol. `roundtable` and `adversarial` are analysis lenses
29
+ All modes produce the same `brainstorm_framing` shape. `roundtable` and `adversarial` are analysis lenses
31
30
  only when explicitly selected by the user; model task-type or risk
32
- classification never selects them. Failure, edge, rollback, compatibility,
33
- migration, and risk branches remain part of `default` traversal.
31
+ classification never selects them. Exhaustive interviewing requires an explicit
32
+ request for thorough interrogation; selecting a lens alone does not require it.
34
33
 
35
- ## Default exhaustive decision tree
34
+ ## Default clarification
36
35
 
37
- Exhaustive means every sourced current-goal branch, not a fixed question count.
38
36
  Every branch must trace to the current user request, repository evidence, or a
39
- settled parent decision. Seed the fixed framing roots: goal, beneficiary and
40
- scenario, current state, desired behavior, scope and non-goals, constraints,
41
- failure and edge behavior, compatibility and migration, success and
42
- Verification, and deferred items. Expand them dynamically after every answer.
43
- Do not use materiality, task type, or risk classification to decide whether a
44
- sourced user decision is worth asking.
45
-
46
- Classify each unresolved node only as a repository fact or a user-owned decision.
47
- Resolve facts with bounded, on-demand read-only evidence. If evidence is
48
- unavailable, record a blocked fact and block only its dependent subtree; never
49
- turn the fact into a user preference. Place every sourced user decision on the
50
- current frontier.
37
+ settled parent decision. For a clear request, use a zero-question fast path when
38
+ no material decision or required fact remains unresolved. Do not seed or expand
39
+ a complete tree by default. Failure, compatibility, rollback, and risk questions
40
+ are relevant when evidence shows they can change the current outcome.
41
+
42
+ Classify each unresolved node as a repository fact, a delegated technical
43
+ choice, or a material user-owned decision. Resolve repository facts with
44
+ bounded, on-demand read-only evidence. If evidence is unavailable, record a
45
+ blocked fact and block only its dependent subtree; never turn the fact into a
46
+ user preference. A delegated technical choice is verifiable through existing
47
+ conventions, a reversible local probe, or an existing recorded decision when it
48
+ does not change the goal, scope, observable behavior, compatibility, risk
49
+ acceptance, or a protected effect; resolve it with evidence and record the
50
+ chosen assumption instead of asking. When a technical choice does change one of
51
+ those, it is material and belongs on the user frontier. Place every material
52
+ user-owned decision on the current frontier.
51
53
 
52
54
  Ask every independent question on the complete currently unblocked frontier
53
55
  together. Hold downstream questions until their prerequisites are decided.
54
56
  Number every question, include grounded options and one recommended answer with
55
57
  a short reason, and accept bulk approval of all recommendations with explicit
56
- exceptions. Direct requirements and adopted recommendations settle only the
57
- current nodes; they never complete the Brainstorm session by themselves.
58
- Recompute the tree after every response and continue through newly unlocked
59
- downstream branches.
58
+ exceptions. Direct requirements and adopted recommendations settle their
59
+ decisions without another approval round. After an answer, ask again only for
60
+ a newly evidenced material decision, not to manufacture further rounds.
60
61
 
61
62
  Minimally clarify an ambiguous answer while independent branches continue. If a
62
63
  later answer or new fact invalidates an earlier choice, reopen only that decision
@@ -64,13 +65,13 @@ delta and explain the new evidence. An explicit defer stops its subtree and is
64
65
  recorded as `BR-DEFER-*`; if the subtree still changes the current Result,
65
66
  interface, or compatibility, explain why it cannot be deferred.
66
67
 
67
- Brainstorm finishes only when the frontier is empty and no blocked fact prevents
68
- traversal. A zero-question fast path is valid only when the complete seeded and
69
- dynamically expanded tree contains no unresolved user decision. If the user
68
+ Brainstorm finishes when the material decision frontier is empty and no blocked
69
+ fact prevents the current handoff. Independent framing may continue while a
70
+ dependent subtree is blocked. If the user
70
71
  stops early, record every open node as `BR-Q-*` and do not mark the framing
71
72
  planning-ready.
72
73
 
73
- When traversal completes, present a concise result-only summary as a
74
+ When clarification completes, present a concise result-only summary as a
74
75
  non-blocking correction window. Do not ask the user to reconfirm decisions
75
76
  reflected without change. If the summary introduces or changes a
76
77
  decision, ask for explicit confirmation of only that decision delta
@@ -79,16 +80,29 @@ confirms a proposed direction or scope. Persist only final decisions: map them
79
80
  to `BR-REQ-*`, `BR-DEC-*`, `BR-OUT-*`, `BR-DEFER-*`, and resolved `BR-Q-*`
80
81
  manifest entries; do not copy the question transcript into repository artifacts.
81
82
 
83
+ ## Explicit exhaustive interrogation
84
+
85
+ Read this section only when the user explicitly requests thorough or exhaustive
86
+ interrogation. Exhaustive means every sourced current-goal branch, not a fixed
87
+ question count. Seed the fixed framing roots: goal, beneficiary and scenario,
88
+ current state, desired behavior, scope and non-goals, constraints, failure and
89
+ edge behavior, compatibility and migration, success and Verification, and
90
+ deferred items. Recompute the tree after every response and traverse newly
91
+ unlocked downstream branches. Adoption closes current nodes, not unexplored
92
+ branches. Resolve facts and delegated choices locally; ask material user-owned
93
+ decisions. Stop when the sourced tree is traversed and its material frontier is
94
+ empty, or report remaining blocked/open nodes if the user stops early.
95
+
82
96
  ## Workflow Rules
83
97
 
84
- - **Trigger Shape**: Use when product framing is still needed. Direct Planner entry remains available for a clear request, but once the user invokes Brainstorm, do not short-circuit its exhaustive traversal because an initial frame appears clear. Do not add a second confirmation for an unchanged final summary.
85
- - **Decision Provenance**: Traverse every sourced current-goal branch. A concrete scenario is a branch when the request, repository, or a settled parent decision makes it relevant; do not invent speculative future needs.
98
+ - **Trigger Shape**: Explicit Brainstorm entry permits proportionate clarification, including a zero-question handoff for a clear request. Read the exhaustive protocol only on an explicit request for thorough interrogation. Do not add a second confirmation for an unchanged final summary.
99
+ - **Decision Provenance**: Investigate evidenced current-goal uncertainty. A concrete scenario is relevant when the request, repository, or a settled parent decision makes it material; do not invent speculative future needs.
86
100
  - **Dependency-Aware Rounds**: Ask every independent question on the complete currently unblocked frontier together. Ask fewer questions only because dependencies keep downstream branches blocked, never because of an arbitrary question budget.
87
101
  - **Read-only by default**: Inspect context and summarize the problem. do not implement inside this skill.
88
102
  - **Handoff**: Write concise design notes under `docs/brainstorms/` only if explicitly requested.
89
103
  - **Handoff Manifest**: When framing is stable, user-confirmed, and routes to planner, include a compact `Brainstorm manifest` with stable IDs for every planner-relevant item: `BR-REQ-*` for confirmed requirements, `BR-DEC-*` for confirmed decisions, `BR-OUT-*` for non-goals, `BR-DEFER-*` for explicitly deferred items, and `BR-Q-*` for open questions. The manifest is the closed-world handoff; the planner must account for every ID instead of relying on prose memory.
90
- - **Default Next Route**: Route to `imm-planner` only when the full frontier is empty, no blocked fact prevents traversal, and every sourced user decision is settled by a direct requirement, explicit answer, or adopted recommendation. Those inputs close their nodes but never the session. An unchanged final summary is a correction window, not another gate. If Brainstorm introduces a new decision, ask for that delta and do not name `imm-planner` as the current next skill.
91
- - **Subagents**: Follow the Adaptive Cache-First Route in `docs/reference/subagent-dispatch-protocol.md`: classify the task, check cache-first discovery pointers, and carry subagent split pressure forward only when the Cost-Based Subagent Gate says parallel research is worth the coordination cost. User explicitly wants solo fallback when split is impossible.
104
+ - **Default Next Route**: Route to `imm-planner` when the material frontier is empty, no required fact blocks the handoff, and every material user decision is settled by a direct requirement, explicit answer, or adopted recommendation. An unchanged final summary is a correction window, not another gate. If Brainstorm introduces a new decision, ask for that delta and do not name `imm-planner` as the current next skill.
105
+ - **Subagents**: Only when optional research is needed, read Research Dispatch and its shared dispatch reference. Default to inline evidence gathering; do not load dispatch instructions merely because Brainstorm was invoked.
92
106
  - **Rejected Decision Evidence**: Use on-demand rejected-decision evidence instead of a global preflight. When a live branch resembles a rejected decision, resolve its recorded reason and optional `reconsider_if` conditions through code/docs inspection before asking the user. Treat each `reconsider_if` list item as an independently sufficient trigger (OR semantics): if available evidence satisfies none, keep the rejection as a current constraint or non-goal without re-litigation; if evidence satisfies one, reopen the decision and cite the condition plus changed evidence; if a condition cannot be resolved, ask only for that concrete missing fact. When `reconsider_if` is absent, preserve the backwards-compatible "what has changed?" fallback after inspection. When `rejection_reason` is absent, inspect an explicit rejection-reason section in the body; if no reason exists, report the metadata gap without inventing a reason or reconsideration condition.
93
107
  - **CONTEXT.md Awareness**: When the user uses vague or conflicting domain terms, check `CONTEXT.md` at the repo root. If a canonical term exists, surface the conflict: "CONTEXT.md defines X as Y, but you seem to mean Z — which is it?" If CONTEXT.md does not exist, note the gap and recommend the planner create it during planning. Use CONTEXT.md vocabulary in the output artifact when available.
94
108
  - **Discovery Protocol**: Before broad searching, read `CONTEXT.md` `## Architecture Map` and the active `.imm/memory/current_iteration.json` step `discovery_cache` when present. Use matching `docs/solutions/` `key_files` frontmatter as the pattern layer. If these pointers are missing or stale, note the discovery gap in the framing instead of compensating with unbounded search.
@@ -135,6 +149,6 @@ Default user-facing shape: `Conclusion -> Scope -> Next Action`. For the normal
135
149
 
136
150
  ## Next Action
137
151
 
138
- - Gate: The exhaustive frontier is empty; no blocked fact prevents traversal; every sourced user decision is settled by a direct requirement, explicit answer, or adopted recommendation; and the result-only summary introduces no unconfirmed decision delta. **If any requested clarification remains unanswered, you MUST NOT proceed to planning or suggest the next skill.** **If a decision delta is still unconfirmed, you MUST NOT proceed to planning, must not name a next skill, and should ask the user to confirm only that delta.**
152
+ - Gate: The material frontier is empty; no required fact blocks the handoff; every material user decision is settled by a direct requirement, explicit answer, or adopted recommendation; and the result-only summary introduces no unconfirmed decision delta. **If any required clarification remains unanswered, you MUST NOT proceed to planning or suggest the next skill.** **If a decision delta is still unconfirmed, you MUST NOT proceed to planning, must not name a next skill, and should ask the user to confirm only that delta.**
139
153
  - If gates pass: suggest `imm-planner` with a one-line reason.
140
154
  - If gates are not met: state which questions or decision deltas remain open; do not name a next skill and wait for the user's answer.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: imm-doc-prune
3
- description: Use to prune stale current documentation from a Git repository after an explicit, hash-bound, user-approved manifest; never deletes Managed authority artifacts.
3
+ description: Use when the user explicitly requests Immune-Brain pruning of stale current documentation.
4
4
  ---
5
5
 
6
6
  # Immune-Brain: Doc Prune
@@ -36,6 +36,8 @@ no persistent report, and no automatic commit.
36
36
 
37
37
  ## Ordered Pruning Protocol
38
38
 
39
+ ### Inventory and Manifest
40
+
39
41
  1. **Establish repository safety.** Mutation requires a Git worktree. A
40
42
  non-Git repository or an untracked candidate is audit-only. Record the
41
43
  candidate path, blob/content hash, tracked status, and candidate-local
@@ -91,6 +93,8 @@ no persistent report, and no automatic commit.
91
93
  "clean stale docs" is insufficient. Interruption starts a fresh scan; no
92
94
  manifest is persisted.
93
95
 
96
+ ### Approved Mutation
97
+
94
98
  9. **Revalidate and mutate minimally.** Re-read candidate bytes, Git status,
95
99
  inbound references, generated ownership, and active scope immediately
96
100
  before each approved change. Drift blocks that item. Delete a whole file
@@ -99,6 +103,8 @@ no persistent report, and no automatic commit.
99
103
  owner before deleting the obsolete source. Never renumber ADRs and never
100
104
  create a new ADR or Solution merely to complete pruning.
101
105
 
106
+ ### Verify and Report
107
+
102
108
  10. **Verify and report.** Re-scan residual names and paths, current local
103
109
  links on current documentation, source/generated parity, existing documentation contract tests,
104
110
  and `git diff --check`. This Skill does not execute arbitrary documented
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: imm-loop
3
- description: Use to run an enrolled TaskIntent to completion through Kernel-governed execution, QA, and Review.
3
+ description: Use when the user explicitly requests execution or resumption of an Immune-Brain task.
4
4
  ---
5
5
 
6
6
  # Immune-Brain: Loop
@@ -16,7 +16,12 @@ claim, TaskIntent, and TaskRecord. Invalid or contradictory projections fail
16
16
  closed. A candidate TaskIntent is not Enrollment authority.
17
17
 
18
18
  Before the first Enrollment of a candidate TaskIntent, confirm the Planner
19
- returned `tracker_associated` for its Initiative. `tracker_projection_failed` or
19
+ returned `tracker_associated` — but only when the candidate belongs to an
20
+ identified GitHub-carried Initiative. Standalone TaskIntents and Local
21
+ Initiatives carry no tracker prerequisite: their Enrollment needs only the
22
+ validated candidate. When membership is uncertain, resolve it against the
23
+ Planner's carrier decision before treating the candidate as exempt; do not
24
+ assume either way. For a GitHub-carried Initiative, `tracker_projection_failed` or
20
25
  `awaiting_user_initiative_confirmation` blocks that Enrollment until the same
21
26
  complete carrier batch succeeds; report the stable carrier reason and its exact
22
27
  retry action instead of enrolling. A carrier command the Host refused, cancelled,
@@ -36,7 +41,7 @@ At every internal role boundary call the read-only `imm_loop_action` Tool. Use
36
41
  exploration, advisory review, Compounder, Kernel ownership, or scope expansion.
37
42
  Use Kernel ownership for an enrolled task. This Tool projects authority; it does
38
43
  not record execution evidence, mutate task state, or replace Kernel operations.
39
- Follow the [Subagent Dispatch Protocol](docs/reference/subagent-dispatch-protocol.md#authorization-authority).
44
+ Before a child dispatch, read the [Subagent Dispatch Protocol](docs/reference/subagent-dispatch-protocol.md#authorization-authority).
40
45
  Never load an internal role as a public Skill or spawn another loop process.
41
46
  The standalone `imm-pr-fix`, `imm-doc-prune`, and `imm-agent-doc-maintain` are host-native
42
47
  maintenance entries, never dispatched as the Loop role. Internal `test-fixer`
@@ -65,8 +70,12 @@ Continue while the current projection has a valid action:
65
70
  6. For rework, follow the projected artifact state before editing. Resolve
66
71
  findings only after fixing and verifying their cause. Changed snapshots
67
72
  invalidate old evidence; freeze and run the newly required obligations.
68
- 7. Stop on terminal `done` or `stopped`, unresolved user decisions, explicit
69
- cancellation, or a failure without a safe projected action.
73
+ 7. An unresolved decision pauses only dependent execution. On `awaiting_user`,
74
+ invoke `request_authorization` directly before ending the turn; use the
75
+ Decisions and Recovery route for its native-gate handling. End the turn if
76
+ the decision remains unresolved, is cancelled, or the gate fails. Otherwise
77
+ continue from the returned projection. Stop on terminal `done` or `stopped`,
78
+ explicit cancellation, or a failure without a safe projected action.
70
79
 
71
80
  Use the fresh projection returned by a successful operation when supplied. Read
72
81
  `status` after interruption, ambiguous mutation results, absent projections, or
@@ -74,12 +83,37 @@ suspected external changes. Never repeat a mutation merely to obtain its result.
74
83
  Kernel CAS and freshness checks remain mandatory; reducing Parent reads does
75
84
  not bypass them. Do not poll or create detached jobs.
76
85
 
86
+ ## Unattended Batch Opt-In
87
+
88
+ The only unattended batch entry is the privileged Host tool `start_unattended_batch`
89
+ with its `initiative_slug` parameter. That parameter is the opt-in: absent the call,
90
+ `imm-loop` behavior is byte-identical to per-task Enrollment, and no batch state,
91
+ branch, or Batch Authorization exists. The Standalone Hosts expose the same tool
92
+ name and the same single parameter; it is never a batch of tasks the Host chose.
93
+
94
+ Invoking it authorizes only a user-confirmed batch of already-planned child
95
+ TaskIntents. The Host projects the batch plan from the Initiative's published
96
+ children, excludes every `critical` child, renders the ordered child list, budget,
97
+ and plan digest through its native confirmation, and issues one Kernel Batch
98
+ Authorization for that exact plan. The extension mints no capability and owns no
99
+ batch state transition: the shared `startBatch` driver in
100
+ `runtime/unattended/` owns every batch transition, and each child is still
101
+ enrolled, assured, and settled by the Kernel under an ordinary TaskRecord.
102
+
103
+ Batch execution never pushes a ref, opens or updates a pull request, resolves a
104
+ user decision, or creates, switches, or deletes a Git worktree. Its sole Git
105
+ effect is the batch branch `imm/<initiative-slug>` plus one scope-bounded commit
106
+ per completed child.
107
+
77
108
  ## Decisions and Recovery
78
109
 
79
- - Scope expansion always returns to `imm-planner`. Collect all currently known missing
80
- paths, caller/test/generated mirrors, and verification reasons in one request.
81
- Do not edit outside scope while waiting or widen it piecemeal without new
82
- evidence. Bounded test or PR repair stays inside the same TaskIntent.
110
+ - Scope expansion returns to Planner's Enrolled Intent Revision route. Planner
111
+ prepares the complete proposed revision without replacing the active owner;
112
+ the current Loop submits it through Kernel revision authority. Collect all
113
+ currently known missing paths, caller/test/generated mirrors, and verification
114
+ reasons in one request. Do not edit outside scope while waiting or widen it
115
+ piecemeal without new evidence. Bounded test or PR repair stays inside the same
116
+ TaskIntent.
83
117
  - Invoke `approve_breaking_intent_revision` with the complete next intent
84
118
  directly; the native Host gate is the single user decision. Do not overwrite
85
119
  enrolled intent sidecars or ask for chat pre-confirmation.
@@ -123,8 +157,6 @@ The internal Compounder is optional: only closed work with structured evidence
123
157
  of a reusable Learning may route to it. Routine completion creates no Learning.
124
158
  It cannot approve successors or delay terminal settlement. A projection with
125
159
  `recommended_authority: user` must not dispatch successor work automatically.
126
- Do not create, switch,
127
- or delete Git worktrees; operate only in the Host launch directory.
128
160
 
129
161
  The Host may attach an opted-in GitHub projection after settlement. Only a fresh claimless
130
162
  `done`/`stopped` projection plus its exact terminal tombstone projects
@@ -151,6 +183,8 @@ Stop reason:
151
183
  Next action:
152
184
  ```
153
185
 
186
+ ## Failure Output
187
+
154
188
  For `settlement_unknown`, call `advance_assurance` once to reconcile the Kernel
155
189
  projection before resuming; never replay the uncertain write directly. The runtime
156
190
  retries only explicit `EINTR`/`EAGAIN` failures of its initial projection read, once,
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: imm-planner
3
- description: Use to create or revise a spec and TaskIntent from requirements; owns scope and decomposition, not implementation or Enrollment.
3
+ description: Use when the user explicitly requests Immune-Brain Spec and TaskIntent planning.
4
4
  ---
5
5
 
6
6
  # Immune-Brain: Planner
@@ -16,8 +16,8 @@ an explicit `imm-loop` 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
19
- candidate Spec/TaskIntent, but it never enrolls a task or enrolls generated
20
- artifacts unconditionally. Explicit Plan-only requests stop after returning the
19
+ candidate Spec/TaskIntent. Planner may request the native Enrollment gate;
20
+ only that gate grants execution authority. Explicit Plan-only requests stop after returning the
21
21
  planning artifacts. A later literal-user request to start Enrollment is a
22
22
  non-authoritative execution trigger: invoke the native Enrollment gate directly,
23
23
  without asking for chat pre-confirmation. For a clear mutation request that
@@ -32,9 +32,10 @@ cannot bypass that boundary, QA, Review, authorization, or completion.
32
32
  ## Clarification supplement
33
33
 
34
34
  Planner consumes an upstream Brainstorm manifest as closed-world framing and
35
- must not repeat, reopen, or rewrite confirmed decisions. Direct Planner entry
36
- and Medium/High Design Risk work must inspect relevant ADRs and rejected
37
- Learnings. It resolves repository facts, performs reference closure, and owns
35
+ must not repeat, reopen, or rewrite confirmed decisions. Consult relevant ADRs
36
+ and rejected Learnings only when an architectural decision, known historical
37
+ constraint, or conflict with the existing design makes them relevant. Reuse
38
+ upstream evidence; absent relevant history is not a planning blocker. It resolves repository facts, performs reference closure, and owns
38
39
  ordinary technical choices:
39
40
  component boundaries, internal interfaces, failure behavior, compatibility,
40
41
  migration, recovery and rollback, Verification, execution slices, dependencies,
@@ -71,15 +72,16 @@ resolved wrapper and use the resolved `imm-kernel` wrapper for every Kernel
71
72
  command below. Do not assume either bare command is available on shell `PATH`.
72
73
  Then route deterministically:
73
74
 
74
- - an active Kernel claim routes to `imm-loop` for foreground Kernel Tool
75
- coordination, not new planning;
75
+ - an active Kernel claim remains with `imm-loop` for foreground Kernel Tool
76
+ coordination, except a Loop-requested revision follows Enrolled Intent Revision
77
+ below to prepare a non-authoritative proposal for that same owner;
76
78
  - an active or otherwise nonterminal v3 Plan remains on its existing v3 route;
77
79
  - no routing policy preserves the legacy v3 Planner behavior;
78
80
  - a valid `kernel_task_intent` retirement policy produces one TaskIntent draft
79
81
  through the current Host's explicit `imm-planner`;
80
82
  - an invalid, unreadable, untracked, or tracked-deleted policy rejects new
81
83
  planning authority with `routing_policy_invalid`;
82
- - no Planner path enrolls a task or falls back to v3 after retirement.
84
+ - no Planner path grants execution authority or falls back to v3 after retirement.
83
85
 
84
86
  Current owner, phase, completion, and authority facts are authoritative only
85
87
  when read from the Assurance projection and TaskRecord. `CONTEXT.md` is
@@ -105,6 +107,11 @@ workspace claim, and final authority preconditions without executing acceptance
105
107
  descriptors. A routine task proceeds from that single confirmation through
106
108
  enrollment, execution and QA without a second human stop.
107
109
 
110
+ ## Candidate Authoring
111
+
112
+ Read this section before creating new candidate artifacts, after request routing
113
+ and clarification. It does not apply to Enrolled Intent Revision.
114
+
108
115
  Before authoring a TaskIntent, trace each expected behavior from its public or
109
116
  runtime entry point through existing imports and callers to the highest focused
110
117
  behavioral tests. Include generated or packaged mirrors and every owner of the
@@ -212,6 +219,19 @@ TaskIntent or TaskRecord. Existing Issue markers grant permission only for
212
219
  idempotent retry of that same approved Initiative; they never grant execution
213
220
  authority.
214
221
 
222
+ For amending an already-published Initiative, the same
223
+ `imm-tracker publish-initiative --stdin --json` operation accepts an optional
224
+ `amendment` input after the literal user approves the changed pending frontier.
225
+ Provide the complete approved pending Tasks plus the complete read-only
226
+ historical Child list, each binding the observed `issue_number`, title, body,
227
+ and state at approval. The tracker verifies every bound Issue against that
228
+ baseline before any write, updates only approved pending briefs, converges the
229
+ exact approved pending `blocked_by` set, creates newly added pending Children,
230
+ and preserves historical Children byte-for-byte with their native Sub-issue
231
+ links and dependency relations. Omitted membership, baseline drift, or a
232
+ stopped historical prerequisite fails closed with zero or bounded mutations
233
+ and an exact retry action; the strict no-amendment default is unchanged.
234
+
215
235
  ### Verification Descriptor Discipline
216
236
 
217
237
  Every acceptance verification descriptor must be a focused, deterministic,
@@ -237,10 +257,10 @@ descriptors or add a mandatory user confirmation. Use the smallest `timeout_ms`
237
257
  - **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.
238
258
  - **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.
239
259
  - **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.
240
- - **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. Every new or revised Spec records `**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.
260
+ - **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.
241
261
  - **Verification**: Every acceptance assertion has a concrete focused descriptor that can fail on the intended regression. Hypothetical evidence is not execution-ready.
242
262
  - **Executable Scope**: `scope_hint` is the mutation envelope, not discovery context. Close references across callers, tests, generated mirrors, and state-machine owners before authoring. Include bound active and archive Spec paths needed for `freeze_artifacts`. Collect all known scope gaps in one revision request; ask again only when new evidence changes the boundary.
243
- - **Devil's Advocate Preplan Audit**: Record a `Devil's Advocate Audit` in the Spec covering rollback resilience, verification vanity, and spec dilution detection. Explain recovery from partial implementation, why verification detects the regression, and how accepted requirements remain covered.
263
+ - **Devil's Advocate Preplan Audit**: Medium/High risk work records a `Devil's Advocate Audit` in the Spec covering rollback resilience, verification vanity, and spec dilution detection. Explain recovery from partial implementation, why verification detects the regression, and how accepted requirements remain covered. Low-risk work omits the empty template; the Spec records outcome, boundary, and concrete verification only.
244
264
  - **Execution posture**: Record `test-first` or `characterization-first` in the Spec when explicitly requested or justified by fragile untested behavior. The Executor owns the local choreography; do not create prototype or RED/GREEN/REFACTOR authority Steps. Throwaway probes must have a cleanup condition and a durable decision output.
245
265
 
246
266
  ## Settlement-Design Contract
@@ -294,21 +314,36 @@ state coverage, and verification cues for desktop and mobile. Use `Standard` or
294
314
  The mode produces an
295
315
  implementation-ready contract and routes it to normal planning or execution.
296
316
 
317
+ ## Enrolled Intent Revision
318
+
319
+ Use this route instead of new-task planning when the current Loop requests a
320
+ scope or acceptance revision. Planner prepares the complete proposed revision
321
+ from the requested delta and concrete evidence without replacing the active
322
+ owner. Keep unaffected decisions; include all known scope, Spec, and acceptance
323
+ changes in the proposal. Preserve the prior on-disk sidecars until Kernel applies
324
+ the revision; do not overwrite the enrolled TaskIntent, invoke the new-intent
325
+ author command, or request a second Enrollment.
326
+
327
+ Return the proposal to the current Loop owner for Kernel `revise_intent` or,
328
+ when breaking, `approve_breaking_intent_revision` with the complete next intent.
329
+ The native gate is the single user decision for a breaking revision; candidate
330
+ preparation does not apply the revision or authorize expanded execution.
331
+
297
332
  ## Planning Rules
298
333
 
299
334
  - **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.
300
335
  - **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.
301
336
  - **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.
302
337
  - **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.
303
- - **Small-scope budget discipline**: For small or fixture-sized planning tasks,
304
- read the named files and root orientation files first (`README.md`,
305
- `CONTEXT.md`, `IMMUNE.md`, `HANDOFF.md`, active tests/docs). Avoid broad
306
- `rg --files`, plugin `skills/`, plugin `dist/`, generated logs, and
307
- unrelated directories until a specific missing fact blocks plan validation.
308
- - **Decision History Discovery**: Direct Planner entry and Medium/High Design
309
- Risk work must inspect relevant ADRs and rejected Learnings. Reuse constraints
310
- already covered by an upstream Brainstorm manifest instead of repeating that
311
- discovery.
338
+ - **Small-scope budget discipline**: Read the named files first for small or
339
+ fixture-sized planning tasks. Read relevant orientation documents and follow
340
+ caller, test, or generated-reference links when a concrete missing fact requires
341
+ them; root documents are not a fixed preflight checklist. Before broad searching,
342
+ consult `CONTEXT.md`'s Architecture Map. Avoid repository-wide listings and
343
+ unrelated directories when targeted evidence resolves the task. Required
344
+ authority, security, and shared-contract reference closure still applies.
345
+ - **Decision History Discovery**: Apply Clarification supplement's conditional
346
+ history lookup; reuse upstream evidence rather than repeating discovery.
312
347
  - **Testing Seam Selection**: Prefer the highest existing observable behavioral
313
348
  test seam and the fewest sufficient seams. Cite relevant test prior art and
314
349
  explain how the selected seam catches the intended regression. This is a
@@ -317,10 +352,10 @@ implementation-ready contract and routes it to normal planning or execution.
317
352
  - **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.
318
353
  - **Brainstorm Manifest Mapping**: Record every upstream `BR-*` item in a Spec `Brainstorm Trace`, mapped to TaskIntent 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.
319
354
  - **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.
320
- - **Subagents**: Follow the Adaptive Cache-First Route in `docs/reference/subagent-dispatch-protocol.md`: classify the task, use cache-first discovery evidence, and add subagent participation only when the Cost-Based Subagent Gate says the slice is multi-domain, high-risk, explicitly requested, or has concrete `parallel_probes`. Plan conditional reviewers such as `security-reviewer` only if their trigger surfaces are explicit; do not manufacture them.
321
- - **Enrolled Intent**: Planner never overwrites an enrolled TaskIntent. Scope or acceptance changes use Kernel revision authority; breaking revisions invoke the native gate directly with the complete next intent. Preserve the prior on-disk sidecars until Kernel applies the revision.
322
- - **CONTEXT.md Vocabulary**: Read `CONTEXT.md` at the repo root. Use canonical terms in Spec, acceptance, and scope descriptions. `CONTEXT.md` is vocabulary and architecture navigation, not execution state.
323
- - **Discovery Protocol**: Read `CONTEXT.md` `## Architecture Map` before broad searching and relevant `docs/solutions/` evidence. Record concrete file pointers and reasons in the Spec. Do not read or write a legacy Step discovery cache.
355
+ - **Subagents**: Only when optional research is needed, read Research Dispatch and its shared dispatch reference. Default to inline evidence gathering. Plan conditional reviewers such as `security-reviewer` only if their trigger surfaces are explicit; do not manufacture them.
356
+ - **Enrolled Intent**: Follow Enrolled Intent Revision for a Loop-requested scope or acceptance change; candidate preparation never changes the current owner or grants execution authority.
357
+ - **CONTEXT.md Vocabulary**: Consult the relevant `CONTEXT.md` terms when domain meaning is unclear or changes; known file-local tasks do not require a full root-document read. `CONTEXT.md` is vocabulary and architecture navigation, not execution state.
358
+ - **Discovery Protocol**: Read `CONTEXT.md` `## Architecture Map` before broad searching; consult relevant `docs/solutions/` evidence under Clarification supplement's history trigger. Record concrete file pointers and reasons in the Spec. Do not read or write a legacy Step discovery cache.
324
359
  - **Planning Quality Gate**: For elevated-risk work, verify contract surfaces, compatibility, interruption recovery, rollback, verification strength, and Brainstorm traceability in the Spec. Do not invoke retired Plan mutation or State Ledger synchronization.
325
360
  - **Parallel Probes**: Optional read-only probes must have bounded non-overlapping scopes, expected evidence, and no file or authority writes. They are advisory discovery, not persisted Step annotations. Probe failure falls back to inline investigation with a recorded reason.
326
361
 
@@ -356,7 +391,9 @@ optional advisory dispatch fails, continue inline and record the reason.
356
391
  Spec under `docs/specs/` plus canonical candidate
357
392
  `docs/plans/<task-id>.intent.json`. The Spec records outcome, discovery evidence,
358
393
  decisions, assumptions, Technical Design when required, output language,
359
- `Devil's Advocate Audit`, and acceptance/test mapping. Include a complete
394
+ the Medium/High risk Devil's Advocate Audit, and acceptance/test mapping. Low
395
+ risk records outcome, boundary, and concrete verification without the empty
396
+ ceremony. Include a complete
360
397
  `Brainstorm Trace` when consuming a Brainstorm manifest. TaskIntent is authored
361
398
  and validated through `imm-kernel`; do not write a prose iteration Plan or sync
362
399
  a State Ledger. Keep historical Plan validation strictly read-only.
@@ -373,15 +410,15 @@ a State Ledger. Keep historical Plan validation strictly read-only.
373
410
  | Split one outcome into read/edit/run micro-steps | One TaskIntent owns one closable outcome; Executor owns implementation batches. |
374
411
  | Append repair outside scope | Return the complete known scope delta for Kernel revision; do not widen execution. |
375
412
  | Drop a brainstorm-confirmed item as "out of scope" without saying so | Closed-world handoff: every `BR-*` ID must be covered, decisioned, deferred, scoped out with reason, or resolved as an assumption. |
376
- | Start planning while brainstorm questions are open | **Clarification Barrier**: Planning is blocked until all `BR-Q-*` items are answered; do not speculate on missing product info. |
377
- | Skip adversarial self-review because the plan is small | **Devil's Advocate** audit still checks rollback resilience, verification vanity, and spec dilution before the plan is treated as execution-ready. |
413
+ | Finalize dependent planning while brainstorm questions are open | **Clarification Barrier**: Finalization and dependent commitments are blocked until required `BR-Q-*` items are answered. Independent investigation and explicitly unapproved alternative drafts may continue; silence is not consent. |
414
+ | Skip adversarial self-review on Medium/High risk because the plan is small | **Devil's Advocate** audit still checks rollback resilience, verification vanity, and spec dilution before the plan is treated as execution-ready. |
378
415
 
379
416
  ## Red Flags
380
417
 
381
418
  - Acceptance verification names only hypothetical evidence with no runnable descriptor.
382
419
  - New work depends on a prose Plan validator, Step activation, or State Ledger.
383
420
  - A Brainstorm manifest lacks a complete Spec `Brainstorm Trace`.
384
- - A Spec lacks a `Devil's Advocate Audit` covering rollback resilience, verification vanity, and spec dilution detection.
421
+ - A Medium/High risk Spec lacks a `Devil's Advocate Audit` covering rollback resilience, verification vanity, and spec dilution detection.
385
422
  - New Spec prose ignores the document-language policy.
386
423
  - Candidate artifacts escape the approved planning scope.
387
424
 
@@ -1,10 +1,12 @@
1
1
  ---
2
2
  name: imm-pr-fix
3
- description: Use to repair GitHub PR review feedback, merge conflicts, or failing CI checks within the current PR scope.
3
+ description: Use when the user explicitly requests Immune-Brain repair of GitHub PR review feedback, merge conflicts, or failing checks.
4
4
  ---
5
5
 
6
6
  # Immune-Brain: PR Fix
7
7
 
8
+ ## Authority Boundary
9
+
8
10
  Repair blockers on one GitHub pull request without creating or mutating
9
11
  TaskIntent, TaskRecord, Kernel, Spec, or Plan authority. An already active
10
12
  Managed task remains owned by `imm-loop`; stop and direct the user there when
@@ -66,7 +68,9 @@ not repair blockers.
66
68
 
67
69
  ### 4. Verify and close out
68
70
 
69
- Run the smallest checks that reproduce each blocker, then any repository check
71
+ Before any push or feedback mutation, apply the BASELINE Host Confirmation
72
+ Boundary to the exact remote effect; the repair request alone does not grant
73
+ unrequested publication authority. Run the smallest checks that reproduce each blocker, then any repository check
70
74
  required by the changed surface. Re-read remote PR status, verify local HEAD is
71
75
  the expected PR head, inspect the final diff, and push only the repair branch.
72
76
  Reply to or resolve handled feedback when GitHub permissions and thread state
@@ -30,6 +30,14 @@ Return exactly one JSON object with the fields required by the Loop review
30
30
  contract: `contract`, `role`, `task_id`, `snapshot_digest`, `decision` (`pass`
31
31
  or `rework`), and for `pass` include `approval` (`kind`, `authority_role`,
32
32
  `summary`), for `rework` include `findings` (`id`, `kind`, `acceptance_id`,
33
- `summary`). Do not invent fields. A passing review has no findings. If the
33
+ `summary`, `evidence`). Every rework finding's `evidence` must carry
34
+ `trigger` (the concrete inputs or state that reach the defect), a non-empty
35
+ `caller_chain` (ordered repository paths or symbols), and `violated`
36
+ (`kind`: `acceptance` or `security_boundary`, `ref`: the acceptance id or
37
+ boundary name). Do not invent fields, and never send an anchor yourself: the
38
+ Kernel derives it as the sha256 of the canonical `{violated.kind,
39
+ violated.ref, caller_chain}`, so an identical claim keeps one stable identity
40
+ across review rounds while a different call chain is a different claim. A
41
+ passing review has no findings. If the
34
42
  checkpoint is `awaiting_user_successor_decision`, stop without dispatch; only
35
43
  a literal user may invoke `--approve-successor`.