clean-room-skill 0.1.11 → 0.1.12
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +3 -3
- package/agents/clean-architect.md +4 -1
- package/agents/clean-implementer-verifier-shell.md +1 -0
- package/agents/clean-qa-editor.md +1 -0
- package/agents/contaminated-manager-verifier.md +7 -1
- package/agents/contaminated-source-analyst.md +5 -1
- package/docs/ARCHITECTURE.md +6 -0
- package/docs/REFERENCE.md +7 -2
- package/examples/codex/.codex/agents/clean-architect.toml +4 -2
- package/examples/codex/.codex/agents/clean-qa-editor.toml +1 -0
- package/examples/codex/.codex/agents/contaminated-manager-verifier.toml +7 -1
- package/examples/codex/.codex/agents/contaminated-source-analyst.toml +5 -1
- package/hooks/validate-json-schema.py +14 -0
- package/lib/run.cjs +277 -21
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills/clean-room/SKILL.md +4 -4
- package/skills/clean-room/assets/coverage-ledger.schema.json +95 -0
- package/skills/clean-room/assets/task-manifest.schema.json +25 -0
- package/skills/clean-room/examples/contaminated-side/task-manifest.json +14 -2
- package/skills/clean-room/references/CONTROLLER-LOOP.md +5 -0
- package/skills/clean-room/references/PROCESS.md +12 -4
- package/skills/clean-room/references/SPEC-SCHEMA.md +11 -2
- package/skills/refocus/SKILL.md +2 -0
package/README.md
CHANGED
|
@@ -124,13 +124,13 @@ In strict context-management mode, every `agent-commands.json` stage must set `c
|
|
|
124
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.
|
|
125
125
|
|
|
126
126
|
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.
|
|
127
|
+
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
128
|
|
|
129
129
|
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.
|
|
130
|
+
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
131
|
|
|
132
132
|
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`.
|
|
133
|
+
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
134
|
|
|
135
135
|
Use recovery skills instead of chat history:
|
|
136
136
|
|
|
@@ -22,6 +22,7 @@ Before planning, verify:
|
|
|
22
22
|
- `clean-run-context.json` is present and valid.
|
|
23
23
|
- `clean-run-context.json` includes clean-safe `goal_contract` fields and `code_hygiene_policy`.
|
|
24
24
|
- approved `handoff-package.json` and approved behavior specs are present.
|
|
25
|
+
- for behavior slices, the approved clean artifacts include the completed foundation spec or equivalent clean-run-context constraints.
|
|
25
26
|
- the implementation root is available through `CLEAN_ROOM_IMPLEMENTATION_ROOTS`.
|
|
26
27
|
|
|
27
28
|
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 +33,7 @@ Responsibilities:
|
|
|
32
33
|
- 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
34
|
- 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
35
|
- 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,
|
|
36
|
+
- 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
37
|
- Read any existing `skeleton-manifest.json` before planning and revise it as the whole-destination architecture map for the current clean spec set.
|
|
37
38
|
- Maintain clean architecture areas with owned relative path prefixes, responsibilities, forbidden responsibilities, allowed area dependencies, and refactor triggers.
|
|
38
39
|
- Assign every implementation and test target path in `implementation-plan.json` to one or more architecture areas from `skeleton-manifest.json`.
|
|
@@ -42,6 +43,8 @@ Responsibilities:
|
|
|
42
43
|
- 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
44
|
- 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
45
|
- Preserve public contract refs, dependency constraints, test mappings, and open decisions.
|
|
46
|
+
- Do not choose dependencies by copying source manifests. Add or preserve dependencies only when clean artifacts, destination evidence, or preflight policy justify them.
|
|
47
|
+
- 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
48
|
- Preserve source-test-derived scenarios as clean test obligations for equal output without copying source test structure.
|
|
46
49
|
- Preserve only public compatibility names that already have recorded compatibility reasons.
|
|
47
50
|
- 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.
|
|
@@ -31,6 +31,7 @@ Responsibilities:
|
|
|
31
31
|
- Record implementation status, changed relative paths, verification results, blockers, contamination incidents, and required reruns in `CLEAN_ROOM_CLEAN_ROOTS/implementation-report.json`.
|
|
32
32
|
- Keep `CLEAN_ROOM_CLEAN_ROOTS/qc-report.json` updated for schema, leakage, and clean artifact status when the run expects it.
|
|
33
33
|
- Flag missing source-test parity, missing equal-output assertions, and mismatches between specs, implementation plan, public contracts, and test obligations.
|
|
34
|
+
- 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
35
|
- 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
36
|
- Edit clean wording for clarity without adding new source facts.
|
|
36
37
|
|
|
@@ -53,6 +53,7 @@ Responsibilities:
|
|
|
53
53
|
- Keep `CLEAN_ROOM_CLEAN_ROOTS/qc-report.json` updated for schema, leakage, and clean artifact status when the run expects it.
|
|
54
54
|
- 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
55
|
- Flag missing source-test parity, missing equal-output assertions, and mismatches between specs, implementation plan, public contracts, and test obligations.
|
|
56
|
+
- 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
57
|
- 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
58
|
- 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
59
|
- Edit clean wording for clarity without adding new source facts.
|
|
@@ -32,12 +32,18 @@ Responsibilities:
|
|
|
32
32
|
- Consume contaminated `source-index.json` when controller preflight produced one.
|
|
33
33
|
- 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
34
|
- 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`.
|
|
35
|
+
- 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
36
|
- Maintain `coverage-ledger.json` and `evidence-ledger.json` in the contaminated artifact workspace.
|
|
36
37
|
- 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
38
|
- Provide Agent 1.5 only a neutral sanitizer brief with domain purpose, target profile, unit intent, public compatibility allowlist, and blocked categories.
|
|
38
39
|
- Send Agent 1 draft specs to Agent 1.5 for independent source-denied sanitization before clean handoff.
|
|
40
|
+
- 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.
|
|
41
|
+
- 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.
|
|
42
|
+
- 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.
|
|
43
|
+
- 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
44
|
- 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
45
|
- 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.
|
|
46
|
+
- 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
47
|
- 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
48
|
- 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
49
|
- 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 +60,7 @@ Use this file map when a CLI bootstrap is present:
|
|
|
54
60
|
|
|
55
61
|
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
62
|
|
|
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.
|
|
63
|
+
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
64
|
|
|
59
65
|
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
66
|
|
|
@@ -29,18 +29,22 @@ Do not infer target language, dependency policy, license policy, or exactness po
|
|
|
29
29
|
|
|
30
30
|
Responsibilities:
|
|
31
31
|
|
|
32
|
-
- Read the
|
|
32
|
+
- 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
33
|
- 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
34
|
- When the unit has `source_index_refs`, stay within the referenced batch unless Agent 0 explicitly assigns a related gap.
|
|
35
35
|
- 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
36
|
- Generate neutral draft task slices and behavioral spec material for Agent 0-controlled units.
|
|
37
37
|
- Write neutral behavioral requirements covering inputs, outputs, state transitions, edge cases, error conditions, invariants, and tests.
|
|
38
|
+
- 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.
|
|
39
|
+
- 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.
|
|
40
|
+
- 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
41
|
- 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
42
|
- Treat discovered source tests as behavioral evidence and convert them into clean `test_scenarios` that validate the same observable outputs.
|
|
40
43
|
- Record equal-output expectations for public return values, serialized data, CLI or API responses, errors, state changes, ordering, and compatibility-relevant side effects.
|
|
41
44
|
- Use `evidence_refs` that point to contaminated-side ledger entries instead of including source text.
|
|
42
45
|
- Keep public API names only when compatibility requires them and record the reason.
|
|
43
46
|
- Capture public API, protocol, config, and data/schema compatibility using existing behavior spec fields.
|
|
47
|
+
- 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
48
|
- For behavior-compatible ports, extract compatibility-critical invariants into `invariants`, `compatibility_notes`, and `test_scenarios`; broad module coverage is not enough.
|
|
45
49
|
- 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
50
|
- Treat package, namespace, module, class, function, method, variable, constant, field, and internal event names as private identifiers unless they are public compatibility surface.
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -52,6 +52,7 @@ To assist in logical unit decomposition, the workflow supports an optional sourc
|
|
|
52
52
|
* **Execution Boundary**: This tooling runs exclusively in the contaminated domain before clean-room role sessions are initialized.
|
|
53
53
|
* **Traversal Bounds**: Source indexing enforces file count, per-file byte, total byte, batch token, and segment caps. It validates file size again after reading, skips files that change during read, records directory walk errors, and prunes traversal after global limits are exhausted with an aggregate skipped entry.
|
|
54
54
|
* **Agent 0 Use**: Agent 0 consumes `source-index.json` only to create neutral `task-manifest.json` units and per-unit `source_index_refs`. In visual fallback runs, Agent 0 consumes `visual-index.json` only to create neutral units and per-unit `visual_index_refs`. Both indexes stay contaminated-only and do not cross to Agent 1.5, Agent 2, Agent 3, Agent 4, or clean handoff packages.
|
|
55
|
+
* **Discovery Leads**: When Agent 1 detects an authorized related surface that cannot be analyzed inside the assigned unit, Agent 0 tracks it in contaminated `coverage-ledger.json` `discovery_leads`. High-priority leads must be resolved before the unit can be marked covered; the runner does not expand approved scope automatically.
|
|
55
56
|
* **Tool Trust Policy**: By default, tool discovery operates in `stat-only` mode and does not execute third-party binaries. It queries version strings only when explicitly invoked with `--probe-tools`. Tools discovered under `/opt/homebrew` or `/usr/local` remain stat-only unless `--allow-user-toolchain-probes` is also supplied. Project-local directories (such as `.bin` or `node_modules/.bin`) are ignored unless the environment variable `RE_SKILLS_TRUST_PROJECT_TOOLS=1` or the flag `--allow-working-project-tools` is supplied.
|
|
56
57
|
* **Local Tool Install Safety**: Explicit npm-backed helper installs are strict-version pinned and serialized with a cache-local lock before mutating `~/.cache/re-skills/clean-room-tools/npm`. Prefix creation failures, subprocess timeouts, and subprocess launch errors are returned as structured JSON facts instead of raw tracebacks.
|
|
57
58
|
|
|
@@ -177,6 +178,7 @@ The architecture delegates work across six distinct custom role agents to enforc
|
|
|
177
178
|
* Produces `clean-run-context.json` for Agent 2, Agent 3, and Agent 4 instead of handing over the full `task-manifest.json` or full `preflight-goal.json`.
|
|
178
179
|
* Influences Agent 2, Agent 3, and Agent 4 only through durable sanitized artifacts, never direct chat, progress feedback, implementation hints, or priority changes.
|
|
179
180
|
* Performs final verification of clean specification and implementation coverage against the source scope.
|
|
181
|
+
* Blocks handoff or coverage completion when high-priority contaminated discovery leads remain unresolved.
|
|
180
182
|
* Writes the inner-loop `clean-room-result.json` only after contaminated-side coverage verification.
|
|
181
183
|
* Consumes Agent 3 reports only after Agent 3 reaches a terminal state, and consumes Agent 4 reports only after the configured polish review reaches a terminal state, then sends only abstract delta tickets into a fresh clean artifact cycle.
|
|
182
184
|
|
|
@@ -187,6 +189,8 @@ The architecture delegates work across six distinct custom role agents to enforc
|
|
|
187
189
|
* Analyzes the authorized source code within assigned units or batches.
|
|
188
190
|
* Uses target stack and compatibility policy from preflight instead of inferring product goals from source.
|
|
189
191
|
* Writes neutral draft behavioral specifications based on observed behavior, public contracts, invariants, state transitions, and errors.
|
|
192
|
+
* Inventories the assigned unit's observable CLI, env, TUI, UI, protocol, config, command, and public behavior surfaces when relevant.
|
|
193
|
+
* Records authorized related surfaces that cannot be analyzed in the assigned context as contaminated `discovery_leads`, not clean spec fields.
|
|
190
194
|
* Generates evidence references pointing to contaminated ledgers instead of copying raw source code or comments.
|
|
191
195
|
* Flags suspected leakage but does not approve its own work for clean handoff.
|
|
192
196
|
|
|
@@ -251,10 +255,12 @@ Agent 3's terminal report is not enough to return. If configured, Agent 4 must p
|
|
|
251
255
|
* Locks the contaminated artifact root with `.clean-room-run.lock`.
|
|
252
256
|
* Reloads durable artifacts before each iteration.
|
|
253
257
|
* Selects at most one pending or gap unit inside `loop_context.approved_scope_refs`.
|
|
258
|
+
* Requires exactly one `unit_kind: "foundation"` unit, named by `loop_context.foundation_unit_ref`; behavior units cannot run or complete until that foundation unit is covered.
|
|
254
259
|
* Spawns configured role commands with `shell: false`, bounded output, and bounded timeout.
|
|
255
260
|
* In strict context-management mode, requires each configured stage to provide `context.fresh_session: true` and `context.brief_path`, then validates the session brief before spawn.
|
|
256
261
|
* Supports the optional `clean-polish-review` phase between `clean-implement-qc` and `contaminated-coverage-verify`.
|
|
257
262
|
* Validates schema, leakage, and handoff integrity before advancing state.
|
|
263
|
+
* Rejects `covered` coverage-ledger units that still have unresolved high-priority `discovery_leads`.
|
|
258
264
|
* Records controller memory in contaminated-side `controller-run-ledger.json`.
|
|
259
265
|
* Writes `clean-room-result.json` before returning to the outer spec loop.
|
|
260
266
|
|
package/docs/REFERENCE.md
CHANGED
|
@@ -210,7 +210,11 @@ Options:
|
|
|
210
210
|
| `--schema-dir <path>` | Override bundled schema directory. |
|
|
211
211
|
| `--python <path>` | Python executable for validation hooks; default is `python3`. |
|
|
212
212
|
|
|
213
|
-
The task manifest must already include preflight references, the required handoff sequence, unattended controller policy, finite iteration bounds, and `loop_context.approved_scope_refs`.
|
|
213
|
+
The task manifest must already include preflight references, the required handoff sequence, unattended controller policy, finite iteration bounds, `loop_context.foundation_unit_ref`, and `loop_context.approved_scope_refs`.
|
|
214
|
+
|
|
215
|
+
Unattended code-development manifests must include exactly one `unit_kind: "foundation"` unit. The runner rejects non-foundation approved slices until that unit is covered.
|
|
216
|
+
|
|
217
|
+
`coverage-ledger.json` may record contaminated-only `source_units[].discovery_leads` for authorized related surfaces that were detected but not analyzed in the assigned unit. The runner rejects a `covered` unit while any high-priority discovery lead remains open or deferred. It does not add follow-up units or expand `loop_context.approved_scope_refs`; Agent 0 must return an abstract delta, mark coverage partial or blocked, or pause for attended approval.
|
|
214
218
|
|
|
215
219
|
Minimal agent command adapter shape for advisory or disabled context management:
|
|
216
220
|
|
|
@@ -323,7 +327,8 @@ The runner exports `CLEAN_ROOM_SESSION_BRIEF_PATH`, `CLEAN_ROOM_ROLE_SESSION_ID`
|
|
|
323
327
|
| `install lock is held` | Another install or uninstall is mutating the same target root | Wait for the other process to finish; stale locks are handled conservatively. |
|
|
324
328
|
| Hook config write failed after files copied | Partial installer state | Fix the filesystem error, then re-run the same installer command. |
|
|
325
329
|
| Install manifest remains `installing` | The previous install did not complete | Re-run the same installer command for that runtime and target root. |
|
|
326
|
-
| `clean-room run` rejects the manifest | Invalid or incomplete unattended loop metadata | Fix `controller_policy`, `loop_context`, and `approved_scope_refs`, then retry `--dry-run`. |
|
|
330
|
+
| `clean-room run` rejects the manifest | Invalid or incomplete unattended loop metadata | Fix `controller_policy`, `loop_context.foundation_unit_ref`, and `approved_scope_refs`, then retry `--dry-run`. |
|
|
331
|
+
| `clean-room run` rejects a covered unit with `discovery_leads` | A high-priority contaminated discovery lead is still unresolved | Analyze the lead in an authorized follow-up unit, mark it resolved, or keep coverage partial/blocked and return an abstract delta. |
|
|
327
332
|
| `clean-room run` rejects an agent command stage in strict context mode | The stage is missing `context.fresh_session: true`, missing `context.brief_path`, or points the brief outside the allowed artifact root | Fix the stage context and regenerate the role-session brief for the selected unit. |
|
|
328
333
|
| `clean-room run` reports no progress | Configured stages exited without durable artifact changes | Check role command cwd/argv, selected unit, and artifact write roots. |
|
|
329
334
|
| `clean-room run` reports repeated unit selection | Same unit selected after a no-progress iteration | Resolve the blocker or update durable artifacts before retrying. |
|
|
@@ -12,12 +12,12 @@ Read approved clean artifacts, CLEAN_ROOM_IMPLEMENTATION_ROOTS, and explicitly c
|
|
|
12
12
|
Write only under CLEAN_ROOM_CLEAN_ROOTS. Do not write code.
|
|
13
13
|
Do not read source workspaces, visual roots, raw screenshots, visual indexes, contaminated ledgers, contaminated chat history, or the full task-manifest.json.
|
|
14
14
|
Stop if only a full task-manifest.json is provided as run context.
|
|
15
|
-
Before planning, require valid clean-run-context.json with clean-safe goal_contract fields and code_hygiene_policy, approved handoff-package.json, approved behavior specs, and an implementation root through CLEAN_ROOM_IMPLEMENTATION_ROOTS.
|
|
15
|
+
Before planning, require valid clean-run-context.json with clean-safe goal_contract fields and code_hygiene_policy, approved handoff-package.json, approved behavior specs, and an implementation root through CLEAN_ROOM_IMPLEMENTATION_ROOTS. For behavior slices, require the approved clean artifacts to include the completed foundation spec or equivalent clean-run-context constraints.
|
|
16
16
|
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.
|
|
17
17
|
Stop if full preflight-goal.json, source index, visual index, raw screenshots, contaminated ledgers, source or visual paths, or direct Agent 0 chat is provided.
|
|
18
18
|
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.
|
|
19
19
|
Merge only approved handoff artifacts into the selected clean schema base.
|
|
20
|
-
Read the clean destination foundation to identify local structure, conventions, tests,
|
|
20
|
+
Read the clean destination foundation and approved foundation spec to identify local structure, conventions, tests, dependency policy, package boundaries, and constraints.
|
|
21
21
|
Read any existing skeleton-manifest.json before planning and revise it as the whole-destination architecture map for the current clean spec set.
|
|
22
22
|
Maintain architecture areas with owned relative path prefixes, responsibilities, forbidden responsibilities, allowed area dependencies, and refactor triggers.
|
|
23
23
|
Assign every target and test path in implementation-plan.json to one or more skeleton-manifest.json architecture areas.
|
|
@@ -26,6 +26,8 @@ Create or update implementation-plan.json as the primary output for code-develop
|
|
|
26
26
|
Carry the preflight-derived code hygiene policy into implementation-plan.json.
|
|
27
27
|
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.
|
|
28
28
|
Map approved specs to destination files, test files, work items, argv-array verification commands, risks, and acceptance criteria using relative implementation-root paths.
|
|
29
|
+
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.
|
|
30
|
+
Do not choose dependencies by copying source manifests. Add or preserve dependencies only when clean artifacts, destination evidence, or preflight policy justify them.
|
|
29
31
|
Preserve source-test-derived scenarios as clean test obligations for equal output without copying source test structure.
|
|
30
32
|
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.
|
|
31
33
|
Stop if contaminated material appears in clean inputs.
|
|
@@ -30,6 +30,7 @@ Do not report progress, ask Agent 0 for guidance, or send partial findings while
|
|
|
30
30
|
Record argv-array verification commands, optional clean-safe container metadata, implementation status, changed relative paths, verification results, blockers, and abstract delta tickets in CLEAN_ROOM_CLEAN_ROOTS/implementation-report.json.
|
|
31
31
|
Review leakage risk and record contamination incidents.
|
|
32
32
|
Flag missing source-test parity, missing equal-output assertions, and mismatches between specs, implementation plan, public contracts, and test obligations.
|
|
33
|
+
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.
|
|
33
34
|
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.
|
|
34
35
|
Keep CLEAN_ROOM_CLEAN_ROOTS/qc-report.json updated when the run expects it.
|
|
35
36
|
Record code hygiene violations as code-hygiene findings in CLEAN_ROOM_CLEAN_ROOTS/qc-report.json.
|
|
@@ -12,16 +12,22 @@ Before source discovery or decomposition, require validated preflight-goal.json,
|
|
|
12
12
|
Do not infer target language, dependency policy, license policy, exactness policy, output directory, or feature add/remove policy from source.
|
|
13
13
|
When acting as agent zero/controller, define and pass 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 clean/source-denied CLEAN_ROOM_ALLOWED_READ_ROOTS into every new role session.
|
|
14
14
|
When context management is enabled, maintain contaminated-side controller-status.json and create one compact role-session-brief.json per role launch. In strict mode, launch each role from a fresh model session, profile, or thread.
|
|
15
|
-
Missing controller_policy means attended. Record loop_context when an outer spec loop invokes the inner clean-room loop for one approved spec slice. 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 configured safety or ambiguity conditions.
|
|
15
|
+
Missing controller_policy means attended. Record loop_context when an outer spec loop invokes the inner clean-room loop for one approved spec slice. 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 configured safety or ambiguity conditions.
|
|
16
16
|
Record the user's format_selection target profile, Agent 0-4 agent_pipeline contract, Agent 1.5 sanitizer role, and optional initialization_snapshot in task-manifest.json.
|
|
17
17
|
Produce clean-run-context.json for Agent 2, Agent 3, and Agent 4 from sanitized initialization, clean-safe preflight goal fields, code hygiene policy, and handoff data. Do not send the full task-manifest.json or full preflight-goal.json to clean roles.
|
|
18
18
|
Influence Agent 2, Agent 3, and Agent 4 only through durable sanitized artifacts. Do not send direct chat instructions, progress feedback, priority changes, implementation hints, or corrective coaching into an active clean role session.
|
|
19
19
|
Use contaminated source-index.json when controller preflight produced one.
|
|
20
20
|
When no indexable source code exists and screenshots/images are the authorized evidence, use contaminated visual-index.json only as fallback input. 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.
|
|
21
21
|
Maintain the tasklist as neutral CLEAN_ROOM_CONTAMINATED_ARTIFACT_ROOTS/task-manifest.json units, map at most one source-index batch, large-file segment, or visual-index batch into each unit, and track coverage under CLEAN_ROOM_CONTAMINATED_ARTIFACT_ROOTS.
|
|
22
|
+
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.
|
|
22
23
|
Provide Agent 1.5 only a neutral sanitizer brief with domain purpose, target profile, unit intent, public compatibility allowlist, and blocked categories.
|
|
23
24
|
Send Agent 1 draft specs to Agent 1.5 for independent source-denied sanitization before clean handoff.
|
|
25
|
+
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.
|
|
26
|
+
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.
|
|
27
|
+
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.
|
|
28
|
+
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.
|
|
24
29
|
Compare clean artifacts and terminal implementation reports against source behavior, discovered source tests, equal-output requirements, and public API/schema compatibility for coverage gaps.
|
|
30
|
+
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.
|
|
25
31
|
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.
|
|
26
32
|
Do not write clean artifacts.
|
|
27
33
|
If source-index.json is needed but missing, pause for controller preflight instead of running shell tools inside this role.
|
|
@@ -10,16 +10,20 @@ Operate only in the contaminated domain.
|
|
|
10
10
|
Before reading source, require active task-manifest.json with preflight_goal_ref and preflight_goal_sha256, one assigned unit_id, authorized source_index_refs when used, authorized visual_index_refs when visual fallback is used, evidence handling policy, and target stack plus compatibility policy from preflight.
|
|
11
11
|
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.
|
|
12
12
|
Do not infer target language, dependency policy, license policy, or exactness policy from source code.
|
|
13
|
-
Read the
|
|
13
|
+
Read the bounded authorized 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.
|
|
14
14
|
When the unit has source_index_refs, stay within the referenced batch unless Agent 0 explicitly assigns a related gap.
|
|
15
15
|
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.
|
|
16
16
|
Write only under CLEAN_ROOM_CONTAMINATED_ARTIFACT_ROOTS.
|
|
17
17
|
Generate neutral draft task slices and behavioral spec material for Agent 0-controlled units.
|
|
18
18
|
Produce neutral behavioral requirements and evidence refs.
|
|
19
|
+
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.
|
|
20
|
+
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.
|
|
21
|
+
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.
|
|
19
22
|
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.
|
|
20
23
|
Treat discovered source tests as behavioral evidence and convert them into clean test_scenarios that validate the same observable outputs.
|
|
21
24
|
Record equal-output expectations for public return values, serialized data, CLI or API responses, errors, state changes, ordering, and compatibility-relevant side effects.
|
|
22
25
|
Capture public API, protocol, config, and data/schema compatibility using existing behavior spec fields.
|
|
26
|
+
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.
|
|
23
27
|
For behavior-compatible ports, extract compatibility-critical invariants into invariants, compatibility_notes, and test_scenarios; broad module coverage is not enough.
|
|
24
28
|
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.
|
|
25
29
|
Flag suspected leakage before returning drafts, but do not approve your own work for clean handoff.
|
|
@@ -468,6 +468,20 @@ def validate_value(value: Any, schema: dict, root_schema: dict, path: tuple[str
|
|
|
468
468
|
seen.add(marker)
|
|
469
469
|
if error_limit_reached(errors):
|
|
470
470
|
return errors
|
|
471
|
+
contains_schema = schema.get("contains")
|
|
472
|
+
if isinstance(contains_schema, dict):
|
|
473
|
+
match_count = 0
|
|
474
|
+
for index, item in enumerate(value):
|
|
475
|
+
if not validate_value(item, contains_schema, root_schema, path + (index,)):
|
|
476
|
+
match_count += 1
|
|
477
|
+
min_contains = schema.get("minContains", 1)
|
|
478
|
+
max_contains = schema.get("maxContains")
|
|
479
|
+
if isinstance(min_contains, int) and match_count < min_contains:
|
|
480
|
+
add_error(errors, f"{path_label(path)}: fewer than minContains {min_contains} matching contains schema")
|
|
481
|
+
if isinstance(max_contains, int) and match_count > max_contains:
|
|
482
|
+
add_error(errors, f"{path_label(path)}: more than maxContains {max_contains} matching contains schema")
|
|
483
|
+
if error_limit_reached(errors):
|
|
484
|
+
return errors
|
|
471
485
|
item_schema = schema.get("items")
|
|
472
486
|
if isinstance(item_schema, dict):
|
|
473
487
|
for index, item in enumerate(value):
|