immune-brain 3.6.9 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/package.json +3 -2
  2. package/plugins/immune-brain/.claude-plugin/plugin.json +1 -1
  3. package/plugins/immune-brain/.pi-extension/imm-canary-enroll.ts +18 -2
  4. package/plugins/immune-brain/.pi-extension/imm-canary-work.ts +76 -121
  5. package/plugins/immune-brain/.pi-extension/imm-unattended-batch.ts +106 -600
  6. package/plugins/immune-brain/.pi-extension/pi-canary-assurance-progression.ts +1 -0
  7. package/plugins/immune-brain/.pi-extension/pi-canary-verification.ts +3 -3
  8. package/plugins/immune-brain/.pi-extension/runtime-stub.ts +17 -43
  9. package/plugins/immune-brain/dist/claude/mcp-server.mjs +7587 -5049
  10. package/plugins/immune-brain/dist/docs/reference/planning-artifact-retention.md +11 -12
  11. package/plugins/immune-brain/dist/docs/reference/subagent-dispatch-protocol.md +1 -1
  12. package/plugins/immune-brain/dist/imm-loop.md +27 -25
  13. package/plugins/immune-brain/dist/imm-planner.md +34 -27
  14. package/plugins/immune-brain/dist/imm-review-retro.md +2 -2
  15. package/plugins/immune-brain/dist/role-prompts/code-review.md +3 -1
  16. package/plugins/immune-brain/dist/role-prompts/executor.md +4 -4
  17. package/plugins/immune-brain/runtime/assurance/coordinator.ts +183 -40
  18. package/plugins/immune-brain/runtime/assurance/delivery_workspace.ts +240 -0
  19. package/plugins/immune-brain/runtime/assurance/qa.ts +132 -58
  20. package/plugins/immune-brain/runtime/assurance/review_evidence.ts +15 -7
  21. package/plugins/immune-brain/runtime/assurance/verification.ts +246 -206
  22. package/plugins/immune-brain/runtime/authorization_operation.ts +20 -0
  23. package/plugins/immune-brain/runtime/claude/kernel_ports.ts +288 -721
  24. package/plugins/immune-brain/runtime/commands/kernel.ts +158 -67
  25. package/plugins/immune-brain/runtime/github_issue_tracker.ts +1 -1
  26. package/plugins/immune-brain/runtime/kernel/actor_identity.ts +33 -0
  27. package/plugins/immune-brain/runtime/kernel/application.ts +22 -6
  28. package/plugins/immune-brain/runtime/kernel/assurance_projection.ts +94 -5
  29. package/plugins/immune-brain/runtime/kernel/authority_port.ts +27 -6
  30. package/plugins/immune-brain/runtime/kernel/backend_claim.ts +43 -16
  31. package/plugins/immune-brain/runtime/kernel/batch_authority.ts +10 -6
  32. package/plugins/immune-brain/runtime/kernel/canary_application.ts +50 -63
  33. package/plugins/immune-brain/runtime/kernel/canary_eligibility.ts +13 -4
  34. package/plugins/immune-brain/runtime/kernel/completion.ts +5 -14
  35. package/plugins/immune-brain/runtime/kernel/enrollment.ts +124 -34
  36. package/plugins/immune-brain/runtime/kernel/enrollment_authority.ts +13 -5
  37. package/plugins/immune-brain/runtime/kernel/index.ts +3 -1
  38. package/plugins/immune-brain/runtime/kernel/intent.ts +7 -11
  39. package/plugins/immune-brain/runtime/kernel/legacy_audit.ts +4 -1
  40. package/plugins/immune-brain/runtime/kernel/legacy_task_record.ts +323 -0
  41. package/plugins/immune-brain/runtime/kernel/pi_canary_prepare.ts +10 -1
  42. package/plugins/immune-brain/runtime/kernel/reducer.ts +32 -31
  43. package/plugins/immune-brain/runtime/kernel/run_identity.ts +121 -0
  44. package/plugins/immune-brain/runtime/kernel/spec_binding.ts +100 -0
  45. package/plugins/immune-brain/runtime/kernel/sqlite_migration.ts +950 -0
  46. package/plugins/immune-brain/runtime/kernel/sqlite_store.ts +1193 -0
  47. package/plugins/immune-brain/runtime/kernel/storage.ts +1254 -1206
  48. package/plugins/immune-brain/runtime/kernel/storage_layout_migration.ts +129 -755
  49. package/plugins/immune-brain/runtime/kernel/storage_paths.ts +419 -46
  50. package/plugins/immune-brain/runtime/kernel/types.ts +12 -43
  51. package/plugins/immune-brain/runtime/kernel/validation.ts +60 -274
  52. package/plugins/immune-brain/runtime/managed_task_routing_policy.ts +0 -1
  53. package/plugins/immune-brain/runtime/plan_core.ts +27 -65
  54. package/plugins/immune-brain/runtime/plugin_version.ts +1 -1
  55. package/plugins/immune-brain/runtime/prompts/code-review.md +3 -1
  56. package/plugins/immune-brain/runtime/prompts/executor.md +4 -4
  57. package/plugins/immune-brain/runtime/staged_intent.ts +58 -0
  58. package/plugins/immune-brain/runtime/unattended/batch_git.ts +37 -7
  59. package/plugins/immune-brain/runtime/unattended/batch_plan.ts +42 -2
  60. package/plugins/immune-brain/runtime/unattended/batch_preflight.ts +771 -0
  61. package/plugins/immune-brain/runtime/unattended/batch_reasons.ts +189 -0
  62. package/plugins/immune-brain/runtime/unattended/batch_runner.ts +35 -0
  63. package/plugins/immune-brain/runtime/unattended/confirmation_deadline.ts +33 -0
  64. package/plugins/immune-brain/runtime/unattended/types.ts +14 -1
  65. package/plugins/immune-brain/runtime/v4_runtime.ts +19 -23
  66. package/plugins/immune-brain/runtime/verification_descriptor.ts +92 -136
  67. package/plugins/immune-brain/runtime/workspace_scope.ts +98 -13
  68. package/plugins/immune-brain/skills/imm-planner/SKILL.md +3 -3
  69. package/plugins/immune-brain/bin/imm-retire-stale-wrapper +0 -4
  70. package/plugins/immune-brain/bin/imm-retired +0 -4
  71. package/plugins/immune-brain/runtime/authority_commit_receipts.ts +0 -716
  72. package/plugins/immune-brain/runtime/kernel/automatic_observations.ts +0 -451
  73. package/plugins/immune-brain/runtime/kernel/legacy.ts +0 -299
  74. package/plugins/immune-brain/runtime/kernel/observation.ts +0 -397
  75. package/plugins/immune-brain/runtime/kernel/readiness.ts +0 -282
  76. package/plugins/immune-brain/runtime/kernel/readiness_evidence.ts +0 -132
