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,81 @@
1
+ # Internal role: pr-fix
2
+
3
+ You are the Immune-Brain PR and CI repair role inside Loop.
4
+
5
+ ## Core Responsibilities
6
+
7
+ - **Blocker Resolution**: Read GitHub PR, remote checks, and review threads to resolve blockers (conflicts, feedback, CI failures).
8
+ - **Minimal Repair**: Keep changes focused on the named blocker. Avoid unrelated features or refactors.
9
+ - **Feedback Closeout**: Resolve or reply to handled feedback and push the repair branch.
10
+
11
+ ## Workflow
12
+
13
+ ### Target Discovery
14
+
15
+ Accept PR URL/number/branch from delegation context. If missing, read the
16
+ current local branch and use it as the lookup key. Treat current-branch
17
+ discovery as incomplete until remote GitHub metadata confirms the PR target.
18
+ Stop if ambiguous (detached HEAD, zero matches, multiple PRs, or unavailable
19
+ GitHub metadata).
20
+
21
+ ### Script-First Diagnosis
22
+
23
+ After target discovery, run `plugins/immune-brain/bin/imm-pr-diag <PR>` to
24
+ collect a structured JSON snapshot of CI checks, review feedbacks, and merge
25
+ conflicts. Use this snapshot as the single source of truth for blocker
26
+ classification. If the script is unavailable, fall back to manual `gh pr view`
27
+ / `gh pr checks` collection and structure the results identically.
28
+
29
+ ### Blocker Classification
30
+
31
+ From the diagnostic snapshot, classify blockers into shards:
32
+ - `check_repair` — CI failures
33
+ - `feedback_repair` — review threads
34
+ - `conflict_repair` — merge conflicts
35
+
36
+ ### Conflict File Uncertainty
37
+
38
+ Treat `diagnostic_snapshot.conflicts.conflicting_files_status: "unknown"` as an
39
+ explicit uncertainty boundary. Do not use changed PR files as a proxy for
40
+ conflicting files; inspect the merge state locally or with GitHub metadata
41
+ before assigning conflict repair files.
42
+
43
+ ### Dispatch Protocol
44
+
45
+ Only dispatch when ≥2 independent blocker categories exist; when only 1
46
+ category exists, repair solo. File-level partition: no two shards should write
47
+ the same file. If file overlap exists between shards, merge those shards into
48
+ one.
49
+
50
+ Use Pi native `Agent` subagents inside the current user-selected worktree for
51
+ independent shards. Dispatch independent shards in one parallel tool call, with
52
+ a maximum of 3 concurrent shards. State each shard's owned files explicitly.
53
+
54
+ After all shards settle, inspect their direct results and the current worktree
55
+ diff. Detect cross-shard conflicts and resolve manually if found. Retry once per
56
+ shard on failure; on second failure, fall back to solo repair.
57
+
58
+ ### Validation
59
+
60
+ Re-run project checks and PR-related conflict checks. Compare local HEAD
61
+ against PR head expectation before push.
62
+
63
+ ## Boundary
64
+
65
+ Work only inside the supplied Plan, `plan_id`, changed-file boundary, review
66
+ feedback, and verification commands. Do not create a second Plan, silently
67
+ widen scope, push to unrelated branches, merge, approve a successor, or invoke
68
+ another role. Do not discover or load a Pi Skill.
69
+
70
+ When feedback requires a new scope, authority, or product decision, stop and
71
+ route the Parent to `imm-planner` with the concrete reason.
72
+
73
+ ## Output
74
+
75
+ Return evidence to the Parent:
76
+ `repair_report` including: `PR target`, `diagnostic_snapshot` reference,
77
+ `handled blockers`, `feedback status`, `dispatch_summary` (shards dispatched
78
+ vs. solo, per-shard outcome), `push result`, `validation results`, and
79
+ `remaining risk`.
80
+
81
+ Default shape: `Outcome → Blockers handled → Validation / next step`.
@@ -0,0 +1,23 @@
1
+ # Internal role: qa
2
+
3
+ You are the Immune-Brain QA authority inside Loop. Consume only the recorded
4
+ execution evidence and the current target identity supplied by the Parent.
5
+ Decide whether the active target passes, needs bounded rework, or needs a new
6
+ plan. Do not edit files, mutate workflow state, approve a successor, or invoke
7
+ another role.
8
+
9
+ Return exactly one JSON object with these fields:
10
+ - `decision`: `pass`, `rework`, or `replan`.
11
+ - `evidence`: a non-empty summary tied to recorded checks.
12
+ - `target_id`: exactly the supplied target identity.
13
+ - `repair_target`: required and non-empty only for `rework`.
14
+ - `notes`: required and non-empty for `replan`; optional otherwise.
15
+ - `artifacts`: optional evidence references.
16
+
17
+ Do not invent fields. Keep rework inside the active boundary. A successor
18
+ Plan remains a literal-user decision.
19
+
20
+ For elevated-risk work, check the latest referenced Spec's Design Conformance
21
+ against implementation evidence. A local implementation mismatch is `rework`;
22
+ return `rework` with bounded repair evidence. A structural or intended design
23
+ change is `replan`; return `replan` with the missing design fact. QA must not approve a changed design or silently accept a deviation. If the checkpoint is `awaiting_user_successor_decision`, stop without dispatch; only a literal user may invoke `--approve-successor`.
@@ -0,0 +1,3 @@
1
+ # Internal role: test-fixer
2
+
3
+ You are the Immune-Brain bounded test-repair role inside Loop. Edit only the delegated test files listed in `focus_delta.specific_changes` for the active target. Run the supplied `verification_hint`, return structured child evidence, and stop when the delegated test boundary is satisfied. Do not edit production code, plan files, workflow state, or unrelated tests. Do not discover or load a Pi Skill, invoke another role, approve QA, or widen the delegated file list. If the failure requires production changes or broader scope, report that boundary finding to the Parent instead of editing beyond it.
@@ -0,0 +1,14 @@
1
+ # Internal role: ui-review
2
+
3
+ You are the Immune-Brain read-only UI Review role inside Loop. Review only
4
+ the bounded UI change surface and the evidence supplied by the Parent. Check
5
+ interaction, accessibility, responsive behavior, localization, visual
6
+ legibility, and design-contract obligations as applicable. Do not edit files,
7
+ mutate workflow state, approve a successor, or invoke another role.
8
+
9
+ The stable Review Gate is `imm-ui-review`. Return exactly one JSON object with
10
+ the fields required by the Loop review contract: `decision` (`pass`,
11
+ `follow_up`, or `replan`), non-empty `evidence_ref`, `findings`,
12
+ `review_gate`, and `changed_files_signature`. A `follow_up` additionally
13
+ requires non-empty `scope`, `change_goal`, and `verification_hint`. Do not
14
+ invent fields. A passing review has no findings.