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.
- package/README.md +239 -0
- package/README.zh-CN.md +239 -0
- package/package.json +84 -0
- package/plugins/immune-brain/.pi-extension/imm-canary-enroll.ts +666 -0
- package/plugins/immune-brain/.pi-extension/imm-canary-work.ts +1622 -0
- package/plugins/immune-brain/.pi-extension/package.json +11 -0
- package/plugins/immune-brain/.pi-extension/pi-canary-assurance-progression.ts +711 -0
- package/plugins/immune-brain/.pi-extension/pi-canary-assurance.ts +154 -0
- package/plugins/immune-brain/.pi-extension/pi-canary-interaction.ts +349 -0
- package/plugins/immune-brain/.pi-extension/pi-canary-invocations.ts +90 -0
- package/plugins/immune-brain/.pi-extension/pi-canary-native-review.ts +214 -0
- package/plugins/immune-brain/.pi-extension/pi-canary-qa-findings.ts +50 -0
- package/plugins/immune-brain/.pi-extension/pi-canary-review-bundle.ts +262 -0
- package/plugins/immune-brain/.pi-extension/pi-canary-tool-failure.ts +28 -0
- package/plugins/immune-brain/.pi-extension/pi-canary-verification.ts +237 -0
- package/plugins/immune-brain/.pi-extension/runtime-stub.ts +414 -0
- package/plugins/immune-brain/.pi-extension/tsconfig.json +20 -0
- package/plugins/immune-brain/bin/imm-kernel +4 -0
- package/plugins/immune-brain/bin/imm-plan +4 -0
- package/plugins/immune-brain/bin/imm-pr-diag +230 -0
- package/plugins/immune-brain/bin/imm-retire-stale-wrapper +4 -0
- package/plugins/immune-brain/bin/imm-retired +4 -0
- package/plugins/immune-brain/bin/imm-tracker +4 -0
- package/plugins/immune-brain/dist/BASELINE.md +138 -0
- package/plugins/immune-brain/dist/docs/reference/HANDOFF-template.md +122 -0
- package/plugins/immune-brain/dist/docs/reference/design-contract-audit-rubric.md +149 -0
- package/plugins/immune-brain/dist/docs/reference/design-contract-review-checklist.md +55 -0
- package/plugins/immune-brain/dist/docs/reference/i18n-review-checklist.md +110 -0
- package/plugins/immune-brain/dist/docs/reference/immune-brain-config.md +52 -0
- package/plugins/immune-brain/dist/docs/reference/planning-artifact-retention.md +94 -0
- package/plugins/immune-brain/dist/docs/reference/planning-quality-gate.md +44 -0
- package/plugins/immune-brain/dist/docs/reference/subagent-dispatch-protocol.md +105 -0
- package/plugins/immune-brain/dist/docs/reference/ux-heuristic-checklist.md +131 -0
- package/plugins/immune-brain/dist/imm-brainstorm.md +140 -0
- package/plugins/immune-brain/dist/imm-doc-prune.md +137 -0
- package/plugins/immune-brain/dist/imm-loop.md +158 -0
- package/plugins/immune-brain/dist/imm-planner.md +387 -0
- package/plugins/immune-brain/dist/imm-pr-fix.md +71 -0
- package/plugins/immune-brain/dist/registry.yaml +49 -0
- package/plugins/immune-brain/dist/role-prompts/advisory-reviewer.md +16 -0
- package/plugins/immune-brain/dist/role-prompts/arch-explorer.md +14 -0
- package/plugins/immune-brain/dist/role-prompts/code-review.md +15 -0
- package/plugins/immune-brain/dist/role-prompts/compounder.md +20 -0
- package/plugins/immune-brain/dist/role-prompts/executor.md +13 -0
- package/plugins/immune-brain/dist/role-prompts/pr-fix.md +81 -0
- package/plugins/immune-brain/dist/role-prompts/qa.md +23 -0
- package/plugins/immune-brain/dist/role-prompts/test-fixer.md +3 -0
- package/plugins/immune-brain/dist/role-prompts/ui-review.md +14 -0
- package/plugins/immune-brain/runtime/authority_commit_receipts.ts +716 -0
- package/plugins/immune-brain/runtime/canonical_json.ts +19 -0
- package/plugins/immune-brain/runtime/commands/kernel.ts +1160 -0
- package/plugins/immune-brain/runtime/github_issue_tracker.ts +1009 -0
- package/plugins/immune-brain/runtime/kernel/application.ts +300 -0
- package/plugins/immune-brain/runtime/kernel/assurance_projection.ts +284 -0
- package/plugins/immune-brain/runtime/kernel/authority_port.ts +208 -0
- package/plugins/immune-brain/runtime/kernel/automatic_observations.ts +451 -0
- package/plugins/immune-brain/runtime/kernel/backend_claim.ts +197 -0
- package/plugins/immune-brain/runtime/kernel/canary_application.ts +507 -0
- package/plugins/immune-brain/runtime/kernel/canary_eligibility.ts +73 -0
- package/plugins/immune-brain/runtime/kernel/completion.ts +160 -0
- package/plugins/immune-brain/runtime/kernel/enrollment.ts +194 -0
- package/plugins/immune-brain/runtime/kernel/enrollment_authority.ts +123 -0
- package/plugins/immune-brain/runtime/kernel/index.ts +29 -0
- package/plugins/immune-brain/runtime/kernel/intent.ts +563 -0
- package/plugins/immune-brain/runtime/kernel/intent_token_registry.ts +80 -0
- package/plugins/immune-brain/runtime/kernel/legacy.ts +299 -0
- package/plugins/immune-brain/runtime/kernel/legacy_audit.ts +153 -0
- package/plugins/immune-brain/runtime/kernel/observation.ts +395 -0
- package/plugins/immune-brain/runtime/kernel/pi_canary_prepare.ts +169 -0
- package/plugins/immune-brain/runtime/kernel/readiness.ts +282 -0
- package/plugins/immune-brain/runtime/kernel/readiness_evidence.ts +132 -0
- package/plugins/immune-brain/runtime/kernel/reducer.ts +624 -0
- package/plugins/immune-brain/runtime/kernel/storage.ts +1780 -0
- package/plugins/immune-brain/runtime/kernel/storage_layout_migration.ts +791 -0
- package/plugins/immune-brain/runtime/kernel/storage_paths.ts +492 -0
- package/plugins/immune-brain/runtime/kernel/types.ts +295 -0
- package/plugins/immune-brain/runtime/kernel/validation.ts +963 -0
- package/plugins/immune-brain/runtime/loop_contract.ts +362 -0
- package/plugins/immune-brain/runtime/managed_task_routing_policy.ts +462 -0
- package/plugins/immune-brain/runtime/plan_core.ts +1053 -0
- package/plugins/immune-brain/runtime/prompts/advisory-reviewer.md +16 -0
- package/plugins/immune-brain/runtime/prompts/arch-explorer.md +14 -0
- package/plugins/immune-brain/runtime/prompts/code-review.md +15 -0
- package/plugins/immune-brain/runtime/prompts/compounder.md +20 -0
- package/plugins/immune-brain/runtime/prompts/executor.md +13 -0
- package/plugins/immune-brain/runtime/prompts/pr-fix.md +81 -0
- package/plugins/immune-brain/runtime/prompts/qa.md +23 -0
- package/plugins/immune-brain/runtime/prompts/test-fixer.md +3 -0
- package/plugins/immune-brain/runtime/prompts/ui-review.md +14 -0
- package/plugins/immune-brain/runtime/role_prompt_bridge.ts +160 -0
- package/plugins/immune-brain/runtime/v4_runtime.ts +295 -0
- package/plugins/immune-brain/runtime/verification_descriptor.ts +162 -0
- package/plugins/immune-brain/runtime/workspace_scope.ts +623 -0
- package/plugins/immune-brain/skills/.ignore +1 -0
- package/plugins/immune-brain/skills/BASELINE.md +138 -0
- package/plugins/immune-brain/skills/imm-brainstorm/SKILL.md +66 -0
- package/plugins/immune-brain/skills/imm-doc-prune/SKILL.md +11 -0
- package/plugins/immune-brain/skills/imm-loop/SKILL.md +52 -0
- package/plugins/immune-brain/skills/imm-planner/SKILL.md +221 -0
- package/plugins/immune-brain/skills/imm-pr-fix/SKILL.md +10 -0
- package/plugins/immune-brain/skills/registry.yaml +49 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
5
|
+
# imm-pr-diag — Collect PR diagnostic data and emit a single JSON report
|
|
6
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
7
|
+
# This is a STANDALONE script. It does NOT depend on Python or
|
|
8
|
+
# immune_brain_runtime.py. It requires only `gh` (GitHub CLI) and `jq`.
|
|
9
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
usage() {
|
|
12
|
+
cat <<EOF
|
|
13
|
+
Usage: $(basename "$0") <PR>
|
|
14
|
+
|
|
15
|
+
Collect diagnostic data for a GitHub pull request and output a single JSON
|
|
16
|
+
object to stdout.
|
|
17
|
+
|
|
18
|
+
Arguments:
|
|
19
|
+
<PR> Pull request identifier — a number, URL, or branch name.
|
|
20
|
+
|
|
21
|
+
Options:
|
|
22
|
+
-h, --help Show this help message and exit.
|
|
23
|
+
|
|
24
|
+
Prerequisites:
|
|
25
|
+
• gh — GitHub CLI (https://cli.github.com)
|
|
26
|
+
• jq — Command-line JSON processor (https://stedolan.github.io/jq)
|
|
27
|
+
|
|
28
|
+
Output:
|
|
29
|
+
A JSON object containing pr_target, checks, reviews, review_threads,
|
|
30
|
+
conflicts, and blocker_summary fields.
|
|
31
|
+
EOF
|
|
32
|
+
exit 0
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
# ── Argument handling ────────────────────────────────────────────────────────
|
|
36
|
+
|
|
37
|
+
if [ $# -eq 0 ]; then
|
|
38
|
+
usage
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
case "${1:-}" in
|
|
42
|
+
-h|--help) usage ;;
|
|
43
|
+
esac
|
|
44
|
+
|
|
45
|
+
PR="$1"
|
|
46
|
+
|
|
47
|
+
# ── Dependency checks ───────────────────────────────────────────────────────
|
|
48
|
+
|
|
49
|
+
if ! command -v gh >/dev/null 2>&1; then
|
|
50
|
+
echo "error: 'gh' (GitHub CLI) is required but not found in PATH." >&2
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
if ! command -v jq >/dev/null 2>&1; then
|
|
55
|
+
echo "error: 'jq' is required but not found in PATH." >&2
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# ── Fetch PR metadata ───────────────────────────────────────────────────────
|
|
60
|
+
|
|
61
|
+
PR_JSON=$(gh pr view "$PR" --json number,headRefName,baseRefName,url,mergeable,mergeStateStatus,files 2>&1) || {
|
|
62
|
+
echo "error: failed to fetch PR data for '${PR}'. Is this a valid PR identifier?" >&2
|
|
63
|
+
echo " gh output: ${PR_JSON}" >&2
|
|
64
|
+
exit 1
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
PR_NUMBER=$(printf '%s\n' "$PR_JSON" | jq -r '.number')
|
|
68
|
+
|
|
69
|
+
# ── Fetch CI checks ─────────────────────────────────────────────────────────
|
|
70
|
+
|
|
71
|
+
CHECKS_STATUS=0
|
|
72
|
+
CHECKS_JSON=$(gh pr checks "$PR" --json name,state,bucket,link,workflow 2>&1) || CHECKS_STATUS=$?
|
|
73
|
+
if [ "$CHECKS_STATUS" -ne 0 ] && [ "$CHECKS_STATUS" -ne 8 ]; then
|
|
74
|
+
echo "error: failed to fetch PR checks for '${PR}'." >&2
|
|
75
|
+
echo " gh output: ${CHECKS_JSON}" >&2
|
|
76
|
+
exit 1
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
# ── Fetch reviews ───────────────────────────────────────────────────────────
|
|
80
|
+
|
|
81
|
+
REVIEWS_JSON=$(gh pr view "$PR" --json reviews --jq '.reviews' 2>/dev/null) || REVIEWS_JSON="[]"
|
|
82
|
+
|
|
83
|
+
# ── Fetch review threads (comments) ─────────────────────────────────────────
|
|
84
|
+
|
|
85
|
+
REPO_FULL_NAME=$(gh repo view --json nameWithOwner --jq '.nameWithOwner' 2>&1) || {
|
|
86
|
+
echo "error: failed to determine repository name for review thread lookup." >&2
|
|
87
|
+
echo " gh output: ${REPO_FULL_NAME}" >&2
|
|
88
|
+
exit 1
|
|
89
|
+
}
|
|
90
|
+
REPO_OWNER=${REPO_FULL_NAME%/*}
|
|
91
|
+
REPO_NAME=${REPO_FULL_NAME#*/}
|
|
92
|
+
THREADS_PAGES=$(gh api graphql --paginate --slurp \
|
|
93
|
+
-f owner="$REPO_OWNER" \
|
|
94
|
+
-f repo="$REPO_NAME" \
|
|
95
|
+
-F pr="$PR_NUMBER" \
|
|
96
|
+
-f query='
|
|
97
|
+
query($owner: String!, $repo: String!, $pr: Int!, $endCursor: String) {
|
|
98
|
+
repository(owner: $owner, name: $repo) {
|
|
99
|
+
pullRequest(number: $pr) {
|
|
100
|
+
reviewThreads(first: 100, after: $endCursor) {
|
|
101
|
+
nodes {
|
|
102
|
+
path
|
|
103
|
+
line
|
|
104
|
+
startLine
|
|
105
|
+
isResolved
|
|
106
|
+
comments(first: 1) {
|
|
107
|
+
nodes {
|
|
108
|
+
body
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
pageInfo {
|
|
113
|
+
hasNextPage
|
|
114
|
+
endCursor
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
' 2>&1) || {
|
|
121
|
+
echo "error: failed to fetch PR review threads for '${PR}'." >&2
|
|
122
|
+
echo " gh output: ${THREADS_PAGES}" >&2
|
|
123
|
+
exit 1
|
|
124
|
+
}
|
|
125
|
+
THREADS_JSON=$(printf '%s\n' "$THREADS_PAGES" | jq '[.[].data.repository.pullRequest.reviewThreads.nodes[]?]')
|
|
126
|
+
|
|
127
|
+
# ── Assemble the final JSON ─────────────────────────────────────────────────
|
|
128
|
+
|
|
129
|
+
jq -n \
|
|
130
|
+
--argjson pr "$PR_JSON" \
|
|
131
|
+
--argjson checks "$CHECKS_JSON" \
|
|
132
|
+
--argjson reviews "$REVIEWS_JSON" \
|
|
133
|
+
--argjson threads "$THREADS_JSON" \
|
|
134
|
+
'
|
|
135
|
+
# ── pr_target ──────────────────────────────────────────────────────────────
|
|
136
|
+
($pr.mergeable // "UNKNOWN") as $mergeable |
|
|
137
|
+
|
|
138
|
+
{
|
|
139
|
+
pr_target: {
|
|
140
|
+
number: $pr.number,
|
|
141
|
+
branch: $pr.headRefName,
|
|
142
|
+
base: $pr.baseRefName,
|
|
143
|
+
url: $pr.url,
|
|
144
|
+
mergeable: $mergeable
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
# ── checks ─────────────────────────────────────────────────────────────────
|
|
148
|
+
checks: [
|
|
149
|
+
$checks[] | {
|
|
150
|
+
name: .name,
|
|
151
|
+
status: .state,
|
|
152
|
+
bucket: (.bucket // null),
|
|
153
|
+
conclusion: (.bucket // .state),
|
|
154
|
+
url: (.link // null),
|
|
155
|
+
workflow: (.workflow // null)
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
|
|
159
|
+
# ── reviews (deduplicate to latest per author) ─────────────────────────────
|
|
160
|
+
reviews: [
|
|
161
|
+
($reviews
|
|
162
|
+
| group_by(.author.login)
|
|
163
|
+
| map(sort_by(.submittedAt) | last)
|
|
164
|
+
| .[]
|
|
165
|
+
) | {
|
|
166
|
+
author: .author.login,
|
|
167
|
+
state: .state,
|
|
168
|
+
body: (.body // "")
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
|
|
172
|
+
# ── review_threads ─────────────────────────────────────────────────────────
|
|
173
|
+
review_threads: [
|
|
174
|
+
$threads[] | {
|
|
175
|
+
path: .path,
|
|
176
|
+
line: (.line // .startLine // null),
|
|
177
|
+
body: (.comments.nodes[0].body // .comments[0].body // ""),
|
|
178
|
+
isResolved: .isResolved
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
|
|
182
|
+
# ── conflicts ──────────────────────────────────────────────────────────────
|
|
183
|
+
conflicts: (
|
|
184
|
+
($mergeable == "CONFLICTING") as $has |
|
|
185
|
+
{
|
|
186
|
+
has_conflicts: $has,
|
|
187
|
+
conflicting_files_status: (
|
|
188
|
+
if $has then
|
|
189
|
+
"unknown"
|
|
190
|
+
else
|
|
191
|
+
"none"
|
|
192
|
+
end
|
|
193
|
+
),
|
|
194
|
+
conflicting_files: (
|
|
195
|
+
if $has then
|
|
196
|
+
[]
|
|
197
|
+
else
|
|
198
|
+
[]
|
|
199
|
+
end
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
|
|
204
|
+
# ── blocker_summary (computed) ─────────────────────────────────────────────
|
|
205
|
+
blocker_summary: (
|
|
206
|
+
# Failing checks
|
|
207
|
+
[ $checks[] | select(.bucket == "fail" or .state == "FAILURE" or .state == "ACTION_REQUIRED") | .name ] as $failing |
|
|
208
|
+
|
|
209
|
+
# Unresolved review threads
|
|
210
|
+
[ $threads[] | select(.isResolved == false) ] | length as $pending |
|
|
211
|
+
|
|
212
|
+
# Merge conflicts
|
|
213
|
+
($mergeable == "CONFLICTING") as $has_conflicts |
|
|
214
|
+
|
|
215
|
+
# Categories
|
|
216
|
+
(
|
|
217
|
+
(if ($failing | length) > 0 then ["check_repair"] else [] end) +
|
|
218
|
+
(if $pending > 0 then ["feedback_repair"] else [] end) +
|
|
219
|
+
(if $has_conflicts then ["conflict_repair"] else [] end)
|
|
220
|
+
) as $cats |
|
|
221
|
+
|
|
222
|
+
{
|
|
223
|
+
failing_checks: $failing,
|
|
224
|
+
pending_feedback_count: $pending,
|
|
225
|
+
has_merge_conflicts: $has_conflicts,
|
|
226
|
+
blocker_categories: $cats
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
'
|
|
@@ -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,122 @@
|
|
|
1
|
+
# HANDOFF.md Template
|
|
2
|
+
|
|
3
|
+
Reference template for the `HANDOFF.md` file at project root.
|
|
4
|
+
|
|
5
|
+
Ownership is split. Everything between the `GENERATED` markers is derived from
|
|
6
|
+
the State Ledger and rewritten by the runtime on every `imm-review pass`; edits
|
|
7
|
+
there are lost on the next pass. Everything outside the markers is narrative the
|
|
8
|
+
runtime cannot derive, and the runtime preserves it untouched. A `HANDOFF.md`
|
|
9
|
+
without markers is adopted on the first pass: the block is inserted below the
|
|
10
|
+
title and existing content is kept.
|
|
11
|
+
|
|
12
|
+
## Standard sections
|
|
13
|
+
|
|
14
|
+
```markdown
|
|
15
|
+
# Immune-Brain Handoff
|
|
16
|
+
|
|
17
|
+
<!-- GENERATED: immune-brain-handoff-state -->
|
|
18
|
+
## Current state
|
|
19
|
+
|
|
20
|
+
- Plan: `<plan path>`
|
|
21
|
+
- Summary: <one-line plan summary>
|
|
22
|
+
|
|
23
|
+
### Completed steps
|
|
24
|
+
|
|
25
|
+
- <Step ID>: <Result line>
|
|
26
|
+
|
|
27
|
+
### Active step
|
|
28
|
+
|
|
29
|
+
- <Step ID>: <Result line>
|
|
30
|
+
|
|
31
|
+
### Known blockers
|
|
32
|
+
|
|
33
|
+
- <Step ID>: <failure exit>
|
|
34
|
+
<!-- END GENERATED: immune-brain-handoff-state -->
|
|
35
|
+
|
|
36
|
+
## Decisions this session
|
|
37
|
+
|
|
38
|
+
<judgement calls a reader would not recover from the Ledger>
|
|
39
|
+
|
|
40
|
+
## Files in play
|
|
41
|
+
|
|
42
|
+
<the few files that matter most on reload, highest priority first>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Compaction Handoff section
|
|
46
|
+
|
|
47
|
+
Appended when compaction is imminent or at each QA pass. Fields match spec R2.
|
|
48
|
+
|
|
49
|
+
```markdown
|
|
50
|
+
## Compaction Handoff
|
|
51
|
+
|
|
52
|
+
### Active plan
|
|
53
|
+
<relative plan path>
|
|
54
|
+
|
|
55
|
+
### Active step
|
|
56
|
+
Step <N> (<Step ID>): <Result line>
|
|
57
|
+
|
|
58
|
+
### Files in play (compaction priority)
|
|
59
|
+
1. <path> — <reason: actively editing / test target / config>
|
|
60
|
+
2. <path> — <reason>
|
|
61
|
+
(max 5; these are the files the agent should reload first post-compact)
|
|
62
|
+
|
|
63
|
+
### Uncommitted work
|
|
64
|
+
<N> files modified, <M> untracked
|
|
65
|
+
Top paths: <path1>, <path2>
|
|
66
|
+
|
|
67
|
+
### Decisions this session
|
|
68
|
+
- <decision 1>
|
|
69
|
+
- <decision 2>
|
|
70
|
+
(not a substitute for ADR/solutions; temporary session context)
|
|
71
|
+
|
|
72
|
+
### Next boundary
|
|
73
|
+
<imm-work | imm-qa | imm-executor> — <one-line reason>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Successor decision (non-authoritative mirror)
|
|
77
|
+
|
|
78
|
+
Include this section only when the current Plan declares a non-terminal successor. Copy the values from a fresh runtime checkpoint; do not infer them from filenames or prose.
|
|
79
|
+
|
|
80
|
+
```markdown
|
|
81
|
+
## Successor decision (non-authoritative mirror)
|
|
82
|
+
|
|
83
|
+
- Current Plan: <canonical relative Plan path>
|
|
84
|
+
- Current Phase: <stable Phase ID>
|
|
85
|
+
- Closure/review state: <closed and reviewed | unresolved boundary>
|
|
86
|
+
- Successor candidate: <stable Phase ID>
|
|
87
|
+
- Successor preconditions: <declared preconditions>
|
|
88
|
+
- Expected Ledger revision: <opaque lowercase revision>
|
|
89
|
+
- Next user decision: <create and validate | explicitly approve a validated successor Plan>
|
|
90
|
+
- Deferred scope: <remaining Roadmap scope or explicit reference>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
This mirror may be stale. The State Ledger plus a fresh validated Plan read remains authoritative, and HANDOFF must never be parsed as transition authority. A placeholder successor path is not executable approval.
|
|
94
|
+
|
|
95
|
+
## Machine-readable mirror (retired)
|
|
96
|
+
|
|
97
|
+
A machine-readable mirror of these fields was once specified for `imm-dehydrate`
|
|
98
|
+
to store under `logic_state.compaction_handoff` in `.imm/memory/state.json`. That
|
|
99
|
+
whole path is retired: the command is gone, `state.json` is deleted, and spec R3
|
|
100
|
+
is withdrawn. `HANDOFF.md` is the only place the compaction fields live, which is
|
|
101
|
+
why the narrative sections below the generated block matter. The shape below is
|
|
102
|
+
kept for historical reference only.
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"compaction_handoff": {
|
|
107
|
+
"active_plan": "<relative plan path>",
|
|
108
|
+
"active_step_id": "<Step ID>",
|
|
109
|
+
"active_step_result": "<Result line>",
|
|
110
|
+
"priority_files": ["<path1>", "<path2>"],
|
|
111
|
+
"uncommitted_summary": "<N files modified, M untracked>",
|
|
112
|
+
"session_decisions": ["<decision 1>"],
|
|
113
|
+
"next_boundary": "<skill name>"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Notes
|
|
119
|
+
|
|
120
|
+
- `imm-work` owns HANDOFF.md writes (boundary exception documented in skill)
|
|
121
|
+
- `.imm/memory/` is the source of truth; HANDOFF.md is a convenience artifact
|
|
122
|
+
- Priority files list is advisory (max 5) and exists only to make Pi session continuation faster
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Design Contract Audit Rubric
|
|
2
|
+
|
|
3
|
+
Use this rubric to audit a project's `DESIGN.md` for completeness, internal
|
|
4
|
+
consistency, accessibility specification, and machine-readability. The rubric
|
|
5
|
+
uses Vercel Geist (`design.md` / `design.dark.md`) as a structural reference for
|
|
6
|
+
what a well-formed, agent-consumable design contract contains — not as a required
|
|
7
|
+
style or aesthetic to adopt.
|
|
8
|
+
|
|
9
|
+
This document is the **audit side**: it evaluates whether a `DESIGN.md` is itself
|
|
10
|
+
a good contract. The separate `design-contract-review-checklist.md` is the
|
|
11
|
+
**consumer side**: it tells reviewers to treat `DESIGN.md` as the authority when
|
|
12
|
+
reviewing rendered UI.
|
|
13
|
+
|
|
14
|
+
## Scope
|
|
15
|
+
|
|
16
|
+
- This rubric is read-only and advisory. It does not write, scaffold, or modify
|
|
17
|
+
any project file.
|
|
18
|
+
- It checks whether the project's **own declared choices** are complete and
|
|
19
|
+
machine-consumable. It does not require a project to adopt Geist's specific
|
|
20
|
+
values.
|
|
21
|
+
- Geist is a structural reference for which dimensions a design contract should
|
|
22
|
+
cover and how tokens should be expressed — never a style authority that
|
|
23
|
+
overrides project decisions.
|
|
24
|
+
|
|
25
|
+
## Audit Dimensions
|
|
26
|
+
|
|
27
|
+
### 1. Structural Coverage
|
|
28
|
+
|
|
29
|
+
Does the `DESIGN.md` cover the core sections an implementation agent needs?
|
|
30
|
+
Check for the presence of:
|
|
31
|
+
|
|
32
|
+
- Overview / design philosophy
|
|
33
|
+
- Colors (semantic palette)
|
|
34
|
+
- Typography (font families, sizes, weights, line-heights)
|
|
35
|
+
- Layout and spacing
|
|
36
|
+
- Elevation and depth
|
|
37
|
+
- Motion and animation
|
|
38
|
+
- Shapes and radii
|
|
39
|
+
- Components (buttons, inputs, common controls)
|
|
40
|
+
- Voice and content guidelines
|
|
41
|
+
- Do's and Don'ts or usage rules
|
|
42
|
+
|
|
43
|
+
A missing section is a gap finding; it is not a failure if the project
|
|
44
|
+
intentionally omits a section and documents why.
|
|
45
|
+
|
|
46
|
+
### 2. Color-Scale Semantics
|
|
47
|
+
|
|
48
|
+
- Are color tokens organized by **intent** (background, border, text, accent,
|
|
49
|
+
state) rather than only by raw lightness?
|
|
50
|
+
- Does the palette define steps or roles that carry semantic meaning (for
|
|
51
|
+
example, `100` = default background, `700` = solid fill)?
|
|
52
|
+
- Are accent colors mapped to state or function (error, warning, success, info,
|
|
53
|
+
link, focus)?
|
|
54
|
+
- Is contrast information referenced or WCAG compliance noted?
|
|
55
|
+
|
|
56
|
+
### 3. Light/Dark Token Parity
|
|
57
|
+
|
|
58
|
+
- If the project supports multiple themes (light/dark), do both themes use the
|
|
59
|
+
**same token names** with different values?
|
|
60
|
+
- Can an agent consume one token vocabulary that works across themes without
|
|
61
|
+
conditional branching on theme names?
|
|
62
|
+
- Are both themes documented in the same structure (or a parallel file with the
|
|
63
|
+
same heading layout)?
|
|
64
|
+
|
|
65
|
+
### 4. Typography Tokens
|
|
66
|
+
|
|
67
|
+
- Are typography choices expressed as **named tokens** with concrete values
|
|
68
|
+
(`fontSize`, `fontWeight`, `lineHeight`, `letterSpacing`) rather than prose
|
|
69
|
+
descriptions alone?
|
|
70
|
+
- Are categories distinguished (headings, body/copy, labels, buttons, code/mono)?
|
|
71
|
+
- Do tokens cover the full range of sizes the project uses?
|
|
72
|
+
- Are font families specified (not only implied)?
|
|
73
|
+
|
|
74
|
+
### 5. Spacing/Layout Rhythm
|
|
75
|
+
|
|
76
|
+
- Is there a defined spacing scale (for example 4px base with named steps)?
|
|
77
|
+
- Are layout rules concrete: max content width, breakpoints, padding
|
|
78
|
+
conventions, responsive behavior?
|
|
79
|
+
- Can an agent derive correct spacing from the contract without guessing?
|
|
80
|
+
|
|
81
|
+
### 6. Elevation/Shape
|
|
82
|
+
|
|
83
|
+
- Are shadow values expressed as concrete `box-shadow` tokens (or equivalent)
|
|
84
|
+
rather than qualitative labels?
|
|
85
|
+
- Are border-radius values defined per context (controls, cards, modals, pills)?
|
|
86
|
+
- Is the elevation hierarchy clear (flat → raised → popover → modal)?
|
|
87
|
+
|
|
88
|
+
### 7. Motion
|
|
89
|
+
|
|
90
|
+
- Are animation durations, easing curves, and allowed motion types specified?
|
|
91
|
+
- Is `prefers-reduced-motion` handling documented?
|
|
92
|
+
- Does the contract distinguish functional motion (reveals, transitions) from
|
|
93
|
+
decorative motion, and discourage the latter?
|
|
94
|
+
|
|
95
|
+
### 8. Component Tokens
|
|
96
|
+
|
|
97
|
+
- Are primary interactive components (buttons, inputs, selects, toggles)
|
|
98
|
+
described with token-level detail: background, text color, border, height,
|
|
99
|
+
radius, padding?
|
|
100
|
+
- Are interaction states covered: default, hover, active, focus, disabled, error?
|
|
101
|
+
- Is the focus ring or focus indicator specified?
|
|
102
|
+
|
|
103
|
+
### 9. Accessibility
|
|
104
|
+
|
|
105
|
+
- Does the contract specify minimum contrast ratios (for example WCAG AA 4.5:1
|
|
106
|
+
for body text)?
|
|
107
|
+
- Is focus visibility required for all interactive elements?
|
|
108
|
+
- Does the contract prohibit signaling state with color alone (requiring icon or
|
|
109
|
+
text pairing)?
|
|
110
|
+
- Are touch targets / minimum sizes referenced for mobile?
|
|
111
|
+
|
|
112
|
+
### 10. Voice/Content
|
|
113
|
+
|
|
114
|
+
- Does the contract include content rules: capitalization conventions, action
|
|
115
|
+
labeling, error message format, empty-state copy, in-progress wording?
|
|
116
|
+
- Are the rules concrete enough that an agent can apply them without subjective
|
|
117
|
+
judgment?
|
|
118
|
+
|
|
119
|
+
### 11. Machine-Readability
|
|
120
|
+
|
|
121
|
+
- Are design decisions expressed as **named tokens with concrete values** that an
|
|
122
|
+
implementation agent can directly consume?
|
|
123
|
+
- Or are decisions expressed only as qualitative prose (for example "use generous
|
|
124
|
+
whitespace") that requires interpretation?
|
|
125
|
+
- Can the contract be parsed section-by-section by an agent without resolving
|
|
126
|
+
ambiguity?
|
|
127
|
+
|
|
128
|
+
## Severity
|
|
129
|
+
|
|
130
|
+
- **Gap**: A section or dimension is entirely absent.
|
|
131
|
+
- **Weak**: A section exists but gives only qualitative prose without
|
|
132
|
+
machine-consumable token values.
|
|
133
|
+
- **Inconsistency**: Two parts of the contract contradict each other (for
|
|
134
|
+
example, a radius value in Components differs from the Shapes section).
|
|
135
|
+
- **Parity drift**: Light and dark themes define different token sets or
|
|
136
|
+
miss entries in one theme.
|
|
137
|
+
- **Accessibility gap**: The contract omits minimum contrast, focus visibility,
|
|
138
|
+
or color-only signaling rules.
|
|
139
|
+
|
|
140
|
+
## Guardrails
|
|
141
|
+
|
|
142
|
+
- This rubric is read-only. Route fixes through normal follow-up handoff paths
|
|
143
|
+
rather than modifying the project `DESIGN.md` during an audit.
|
|
144
|
+
- Do not impose Geist's specific palette, radii, spacing, font choices, or
|
|
145
|
+
aesthetic on the audited project.
|
|
146
|
+
- Do not treat a missing `DESIGN.md` as a rubric failure; report the absence and
|
|
147
|
+
recommend authoring one.
|
|
148
|
+
- Keep findings style-neutral: critique completeness and consumability, not
|
|
149
|
+
taste.
|