immune-brain 5.3.0 → 5.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +4 -4
  2. package/README.zh-CN.md +4 -4
  3. package/package.json +2 -1
  4. package/plugins/immune-brain/.claude-plugin/plugin.json +1 -1
  5. package/plugins/immune-brain/.pi-extension/imm-canary-enroll.ts +54 -70
  6. package/plugins/immune-brain/.pi-extension/imm-canary-work.ts +163 -28
  7. package/plugins/immune-brain/.pi-extension/imm-unattended-batch.ts +71 -10
  8. package/plugins/immune-brain/.pi-extension/pi-canary-tool-failure.ts +1 -1
  9. package/plugins/immune-brain/.pi-extension/pi-run-continuation.ts +161 -0
  10. package/plugins/immune-brain/agents/immune-brain-reviewer.md +26 -2
  11. package/plugins/immune-brain/dist/BASELINE.md +13 -1
  12. package/plugins/immune-brain/dist/claude/mcp-server.mjs +16130 -12734
  13. package/plugins/immune-brain/dist/docs/reference/code-quality-guard.md +3 -1
  14. package/plugins/immune-brain/dist/docs/reference/immune-brain-config.md +41 -1
  15. package/plugins/immune-brain/dist/docs/reference/planning-quality-gate.md +1 -1
  16. package/plugins/immune-brain/dist/imm-planner.md +57 -16
  17. package/plugins/immune-brain/dist/imm-run-batch.md +398 -0
  18. package/plugins/immune-brain/dist/imm-run.md +89 -344
  19. package/plugins/immune-brain/dist/role-prompts/code-review.md +26 -2
  20. package/plugins/immune-brain/dist/role-prompts/executor.md +35 -10
  21. package/plugins/immune-brain/hooks/hooks.json +21 -1
  22. package/plugins/immune-brain/runtime/assurance/coordinator.ts +203 -13
  23. package/plugins/immune-brain/runtime/assurance/delivery_workspace.ts +2 -1
  24. package/plugins/immune-brain/runtime/assurance/enrollment_git_base.ts +99 -14
  25. package/plugins/immune-brain/runtime/assurance/phase_entry.ts +1 -7
  26. package/plugins/immune-brain/runtime/assurance/qa.ts +126 -43
  27. package/plugins/immune-brain/runtime/assurance/qa_findings.ts +8 -0
  28. package/plugins/immune-brain/runtime/assurance/review_evidence.ts +48 -0
  29. package/plugins/immune-brain/runtime/assurance/run_continuation.ts +284 -0
  30. package/plugins/immune-brain/runtime/assurance/verdict_authority.ts +46 -4
  31. package/plugins/immune-brain/runtime/assurance/verification.ts +83 -35
  32. package/plugins/immune-brain/runtime/assurance/workflow_autocommit.ts +222 -0
  33. package/plugins/immune-brain/runtime/claude/interaction.ts +11 -2
  34. package/plugins/immune-brain/runtime/claude/kernel_ports.ts +199 -48
  35. package/plugins/immune-brain/runtime/claude/lane_guard.ts +8 -15
  36. package/plugins/immune-brain/runtime/claude/mcp_server.ts +105 -9
  37. package/plugins/immune-brain/runtime/claude/run_continuation.ts +274 -0
  38. package/plugins/immune-brain/runtime/commands/kernel.ts +41 -103
  39. package/plugins/immune-brain/runtime/github_issue_tracker.ts +60 -2
  40. package/plugins/immune-brain/runtime/kernel/application.ts +4 -1
  41. package/plugins/immune-brain/runtime/kernel/assurance_projection.ts +103 -20
  42. package/plugins/immune-brain/runtime/kernel/canary_application.ts +57 -7
  43. package/plugins/immune-brain/runtime/kernel/completion.ts +28 -4
  44. package/plugins/immune-brain/runtime/kernel/enrollment.ts +48 -8
  45. package/plugins/immune-brain/runtime/kernel/intent.ts +169 -104
  46. package/plugins/immune-brain/runtime/kernel/reducer.ts +136 -6
  47. package/plugins/immune-brain/runtime/kernel/risk_floor.ts +286 -0
  48. package/plugins/immune-brain/runtime/kernel/storage_layout_migration.ts +83 -1
  49. package/plugins/immune-brain/runtime/kernel/storage_paths.ts +1 -1
  50. package/plugins/immune-brain/runtime/kernel/types.ts +49 -3
  51. package/plugins/immune-brain/runtime/kernel/validation.ts +147 -7
  52. package/plugins/immune-brain/runtime/loop_contract.ts +5 -0
  53. package/plugins/immune-brain/runtime/plan_core.ts +15 -8
  54. package/plugins/immune-brain/runtime/plugin_source_skew.ts +58 -0
  55. package/plugins/immune-brain/runtime/plugin_version.ts +1 -1
  56. package/plugins/immune-brain/runtime/prompts/code-review.md +26 -2
  57. package/plugins/immune-brain/runtime/prompts/executor.md +35 -10
  58. package/plugins/immune-brain/runtime/unattended/batch_delegation.ts +5 -3
  59. package/plugins/immune-brain/runtime/unattended/batch_disposition.ts +40 -10
  60. package/plugins/immune-brain/runtime/unattended/batch_final_verification.ts +57 -3
  61. package/plugins/immune-brain/runtime/unattended/batch_git.ts +424 -66
  62. package/plugins/immune-brain/runtime/unattended/batch_integration.ts +2 -1
  63. package/plugins/immune-brain/runtime/unattended/batch_kernel_port.ts +13 -0
  64. package/plugins/immune-brain/runtime/unattended/batch_lanes.ts +43 -24
  65. package/plugins/immune-brain/runtime/unattended/batch_plan.ts +6 -2
  66. package/plugins/immune-brain/runtime/unattended/batch_preflight.ts +102 -41
  67. package/plugins/immune-brain/runtime/unattended/batch_reasons.ts +9 -3
  68. package/plugins/immune-brain/runtime/unattended/batch_reconfirmation.ts +9 -9
  69. package/plugins/immune-brain/runtime/unattended/batch_runner.ts +90 -32
  70. package/plugins/immune-brain/runtime/unattended/batch_state.ts +102 -4
  71. package/plugins/immune-brain/runtime/unattended/parent_delivery_consolidation.ts +248 -0
  72. package/plugins/immune-brain/runtime/workspace_scope.ts +126 -18
  73. package/plugins/immune-brain/skills/BASELINE.md +13 -1
  74. package/plugins/immune-brain/skills/imm-planner/SKILL.md +5 -0
  75. package/plugins/immune-brain/skills/imm-run/SKILL.md +12 -8
