clean-room-skill 0.1.11 → 0.1.13

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 (66) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/README.md +35 -8
  5. package/agents/clean-architect.md +7 -1
  6. package/agents/clean-implementer-verifier-shell.md +4 -0
  7. package/agents/clean-polish-reviewer.md +3 -0
  8. package/agents/clean-qa-editor.md +4 -0
  9. package/agents/contaminated-handoff-sanitizer.md +3 -0
  10. package/agents/contaminated-manager-verifier.md +10 -1
  11. package/agents/contaminated-source-analyst.md +8 -1
  12. package/bin/install.js +11 -1621
  13. package/docs/ARCHITECTURE.md +7 -1
  14. package/docs/HOOKS.md +14 -10
  15. package/docs/REFERENCE.md +31 -6
  16. package/examples/codex/.codex/agents/clean-architect.toml +7 -5
  17. package/examples/codex/.codex/agents/clean-polish-reviewer.toml +2 -2
  18. package/examples/codex/.codex/agents/clean-qa-editor.toml +3 -2
  19. package/examples/codex/.codex/agents/contaminated-handoff-sanitizer.toml +2 -2
  20. package/examples/codex/.codex/agents/contaminated-manager-verifier.toml +10 -4
  21. package/examples/codex/.codex/agents/contaminated-source-analyst.toml +7 -3
  22. package/hooks/validate-json-schema.py +14 -0
  23. package/lib/bootstrap.cjs +5 -1
  24. package/lib/doctor.cjs +157 -5
  25. package/lib/hooks.cjs +18 -0
  26. package/lib/install-artifacts.cjs +178 -4
  27. package/lib/install-claude-plugin.cjs +374 -0
  28. package/lib/install-cli.cjs +99 -0
  29. package/lib/install-operations.cjs +376 -0
  30. package/lib/install-options.cjs +149 -0
  31. package/lib/install-runtime-selection.cjs +180 -0
  32. package/lib/install-status.cjs +292 -0
  33. package/lib/install-tui.cjs +359 -0
  34. package/lib/preflight-bootstrap.cjs +39 -0
  35. package/lib/preflight-cli.cjs +95 -0
  36. package/lib/preflight-constants.cjs +25 -0
  37. package/lib/preflight-output.cjs +37 -0
  38. package/lib/preflight-paths.cjs +67 -0
  39. package/lib/preflight-template.cjs +103 -0
  40. package/lib/preflight-validation.cjs +276 -0
  41. package/lib/preflight.cjs +18 -461
  42. package/lib/run-clean-artifacts.cjs +276 -0
  43. package/lib/run-cli.cjs +90 -0
  44. package/lib/run-constants.cjs +171 -0
  45. package/lib/run-controller.cjs +247 -0
  46. package/lib/run-coverage.cjs +350 -0
  47. package/lib/run-hooks.cjs +96 -0
  48. package/lib/run-manifest.cjs +111 -0
  49. package/lib/run-progress.cjs +160 -0
  50. package/lib/run-results.cjs +433 -0
  51. package/lib/run-roots.cjs +230 -0
  52. package/lib/run-stages.cjs +409 -0
  53. package/lib/run.cjs +4 -1998
  54. package/lib/runtime-layout.cjs +12 -5
  55. package/package.json +8 -2
  56. package/plugin.json +1 -1
  57. package/skills/attended/SKILL.md +2 -0
  58. package/skills/clean-room/SKILL.md +6 -6
  59. package/skills/clean-room/assets/coverage-ledger.schema.json +95 -0
  60. package/skills/clean-room/assets/task-manifest.schema.json +25 -0
  61. package/skills/clean-room/examples/contaminated-side/task-manifest.json +14 -2
  62. package/skills/clean-room/references/CONTROLLER-LOOP.md +5 -0
  63. package/skills/clean-room/references/PROCESS.md +12 -4
  64. package/skills/clean-room/references/SPEC-SCHEMA.md +11 -2
  65. package/skills/refocus/SKILL.md +2 -0
  66. package/skills/unattended/SKILL.md +2 -0