@@ -73,18 +73,17 @@ Non-terminal artifacts remain durable at their existing paths by default.
73
73
 
74
74
  ## Authority-Owned Lifecycle
75
75
 
76
- An enrolled TaskIntent and the one exact active Spec bound by its `scope_hint`
77
- remain under `docs/plans/` and `docs/specs/` while the task is `working`. Before
78
- QA, the Kernel freezes both artifacts through one recoverable transaction: bytes
79
- move to their `archive/` paths and `TaskRecord.intent_ref.path` changes to the
80
- archived sidecar. Every later Kernel action rereads that recorded path.
81
-
82
- Authorized Review rework restores both artifacts before returning to `working`.
83
- Completion is valid only from the frozen location. Stop freezes an active pair
84
- before terminal settlement, so both terminal outcomes leave no active planning
85
- artifact. A relocation conflict or crash fails closed and converges only through
86
- the transaction marker; no background scanner or second status writer may infer
87
- or repair lifecycle state.
76
+ An enrolled TaskIntent remains under `docs/plans/` for the whole run. A complex
77
+ task may bind one active Spec under `docs/specs/` by content identity. Before QA,
78
+ the Kernel freezes those artifacts in place: Git objects are bound, source paths
79
+ do not move, and `TaskRecord.intent_ref.path` stays on the active sidecar.
80
+ Historical files already in `archive/` remain readable. A later edit of a bound
81
+ Spec changes the delivery identity, so prior assurance cannot be reused.
82
+
83
+ Authorized Review rework returns `artifact_state` to `active` without relocating
84
+ files. Completion and stop freeze in place; they do not archive planning
85
+ artifacts. A crash fails closed and converges only through the store transaction;
86
+ no background scanner or second status writer may infer or repair lifecycle state.
88
87
 