@@ -54,5 +54,7 @@ There are no hard line-count, parameter-count, nesting, complexity, boolean-para
54
54
  - `blocking`: a concrete correctness, security, error-state, dependency/API authenticity, test-integrity, or unauthorized-behavior defect.
55
55
  - `advisory`: a concrete task-local maintenance risk worth fixing in this change, with an affected path and failure rationale.
56
56
  - Pure formatting, naming preference, line count, parameter count, design taste, and hypothetical extensibility produce no finding.
57
- - A passing Review has no findings. Do not turn low-value suggestions into `rework` merely to preserve them.
57
+ - A `pass` may carry advisory notes: they are archived on the review attestation and never require action. A `rework` contains only blocking findings, at least one; a note that blocks nothing is an advisory finding on a `pass`, never on `rework`. Do not turn low-value suggestions into `rework` merely to preserve them.
58
+ - Every blocking finding states its `evidence.trigger` as a concrete input or state and the observable wrong result it produces. A finding that cannot name the wrong result is not blocking.
59
+ - Judge against the threat model and supported environment declared in the Spec or TaskIntent goal. A defect that needs an attacker, input source, repository format, encoding, or platform outside that declaration is advisory. When nothing is declared, assume inputs come from the repository's own tooling and the user's trusted workspace. `security_boundary` means a security, data-loss, or authority boundary the change actually crosses.
58
60
  - Findings identify the affected path and risk. Review reports risks and verification criteria; it does not edit code or generate patches.
@@ -78,7 +78,47 @@ runner reads none of them. None has a built-in default.
78
78
  them each Executor Host uses its own default.
79
79
 
80
80
  Lane-mode agents only create: they close no tab, stop no session and remove no