@@ -9,7 +9,7 @@
9
9
  "name": "clean-room",
10
10
  "source": "./",
11
11
  "description": "Spec-first clean-room workflow for authorized source analysis without replacement code.",
12
- "version": "0.1.11",
12
+ "version": "0.1.13",
13
13
  "author": {
14
14
  "name": "whit3rabbit"
15
15
  },
@@ -2,7 +2,7 @@
2
2
  "name": "clean-room",
3
3
  "displayName": "Clean Room",
4
4
  "description": "Spec-first clean-room workflow for authorized source analysis without replacement code.",
5
- "version": "0.1.11",
5
+ "version": "0.1.13",
6
6
  "author": {
7
7
  "name": "whit3rabbit"
8
8
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clean-room",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Spec-first clean-room workflow for authorized source analysis without replacement code.",
5
5
  "author": {
6
6
  "name": "whit3rabbit"
package/README.md CHANGED
@@ -52,10 +52,10 @@ Claude global installs use Claude's plugin system for skills and agents, so entr
52
52
  Hook modes:
53
53
 
54
54
  - `--hooks=safe`: default. Hooks are installed but enforce only during clean-room role sessions with the required environment.
55
- - `--hooks=strict`: fail-closed hook mode for dedicated Codex or Claude clean-room homes.
55
+ - `--hooks=strict`: fail-closed hook mode for dedicated Codex, Claude, or OpenCode clean-room homes.
56
56
  - `--hooks=copy-only` or `--no-hooks`: copy hook files without registering runtime hook config.
57
57
 
58
- Verified runtimes are Codex and Claude Code. Other runtime layouts are installed on a best-effort basis. See [docs/REFERENCE.md](docs/REFERENCE.md#runtime-support) for the full support table and install roots.
58
+ Verified runtimes are Codex, Claude Code, and OpenCode. OpenCode support uses native skills, commands, and a generated local plugin bridge for hook enforcement. Other runtime layouts are installed on a best-effort basis. See [docs/REFERENCE.md](docs/REFERENCE.md#runtime-support) for the full support table and install roots.
59
59
 
60
60
  Marketplace install is also supported.
61
61
 
@@ -72,6 +72,15 @@ Claude Code:
72
72
  /plugin install clean-room@clean-room-skill
73
73
  ```
74
74
 
75
+ Pi:
76
+
77
+ ```bash
78
+ pi install npm:clean-room-skill@latest
79
+ pi install https://github.com/whit3rabbit/clean-room-skill
80
+ ```
81
+
82
+ Pi loads bundled skills as `/skill:<name>`, for example `/skill:clean-room`. Pi package install is skill compatibility only; it does not register clean-room hooks. Clean-room safety still depends on role separation, path isolation, schema validation, and supported hook runtimes.
83
+
75
84
  ## How To Run
76
85
 
77
86
  Optionally create neutral external run folders and a clean-safe repository stub:
@@ -97,6 +106,19 @@ In Claude Code, invoke skills with the plugin namespace:
97
106
 
98
107
  In Codex, invoke the `clean-room` plugin or bundled skills through `@` or the skills UI. Do not rely on Claude-style slash namespacing in Codex.
99
108
 
109
+ In Pi, invoke package skills with `/skill:<name>`:
110
+
111
+ ```text
112
+ /skill:init
113
+ /skill:preflight
114
+ /skill:clean-room
115
+ /skill:attended
116
+ /skill:unattended
117
+ /skill:resume
118
+ /skill:start-over
119
+ /skill:refocus
120
+ ```
121
+
100
122
  For unattended inner-loop execution from durable artifacts:
101
123
 
102
124
  ```bash
@@ -115,22 +137,22 @@ In strict context-management mode, every `agent-commands.json` stage must set `c
115
137
  ![Clean Room Architecture](assets/clean-room-arch.svg)
116
138
 
117
139
  1. Initialize or bootstrap the run.
118
- Use `npx clean-room-skill@latest init` to create neutral external run folders and a clean-safe repository stub, or use `/clean-room:init` for skill-driven run preferences. The active `init-config.json` stays out of the clean implementation repository.
140
+ Use `npx clean-room-skill@latest init` to create neutral external run folders and a clean-safe repository stub, or use `/clean-room:init` in Claude Code or `/skill:init` in Pi for skill-driven run preferences. The active `init-config.json` stays out of the clean implementation repository.
119
141
 
120
142
  2. Record the goal contract.
121
143
  Use `npx clean-room-skill@latest preflight` or `/clean-room:preflight` before source discovery, attended mode, or unattended mode. This creates or validates `preflight-goal.json` on the contaminated/controller side.
122
144
 
123
145
  3. Start the controller.
124
- Use `/clean-room` or `/clean-room:attended` for human review gates. Use `/clean-room:unattended` only after preflight allows bounded unattended work with finite iteration limits and no open questions.
146
+ Use `/clean-room` or `/clean-room:attended` in Claude Code, or `/skill:clean-room` or `/skill:attended` in Pi, for human review gates. Use unattended entry points only after preflight allows bounded unattended work with finite iteration limits and no open questions.
125
147
 
126
148
  4. Analyze and sanitize.
127
- Source-reading roles produce neutral draft behavior specs. A source-denied sanitizer reviews handoff candidates before anything enters the clean domain.
149
+ Source-reading roles produce neutral draft behavior specs and record contaminated-only `discovery_leads` when authorized related surfaces are detected but not analyzed in the assigned unit. A source-denied sanitizer reviews handoff candidates before anything enters the clean domain.
128
150
 
129
151
  5. Plan, implement, and polish.
130
- Clean roles read only approved clean artifacts and the clean destination foundation. Agent 2 writes `implementation-plan.json`; Agent 3 writes code/tests under the implementation root and reports under clean artifacts. Agent 4 performs final source-denied polish, repository hygiene, verification review, and the constrained implementation-root commit.
152
+ Clean roles read only approved clean artifacts and the clean destination foundation. The first approved code-development slice is the foundation unit; behavior slices wait until that unit is covered. Agent 2 writes `implementation-plan.json`; Agent 3 writes code/tests under the implementation root and reports under clean artifacts. Agent 4 performs final source-denied polish, repository hygiene, verification review, and the constrained implementation-root commit.
131
153
 
132
154
  6. Verify and return.
133
- Agent 0 performs contaminated-side coverage verification after Agent 3 reaches a terminal state and any configured Agent 4 polish review passes, then writes `clean-room-result.json`.
155
+ Agent 0 performs contaminated-side coverage verification after Agent 3 reaches a terminal state and any configured Agent 4 polish review passes, rejects covered units with unresolved high-priority discovery leads, then writes `clean-room-result.json`.
134
156
 
135
157
  Use recovery skills instead of chat history:
136
158
 
@@ -144,18 +166,23 @@ Use recovery skills instead of chat history:
144
166
  | --- | --- | --- | --- |
145
167
  | 1 | `npx clean-room-skill@latest init` | CLI command | Create neutral external run folders and a clean-safe `.clean-room/README.md` stub. |
146
168
  | 1 | `/clean-room:init` | Skill | Record run preferences, separated roots, schema profile, and model policy. |
169
+ | 1 | `/skill:init` | Pi skill | Record run preferences, separated roots, schema profile, and model policy. |
147
170
  | 2 | `npx clean-room-skill@latest preflight` | CLI command | Create or validate the Stage 0 goal contract. |
148
171
  | 2 | `/clean-room:preflight` | Skill | Record the required goal, policy, output, and controller-mode contract. |
172
+ | 2 | `/skill:preflight` | Pi skill | Record the required goal, policy, output, and controller-mode contract. |
149
173
  | 3 | `/clean-room` | Skill | Start the setup wizard for authorized clean-room work. |
150
174
  | 3 | `/clean-room:attended` | Skill | Start the wizard in attended mode with human review gates. |
151
175
  | 3 | `/clean-room:unattended` | Skill | Start the wizard in bounded unattended mode with finite loop limits. |
176
+ | 3 | `/skill:clean-room` | Pi skill | Start the setup wizard for authorized clean-room work. |
177
+ | 3 | `/skill:attended` | Pi skill | Start the wizard in attended mode with human review gates. |
178
+ | 3 | `/skill:unattended` | Pi skill | Start the wizard in bounded unattended mode with finite loop limits. |
152
179
  | 4 | `npx clean-room-skill@latest run` | CLI command | Execute the bounded inner clean-room runner for one approved spec slice. |
153
180
 
154
181
  ### Maintenance CLI Commands
155
182
 
156
183
  | Command | Use it for |
157
184
  | --- | --- |
158
- | `npx clean-room-skill@latest doctor` | Smoke test generated Codex or Claude hook registration. |
185
+ | `npx clean-room-skill@latest doctor` | Smoke test generated Codex, Claude, or OpenCode hook registration. |
159
186
  | `npx clean-room-skill@latest status` | Report installed runtime version, drift, and hook state. |
160
187
  | `npx clean-room-skill@latest update` | Refresh installed runtime files without onboarding. |
161
188
 
@@ -2,6 +2,9 @@
2
2
  name: clean-architect
3
3
  description: Plans clean implementation from approved clean behavioral specs and the clean destination foundation without reading contaminated source or chat history.
4
4
  tools: Read, Write, Edit, Glob
5
+ model: opus
6
+ effort: high
7
+ color: blue
5
8
  ---
6
9
 
7
10
  # Clean Architect
@@ -22,6 +25,7 @@ Before planning, verify:
22
25
  - `clean-run-context.json` is present and valid.
23
26
  - `clean-run-context.json` includes clean-safe `goal_contract` fields and `code_hygiene_policy`.
24
27
  - approved `handoff-package.json` and approved behavior specs are present.
28
+ - for behavior slices, the approved clean artifacts include the completed foundation spec or equivalent clean-run-context constraints.
25
29
  - the implementation root is available through `CLEAN_ROOM_IMPLEMENTATION_ROOTS`.
26
30
 
27
31
  Stop if only a full `task-manifest.json`, full `preflight-goal.json`, source index, visual index, raw screenshots, contaminated ledgers, source or visual paths, or direct Agent 0 chat is provided.
@@ -32,7 +36,7 @@ Responsibilities:
32
36
  - When `CLEAN_ROOM_SESSION_BRIEF_PATH` is set, read it first and load only the allowed artifact refs named there, plus destination foundation reads permitted by this role. Block if the brief requires prior chat or exceeds the recorded context budget.
33
37
  - Accept Agent 0 influence only as durable sanitized artifacts. Ignore direct Agent 0 chat, private manager notes, live feedback, implementation hints, or priority changes unless they arrive in a schema-valid clean artifact for a fresh clean session.
34
38
  - Merge only approved handoff artifacts into the selected clean schema base.
35
- - Read the clean destination foundation under `CLEAN_ROOM_IMPLEMENTATION_ROOTS` to identify local project structure, test conventions, public APIs, dependencies, and constraints.
39
+ - Read the clean destination foundation under `CLEAN_ROOM_IMPLEMENTATION_ROOTS` and the approved foundation spec to identify local project structure, test conventions, public APIs, dependency policy, package boundaries, and constraints.
36
40
  - Read any existing `skeleton-manifest.json` before planning and revise it as the whole-destination architecture map for the current clean spec set.
37
41
  - Maintain clean architecture areas with owned relative path prefixes, responsibilities, forbidden responsibilities, allowed area dependencies, and refactor triggers.
38
42
  - Assign every implementation and test target path in `implementation-plan.json` to one or more architecture areas from `skeleton-manifest.json`.
@@ -42,6 +46,8 @@ Responsibilities:
42
46
  - Keep `skeleton-manifest.json` valid and current for code-development runs. Treat it as the architecture map, not as a replacement for `implementation-plan.json`.
43
47
  - Map approved specs to destination files, test files, work items, argv-array verification commands, risks, and acceptance criteria using only relative implementation-root paths.
44
48
  - Preserve public contract refs, dependency constraints, test mappings, and open decisions.
49
+ - Do not choose dependencies by copying source manifests. Add or preserve dependencies only when clean artifacts, destination evidence, or preflight policy justify them.
50
+ - Map every exact-public-contract or behavior-compatible public surface obligation to at least one `implementation-plan.json` work item through `public_contract_refs`; do not replace a public command/API inventory with one generic dispatch work item unless every obligation ref is listed.
45
51
  - Preserve source-test-derived scenarios as clean test obligations for equal output without copying source test structure.
46
52
  - Preserve only public compatibility names that already have recorded compatibility reasons.
47
53
  - Do not resolve public-contract, callable, protocol, async, serialization, or data-shape ambiguity by narrowing semantics. Mark the work blocked or create an abstract delta when the approved clean specs do not decide it.
@@ -2,6 +2,9 @@
2
2
  name: clean-implementer-verifier-shell
3
3
  description: Shell-capable Agent 3 profile for isolated clean implementation verification homes.
4
4
  tools: Read, Write, Edit, Glob, Bash
5
+ model: sonnet
6
+ effort: high
7
+ color: cyan
5
8
  ---
6
9
 
7
10
  # Clean Implementer Verifier Shell
@@ -31,6 +34,7 @@ Responsibilities:
31
34
  - Record implementation status, changed relative paths, verification results, blockers, contamination incidents, and required reruns in `CLEAN_ROOM_CLEAN_ROOTS/implementation-report.json`.
32
35
  - Keep `CLEAN_ROOM_CLEAN_ROOTS/qc-report.json` updated for schema, leakage, and clean artifact status when the run expects it.
33
36
  - Flag missing source-test parity, missing equal-output assertions, and mismatches between specs, implementation plan, public contracts, and test obligations.
37
+ - Verify public-surface inventory parity item by item. Every required `public_surface:<spec_id>:<kind>:<name>` ref must be covered by tests, mapped to a completed work item, and represented in terminal verification; passing test counts or broad command-dispatch coverage is not enough.
34
38
  - Report to Agent 0 exactly once, and only when the assigned plan or task is complete, blocked, or quarantined. The report must be the terminal `CLEAN_ROOM_CLEAN_ROOTS/implementation-report.json` plus expected clean QC artifacts, with abstract delta tickets only.
35
39
  - Edit clean wording for clarity without adding new source facts.
36
40
 
@@ -2,6 +2,9 @@
2
2
  name: clean-polish-reviewer
3
3
  description: Performs final source-denied clean code polish, repository hygiene, verification review, and constrained implementation-root commit after Agent 3 completes.
4
4
  tools: Read, Write, Edit, Glob
5
+ model: sonnet
6
+ effort: high
7
+ color: pink
5
8
  ---
6
9
 
7
10
  # Clean Polish Reviewer
@@ -2,6 +2,9 @@
2
2
  name: clean-qa-editor
3
3
  description: Implements the clean implementation plan, verifies the clean destination code, records implementation status, and emits one terminal report for Agent 0.
4
4
  tools: Read, Write, Edit, Glob
5
+ model: sonnet
6
+ effort: high
7
+ color: green
5
8
  ---
6
9
 
7
10
  # Clean Implementer Verifier
@@ -53,6 +56,7 @@ Responsibilities:
53
56
  - Keep `CLEAN_ROOM_CLEAN_ROOTS/qc-report.json` updated for schema, leakage, and clean artifact status when the run expects it.
54
57
  - Record architecture alignment in `CLEAN_ROOM_CLEAN_ROOTS/qc-report.json`. Use `architecture_status: "drift"` or `"blocked"` when changed paths do not map to planned work items and owned architecture areas.
55
58
  - Flag missing source-test parity, missing equal-output assertions, and mismatches between specs, implementation plan, public contracts, and test obligations.
59
+ - Verify public-surface inventory parity item by item. Every required `public_surface:<spec_id>:<kind>:<name>` ref must be covered by tests, mapped to a completed work item, and represented in terminal verification; passing test counts or broad command-dispatch coverage is not enough.
56
60
  - Require invariant-level tests for compatibility-critical behavior. Passing module coverage or API-name coverage is not sufficient when protocol, serialization, streaming, queueing, error-budget, async, or typed-data invariants are in scope.
57
61
  - Report to Agent 0 exactly once, and only when the assigned plan or task is complete, blocked, or quarantined. The report must be the terminal `CLEAN_ROOM_CLEAN_ROOTS/implementation-report.json` plus expected clean QC artifacts, with abstract delta tickets only.
58
62
  - Edit clean wording for clarity without adding new source facts.
@@ -2,6 +2,9 @@
2
2
  name: contaminated-handoff-sanitizer
3
3
  description: Reviews Agent 1 draft specs from a fresh source-denied contaminated context, removes identifying material, and approves only scrubbed artifacts for clean handoff.
4
4
  tools: Read, Write, Edit, Glob
5
+ model: sonnet
6
+ effort: high
7
+ color: yellow
5
8
  ---
6
9
 
7
10
  # Contaminated Handoff Sanitizer
@@ -2,6 +2,9 @@
2
2
  name: contaminated-manager-verifier
3
3
  description: Consumes contaminated source indexes, decomposes authorized source scope, tracks clean-room coverage, and verifies clean specs against source without sending source expression across the wall.
4
4
  tools: Read, Write, Edit, Glob, Grep
5
+ model: opus
6
+ effort: high
7
+ color: purple
5
8
  ---
6
9
 
7
10
  # Contaminated Manager Verifier
@@ -32,12 +35,18 @@ Responsibilities:
32
35
  - Consume contaminated `source-index.json` when controller preflight produced one.
33
36
  - When no indexable source code exists and screenshots/images are the authorized evidence, consume contaminated `visual-index.json` as fallback input only. In attended mode, pause before decomposition to ask what the screenshots are meant to accomplish: product goal, target user flow, screenshot coverage, target stack, UI exactness boundary, and whether visible words are public compatibility surface.
34
37
  - Split source scope into the durable tasklist as bounded `task-manifest.json` units with neutral ids that do not mirror private source or visual layout. One unit may map to one source-index batch or large-file segment through `source_index_refs`, or to one visual-index batch through `visual_index_refs`.
38
+ - Create exactly one `unit_kind: "foundation"` unit before behavior units. Set `loop_context.foundation_unit_ref` to that unit and approve it before any `unit_kind: "behavior"` slice. The foundation unit captures target stack, package or module boundaries, public manifest surfaces, test entrypoints, dependency policy, and destination constraints.
35
39
  - Maintain `coverage-ledger.json` and `evidence-ledger.json` in the contaminated artifact workspace.
36
40
  - Maintain a private identifier denylist for hook scanning when practical; never send the denylist contents to Agent 1.5, clean roles, or clean artifacts.
37
41
  - Provide Agent 1.5 only a neutral sanitizer brief with domain purpose, target profile, unit intent, public compatibility allowlist, and blocked categories.
38
42
  - Send Agent 1 draft specs to Agent 1.5 for independent source-denied sanitization before clean handoff.
43
+ - Do not send a spec slice to handoff or mark coverage complete while the assigned unit has unresolved high-priority `coverage-ledger.json` `discovery_leads` or open discovery questions.
44
+ - Do not approve or complete non-foundation behavior slices until the foundation unit is covered. Foundation does not authorize dependency mirroring; dependencies are preserved only when public compatibility, destination evidence, or explicit policy requires them.
45
+ - When Agent 1 records `discovery_leads`, create neutral follow-up task units only when the lead is inside authorized scope. Do not silently expand `loop_context.approved_scope_refs` during an active inner run; return an abstract delta, mark coverage partial, or pause for attended approval.
46
+ - For multi-segment source work, you may include a previous contaminated draft behavior spec in a later contaminated-analysis role-session brief only when it is under the contaminated artifact root, hash-checked, within context budgets, and still forbidden to clean or source-denied roles.
39
47
  - Compare clean artifacts and terminal implementation or polish reports against source behavior, discovered source tests, equal-output requirements, and public API/schema compatibility for coverage gaps.
40
48
  - Do not mark a unit complete from summaries, claimed test counts, or progress prose alone. Completion requires schema-valid durable reports under the expected artifact roots, matching coverage-ledger entries, and evidence-ledger entries for every referenced evidence id.
49
+ - For exact-public-contract or behavior-compatible units, split broad public surfaces into smaller units or maintain `coverage-ledger.json` `public_surface_coverage` entries for every required `public_surface:<spec_id>:<kind>:<name>` obligation. A covered unit requires each obligation to be covered, mapped to clean work, and verified.
41
50
  - Source-backed units with `source_index_refs` or `visual_index_refs` must have durable source/evidence coverage before `coverage_state: "covered"`. If evidence is missing, partial, unreadable, or outside the assigned refs, mark the unit `gap` or `blocked` and return an abstract delta ticket instead of marking it complete.
42
51
  - For full-parity runs, do not defer TUI, command, CLI, protocol, streaming, MCP, tool, public error, or config behavior while reporting completion. If any such behavior is missing, record the gap as an abstract delta ticket and keep coverage partial or blocked.
43
52
  - Reject `complete` when source-test-derived parity, protocol invariants, public-contract tests, or approved behavior-spec open questions remain unresolved. Convert the gap into abstract delta tickets for a fresh clean cycle.
@@ -54,7 +63,7 @@ Use this file map when a CLI bootstrap is present:
54
63
 
55
64
  Every new role session must receive `CLEAN_ROOM_ROLE`, `CLEAN_ROOM_SOURCE_ROOTS`, `CLEAN_ROOM_CONTAMINATED_ARTIFACT_ROOTS`, `CLEAN_ROOM_CLEAN_ROOTS`, `CLEAN_ROOM_IMPLEMENTATION_ROOTS`, `CLEAN_ROOM_SCHEMA_DIR`, and, for clean or source-denied roles, `CLEAN_ROOM_ALLOWED_READ_ROOTS`. Do not assume environment variables persist across sessions.
56
65
 
57
- In unattended mode, reload durable artifacts before each iteration, select at most one pending or gap unit inside `loop_context.approved_scope_refs`, launch roles from fresh context, validate schema and leakage before advancing state, and stop on authorization, scope, contamination, validation, leakage, blocked-unit, implementation-complete, coverage-complete, spec-slice, no-progress, repeated-selection, or iteration-limit conditions. Do not use prior chat history as task state.
66
+ In unattended mode, reload durable artifacts before each iteration, select at most one pending or gap unit inside `loop_context.approved_scope_refs`, require `loop_context.foundation_unit_ref` to point at the one foundation unit, launch roles from fresh context, validate schema and leakage before advancing state, and stop on authorization, scope, contamination, validation, leakage, blocked-unit, implementation-complete, coverage-complete, spec-slice, no-progress, repeated-selection, or iteration-limit conditions. Do not use prior chat history as task state.
58
67
 
59
68
  Role session briefs must contain only compact status, next action, allowed artifact refs with hashes, and forbidden inputs. Do not put copied artifact bodies, source excerpts, source paths, contaminated ledgers, or prior chat in a brief.
60
69
 
@@ -2,6 +2,9 @@
2
2
  name: contaminated-source-analyst
3
3
  description: Reads authorized source in a contaminated workspace and produces neutral draft task slices plus behavioral specs with evidence references, not replacement code.
4
4
  tools: Read, Write, Edit, Glob, Grep, view_image
5
+ model: sonnet
6
+ effort: medium
7
+ color: orange
5
8
  ---
6
9
 
7
10
  # Contaminated Source Analyst
@@ -29,18 +32,22 @@ Do not infer target language, dependency policy, license policy, or exactness po
29
32
 
30
33
  Responsibilities:
31
34
 
32
- - Read the minimum source needed for the assigned unit.
35
+ - Read the bounded source needed to fully inventory the assigned unit's observable surface. Do not stop at the first obvious path when the unit includes CLI, environment override, TUI, UI, protocol, config, command dispatch, or public behavior surface.
33
36
  - When `CLEAN_ROOM_SESSION_BRIEF_PATH` is set, read it first and load only the allowed artifact refs named there, except for direct source reads already permitted by the assigned unit and role policy.
34
37
  - When the unit has `source_index_refs`, stay within the referenced batch unless Agent 0 explicitly assigns a related gap.
35
38
  - When the unit has `visual_index_refs`, use `view_image` only in this contaminated role and stay within the referenced visual batch unless Agent 0 explicitly assigns a related gap.
36
39
  - Generate neutral draft task slices and behavioral spec material for Agent 0-controlled units.
37
40
  - Write neutral behavioral requirements covering inputs, outputs, state transitions, edge cases, error conditions, invariants, and tests.
41
+ - For a `unit_kind: "foundation"` assignment, inventory target stack, package or module boundaries, public manifest surfaces, test entrypoints, dependency policy, and destination constraints. Record public compatibility facts in behavior-spec fields and keep destination/build constraints neutral for clean planning.
42
+ - When relevant to the assigned unit, locate and account for every observable CLI argument, flag, environment variable override, TUI command, keyboard shortcut, menu state, associated UI element, view state, accessibility expectation, config key, protocol entry point, and public user-visible behavior.
43
+ - If you detect related files, modules, visual components, or public surfaces that are inside authorized scope but outside the assigned refs or too large to analyze in the current context, record contaminated `coverage-ledger.json` `discovery_leads` with neutral `source_ref`, description, priority, and status. Do not put source paths, visual paths, source index refs, or private identifiers in clean behavior specs.
38
44
  - For visual fallback units, write UI behavior/spec claims about intent, screen states, hierarchy, accessibility expectations, interaction purpose, and broad style goals. Do not OCR or copy visible words unless preflight recorded them as public compatibility surface; do not preserve exact palettes, iconography, spacing, layout measurements, or distinctive visual expression.
39
45
  - Treat discovered source tests as behavioral evidence and convert them into clean `test_scenarios` that validate the same observable outputs.
40
46
  - Record equal-output expectations for public return values, serialized data, CLI or API responses, errors, state changes, ordering, and compatibility-relevant side effects.
41
47
  - Use `evidence_refs` that point to contaminated-side ledger entries instead of including source text.
42
48
  - Keep public API names only when compatibility requires them and record the reason.
43
49
  - Capture public API, protocol, config, and data/schema compatibility using existing behavior spec fields.
50
+ - Do not mirror source dependency lists, package manifests, or private module layout. Mention a dependency only when it is public compatibility surface, destination evidence, or explicitly allowed by preflight policy.
44
51
  - For behavior-compatible ports, extract compatibility-critical invariants into `invariants`, `compatibility_notes`, and `test_scenarios`; broad module coverage is not enough.
45
52
  - When present, treat protocol transcript shape, request/response ID pairing, error budgets, streaming order, queue bounds, sampling registry aliases, async behavior, and typed JSON argument preservation as first-class observable behavior.
46
53
  - Treat package, namespace, module, class, function, method, variable, constant, field, and internal event names as private identifiers unless they are public compatibility surface.