immune-brain 2.8.2

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 (101) hide show
  1. package/README.md +239 -0
  2. package/README.zh-CN.md +239 -0
  3. package/package.json +84 -0
  4. package/plugins/immune-brain/.pi-extension/imm-canary-enroll.ts +666 -0
  5. package/plugins/immune-brain/.pi-extension/imm-canary-work.ts +1622 -0
  6. package/plugins/immune-brain/.pi-extension/package.json +11 -0
  7. package/plugins/immune-brain/.pi-extension/pi-canary-assurance-progression.ts +711 -0
  8. package/plugins/immune-brain/.pi-extension/pi-canary-assurance.ts +154 -0
  9. package/plugins/immune-brain/.pi-extension/pi-canary-interaction.ts +349 -0
  10. package/plugins/immune-brain/.pi-extension/pi-canary-invocations.ts +90 -0
  11. package/plugins/immune-brain/.pi-extension/pi-canary-native-review.ts +214 -0
  12. package/plugins/immune-brain/.pi-extension/pi-canary-qa-findings.ts +50 -0
  13. package/plugins/immune-brain/.pi-extension/pi-canary-review-bundle.ts +262 -0
  14. package/plugins/immune-brain/.pi-extension/pi-canary-tool-failure.ts +28 -0
  15. package/plugins/immune-brain/.pi-extension/pi-canary-verification.ts +237 -0
  16. package/plugins/immune-brain/.pi-extension/runtime-stub.ts +414 -0
  17. package/plugins/immune-brain/.pi-extension/tsconfig.json +20 -0
  18. package/plugins/immune-brain/bin/imm-kernel +4 -0
  19. package/plugins/immune-brain/bin/imm-plan +4 -0
  20. package/plugins/immune-brain/bin/imm-pr-diag +230 -0
  21. package/plugins/immune-brain/bin/imm-retire-stale-wrapper +4 -0
  22. package/plugins/immune-brain/bin/imm-retired +4 -0
  23. package/plugins/immune-brain/bin/imm-tracker +4 -0
  24. package/plugins/immune-brain/dist/BASELINE.md +138 -0
  25. package/plugins/immune-brain/dist/docs/reference/HANDOFF-template.md +122 -0
  26. package/plugins/immune-brain/dist/docs/reference/design-contract-audit-rubric.md +149 -0
  27. package/plugins/immune-brain/dist/docs/reference/design-contract-review-checklist.md +55 -0
  28. package/plugins/immune-brain/dist/docs/reference/i18n-review-checklist.md +110 -0
  29. package/plugins/immune-brain/dist/docs/reference/immune-brain-config.md +52 -0
  30. package/plugins/immune-brain/dist/docs/reference/planning-artifact-retention.md +94 -0
  31. package/plugins/immune-brain/dist/docs/reference/planning-quality-gate.md +44 -0
  32. package/plugins/immune-brain/dist/docs/reference/subagent-dispatch-protocol.md +105 -0
  33. package/plugins/immune-brain/dist/docs/reference/ux-heuristic-checklist.md +131 -0
  34. package/plugins/immune-brain/dist/imm-brainstorm.md +140 -0
  35. package/plugins/immune-brain/dist/imm-doc-prune.md +137 -0
  36. package/plugins/immune-brain/dist/imm-loop.md +158 -0
  37. package/plugins/immune-brain/dist/imm-planner.md +387 -0
  38. package/plugins/immune-brain/dist/imm-pr-fix.md +71 -0
  39. package/plugins/immune-brain/dist/registry.yaml +49 -0
  40. package/plugins/immune-brain/dist/role-prompts/advisory-reviewer.md +16 -0
  41. package/plugins/immune-brain/dist/role-prompts/arch-explorer.md +14 -0
  42. package/plugins/immune-brain/dist/role-prompts/code-review.md +15 -0
  43. package/plugins/immune-brain/dist/role-prompts/compounder.md +20 -0
  44. package/plugins/immune-brain/dist/role-prompts/executor.md +13 -0
  45. package/plugins/immune-brain/dist/role-prompts/pr-fix.md +81 -0
  46. package/plugins/immune-brain/dist/role-prompts/qa.md +23 -0
  47. package/plugins/immune-brain/dist/role-prompts/test-fixer.md +3 -0
  48. package/plugins/immune-brain/dist/role-prompts/ui-review.md +14 -0
  49. package/plugins/immune-brain/runtime/authority_commit_receipts.ts +716 -0
  50. package/plugins/immune-brain/runtime/canonical_json.ts +19 -0
  51. package/plugins/immune-brain/runtime/commands/kernel.ts +1160 -0
  52. package/plugins/immune-brain/runtime/github_issue_tracker.ts +1009 -0
  53. package/plugins/immune-brain/runtime/kernel/application.ts +300 -0
  54. package/plugins/immune-brain/runtime/kernel/assurance_projection.ts +284 -0
  55. package/plugins/immune-brain/runtime/kernel/authority_port.ts +208 -0
  56. package/plugins/immune-brain/runtime/kernel/automatic_observations.ts +451 -0
  57. package/plugins/immune-brain/runtime/kernel/backend_claim.ts +197 -0
  58. package/plugins/immune-brain/runtime/kernel/canary_application.ts +507 -0
  59. package/plugins/immune-brain/runtime/kernel/canary_eligibility.ts +73 -0
  60. package/plugins/immune-brain/runtime/kernel/completion.ts +160 -0
  61. package/plugins/immune-brain/runtime/kernel/enrollment.ts +194 -0
  62. package/plugins/immune-brain/runtime/kernel/enrollment_authority.ts +123 -0
  63. package/plugins/immune-brain/runtime/kernel/index.ts +29 -0
  64. package/plugins/immune-brain/runtime/kernel/intent.ts +563 -0
  65. package/plugins/immune-brain/runtime/kernel/intent_token_registry.ts +80 -0
  66. package/plugins/immune-brain/runtime/kernel/legacy.ts +299 -0
  67. package/plugins/immune-brain/runtime/kernel/legacy_audit.ts +153 -0
  68. package/plugins/immune-brain/runtime/kernel/observation.ts +395 -0
  69. package/plugins/immune-brain/runtime/kernel/pi_canary_prepare.ts +169 -0
  70. package/plugins/immune-brain/runtime/kernel/readiness.ts +282 -0
  71. package/plugins/immune-brain/runtime/kernel/readiness_evidence.ts +132 -0
  72. package/plugins/immune-brain/runtime/kernel/reducer.ts +624 -0
  73. package/plugins/immune-brain/runtime/kernel/storage.ts +1780 -0
  74. package/plugins/immune-brain/runtime/kernel/storage_layout_migration.ts +791 -0
  75. package/plugins/immune-brain/runtime/kernel/storage_paths.ts +492 -0
  76. package/plugins/immune-brain/runtime/kernel/types.ts +295 -0
  77. package/plugins/immune-brain/runtime/kernel/validation.ts +963 -0
  78. package/plugins/immune-brain/runtime/loop_contract.ts +362 -0
  79. package/plugins/immune-brain/runtime/managed_task_routing_policy.ts +462 -0
  80. package/plugins/immune-brain/runtime/plan_core.ts +1053 -0
  81. package/plugins/immune-brain/runtime/prompts/advisory-reviewer.md +16 -0
  82. package/plugins/immune-brain/runtime/prompts/arch-explorer.md +14 -0
  83. package/plugins/immune-brain/runtime/prompts/code-review.md +15 -0
  84. package/plugins/immune-brain/runtime/prompts/compounder.md +20 -0
  85. package/plugins/immune-brain/runtime/prompts/executor.md +13 -0
  86. package/plugins/immune-brain/runtime/prompts/pr-fix.md +81 -0
  87. package/plugins/immune-brain/runtime/prompts/qa.md +23 -0
  88. package/plugins/immune-brain/runtime/prompts/test-fixer.md +3 -0
  89. package/plugins/immune-brain/runtime/prompts/ui-review.md +14 -0
  90. package/plugins/immune-brain/runtime/role_prompt_bridge.ts +160 -0
  91. package/plugins/immune-brain/runtime/v4_runtime.ts +295 -0
  92. package/plugins/immune-brain/runtime/verification_descriptor.ts +162 -0
  93. package/plugins/immune-brain/runtime/workspace_scope.ts +623 -0
  94. package/plugins/immune-brain/skills/.ignore +1 -0
  95. package/plugins/immune-brain/skills/BASELINE.md +138 -0
  96. package/plugins/immune-brain/skills/imm-brainstorm/SKILL.md +66 -0
  97. package/plugins/immune-brain/skills/imm-doc-prune/SKILL.md +11 -0
  98. package/plugins/immune-brain/skills/imm-loop/SKILL.md +52 -0
  99. package/plugins/immune-brain/skills/imm-planner/SKILL.md +221 -0
  100. package/plugins/immune-brain/skills/imm-pr-fix/SKILL.md +10 -0
  101. package/plugins/immune-brain/skills/registry.yaml +49 -0