81
- Lane. The full contract is `plugins/immune-brain/dist/imm-run.md#lane-preferences`.
81
+ Lane. The full contract is `plugins/immune-brain/dist/imm-run-batch.md#lane-preferences`.
82
+
83
+ ## Risk Floor
84
+
85
+ The paths that force a higher task risk are declared by the project in one
86
+ tracked file, `.imm/risk-floor.json`. It is not a preference an Agent reads: the
87
+ Kernel enforces it, so it does not live in `AGENTS.md` or `CLAUDE.md`.
88
+
89
+ ```json
90
+ {
91
+ "contract": "assurance_kernel/risk_floor/v1",
92
+ "material": { "paths": ["src/auth"], "changed_only": ["db/migrations"] },
93
+ "critical": { "paths": ["infra/prod"], "changed_only": [] }
94
+ }
95
+ ```
96
+
97
+ - `paths` raises a task whose `scope_hint` can reach the prefix, including
98
+ through a glob, or whose changed paths sit beneath it.
99
+ - `changed_only` raises a task only through its changed paths, so a scope that
100
+ merely names the prefix keeps its declared risk.
101
+ - Every entry is a literal, normalized, project-relative path prefix with
102
+ forward slashes and no wildcard. Both tiers and both lists are optional.
103
+ - A declared risk is only ever raised, never lowered.
104
+
105
+ The reader fails closed:
106
+
107
+ - No file means no floor. Every task keeps the risk its TaskIntent declares.
108
+ - A file that is not valid JSON, has an unknown field or a wrong type, is not a
109
+ regular file, exceeds 64 KiB, or cannot be read makes every task of the
110
+ project `critical`.
111
+ - A file with staged, unstaged or untracked changes is treated the same way
112
+ until it is committed, so an edit made beside a task cannot lower that task's
113
+ floor.
114
+ - `.imm/risk-floor.json` itself is always `critical`: a task whose scope can
115
+ reach it, or that changes it, is `critical` whatever the file says.
116
+
117
+ `imm-kernel inspect --json` reports the prefixes in force as
118
+ `risk.floor_prefixes` and the reason an untrusted declaration was refused as
119
+ `risk.floor_invalid`. A TaskRecord keeps the risk it was enrolled with; changing
120
+ the declaration does not re-grade a task that is already enrolled. ADR 0023
121
+ records the decision.
82
122
 
83
123
  ## Other Preferences
84
124
 