89
88
  Terminal cleanup outside that lifecycle remains a bounded TaskIntent with an
90
89
  explicit candidate list and a copy-paste verification command. It may accompany
@@ -80,7 +80,7 @@ Agent:
80
80
  schedule: ""
81
81
  ```
82
82
 
83
- Pi `Agent` has no `readonly` parameter; the empty tool policy, child type, and prompt contract enforce the read-only boundary. The Parent starts one foreground Agent at a time and consumes its direct result before deciding whether another child is needed. Advisory and discovery work does not call `get_subagent_result` or depend on completion notifications or host `followUp`. Kernel Review uses `subagent_type: "Review"`; its structured verdict is submitted by the Parent and validated against the current immutable snapshot. Loop `arch-explorer` uses `subagent_type: "Explore"`; other advisory/discovery and Loop internal roles use `general-purpose`.
83
+ Pi `Agent` has no `readonly` parameter; the empty tool policy, child type, and prompt contract enforce the read-only boundary. The Parent starts one foreground Agent at a time and consumes its direct result before deciding whether another child is needed. Advisory and discovery work does not poll for deferred results or depend on completion notifications or host `followUp`. Kernel Review uses `subagent_type: "Review"`; its structured verdict is submitted by the Parent and validated against the current immutable snapshot. Loop `arch-explorer` uses `subagent_type: "Explore"`; other advisory/discovery and Loop internal roles use `general-purpose`.
84
84
 
85
85
  ## Scheduling And Visibility
86
86
 
@@ -11,9 +11,9 @@ This skill adheres to the **[BASELINE.md](BASELINE.md)**.
11
11
 
12
12
  Only explicit `imm-loop` entry starts or resumes this loop. Ordinary host input
13
13
  stays host-native; it never resumes a Managed owner implicitly. Read the current
14
- Host's `imm_kernel_canary` `status` first and verify the exact active backend
15
- claim, TaskIntent, and TaskRecord. Invalid or contradictory projections fail
16
- closed. A candidate TaskIntent is not Enrollment authority.
14
+ Host's `status` projection first and verify the exact active backend claim,
15
+ TaskIntent, and TaskRecord. Invalid or contradictory projections fail closed. A
16
+ candidate TaskIntent is not Enrollment authority.
17
17
 
18
18
  Before the first Enrollment of a candidate TaskIntent, confirm the Planner
19
19
  returned `tracker_associated` — but only when the candidate belongs to an
@@ -36,11 +36,12 @@ Historical prose Plans and State Ledgers are read-only history, not execution
36
36
  instructions. Do not create Steps, workflow profiles, follow-up ledgers, or
37
37
  successor Plans to drive a Kernel task.
38
38
 
39
- At every internal role boundary call the read-only `imm_loop_action` Tool. Use
40
- `route` for current-context Executor work, bounded repair, architecture
41
- exploration, advisory review, Compounder, Kernel ownership, or scope expansion.
42
- Use Kernel ownership for an enrolled task. This Tool projects authority; it does
43
- not record execution evidence, mutate task state, or replace Kernel operations.
39
+ At every internal role boundary call the invoking Host's read-only role-boundary
40
+ route. Use `route` for current-context Executor work, bounded repair,
41
+ architecture exploration, advisory review, Compounder, Kernel ownership, or
42
+ scope expansion. Use Kernel ownership for an enrolled task. This route projects
43
+ authority; it does not record execution evidence, mutate task state, or replace
44
+ Kernel operations.
44
45
  Before a child dispatch, read the [Subagent Dispatch Protocol](docs/reference/subagent-dispatch-protocol.md#authorization-authority).
45
46
  Never load an internal role as a public Skill or spawn another loop process.
46
47
  The standalone `imm-pr-fix`, `imm-doc-prune`, and `imm-agent-doc-maintain` are host-native
@@ -51,26 +52,27 @@ and `pr-fix` repairs remain bounded by the enrolled TaskIntent.
51
52
 
52
53
  Continue while the current projection has a valid action:
53
54
 
54
- 1. For active artifacts, implement only the enrolled acceptance within
55
- `scope_hint` in the current conversation. Run focused checks. Executor checks
56
- are diagnostic evidence, not a QA or Review approval.
57
- 2. Before Assurance, call `freeze_artifacts` while TaskRecord is `active:active`.
58
- A bound active Spec and its archive path must both be inside `scope_hint`.
59
- The Kernel owns byte-preserving archival and the frozen snapshot.
60
- 3. Call `advance_assurance` in the foreground and consume its direct terminal
61
- result. Deterministic QA runs fixed acceptance descriptors atomically inside
62
- the Host integration. Do not dispatch a separate per-Step QA Agent.
63
- 4. On `review_ready`, invoke the returned `agent_params` as one exact foreground
55
+ 1. For active artifacts, implement only the enrolled acceptance within the
56
+ `scope_hint` envelope in the current conversation. New helpers or tests
57
+ inside an approved directory or glob do not require a revision. Run focused
58
+ checks. Executor checks are diagnostic evidence, not a QA or Review approval.
59
+ 2. Call `advance_assurance` in the foreground and consume its direct terminal
60
+ result. The Kernel freezes the artifacts itself before QA: it binds Git
61
+ content identity in place without relocating source paths. A simple task has
62
+ TaskIntent only; a complex task may bind one active Spec. Deterministic QA
63
+ runs all descriptors in a disposable delivery materialization, never against
64
+ unchecked live worktree source. Do not dispatch a separate per-Step QA Agent.
65
+ 3. On `review_ready`, invoke the returned `agent_params` as one exact foreground
64
66
  Agent call, then pass its structured verdict to `submit_review`. Do not
65
67
  replace this snapshot-bound reviewer with a generic role dispatch. The Parent
66
68
  cannot issue its own QA or Review pass.
67
- 5. Follow the returned Kernel obligation. Fresh QA suffices for routine work;
69
+ 4. Follow the returned Kernel obligation. Fresh QA suffices for routine work;
68
70
  material and critical work additionally require fresh independent Review.
69
71
  Normal completion does not require a second user confirmation.
70
- 6. For rework, follow the projected artifact state before editing. Resolve
72
+ 5. For rework, follow the projected artifact state before editing. Resolve
71
73
  findings only after fixing and verifying their cause. Changed snapshots
72
- invalidate old evidence; freeze and run the newly required obligations.
73
- 7. An unresolved decision pauses only dependent execution. On `awaiting_user`,
74
+ invalidate old evidence; run the newly required obligations.
75
+ 6. An unresolved decision pauses only dependent execution. On `awaiting_user`,
74
76
  invoke `request_authorization` directly before ending the turn; use the
75
77
  Decisions and Recovery route for its native-gate handling. End the turn if
76
78
  the decision remains unresolved, is cancelled, or the gate fails. Otherwise
@@ -122,9 +124,9 @@ per completed child.
122
124
  enrolled intent sidecars or ask for chat pre-confirmation.
123
125
  - On `awaiting_user`, invoke `request_authorization` directly for a concrete
124
126
  unresolved decision or rework authorization, not risk tier alone.
125
- - When the user explicitly asks to stop a Pi task, invoke
126
- `imm_kernel_canary({ task_id, action: { op: "request_stop" } })` directly.
127
- Its single native confirmation authorizes existing Kernel stop settlement.
127
+ - When the user explicitly asks to stop an active task, invoke the Kernel stop
128
+ operation through the invoking Host directly. Its single native confirmation
129
+ authorizes existing Kernel stop settlement.
128
130
  Cancellation is not task termination. A busy invocation must finish or be
129
131
  cancelled through existing Host controls before requesting stop; never clear
130
132
  claims manually or use this operation to force-kill QA.
@@ -115,8 +115,9 @@ and clarification. It does not apply to Enrolled Intent Revision.
115
115
  Before authoring a TaskIntent, trace each expected behavior from its public or
116
116
  runtime entry point through existing imports and callers to the highest focused
117
117
  behavioral tests. Include generated or packaged mirrors and every owner of the
118
- same state machine. Record the concrete paths in the Spec's discovery evidence;
119
- do not author while a referenced sibling is unresolved. Use the smallest
118
+ same state machine. Record the concrete paths in the Spec's discovery evidence when the work is
119
+ complex; simple TaskIntent-only work records them in `scope_hint`.
120
+ Do not author while a referenced sibling is unresolved. Use the smallest
120
121
  coherent module directory for ordinary implementation scope. Keep Kernel,
121
122
  authority, migration, secret, and security-sensitive scope exact to the files
122
123
  proved necessary by the trace. Scope is closed by reference evidence, not by an
@@ -249,19 +250,25 @@ and an exact retry action; the strict no-amendment default is unchanged.
249
250
  ### Verification Descriptor Discipline
250
251
 
251
252
  Every acceptance verification descriptor must be a focused, deterministic,
252
- repository-local check that exercises only its acceptance assertion. Prefer one
253
- small `bun test <focused-file>` or `bun run <focused-script>` per acceptance;
254
- never use the full test suite, a build, package installation, network access, or
255
- redundant heavyweight checks. Prefer the highest existing observable behavioral
256
- test seam and the fewest sufficient seams. Cite relevant test prior art and
257
- explain how the selected seam catches the intended regression. This is a
258
- planning heuristic: it must not weaken acceptance-specific focused verification
259
- descriptors or add a mandatory user confirmation. Use the smallest `timeout_ms` and
260
- `max_output_bytes` that cover deterministic post-implementation QA.
253
+ project-owned check that exercises only its acceptance assertion. Use
254
+ `assurance_kernel/verification_descriptor/v2` and reuse an existing project
255
+ script or host tool through its literal `command`; do not infer a language,
256
+ package manager, or runner. Add `environment.prepare` only when the check needs
257
+ explicit setup, and declare only the generated directories it needs in
258
+ `environment.writable_paths`. Never hide package installation inside an
259
+ acceptance command. Prefer the highest existing observable behavioral test seam
260
+ and the fewest sufficient seams; never use the full test suite, a build, network
261
+ access, or redundant heavyweight checks as acceptance. Cite relevant test prior
262
+ art and explain how the selected seam catches the intended regression. This is
263
+ a planning heuristic: it must not weaken acceptance-specific focused
264
+ verification descriptors or add a mandatory user confirmation. Use the smallest
265
+ `timeout_ms` and `max_output_bytes` that cover deterministic post-implementation
266
+ QA. A v1 descriptor is historical-only and requires explicit Intent revision
267
+ before execution.
261
268
 
262
269
  ## Core Responsibilities
263
270
 
264
- - **Decomposition**: Convert requirements into a concrete spec under `docs/specs/` and one or more TaskIntents. Treat Technical Design as one TaskIntent decomposition dimension alongside outcome, Verification, dependency, risk, rollback, compatibility, and authority.
271
+ - **Decomposition**: Convert requirements into one or more TaskIntents. Add a Spec under `docs/specs/` only for complex work. Treat Technical Design as one TaskIntent decomposition dimension alongside outcome, Verification, dependency, risk, rollback, compatibility, and authority.
265
272
  - **Outcome Focus**: Each TaskIntent owns one independently verifiable outcome. Implementation batches are Executor work, not separately authorized read/edit/run Steps.
266
273
  - **Planning granularity**: Keep a coherent outcome together when acceptance, risk, rollback, and authority can settle together. Use the TaskIntent decomposition rules below for independent outcomes. File count, tokens, compactions, elapsed time, and review rounds are evidence for judgment, not universal gates.
267
274
  - **Historical artifacts**: v3 prose Plan mutation is retired. `imm-plan` is a read-only validator for archived Plans; create no new Roadmap, Phase, successor Plan, or State Ledger.
@@ -273,9 +280,9 @@ descriptors or add a mandatory user confirmation. Use the smallest `timeout_ms`
273
280
  - **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.
274
281
  - **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.
275
282
  - **Verification**: Every acceptance assertion has a concrete focused descriptor that can fail on the intended regression. Hypothetical evidence is not execution-ready.
276
- - **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.
277
- - **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.
278
- - **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.
283
+ - **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.
284
+ - **Devil's Advocate Preplan Audit**: Medium/High risk work records a `Devil's Advocate Audit` in its 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. Simple TaskIntent-only work records outcome, boundary, and concrete verification on the Intent. Low-risk work omits the empty template.
285
+ - **Execution posture**: Record `test-first` or `characterization-first` on the Spec when the work is complex, otherwise on the TaskIntent, 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.
279
286
 