@@ -0,0 +1,138 @@
1
+ # Immune-Brain Skill Baseline
2
+
3
+ ## Shared Guards
4
+
5
+ - Load detailed workflow text from `dist/` only on invocation.
6
+ - Ask only when missing information changes outcome or risk.
7
+ - Keep edits inside the user-requested Direct scope or the active Managed step boundary.
8
+ - Record reproducible evidence before reporting closure.
9
+ - Use shallow discovery first.
10
+ - Lead with conclusion, evidence, and Next Action.
11
+ - Advisory roles do not implement; Managed execution roles do not close QA.
12
+ - An explicit Managed Skill entry stops host-native mutation and routes scope changes to `imm-planner`; Managed execution remains inside its accepted boundary.
13
+
14
+ ## Workflow Activation
15
+
16
+ Ordinary host input stays host-native and does not run natural-language Managed
17
+ routing. A new Managed workflow starts only from explicit `imm-brainstorm`,
18
+ `imm-planner`, or `imm-loop` Skill entry.
19
+
20
+ 1. **Continue an existing Managed owner explicitly**: an active Assurance
21
+ projection, TaskIntent, TaskRecord, reviewer `follow_up`, or other nonterminal
22
+ Managed owner remains authoritative; the user resumes it with `imm-loop`.
23
+ 2. **Start explicitly**: the selected Immune-Brain Skill owns its planning or
24
+ coordination work. It creates only requested artifacts and their required
25
+ parent directories; it does not install project-wide contract files.
26
+ 3. **Preserve authority**: Planner output is a candidate for later literal-user
27
+ Enrollment, and Fast-Track preserves TaskIntent scope, Enrollment, QA,
28
+ Review, authorization, and completion boundaries.
29
+
30
+ Do not inspect or mutate Immune-Brain state merely because ordinary host input
31
+ contains a mutation verb. File count, local verifier count, ordinary retries,
32
+ read-only advisors, and unrelated dirty files do not change these boundaries.
33
+
34
+ ### Non-Mutating Host Path
35
+
36
+ Read-only and explicit no-modification requests stay with the ordinary host
37
+ agent. This path creates no Spec, Plan, TaskIntent, TaskRecord, State Ledger,
38
+ acceptance evidence, QA job, mandatory Review job, HANDOFF update, or
39
+ Compounder state. It may explain, inspect, or review without Enrollment.
40
+
41
+ ### Managed Execution And Completion
42
+
43
+ The matching Managed owner drives execution, evidence, QA, Review, and
44
+ completion without switching to a non-authoritative path. Scope expansion
45
+ returns to `imm-planner`; an enrolled task resumes through `imm-loop` from the
46
+ current Assurance projection. Do not create or mutate workflow state while
47
+ classifying a non-mutating request.
48
+
49
+ Stage only explicit task-owned paths. Never use `git add .` or `git add -A` in a dirty worktree.
50
+
51
+ ### Host Confirmation Boundary
52
+
53
+ Require exact host confirmation only for privileged effects:
54
+
55
+ - publish, release, deployment, or remote-system mutation;
56
+ - destructive or irreversible operations and Git history rewrite;
57
+ - credential, secret, permission, or access-control changes;
58
+ - authority discard, task stop, breaking intent revision, or risk/policy
59
+ override; and
60
+ - external writes whose target or impact cannot be safely reversed locally.
61
+
62
+ Routine Managed enrollment uses one host confirmation bound to the TaskIntent content hash at the Planner's final `ctx.ui.custom` gate. Enrollment validates intent, Git ownership, scope, workspace claim, and final authority preconditions without executing acceptance descriptors; deterministic QA executes them after implementation. The routine task proceeds from that single confirmation through enrollment, execution, and QA without a second human stop. Do not request confirmation for local in-scope edits, local verification, ordinary Direct rework, scoped diff review, or completion reporting. Managed evidence, QA, Review, and completion authority remain governed by their Managed contracts; R2 does not weaken them.
63
+
64
+ ## Parallel Read-Only Dispatch
65
+
66
+ State mutations, step activations, QA decisions, and plan switches remain
67
+ strictly sequential. Read-only work — repo exploration, advisory review,
68
+ host probing, planner research — may be dispatched in parallel.
69
+
70
+ Parallel dispatch is restricted by capability, not by a closed Skill list. Every
71
+ child delegation packet must enforce read-only advisory behavior: no file edits,
72
+ Plan writes, workflow-state mutation, or QA closure. Eligible examples include
73
+ Brainstorm and Planner research children, Domain Mappers and architecture
74
+ explorers, advisory reviewers, and provider-native read-only explorers such as
75
+ Pi `Explore`. Executor, QA, Compounder, owning Planner, and test-fixer children
76
+ always run sequentially.
77
+
78
+ ## Output Language Policy
79
+
80
+ - Honor the configured language for user-facing replies and short summaries.
81
+ - Persisted Immune-Brain documents default to English, including `HANDOFF.md`,
82
+ `docs/brainstorms/`, `docs/specs/`, `docs/plans/`, and `docs/solutions/`.
83
+ - A reply-language instruction such as "use Chinese when replying" does not
84
+ change document language. Change persisted document language only when the
85
+ current user request, project instructions such as `AGENTS.md`, or host/user
86
+ preference contains an explicit document-language instruction.
87
+ - Reply language precedence is: current user instruction, then project
88
+ instructions such as `AGENTS.md`, then host or user-level preference, then
89
+ the repo-wide default output contract. Document language precedence is:
90
+ current explicit document-language instruction, then project explicit
91
+ document-language instruction, then host or user-level explicit
92
+ document-language preference, then English.
93
+ - Do not translate or rename machine contracts: schema fields, enum values,
94
+ CLI flags, JSON keys, file paths, tool names, API names,
95
+ and code identifiers stay literal.
96
+ - Preserve `CONTEXT.md` canonical terms such as `Step`, `Plan`, `Spec`,
97
+ `Skill`, `Brainstorm`, `Executor`, `QA`, `Compounder`, `Learning`, and `ADR`;
98
+ add local-language explanations around them when helpful.
99
+
100
+ ## Success Criteria
101
+
102
+ - Direct work closes only under the Direct completion contract above.
103
+ - A Managed Step is ready to execute only when the target result, boundary, and
104
+ verification path are clear enough to avoid speculative edits.
105
+ - A Managed Step is closable only when execution evidence proves the recorded
106
+ verification path and the active boundary still matches the Plan.
107
+ - Managed scope changes, missing evidence, or structural mismatch return to
108
+ `imm-planner` instead of being hidden inside execution or QA.
109
+
110
+ ## Retirement Completion
111
+
112
+ For retirement-class work, deletion of source and contract text is a completion condition. A retirement is not complete until the source and its contract text are deleted.
113
+
114
+ An absence test is transitional scaffolding proving an in-progress deletion rather than a substitute for one. An absence test is transitional evidence of an in-progress deletion and may not stand in place of one. Distinguish an absence assertion that guards something already gone, which is durable and correct, from one that stands in for a deletion still owed, which is a promise recorded as if it were a result.
115
+
116
+ ## Collaboration Posture
117
+
118
+ - When to ask: ask only when missing information would change the outcome,
119
+ authority boundary, or risk profile.
120
+ - When to proceed: proceed on explicit, low-risk assumptions when the next
121
+ evidence path can validate or reject them.
122
+ - Keep uncertainty visible in evidence, notes, or Next Action instead of
123
+ silently widening scope.
124
+
125
+ ## Hub skill anatomy
126
+
127
+ The public Skills `imm-brainstorm`, `imm-planner`, and `imm-loop` carry the
128
+ repo's user-facing workflow authority. Execution, QA, review, repair,
129
+ exploration, and learning are internal runtime roles dispatched by Loop through
130
+ packaged role prompts; they are not additional public Skills. Keep explicit
131
+ `Rationalizations`, `Red Flags`, and Verification guidance grounded in
132
+ Immune-Brain commands and `.imm` state.
133
+
134
+ ## Shallow Discovery
135
+
136
+ Prefer shallow discovery before full-file reads. Start with file lists,
137
+ `rg` hits, symbol/signature scans, and targeted line ranges; read whole files
138
+ only when the narrower evidence path cannot answer the active Step question.
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: imm-brainstorm
3
+ description: Use to frame and clarify an ambiguous problem and its open questions before planning; framing only, no implementation or plan writing.
4
+ ---
5
+
6
+ # Immune-Brain: Brainstorm
7
+
8
+ Load [`../../dist/imm-brainstorm.md`](../../dist/imm-brainstorm.md), then frame the
9
+ task before planning. Do not edit project files. Return goal, constraints,
10
+ unknowns, readiness, and Next Action.
11
+
12
+ ## Default exhaustive decision tree
13
+
14
+ Exhaustive clarification traverses every current-goal branch grounded in the
15
+ user request, repository evidence, or a settled parent decision. Do not use a
16
+ materiality or task-type judgment to decide whether a sourced user decision is
17
+ worth asking. Seed the fixed framing roots: goal, beneficiary and scenario,
18
+ current state, desired behavior, scope and non-goals, constraints, failure and
19
+ edge behavior, compatibility and migration, success and Verification, and
20
+ deferred items; then expand branches from each answer.
21
+
22
+ Classify each unresolved node only as a repository fact or a user-owned decision.
23
+ Resolve repository facts with bounded, on-demand read-only evidence. A blocked
24
+ fact blocks only its dependent subtree and remains explicit; never convert it
25
+ into a user preference. Place every sourced user decision on the complete
26
+ currently unblocked frontier. Hold dependent questions until their parents are
27
+ settled, but ask all independent questions together. Number each question,
28
+ include grounded options and a recommended answer with a short reason, and
29
+ accept bulk approval of all recommendations with explicit exceptions.
30
+
31
+ Direct requirements and adopted recommendations settle only the current nodes;
32
+ they never complete the Brainstorm session by themselves. Recompute the tree
33
+ after every response and continue through newly unlocked downstream branches.
34
+ Minimally clarify an ambiguous answer. If later evidence invalidates a settled
35
+ choice, reopen only that decision delta. An explicit defer stops its subtree and
36
+ becomes `BR-DEFER-*`, unless it still changes the current Result, interface, or
37
+ compatibility and therefore cannot be deferred.
38
+
39
+ Brainstorm is complete only when the frontier is empty and no blocked fact
40
+ prevents traversal. A zero-question fast path is valid only when the complete
41
+ seeded and dynamically expanded tree contains no unresolved user decision. If
42
+ the user stops early, emit every open node as `BR-Q-*` and do not mark the frame
43
+ planning-ready. Otherwise present a result-only summary as a non-blocking
44
+ correction window and retain final decisions in the `BR-*` manifest rather than
45
+ copying the question transcript. Do not ask the user to reconfirm decisions
46
+ reflected without change. If the summary introduces or changes a decision, ask
47
+ for explicit confirmation of only that decision delta and block Planner handoff
48
+ until it is answered. Agent judgment alone never confirms a proposed direction
49
+ or scope.
50
+
51
+ Brainstorm supports `default`, `roundtable`, and `adversarial` modes. All use the
52
+ same exhaustive frontier protocol; `roundtable` and `adversarial` add analysis
53
+ lenses only when explicitly selected by the user. Required failure, rollback,
54
+ compatibility, migration, and risk branches remain part of default traversal.
55
+ Consult ADRs and on-demand rejected-decision evidence only when a live branch
56
+ reaches that topic.
57
+ Architecture mapping is a bounded, read-only `arch-explorer` role selected
58
+ through the internal Loop bridge; it cannot write a Spec, Plan, or workflow
59
+ state. Pi's adapter may consume `brainstorm_ensemble` dispatch JSON to prepare
60
+ advisory Pi subagent envelopes, but envelope construction is not child execution
61
+ and does not transfer framing authority. Pi itself may launch those subagents,
62
+ collect completed child outputs, and feed them to
63
+ `normalizePiBrainstormAgentResults`; runtime does not call any agent, poll
64
+ background work, mutate state, or own final Spec/Plan authority.
65
+ Agreement becomes framing evidence, Disagreement becomes decision criteria or
66
+ `BR-Q-*`, and strong-model blockers become risks or verification requirements.
@@ -0,0 +1,11 @@
1
+ ---
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.
4
+ ---
5
+
6
+ # Immune-Brain: Doc Prune
7
+
8
+ Load [`../../dist/imm-doc-prune.md`](../../dist/imm-doc-prune.md), then prune
9
+ stale current documentation from the target Git repository. This is a
10
+ standalone host-native maintenance entry, not a Managed Path continuation
11
+ and not an `imm-loop` internal-role dispatch.
@@ -0,0 +1,52 @@
1
+ ---
2
+ name: imm-loop
3
+ description: Use to run a validated Plan to completion in the current conversation through checkpoints and isolated QA/review authorities.
4
+ ---
5
+
6
+ # Immune-Brain: Loop
7
+
8
+ Load [`../../dist/imm-loop.md`](../../dist/imm-loop.md), then run the checkpoint loop in the current Pi conversation. Keep active Step implementation in this conversation; use Pi native `Agent` subagents only when the runtime reports `awaiting_qa_decision` or a required review gate. Standard Plan Steps close from passing evidence without per-Step QA; Strict Plan Steps retain isolated QA. Return visible checkpoint progress and a final stop summary.
9
+ At every runtime role boundary, call the read-only `imm_loop_action` Tool. Use
10
+ `route` for active Steps, bounded repair, architecture exploration, advisory
11
+ review, Compounder, Kernel ownership, or scope expansion. Use `dispatch_role`
12
+ for `qa`, `code-review`, and `ui-review`, then invoke the returned foreground
13
+ Agent envelope exactly. Brainstorm and Planner use the same Tool for bounded
14
+ `arch-explorer` and explicit-lens `advisory-reviewer` dispatches. Loop may
15
+ dispatch `compounder` only when a closed Step supplies structured evidence for
16
+ a reusable Learning; routine work without that evidence returns `next: none`
17
+ and creates no Learning. Do not discover or load a Pi Skill for these roles. The Managed Path public entries remain `imm-brainstorm`, `imm-planner`, and `imm-loop`; standalone `imm-pr-fix` and `imm-doc-prune` are host-native and are never dispatched as the Loop role.
18
+ Subagent Dispatch Protocol](../../dist/docs/reference/subagent-dispatch-protocol.md#authorization-authority).
19
+ All internal Agent dispatch envelopes use `run_in_background: false` and
20
+ return `tool_call`, `tool_result`, and `tool_execution_end` evidence to the
21
+ Parent before any workflow mutation.
22
+
23
+ At `terminal_plan_complete`, stop with no next skill, authority, or action. At `awaiting_user_successor_decision`, stop with `recommended_authority: user`. This boundary follows the explicit internal Compounder handoff and runtime terminal settlement; it must not dispatch Planner, Compounder, transition, or a new Pi session/subagent. Only a literal user may approve a successor through the native authority gate; the internal runtime token is `--approve-successor`, never a public Skill or user-facing entry.
24
+
25
+ Scope expansion always returns to `imm-planner`; Executor and repair roles must stop with the concrete missing scope and verification reason instead of widening execution.
26
+
27
+ The loop always enters through `imm_loop_action`: the projected action's `next`
28
+ authority is `executor`, `test-fixer`, `pr-fix`, `arch-explorer`,
29
+ `advisory-reviewer`, `compounder`, `imm_kernel_canary`, `imm-planner`, or
30
+ `none`.
31
+
32
+ When the Kernel projection reports an active/draining backend claim, keep
33
+ `imm-loop` as the user-facing entry and call the `imm_kernel_canary` Tool for
34
+ that owned task. Enrollment uses the `imm_canary_enrollment` Tool and Review
35
+ authorization remains a native TUI gate. When the projection calls for
36
+ `request_authorization`, `approve_breaking_intent_revision`, or
37
+ `repair_authority_state`, invoke the exact Tool operation directly without
38
+ asking the user for chat pre-confirmation; the native host interaction is the
39
+ single authority decision. Do not invoke the removed `imm-canary-work` Skill as
40
+ a separate entry point. Invalid or contradictory projections fail closed. After
41
+ implementation and focused verification, freeze the artifacts and call
42
+ `advance_assurance`. If it returns `review_ready`, invoke the exact reserved
43
+ foreground Agent and call `submit_review`; `request_authorization` remains the
44
+ critical-risk user authorization boundary. Every QA/Review operation stays
45
+ foreground and returns its next projected obligation directly to the Parent. The host performs any opted-in GitHub Issue projection only after the
46
+ corresponding authority mutation: only a fresh claimless `done`/`stopped`
47
+ projection with its exact terminal tombstone projects terminal closure
48
+ (`completed`/`not planned`); Enrollment performs no GitHub projection. Treat the
49
+ attached tracker result as non-authoritative observation. Report its failure
50
+ separately, but never use it as evidence, a stop condition, or a reason to
51
+ repeat a Kernel mutation. A terminal tombstone alone never blocks unrelated v3
52
+ routing.
@@ -0,0 +1,221 @@
1
+ ---
2
+ name: imm-planner
3
+ description: Use to create or revise a spec and iteration plan from requirements; owns scope and plan decomposition, not implementation or step activation.
4
+ ---
5
+
6
+ # Immune-Brain: Planner
7
+
8
+ Load [`../../dist/imm-planner.md`](../../dist/imm-planner.md), then create or revise
9
+ the executable plan. `mode: page_design` is the canonical pre-implementation
10
+ design-contract mode formerly exposed as `imm-page-design`. Keep scope
11
+ explicit, including the Devil's Advocate preplan audit and `Devil's Advocate Audit` output. Return plan path, decisions,
12
+ first step, verification approach, and Next Action.
13
+
14
+ ## Clarification supplement
15
+
16
+ Planner consumes an upstream Brainstorm manifest as a closed-world input and
17
+ must not repeat, reopen, or rewrite confirmed decisions. Direct Planner entry
18
+ and Medium/High Design Risk work must inspect relevant ADRs and rejected
19
+ Learnings. It resolves repository facts and owns ordinary technical choices: design and component boundaries, failure behavior, compatibility, migration, recovery and
20
+ rollback, Verification, execution slices, dependencies, scope, and delivery
21
+ risk. It then authors the candidate Spec, Plan, or TaskIntent.
22
+
23
+ Planner may ask only when concrete new evidence exposes an omission, repository
24
+ conflict, or invalidated assumption. Ask the focused decision delta, cite the
25
+ upstream `BR-*` item and new evidence when available, and preserve every
26
+ unaffected decision. Resolve a local delta here; if its answer reopens multiple
27
+ product branches or changes the overall goal or Scope, stop and return to
28
+ `imm-brainstorm`.
29
+
30
+ Direct Planner entry remains valid for clear requests. Resolve facts and derive
31
+ technical design without a Brainstorm pass; if an unresolved user-owned product
32
+ decision appears, return to `imm-brainstorm` instead of silently choosing it or
33
+ starting a second exhaustive interview. A zero-question fast path is valid when
34
+ no supplement is required. Present an unchanged result summary as a
35
+ non-blocking correction window and do not ask the user to reconfirm existing
36
+ decisions. If the summary itself introduces or changes a user decision, confirm
37
+ only that decision delta before finalizing.
38
+
39
+ Settlement-class intents (terminal settlement, cancellation, timeout, race, or
40
+ authority-lifecycle semantics) must embed the `Settlement-Design Contract`
41
+ enumeration required by the loaded contract before they are execution-ready.
42
+
43
+ ## Technical Design Views And Decomposition
44
+
45
+ For Medium and High Design 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. The Spec is the single Technical Design baseline. Persist those decisions there; do not copy them into a TaskIntent or revive prose Plan authority. Low risk remains concise and is not forced to produce empty architecture, interface, data-flow, state, or sequence sections.
46
+
47
+ Use the selected design boundaries as one TaskIntent decomposition dimension alongside outcome, Verification, dependency, risk, rollback, compatibility, and authority. Keep one TaskIntent when the selected views describe one coherent executable slice with shared acceptance, risk treatment, rollback, 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. Do not split merely because the design names several layers, files, or services.
48
+
49
+ ## Reference Closure Preflight
50
+
51
+ Before authoring a TaskIntent, trace each expected behavior from its public or
52
+ runtime entry point through existing imports and callers to the highest focused
53
+ behavioral tests. Include generated or packaged mirrors and every owner of the
54
+ same state machine. Record the concrete paths in the Spec's discovery evidence;
55
+ do not author while a referenced sibling is unresolved. Use the smallest
56
+ coherent module directory for ordinary implementation scope. Keep Kernel,
57
+ authority, migration, secret, and security-sensitive scope exact to the files
58
+ proved necessary by the trace. Scope is closed by reference evidence, not by an
59
+ exhaustive filename guess.
60
+
61
+ ## Managed Request Routing
62
+
63
+ `imm-planner` is entered explicitly by the user for a clear repository mutation.
64
+ Ordinary host input does not invoke this Skill through natural-language routing.
65
+ An active Assurance projection remains authoritative and is resumed only through an explicit `imm-loop` entry; explicit Planner entry owns planning and the later native Enrollment gate:
66
+ - an active Assurance projection remains on its current owner until the user explicitly enters `imm-loop`;
67
+ - read-only, explanation, review-only, Plan-only, and explicit no-modification
68
+ requests do not enroll;
69
+ - materially ambiguous mutations go to `imm-brainstorm` before planning; and
70
+ - clear new mutations reach this Planner phase.
71
+
72
+ Plan-only output remains non-authoritative. Planner creates or validates a
73
+ candidate Spec/TaskIntent, but it never enrolls a task or enrolls generated
74
+ artifacts unconditionally. Explicit Plan-only requests stop after returning the
75
+ planning artifacts. A later literal-user request to start Enrollment is a non-authoritative
76
+ execution trigger: invoke the native Enrollment gate directly, without asking
77
+ for chat pre-confirmation. For a clear mutation request that already includes
78
+ execution, invoke that gate as soon as the candidate is validated and Git-tracked.
79
+ Literal-user confirmation in the native gate remains the authority boundary.
80
+ Fast-Track may compress the same phases but cannot bypass that boundary, QA,
81
+ Review, authorization, or completion.
82
+
83
+ ## Kernel TaskIntent Routing
84
+
85
+ Before producing a new managed planning artifact, resolve the canonical wrappers
86
+ from the declared Skill location: `../../bin/imm-plan` and
87
+ `../../bin/imm-kernel`. Invoke `imm-plan --routing-status --json` through that
88
+ resolved wrapper and use the resolved `imm-kernel` wrapper for every Kernel
89
+ command below. Do not assume either bare command is available on shell `PATH`.
90
+ Then route deterministically:
91
+
92
+ - an active Kernel claim routes to `imm-loop` for foreground Kernel Tool
93
+ coordination, not new planning;
94
+ - an active or otherwise nonterminal v3 Plan remains on its existing v3 route;
95
+ - no routing policy preserves the legacy v3 Planner behavior;
96
+ - a valid `kernel_task_intent` retirement policy produces one TaskIntent draft
97
+ through Pi `imm-planner`;
98
+ - an invalid, unreadable, untracked, or tracked-deleted policy rejects new
99
+ planning authority with `routing_policy_invalid`;
100
+ - no Planner path enrolls a task or falls back to v3 after retirement.
101
+
102
+ Current owner, phase, completion, and authority facts are authoritative only
103
+ when read from the Assurance projection and TaskRecord. `CONTEXT.md` is
104
+ non-authoritative vocabulary and architecture navigation, not a workflow-status
105
+ source. If its prose conflicts with those authority facts, report stale
106
+ documentation, preserve projection-based routing, and do not automatically
107
+ synchronize either representation.
108
+
109
+ Pi host identity is implicit and never a planning input. The production boundary
110
+ that turns a Git-tracked TaskIntent draft into managed execution authority is the
111
+ native host TUI: the Planner's final `ctx.ui.custom` gate (via the
112
+ `imm_canary_enrollment` foreground Tool) provides one literal-user confirmation
113
+ bound to the TaskIntent content hash. Invoke the Tool directly when the route is
114
+ ready; do not ask for a chat pre-confirmation. Enrollment validates the intent,
115
+ Git ownership, scope, workspace claim, and final authority preconditions without
116
+ executing acceptance descriptors. A routine task proceeds from that single
117
+ confirmation through enrollment, execution and QA without a second human stop.
118
+
119
+ The Planner never writes the `docs/plans/<task-id>.intent.json` artifact
120
+ directly and never overwrites an existing TaskIntent. Under an active
121
+ `kernel_task_intent` policy it supplies one complete candidate to the canonical
122
+ `imm-kernel intent author <path> --stdin --json` command, which owns strict
123
+ parsing, verification-descriptor canonicalization, path binding, and exclusive
124
+ file creation; then it validates the created artifact with
125
+ `imm-kernel intent validate <path> --json`. Revisions of an enrolled intent
126
+ continue through Kernel `revise_intent` authority and are not a Planner
127
+ overwrite path.
128
+
129
+ ### Initiative Carrier Preference
130
+
131
+ For a large proposal split across multiple TaskIntents, exactly one planning
132
+ carrier is chosen per Initiative: a Local Markdown file at
133
+ `docs/initiatives/<slug>.md` or one GitHub Parent Issue. This preference applies
134
+ only to Initiatives; ordinary TaskIntents remain tracked by Kernel TaskRecords.
135
+ Resolve the carrier in this order:
136
+
137
+ 1. a literal user instruction for the current request;
138
+ 2. `Initiative carrier default: local` or `Initiative carrier default: github`
139
+ in the repository root `AGENTS.md`;
140
+ 3. the same directive in `~/.pi/agent/AGENTS.md`; or
141
+ 4. ask the user when no valid directive exists.
142
+
143
+ A repository directive overrides the global directive. Report an invalid value
144
+ and ask instead of guessing. After resolving it, display one non-blocking line
145
+ with the selected carrier and its source. A configured `github` default is
146
+ standing opt-in for GitHub projection, but the literal user must still confirm
147
+ the named Initiative and its immutable slug before the first remote mutation.
148
+ Surface that name, slug, and the proposed Parent/Child creation together as soon
149
+ as decomposition establishes multiple TaskIntents. Recommend one answer so the
150
+ user may adopt the complete current decision frontier in bulk. A prior bulk
151
+ approval cannot confirm a name or slug that had not yet been shown.
152
+ Resolve `../../bin/imm-tracker` from this Skill location; do not assume a bare
153
+ command is on `PATH`. After the first TaskIntent has been authored, staged, and
154
+ validated with `valid: true` and `enrollment_ready: true`, and both the named
155
+ Initiative and its immutable slug are confirmed, attempt the GitHub projection
156
+ before returning the final Planner result or invoking Enrollment: call
157
+ `imm-tracker create-initiative --stdin --json` once with the confirmed goal,
158
+ stable Slice summaries, and the public Parent projection fields. `create-initiative`
159
+ receives the stable Initiative goal and Slice summaries plus the
160
+ public Parent projection fields `problem`, `result`, `decisions`,
161
+ `testing_strategy`, and `out_of_scope`. It creates a result-oriented Parent title
162
+ `[<initiative>] <result>` and never rewrites an existing Parent.
163
+
164
+ Then call
165
+ `imm-tracker upsert-task --initiative-id <slug> --slice-id <id> --intent <path> --projection-json <json> --json`
166
+ to create one neutral open Child Issue and attach it to the Parent as a native
167
+ Sub-issue. The projection JSON is public planning context only and may contain
168
+ `result`, `current_behavior`, `desired_behavior`, `key_interfaces`,
169
+ `verification`, `blocked_by` Task IDs, `out_of_scope`, and `agent_handoff`.
170
+ The tracker rereads the canonical TaskIntent for identity, risk, and acceptance;
171
+ projection fields never widen TaskIntent scope or authority. The Child title is
172
+ `[<initiative>/<slice>] <result>` with no `IB:` prefix or Task ID. Its body is an
173
+ Agent Brief with Parent, What to build, Current behavior, Desired behavior, Key
174
+ interfaces, Acceptance criteria, Verification, Blocked by, Out of scope, Agent
175
+ handoff, and Authority boundary sections. Native `blocked_by` relations are
176
+ created only for exact marker-owned Task Issues and are idempotently observed.
177
+ Internal role prompts, tool policies, review gates, model reservations, and
178
+ prompt digests never belong in this external handoff.
179
+ If `docs/initiatives/<slug>.md` exists, the tracker fails with a
180
+ carrier conflict; Local mode performs zero GitHub operations. A future Slice remains a parent checklist entry until its own TaskIntent is
181
+ canonically authored and validated.
182
+
183
+ Tracker output is observation, never authority. Before the Planner returns, its
184
+ GitHub carrier outcome must be exactly one of: `tracker_associated` after both
185
+ operations return `created`, `updated`, or `already_current`;
186
+ `awaiting_user_initiative_confirmation` with the single pending Initiative
187
+ name-and-slug decision; or `tracker_projection_failed` with the returned failure
188
+ and exact retry action.
189
+ A candidate Initiative name or slug recorded only in the Spec or final summary
190
+ is neither user confirmation nor a completed carrier outcome. Report `retryable_failure`,
191
+ `permanent_failure`, or `ambiguous_remote_state` and the exact retry action, but
192
+ do not block planning, Enrollment, execution, QA, Review, settlement, or another
193
+ association. Do not infer opt-in from tracker output or Issue state,
194
+ auto-close the parent, import Issue state, create a TaskIntent from an Issue, or store Issue identity in TaskIntent or
195
+ TaskRecord. Existing Issue markers grant permission only for later one-way
196
+ projection updates to that same Initiative; they never grant execution authority.
197
+
198
+ ### Verification Descriptor Discipline
199
+
200
+ Every acceptance verification descriptor must be a focused, deterministic,
201
+ repository-local check that exercises only its acceptance assertion. Prefer one
202
+ small `bun test <focused-file>` or `bun run <focused-script>` per acceptance;
203
+ never use the full test suite, a build, package installation, network access, or
204
+ redundant heavyweight checks. Prefer the highest existing observable behavioral
205
+ test seam and the fewest sufficient seams. Cite relevant test prior art and
206
+ explain how the selected seam catches the intended regression. This is a
207
+ planning heuristic: it must not weaken acceptance-specific focused verification
208
+ descriptors or add a mandatory user confirmation. Use the smallest `timeout_ms` and
209
+ `max_output_bytes` that cover deterministic post-implementation QA.
210
+
211
+ ## Retirement Completion Contract
212
+
213
+ For retirement-class work, deletion of source and contract text is a completion condition. A retirement that routes the command to a retirement wall, pins the absence with test assertions, and leaves the source in the tree is not complete. A retirement is not complete until the source and its contract text are deleted.
214
+
215
+ An absence test is transitional scaffolding proving an in-progress deletion rather than a substitute for one. An absence test is transitional evidence of an in-progress deletion and may not stand in place of one. It proves a deletion in progress, not a completed result. Distinguish an absence assertion that guards something already gone, which is durable and correct, from one that stands in for a deletion still owed, which is a promise recorded as if it were a result.
216
+ Architecture exploration and advisory review use the internal Loop bridge's
217
+ read-only `arch-explorer` and `advisory-reviewer` roles. They can supply
218
+ candidates, evidence, and decision criteria, but cannot write this Spec/Plan or
219
+ activate execution.
220
+ Agreement becomes evidence, Disagreement becomes decision criteria, and
221
+ strong-model blockers become risks or verification requirements.
@@ -0,0 +1,10 @@
1
+ ---
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.
4
+ ---
5
+
6
+ # Immune-Brain: PR Fix
7
+
8
+ Load [`../../dist/imm-pr-fix.md`](../../dist/imm-pr-fix.md) and repair the
9
+ target PR directly. This is a standalone host-native repair entry, not a
10
+ Managed Path continuation and not an `imm-loop` internal-role dispatch.
@@ -0,0 +1,49 @@
1
+ version: 1
2
+ source_glob: skills/*/SKILL.md
3
+ skills:
4
+ - name: imm-brainstorm
5
+ path: skills/imm-brainstorm/SKILL.md
6
+ role: brainstorm
7
+ title: Brainstormer
8
+ role_class: framing
9
+ canonical: true
10
+ modes: [default, roundtable, adversarial]
11
+ output_artifacts: [brainstorm_framing]
12
+ next_actions: [imm-planner]
13
+ boundary: Problem framing only; no implementation or QA closure.
14
+ - name: imm-planner
15
+ path: skills/imm-planner/SKILL.md
16
+ role: plan
17
+ title: Planner
18
+ role_class: authority
19
+ canonical: true
20
+ output_artifacts: [validated_plan]
21
+ next_actions: [imm-loop]
22
+ boundary: Owns plan creation and revision; no executor edits.
23
+ - name: imm-loop
24
+ path: skills/imm-loop/SKILL.md
25
+ role: coordinate
26
+ title: Run
27
+ role_class: coordinator
28
+ canonical: true
29
+ output_artifacts: [run_status]
30
+ next_actions: [imm-planner]
31
+ boundary: Coordinate the validated plan through execution, review, and settlement; no planning bypass.
32
+ - name: imm-pr-fix
33
+ path: skills/imm-pr-fix/SKILL.md
34
+ role: execute
35
+ title: PR Fix
36
+ role_class: repair
37
+ canonical: true
38
+ output_artifacts: [repair_report]
39
+ next_actions: []
40
+ boundary: Repair one GitHub PR directly; no Managed authority mutation or scope expansion.
41
+ - name: imm-doc-prune
42
+ path: skills/imm-doc-prune/SKILL.md
43
+ role: execute
44
+ title: Doc Prune
45
+ role_class: repair
46
+ canonical: true
47
+ output_artifacts: [prune_report]
48
+ next_actions: []
49
+ boundary: Prune stale current documentation after explicit manifest approval; no Managed authority mutation or authority-artifact deletion.