@@ -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. For a multi-TaskIntent Initiative only, require each Slice to state what is observable and verifiable when that Slice alone has landed, and no acceptance may require another unfinished Slice's work to pass; a Slice with no such statement is a horizontal layer slice and is re-cut. Record the exception for a wide mechanical refactor whose blast radius prevents any green vertical slice, with the rationale and a final integrate-and-verify Slice that the batches block.
26
- - **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.
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. Only a Medium/High risk Spec whose design requires a diagram records `**Diagram decision**: required` and a non-empty `**Diagram reason**:`, and it must include Mermaid. A Spec that needs no diagram records neither field and does not explain the omission. 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`. Every Spec decision and every acceptance names exactly one source — an upstream `BR-*` ID, repository evidence, or a delegated technical choice — with or without an upstream manifest, and a user-owned decision that names no source is a defect the Planner removes or returns for clarification. A Spec for work with a user-observable change has a `User scenarios` section; each scenario keeps its upstream `BR-SCN-<n>` ID, or on direct entry is confirmed in clarification and recorded as Spec-local `SCN-<n>`, is tagged `automated` with at least one acceptance ID or `manual` with the reason it cannot be automated, and the mapping is one-way. In a multi-TaskIntent Initiative a scenario belongs to exactly one Slice, the one that first makes it observable. `BR-SCN-*` items fall under the existing handoff completeness check, a scenario with no source is a defect, and `no user-visible change` requires a recorded reason.
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.
@@ -12,8 +12,8 @@ This skill adheres to the **[BASELINE.md](BASELINE.md)**.
12
12
  `imm-planner` starts on the user's request for a Spec, Plan, or TaskIntent for a
13
13
  repository change, by slash command or in natural language. A request that asks
14
14
  for none of these stays host-native, and `imm-run` starts only from a
15
- literal-user entry. A model-entered Planner outside an enrolled task ends the
16
- session's run entry, so Enrollment needs a fresh `imm-run` entry.
15
+ literal-user entry. A model-entered Planner leaves the session's run entry
16
+ unchanged; a literal `imm-planner` entry ends it.
17
17
  An active Assurance projection remains authoritative and is resumed only through
18
18
  an explicit `imm-run` entry; Planner entry owns planning only.
19
19
 
@@ -91,6 +91,13 @@ resolved wrapper and use the resolved `imm-kernel` wrapper for every Kernel
91
91
  command below. Do not assume either bare command is available on shell `PATH`.
92
92
  Then route deterministically:
93
93
 
94
+ When `intent author` reports `layout_migration_required`, run the resolved
95
+ `imm-kernel migrate --storage-layout` wrapper yourself and retry authoring after
96
+ its `ready` result, without interrupting the user. A pending migration diff is
97
+ committed automatically. On a Git failure, repair the reported precondition
98
+ and retry; `recovery_required`, `migration_blocked_active` and `invalid` remain
99
+ blocking layout conditions.
100
+
94
101
  - an active Kernel claim remains with `imm-run` for foreground Kernel Tool
95
102
  coordination, except a Loop-requested revision follows Enrolled Intent Revision
96
103
  below to prepare a non-authoritative proposal for that same owner;
@@ -179,8 +186,10 @@ integration assertions; for runtime changes, include the generated Claude bundle
179
186
  when it inlines that runtime and the required release changeset. Resolve these
180
187
  paths from the build and test references before Enrollment. Record the concrete paths in the Spec's discovery evidence when the work is
181
188
  complex; simple TaskIntent-only work records them in `scope_hint`.
182
- Do not author while a referenced sibling is unresolved. Use the smallest
183
- coherent module directory for ordinary implementation scope. Keep Kernel,
189
+ Do not author while a referenced sibling is unresolved. Default ordinary
190
+ implementation scope to the smallest coherent module directory: name the
191
+ concrete files it needs, so a sibling the work later needs is a same-directory
192
+ addition the Loop owner submits itself with `revise_intent` (ADR 0021). Keep Kernel,
184
193
  authority, migration, secret, and security-sensitive scope exact to the files
185
194
  proved necessary by the trace. Scope is closed by reference evidence, not by an
186
195
  exhaustive filename guess.
@@ -377,16 +386,18 @@ the strict no-amendment default is unchanged.
377
386
  Every acceptance verification descriptor must be a focused, deterministic,
378
387
  project-owned check that exercises only its acceptance assertion. Use
379
388
  `assurance_kernel/verification_descriptor/v2` and reuse an existing project
380
- script or host tool through its literal `command`; do not infer a language,
381
- package manager, or runner. Add `environment.prepare` only when the check needs
389
+ script or host tool through its literal `command`. Write a compound command as
390
+ `executable: "sh"` with `argv: ["-c", "<line>"]`; the exit status of that line
391
+ decides the result. Add `environment.prepare` only when the check needs
382
392
  explicit setup, and declare only the generated directories it needs in
383
393
  `environment.writable_paths`. Never hide package installation inside an
384
394
  acceptance command. For every descriptor, identify whether its executable is
385
395
  provided by the QA host or by tracked delivery content, where every dependency
386
- comes from in the disposable delivery, what explicit setup is required, and
387
- which declared writable paths that setup or check creates. A dependency found
388
- only in the Planner's live worktree, including an absolute local `node_modules`
389
- path, is not delivery provenance. Prefer the highest existing observable behavioral test seam
396
+ comes from, and what explicit setup is required. QA runs in the task's working
397
+ directory after an equality check with the frozen snapshot, so a dependency
398
+ already present in that working directory, such as an installed `node_modules`,
399
+ is valid provenance. `environment.writable_paths` is still parsed and no longer
400
+ restricts where a command may write. Prefer the highest existing observable behavioral test seam
390
401
  and the fewest sufficient seams; never use the full test suite, a build, network
391
402
  access, or redundant heavyweight checks as acceptance. Cite relevant test prior
392
403
  art and explain how the selected seam catches the intended regression. This is
@@ -412,9 +423,10 @@ own duration evidence. These are workflow-quality input patterns, not requests
412
423
  to edit the original applications that motivated the audit.
413
424
 
414
425
  **Environment and prerequisite discipline.** A descriptor that needs a
415
- prerequisite states its provenance and how it is obtained. Preparation must not
416
- hide a download, credential use, production write, or system change: authorize
417
- it explicitly, or redesign the check to avoid it. Require cleanup on failure and
426
+ prerequisite states its provenance and how it is obtained. QA commands run with
427
+ the host process environment, and the Kernel does not judge how dependencies are
428
+ obtained. Preparation must not hide a production write or system change:
429
+ authorize it explicitly, or redesign the check to avoid it. Require cleanup on failure and
418
430
  interruption, and restoration of any explicitly authorized setting. An absent
419
431
  dependency, a missing simulator, or a preparation failure is a failed check, not
420
432
  a pass. Zero matched checks and skipped required checks are failures: a required
@@ -424,6 +436,26 @@ human judgment of motion quality; a descriptor can assert only the automated
424
436
  half. Textual presence in a contract string is not proof that a provider obeyed
425
437
  it, and structural Enrollment readiness is not proof that a descriptor executed.
426
438
 
439
+ **Threat model and supported environment.** Every Spec whose design takes
440
+ external input states one `Threat model and supported environment` line: the
441
+ input's trust level, the adversary if any, and the supported Git object formats,
442
+ encodings, and platforms. `None beyond the repository's own tooling` is a valid
443
+ declaration; an omitted line is not. Acceptance and Review are judged against
444
+ that declaration, so an input or environment it excludes is not an acceptance
445
+ case.
446
+
447
+ **Enumerated negative cases.** Write acceptance as the concrete negative cases
448
+ the slice must reject, each naming its input and its expected rejection. Never
449
+ write an absolute clause such as `any missing, malformed, or unsafe input cannot
450
+ succeed`: it has no bound a descriptor can exercise and invites unbounded
451
+ Review rounds. Name the cases the slice handles, such as an empty value, a
452
+ truncated record, or a path outside the scope, and pin each in a test.
453
+
454
+ **Focused descriptors.** A descriptor lists the explicit test files that
455
+ exercise its acceptance, such as `bun test tests/<seam>.test.ts`, never a whole
456
+ suite or an unscoped test command, so an unrelated failure cannot fail an
457
+ acceptance.
458
+
427
459
  ## Core Responsibilities