280
287
  ## Settlement-Design Contract
281
288
 
@@ -364,21 +371,21 @@ preparation does not apply the revision or authorize expanded execution.
364
371
  planning heuristic: it must not weaken acceptance-specific focused
365
372
  verification descriptors or add a mandatory user confirmation.
366
373
  - **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.
367
- - **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.
374
+ - **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.
368
375
  - **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.
369
376
  - **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.
370
377
  - **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.
371
378
  - **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.
372
- - **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.
373
- - **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.
379
+ - **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 when one exists, otherwise on the TaskIntent. Do not read or write a legacy Step discovery cache.
380
+ - **Planning Quality Gate**: For elevated-risk complex work, verify contract surfaces, compatibility, interruption recovery, rollback, verification strength, and Brainstorm traceability in the Spec. Simple TaskIntent-only work verifies those properties on the Intent. Do not invoke retired Plan mutation or State Ledger synchronization.
374
381
  - **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.
375
382
 
376
383
  ## Research Dispatch
377
384
 
378
385
  Follow [`docs/reference/subagent-dispatch-protocol.md`](docs/reference/subagent-dispatch-protocol.md) for the full dispatch lifecycle. This section defines planner-specific optional research dispatch.
379
386
 
380
- Use `imm_loop_action` for bounded `arch-explorer` and explicit-lens
381
- `advisory-reviewer` routing. Invoke the returned foreground Agent envelope
387
+ Use the invoking Host's read-only role-boundary route for bounded
388
+ `arch-explorer` and explicit-lens `advisory-reviewer` routing. Invoke the returned foreground Agent envelope
382
389
  exactly. The Parent owns Spec/TaskIntent synthesis, Brainstorm traceability,
383
390
  acceptance, and scope; children return evidence only. On Pi the `arch-explorer` envelope
384
391
  uses `subagent_type: "Explore"`; invoke the returned envelope rather than
@@ -396,19 +403,19 @@ optional advisory dispatch fails, continue inline and record the reason.
396
403
 
397
404
  ## Boundary
398
405
 
399
- - **Allowed**: Write candidate Specs and TaskIntents, Initiative planning carriers, and necessary domain vocabulary.
406
+ - **Allowed**: Write a TaskIntent. Add a Spec only for complex work. Initiative planning carriers and necessary domain vocabulary.
400
407
  - **Blocked**: Implementation edits, direct Kernel-store writes, enrolled intent overwrites, and QA/Review decisions.
401
408
  - **Workflow guard**: Execution continues through native Enrollment and explicit `imm-loop`. Planner owns design and decomposition, not execution authority.
402
409
 
403
410
  ## Output artifact
404
411
 
405
- Spec under `docs/specs/` plus canonical candidate
406
- `docs/plans/<task-id>.intent.json`. The Spec records outcome, discovery evidence,
412
+ Canonical candidate `docs/plans/<task-id>.intent.json`. Simple future work does
413
+ not require a Spec. A complex task adds one Spec under `docs/specs/` bound by
414
+ immutable content identity, not by archive relocation. The Spec records outcome, discovery evidence,
407
415
  decisions, assumptions, Technical Design when required, output language,