428
460
 
429
461
  - **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.
@@ -434,10 +466,10 @@ it, and structural Enrollment readiness is not proof that a descriptor executed.
434
466
  - **Risk-Triggered Exploration**: Before authoring a TaskIntent, resolve only unknowns that could change scope, design, or verification using targeted read-only probes. Internal `arch-explorer` and explicit-lens `advisory-reviewer` roles return evidence without writing the Spec, TaskIntent, or workflow state. Stop probing when outcome, scope, and verification are concrete. Do not use retired Plan termination flags to classify discovery failures.
435
467
  - **Simplicity**: Apply the BASELINE Workflow Activation gate first. Non-mutating host-native work creates no Planner artifact. The user's request for a Spec, Plan, or TaskIntent, by slash command or in natural language, starts this Planner phase; other host input stays host-native. Create one coherent outcome instead of expanding ceremony.
436
468
  - **Design-Depth Classification**: Classify change design risk with the smallest sufficient tier: **Low risk** (copy, configuration, trivial rename, or contained local fix) may omit a separate Technical Design; **Medium risk** (non-trivial single-module behavior or internal contract) records affected components, decisions, invariants, failure behavior, and verification implications; **High risk** (cross-module/API/data-flow/state-machine, security, migration, concurrency, architecture ownership, cross-runtime/package-contract, or persisted-state work) records boundaries, interfaces or flow, alternatives, invariants, rollback/compatibility, and verification implications. Medium and High risk require Technical Design in the Spec. Do not classify a change as Low risk when it has a contract, ownership, security, persistence, compatibility, or multi-component concern. Every new or revised Spec records `**Design risk**: Low|Medium|High` with an adjacent rationale.
437
- - **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.
469
+ - **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. 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.
438
470
  - **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.