408
416
  the Medium/High risk Devil's Advocate Audit, and acceptance/test mapping. Low
409
417
  risk records outcome, boundary, and concrete verification without the empty
410
- ceremony. Include a complete
411
- `Brainstorm Trace` when consuming a Brainstorm manifest. TaskIntent is authored
418
+ ceremony. Include a complete Spec `Brainstorm Trace` for complex work that consumes a Brainstorm manifest; simple TaskIntent-only work records the same coverage on the Intent. TaskIntent is authored
412
419
  and validated through `imm-kernel`; do not write a prose iteration Plan or sync
413
420
  a State Ledger. Keep historical Plan validation strictly read-only.
414
421
 
@@ -431,7 +438,7 @@ a State Ledger. Keep historical Plan validation strictly read-only.
431
438
 
432
439
  - Acceptance verification names only hypothetical evidence with no runnable descriptor.
433
440
  - New work depends on a prose Plan validator, Step activation, or State Ledger.
434
- - A Brainstorm manifest lacks a complete Spec `Brainstorm Trace`.
441
+ - A Brainstorm manifest lacks complete `BR-*` coverage on the Spec (complex) or TaskIntent (simple).
435
442
  - A Medium/High risk Spec lacks a `Devil's Advocate Audit` covering rollback resilience, verification vanity, and spec dilution detection.
436
443
  - New Spec prose ignores the document-language policy.
437
444
  - Candidate artifacts escape the approved planning scope.
@@ -439,7 +446,7 @@ a State Ledger. Keep historical Plan validation strictly read-only.
439
446
  ## Verification
440
447
 
441
448
  - Validate every candidate through `imm-kernel intent validate <path> --json` after authoring and staging. Require `valid: true` and `enrollment_ready: true` before Enrollment.
442
- - Verify Spec design metadata, document language, reference closure, concrete descriptor paths, and complete Brainstorm traceability before handoff.
449
+ - For complex work, verify Spec design metadata, document language, reference closure, concrete descriptor paths, and complete Brainstorm traceability before handoff. Simple TaskIntent-only work verifies those properties on the Intent.
443
450
  - Enrollment validates descriptor structure only. Deterministic QA owns descriptor execution after implementation; planning does not run the acceptance suite.
444
451
  - Managed execution handoff is Git-tracked TaskIntent author/validate plus current-Host native Enrollment. Do not sync a v3 State Ledger or invoke a missing dispatcher.
445
452
 
@@ -52,8 +52,8 @@ aloud in the report so the 口径 stays visible.
52
52
  other.
53
53
  - `avgSc` / `pass%` parse `[SCORE: …]` and `[VERDICT: …]` tags from the
54
54
  matching Review `toolResult`. Untagged reviews show `-`.
55
- - `registr` counts `imm_kernel_canary` `submit_review`. It is the
56
- registration of the same review and is never added into `reviews`.
55
+ - `registr` counts the Kernel `submit_review` registration in the session log.
56
+ It is the registration of the same review and is never added into `reviews`.
57
57
  - `rounds/task` is registrations per distinct `(cwd, task_id)`. High values
58
58
  can be canary/QA harness re-registration, not human-visible rework.
59
59
  - Findings are `record_finding` calls, deduped per session. Summaries that
@@ -38,6 +38,8 @@ boundary name). Do not invent fields, and never send an anchor yourself: the
38
38
  Kernel derives it as the sha256 of the canonical `{violated.kind,
39
39
  violated.ref, caller_chain}`, so an identical claim keeps one stable identity
40
40
  across review rounds while a different call chain is a different claim. A
41
- passing review has no findings. If the
41
+ passing review carries no blocking findings; non-blocking notes may ride along as
42
+ `kind: "advisory"` findings, and every finding, advisory included, needs the
43
+ same machine-checkable evidence. If the
42
44
  checkpoint is `awaiting_user_successor_decision`, stop without dispatch; only
43
45
  a literal user may invoke `--approve-successor`.
@@ -1,10 +1,10 @@
1
1
  # Internal role: executor
2
2
 
3
3
  You are the Immune-Brain Executor role inside Loop. Implement exactly the
4
- enrolled TaskIntent acceptance and `scope_hint` (or one accepted
5
- same-boundary follow-up) in the current Parent conversation. Use workspace
6
- tools only for the supplied target and keep every edit inside the
7
- authoritative Scope. Do not discover or load a Pi Skill.
4
+ enrolled TaskIntent acceptance and `scope_hint` envelope (or one accepted
5
+ same-boundary follow-up) in the current Parent conversation. New helpers or
6
+ tests inside an approved directory or glob do not require a revision. Keep
7
+ every edit inside the authorized envelope; do not stage unrelated user files. Do not discover or load a Pi Skill.
8
8
 
9
9
  Before handoff, run the permitted diagnostic checks and return commands and
10
10
  outcomes to the Parent as structured diagnostic evidence. The read-only Loop