439
471
  - **TaskIntent decomposition**: Use the selected design boundaries as one retain/split criterion for TaskIntent slices. Keep work in one TaskIntent when the selected views describe one coherent executable slice with shared acceptance, risk treatment, rollback, and authority. Split a successor TaskIntent when a service boundary, state-machine owner, migration/compatibility boundary, independently promotable layer, or sequence dependency needs independent verification, rollback, authorization, or settlement. Do not split merely because the design names several layers, files, or services. Treat trust-boundary changes as the same kind of decomposition evidence: a TaskIntent should normally change one primary trust-boundary invariant, while merely traversing several boundaries or updating both sides of one end-to-end authority chain does not require a split. Split separate trust invariants when they can be independently verified, rolled back, authorized, migrated, or settled. Keep multiple trust-boundary changes together only when they form one atomic security outcome and splitting would create an unsafe or unusable intermediate state; record that reason in the Spec. This is Planner judgment, not a TaskIntent schema field or an Enrollment counting rule. This does not revive prose Plan, Roadmap, or Phase authority. For a multi-TaskIntent Initiative only, each Slice also states what is observable and verifiable when that Slice alone has landed, and no acceptance may require another unfinished Slice's work to pass; the Initiative review table's existing `result` column carries that statement. A Slice with no such result is a horizontal layer slice and is re-cut. Exception: a wide mechanical refactor whose blast radius prevents any green vertical slice may be batched, with the rationale recorded and the batches blocking one final integrate-and-verify Slice.
440
- - **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.
472
+ - **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. Only a Medium/High risk Spec whose design requires a diagram records `**Diagram decision**: required` and a non-empty `**Diagram reason**:`, and it must have a Mermaid block. A Spec that needs no diagram records neither field and does not explain the omission. Low-risk Specs omit the empty ceremony and record neither field.
441
473
  - **Verification**: Every acceptance assertion has a concrete focused descriptor that can fail on the intended regression, and every named invariant has positive, negative, and bound controls at an observable seam. Hypothetical evidence is not execution-ready; a check that matches zero tests, is skipped, or lacks its prerequisite is a failure rather than a pass.
442
474
  - **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.
443
475
  - **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.
@@ -504,11 +536,19 @@ changes in the proposal. Preserve the prior on-disk sidecars until Kernel applie
504
536
  the revision; do not overwrite the enrolled TaskIntent, invoke the new-intent
505
537
  author command, or request a second Enrollment.
506
538
 
507
- Return the proposal to the current Loop owner for Kernel `revise_intent` or,
539
+ A same-directory file addition is not a Planner request: the Loop owner submits
540
+ it directly (ADR 0021). Return the proposal to the current Loop owner for Kernel `revise_intent` or,
508
541
  when breaking, `approve_breaking_intent_revision` with the complete next intent.
509
542
  The native gate is the single user decision for a breaking revision; candidate
510
543
  preparation does not apply the revision or authorize expanded execution.
511
544
 
545
+ Revision ownership: the Loop owner prepares a scope or acceptance revision in
546
+ the executing session, through Kernel `revise_intent` or
547
+ `approve_breaking_intent_revision`. A Planner session is for a change of goal,
548
+ bound Spec design, or decomposition, and returns any other proposal to the
549
+ executing session instead of editing the task's files. No Host refuses a file
550
+ edit because of the session's entry.
551
+
512
552
  A revision is warranted only when the goal, the `scope_hint`, or a user-visible
513
553
  commitment changes. A finding whose defect lies inside the current goal and scope
514
554
  is ordinary rework for the Loop, not a revision request: decline to prepare one
@@ -631,6 +671,7 @@ a State Ledger. Keep historical Plan validation strictly read-only.
631
671
  ## Red Flags
632
672
 
633
673
  - Acceptance verification names only hypothetical evidence with no runnable descriptor.
674
+ - A Spec with external input omits its `Threat model and supported environment` line, acceptance uses an absolute any-malformed-input clause instead of enumerated negative cases, or a descriptor runs a whole suite instead of focused test files.
634
675
  - An acceptance descriptor names no negative or bound control for its invariant, or its required prerequisite (dependency, simulator, preparation) is absent and still counted as a pass.
635
676
  - A required check matches zero tests or is skipped and the run is reported as passing.
636
677
  - New work depends on a prose Plan validator, Step activation, or State Ledger.