clean-room-skill 0.1.0

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 (56) hide show
  1. package/.claude-plugin/marketplace.json +19 -0
  2. package/.claude-plugin/plugin.json +20 -0
  3. package/.codex-plugin/plugin.json +36 -0
  4. package/LICENSE +21 -0
  5. package/README.md +376 -0
  6. package/agents/clean-architect.md +27 -0
  7. package/agents/clean-qa-editor.md +27 -0
  8. package/agents/contaminated-manager-verifier.md +35 -0
  9. package/agents/contaminated-source-analyst.md +26 -0
  10. package/bin/install.js +535 -0
  11. package/examples/codex/.codex/agents/clean-architect.toml +17 -0
  12. package/examples/codex/.codex/agents/clean-qa-editor.toml +17 -0
  13. package/examples/codex/.codex/agents/contaminated-manager-verifier.toml +21 -0
  14. package/examples/codex/.codex/agents/contaminated-source-analyst.toml +17 -0
  15. package/hooks/check-artifact-leakage.py +317 -0
  16. package/hooks/clean-room-hook.py +88 -0
  17. package/hooks/clean_room_paths.py +130 -0
  18. package/hooks/deny-clean-room-shell.py +30 -0
  19. package/hooks/deny-clean-source-read.py +104 -0
  20. package/hooks/deny-contaminated-clean-write.py +134 -0
  21. package/hooks/hooks.json +44 -0
  22. package/hooks/require-clean-room-env.py +127 -0
  23. package/hooks/validate-handoff-package.py +140 -0
  24. package/hooks/validate-json-schema.py +283 -0
  25. package/lib/fs-utils.cjs +123 -0
  26. package/lib/hooks.cjs +214 -0
  27. package/package.json +49 -0
  28. package/plugin.json +20 -0
  29. package/skills/attended/SKILL.md +25 -0
  30. package/skills/clean-room/SKILL.md +134 -0
  31. package/skills/clean-room/assets/behavior-spec.schema.json +367 -0
  32. package/skills/clean-room/assets/contamination-incident.schema.json +60 -0
  33. package/skills/clean-room/assets/coverage-ledger.schema.json +139 -0
  34. package/skills/clean-room/assets/evidence-ledger.schema.json +80 -0
  35. package/skills/clean-room/assets/handoff-package.schema.json +114 -0
  36. package/skills/clean-room/assets/qc-report.schema.json +248 -0
  37. package/skills/clean-room/assets/skeleton-manifest.schema.json +239 -0
  38. package/skills/clean-room/assets/source-index.schema.json +622 -0
  39. package/skills/clean-room/assets/task-manifest.schema.json +593 -0
  40. package/skills/clean-room/examples/README.md +18 -0
  41. package/skills/clean-room/examples/minimal-spec-package/behavior-spec.json +61 -0
  42. package/skills/clean-room/examples/minimal-spec-package/coverage-ledger.json +27 -0
  43. package/skills/clean-room/examples/minimal-spec-package/evidence-ledger.json +17 -0
  44. package/skills/clean-room/examples/minimal-spec-package/handoff-package.json +26 -0
  45. package/skills/clean-room/examples/minimal-spec-package/qc-report.json +25 -0
  46. package/skills/clean-room/examples/minimal-spec-package/skeleton-manifest.json +45 -0
  47. package/skills/clean-room/examples/minimal-spec-package/source-index.json +156 -0
  48. package/skills/clean-room/examples/minimal-spec-package/task-manifest.json +220 -0
  49. package/skills/clean-room/references/LEAKAGE-RULES.md +92 -0
  50. package/skills/clean-room/references/PROCESS.md +185 -0
  51. package/skills/clean-room/references/SPEC-SCHEMA.md +185 -0
  52. package/skills/clean-room/references/TARGET-LANGUAGE-GUIDE.md +43 -0
  53. package/skills/clean-room/scripts/build_source_index.py +1253 -0
  54. package/skills/clean-room/scripts/clean_room_tool_manager.py +199 -0
  55. package/skills/clean-room/scripts/clean_room_tooling.py +370 -0
  56. package/skills/unattended/SKILL.md +26 -0
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "clean-room-skill",
3
+ "description": "Spec-first clean-room workflow for authorized source analysis without replacement code.",
4
+ "owner": {
5
+ "name": "whit3rabbit"
6
+ },
7
+ "plugins": [
8
+ {
9
+ "name": "clean-room",
10
+ "source": ".",
11
+ "description": "Spec-first clean-room workflow for authorized source analysis without replacement code.",
12
+ "version": "0.1.0",
13
+ "author": {
14
+ "name": "whit3rabbit"
15
+ },
16
+ "category": "development"
17
+ }
18
+ ]
19
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "clean-room",
3
+ "displayName": "Clean Room",
4
+ "description": "Spec-first clean-room workflow for authorized source analysis without replacement code.",
5
+ "version": "0.1.0",
6
+ "author": {
7
+ "name": "whit3rabbit"
8
+ },
9
+ "homepage": "https://github.com/whit3rabbit/clean-room-skill",
10
+ "repository": "https://github.com/whit3rabbit/clean-room-skill",
11
+ "keywords": [
12
+ "clean-room",
13
+ "specification",
14
+ "reverse-engineering",
15
+ "compliance"
16
+ ],
17
+ "skills": "./skills/",
18
+ "agents": "./agents/",
19
+ "hooks": "./hooks/hooks.json"
20
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "clean-room",
3
+ "version": "0.1.0",
4
+ "description": "Spec-first clean-room workflow for authorized source analysis without replacement code.",
5
+ "author": {
6
+ "name": "whit3rabbit"
7
+ },
8
+ "homepage": "https://github.com/whit3rabbit/clean-room-skill",
9
+ "repository": "https://github.com/whit3rabbit/clean-room-skill",
10
+ "keywords": [
11
+ "clean-room",
12
+ "specification",
13
+ "migration",
14
+ "reverse-engineering",
15
+ "compliance"
16
+ ],
17
+ "skills": "./skills/",
18
+ "hooks": "./hooks/hooks.json",
19
+ "interface": {
20
+ "displayName": "Clean Room",
21
+ "shortDescription": "Produce clean-room behavioral specs",
22
+ "longDescription": "Guides spec-first clean-room workflows that separate contaminated source analysis from clean behavioral specifications, skeleton manifests, QC reports, and test plans. Writes clean specification artifacts only. Does not generate replacement implementation code.",
23
+ "developerName": "whit3rabbit",
24
+ "category": "Development",
25
+ "capabilities": [
26
+ "Read",
27
+ "Write"
28
+ ],
29
+ "defaultPrompt": [
30
+ "Create a clean-room spec package for this authorized source scope.",
31
+ "Review these clean-room spec artifacts for leakage, coverage gaps, and schema conformance.",
32
+ "Organize these behavioral specs into a clean skeleton manifest."
33
+ ],
34
+ "brandColor": "#0F766E"
35
+ }
36
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 whit3rabbit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,376 @@
1
+ # Clean Room
2
+
3
+ Spec-first clean-room workflow for software to spec.
4
+
5
+ This is a POC based on the ideas presented here:
6
+
7
+ https://malus.sh/blog.html
8
+
9
+ This plugin packages the `clean-room`, `attended`, and `unattended` skills, Claude role agents, Codex role-agent templates, JSON schemas, examples, and hook guardrails for separating contaminated source analysis from clean behavioral specification work.
10
+
11
+ It is an engineering risk-reduction workflow. It is not legal advice and does not create a legal safe harbor.
12
+
13
+ ## Use This For
14
+
15
+ - Authorized source-to-spec migration planning.
16
+ - Clean behavioral specifications for compatibility work.
17
+ - Skeleton manifests, QC reports, open questions, and test plans.
18
+ - Documented separation between source-reading roles and clean artifact roles.
19
+
20
+ ## Threat Model And Non-Goals
21
+
22
+ This workflow protects against:
23
+
24
+ - accidental source expression crossing into clean specs
25
+ - clean agents reading contaminated roots
26
+ - contaminated agents writing clean artifacts
27
+ - clean or contaminated agents writing outside their role artifact roots
28
+ - unbounded unattended controller loops
29
+
30
+ It does not protect against:
31
+
32
+ - hostile local users
33
+ - compromised host tooling
34
+ - shared model context outside role isolation
35
+ - legal conclusions
36
+ - side channels through filenames, timing, or retained chat context
37
+
38
+ ## Install
39
+
40
+ Preferred direct installer:
41
+
42
+ ```bash
43
+ npx clean-room-skill@latest
44
+ ```
45
+
46
+ The installer prompts for runtime and scope when no flags are supplied. For non-interactive installs, pass the runtime and scope explicitly:
47
+
48
+ ```bash
49
+ npx clean-room-skill@latest --codex --global --yes
50
+ npx clean-room-skill@latest --claude --global --yes
51
+ npx clean-room-skill@latest --antigravity --global --yes
52
+ npx clean-room-skill@latest --all --global --yes
53
+ ```
54
+
55
+ Supported runtime roots:
56
+
57
+ - Codex global: `CODEX_HOME` or `~/.codex`
58
+ - Claude Code global: `CLAUDE_CONFIG_DIR` or `~/.claude`
59
+ - Antigravity global: `ANTIGRAVITY_PLUGIN_DIR` or `~/.gemini/config/plugins/clean-room-skill`
60
+
61
+ Local installs are supported for Codex and Claude Code through `--local`. Antigravity local installs are rejected in v1.
62
+
63
+ Hook modes:
64
+
65
+ - `--hooks=safe`: default. Copies hooks and registers a wrapper that no-ops unless `CLEAN_ROOM_HOOK_ENFORCE=1` or clean-room environment variables are present.
66
+ - `--hooks=copy-only` or `--no-hooks`: copies hook files but does not register Codex or Claude hook config.
67
+ - `--hooks=strict`: registers fail-closed hooks for dedicated clean-room homes.
68
+
69
+ Useful maintenance commands:
70
+
71
+ ```bash
72
+ npx clean-room-skill@latest --dry-run --all --global
73
+ npx clean-room-skill@latest --codex --global --uninstall --yes
74
+ ```
75
+
76
+ The installer writes `clean-room-install-manifest.json` into each target root. Reinstalling replaces only manifest-managed files automatically. If a managed file was locally modified, the previous version is backed up under `clean-room-patches/<timestamp>/`. Unknown existing files are not overwritten in non-interactive mode.
77
+
78
+ Marketplace install remains available.
79
+
80
+ From Codex marketplace:
81
+
82
+ ```bash
83
+ codex plugin marketplace add https://github.com/whit3rabbit/clean-room-skill.git
84
+ ```
85
+
86
+ Then install or enable `clean-room` from the `clean-room-skill` marketplace. Enable plugin hooks in trusted Codex config before relying on guardrails:
87
+
88
+ ```toml
89
+ [features]
90
+ plugin_hooks = true
91
+ ```
92
+
93
+ From Claude Code marketplace:
94
+
95
+ ```text
96
+ /plugin marketplace add https://github.com/whit3rabbit/clean-room-skill.git
97
+ /plugin install clean-room@clean-room-skill
98
+ ```
99
+
100
+ Manual Antigravity install:
101
+
102
+ Clone this repository into your local plugins directory:
103
+
104
+ ```bash
105
+ git clone https://github.com/whit3rabbit/clean-room-skill.git ~/.gemini/config/plugins/clean-room-skill
106
+ ```
107
+
108
+ Reload or restart the host if the plugin is not visible immediately.
109
+
110
+ ## Invocation
111
+
112
+ In Claude Code, use the plugin skill namespace:
113
+
114
+ ```text
115
+ /clean-room
116
+ /clean-room:clean-room
117
+ /clean-room:attended
118
+ /clean-room:unattended
119
+ ```
120
+
121
+ `/clean-room` and `/clean-room:clean-room` start the setup wizard. `/clean-room:attended` starts the same wizard with attended review gates. `/clean-room:unattended` starts it with bounded unattended defaults: one unit per iteration, finite max iterations, and the configured safety stop conditions.
122
+
123
+ In Codex, invoke the `clean-room` plugin or one of its bundled skills explicitly with `@` or the skills UI. Do not rely on Claude-style `/clean-room:...` namespacing in Codex.
124
+
125
+ ## Operating Model
126
+
127
+ Use separate workspaces, worktrees, repositories, or profiles for contaminated and clean work:
128
+
129
+ - Contaminated source workspace: source-readable, read-only where practical.
130
+ - Contaminated artifact workspace: source indexes, task manifests, coverage ledgers, evidence ledgers, draft specs, and abstract delta tickets. Configure as `CLEAN_ROOM_CONTAMINATED_ARTIFACT_ROOTS`.
131
+ - Clean spec workspace: approved behavior specs, handoff packages, skeleton manifests, QC reports, and test plans.
132
+ - Clean allowed reference workspace: public documentation or destination constraints explicitly approved for clean-role reads.
133
+
134
+ Prompt instructions alone are not a boundary. Use path separation, role-specific sessions, hook checks, schema validation, and artifact quarantine.
135
+
136
+ ## Separation Diagram
137
+
138
+ ![Clean Room Architecture](assets/clean-room-arch.svg)
139
+
140
+ ### Flowchart Representation
141
+
142
+ ```mermaid
143
+ flowchart LR
144
+ subgraph contaminated["Contaminated domain: source-readable"]
145
+ source["Authorized source roots<br/>CLEAN_ROOM_SOURCE_ROOTS"]
146
+ manager["Agent 0: contaminated-manager-verifier<br/>Scope, decompose, track coverage, verify"]
147
+ analyst["Agent 1: contaminated-source-analyst<br/>Read source, write neutral tasks and specs"]
148
+ ledgers["Contaminated artifacts<br/>CLEAN_ROOM_CONTAMINATED_ARTIFACT_ROOTS<br/>source-index.json<br/>task-manifest.json<br/>coverage-ledger.json<br/>evidence-ledger.json"]
149
+ scrub["Leakage review<br/>Remove source expression"]
150
+ end
151
+
152
+ subgraph wall["Clean-room wall"]
153
+ handoff["Approved handoff only<br/>handoff-package.json<br/>scrubbed behavior-spec.json"]
154
+ blocked["Blocked from crossing<br/>source excerpts, raw diffs, copied comments,<br/>private identifiers, source-shaped pseudocode"]
155
+ end
156
+
157
+ subgraph clean["Clean domain: source-denied"]
158
+ cleanroots["Clean artifact roots<br/>CLEAN_ROOM_CLEAN_ROOTS"]
159
+ publicrefs["Allowed public refs<br/>CLEAN_ROOM_ALLOWED_READ_ROOTS"]
160
+ architect["Agent 2: clean-architect<br/>Manage schema base and skeleton manifest"]
161
+ qa["Agent 3: clean-qa-editor<br/>Validate schema, leakage, coverage, testability"]
162
+ outputs["Clean outputs<br/>skeleton-manifest.json<br/>qc-report.json<br/>test plan notes"]
163
+ end
164
+
165
+ subgraph guardrails["Guardrails and audit"]
166
+ env["require-clean-room-env.py"]
167
+ denyread["deny-clean-source-read.py"]
168
+ denywrite["deny-contaminated-clean-write.py<br/>write root policy"]
169
+ denyshell["deny-clean-room-shell.py"]
170
+ scan["check-artifact-leakage.py<br/>validate-json-schema.py"]
171
+ end
172
+
173
+ source --> manager
174
+ manager --> analyst
175
+ manager --> ledgers
176
+ analyst --> ledgers
177
+ analyst --> scrub
178
+ scrub --> handoff
179
+ handoff --> cleanroots
180
+ cleanroots --> architect
181
+ publicrefs --> architect
182
+ architect --> outputs
183
+ outputs --> qa
184
+ qa --> outputs
185
+ qa -. abstract delta tickets only .-> manager
186
+
187
+ blocked -. quarantine do not hand off .-> ledgers
188
+ env -. required for every role session .-> manager
189
+ env -. required for every role session .-> architect
190
+ denyread -. clean roles cannot read source roots .-> cleanroots
191
+ denywrite -. contaminated writes only to contaminated artifact roots .-> ledgers
192
+ denywrite -. clean writes only to clean roots .-> cleanroots
193
+ denyshell -. no shell-style tools in role sessions .-> manager
194
+ denyshell -. no shell-style tools in role sessions .-> architect
195
+ scan -. post-write checks .-> outputs
196
+
197
+ classDef contaminatedDomain fill:#fff7ed,stroke:#c2410c,color:#111827;
198
+ classDef cleanDomain fill:#ecfeff,stroke:#0e7490,color:#111827;
199
+ classDef wallClass fill:#f8fafc,stroke:#475569,color:#111827;
200
+ classDef guardClass fill:#f0fdf4,stroke:#15803d,color:#111827;
201
+ class source,manager,analyst,ledgers,scrub contaminatedDomain;
202
+ class cleanroots,publicrefs,architect,qa,outputs cleanDomain;
203
+ class handoff,blocked wallClass;
204
+ class env,denyread,denywrite,denyshell,scan guardClass;
205
+ ```
206
+
207
+ ## Roles
208
+
209
+ - Agent 0 / `contaminated-manager-verifier`: consumes contaminated source indexes, decomposes scope into logical batches, tracks coverage, verifies clean specs against source, and receives Agent 3 final QC reports.
210
+ - Agent 1 / `contaminated-source-analyst`: reads authorized source and writes neutral task/spec material with evidence references, not code.
211
+ - Agent 2 / `clean-architect`: reads approved clean artifacts, manages the selected clean schema base, and organizes artifacts into target-neutral skeleton manifests.
212
+ - Agent 3 / `clean-qa-editor`: validates schema conformance, leakage risk, terminology, coverage gaps, and testability, then reports abstract findings back to Agent 0.
213
+
214
+ Claude role agents are in `agents/`. Codex role-agent templates are in `examples/codex/.codex/agents/`.
215
+
216
+ ## Required Environment
217
+
218
+ Set and pass this environment block into every clean-room role session before tool use:
219
+
220
+ ```text
221
+ CLEAN_ROOM_ROLE
222
+ CLEAN_ROOM_SOURCE_ROOTS
223
+ CLEAN_ROOM_CONTAMINATED_ARTIFACT_ROOTS
224
+ CLEAN_ROOM_CLEAN_ROOTS
225
+ CLEAN_ROOM_SCHEMA_DIR
226
+ CLEAN_ROOM_ALLOWED_READ_ROOTS
227
+ ```
228
+
229
+ For clean roles, reads are deny-by-default. They may read only `CLEAN_ROOM_CLEAN_ROOTS` plus explicit public or destination constraint roots in `CLEAN_ROOM_ALLOWED_READ_ROOTS`. Source roots in `CLEAN_ROOM_SOURCE_ROOTS` stay denied.
230
+
231
+ Writes are also deny-by-default. Clean roles may write only under `CLEAN_ROOM_CLEAN_ROOTS`. Contaminated roles may write only under `CLEAN_ROOM_CONTAMINATED_ARTIFACT_ROOTS`. Source roots stay read-only for contaminated roles unless a separate, explicit process outside this plugin changes that policy.
232
+
233
+ Optional hook-only guardrail:
234
+
235
+ ```text
236
+ CLEAN_ROOM_PRIVATE_IDENTIFIER_DENYLIST
237
+ ```
238
+
239
+ Set it to path-separated, line-oriented files containing private source package, module, class, function, method, variable, constant, field, or other internal identifiers to reject from clean artifacts. Blank lines and `#` comments are ignored. Files are bounded to 1,000,000 bytes each, 20,000 total terms, and 512 characters per term. Keep those files outside clean-role readable roots and do not paste their contents into model-visible artifacts.
240
+
241
+ Do not grant shell-style tools to clean-room role sessions. Shell access can bypass path-aware read and write hooks.
242
+
243
+ For multi-file scopes, run `skills/clean-room/scripts/build_source_index.py` as controller preflight before clean-room role sessions. Store `source-index.json` under `CLEAN_ROOM_CONTAMINATED_ARTIFACT_ROOTS`, or pass `--contaminated-artifact-root` explicitly. The script refuses `--output` outside those roots. It is contaminated-only and must not be included in clean handoff packages.
244
+
245
+ Optional AST/indexing helpers are checked before the controller loop, not from clean-room role sessions:
246
+
247
+ ```bash
248
+ python3 skills/clean-room/scripts/clean_room_tool_manager.py --status
249
+ ```
250
+
251
+ `--status` is stat-only by default. Use `--probe-tools` only when you want it to execute discovered tools with version commands:
252
+
253
+ ```bash
254
+ python3 skills/clean-room/scripts/clean_room_tool_manager.py --status --probe-tools
255
+ ```
256
+
257
+ Local helper installs are explicit and version-pinned, and they write to `~/.cache/re-skills/clean-room-tools/`:
258
+
259
+ ```bash
260
+ python3 skills/clean-room/scripts/clean_room_tool_manager.py --install-local ast-grep --version <exact-version>
261
+ ```
262
+
263
+ Target-project `.local/bin`, `.bin`, and `node_modules/.bin` are ignored unless the controller opts into `--allow-working-project-tools` or `RE_SKILLS_TRUST_PROJECT_TOOLS=1`. Npm prefix/global discovery also requires `--probe-tools` because it executes `npm`.
264
+
265
+ ## Controller Modes
266
+
267
+ Missing `controller_policy` means `attended`.
268
+
269
+ - `attended`: agent zero pauses for human review at scope gate, clean handoff, QC deltas, blocked units, and final coverage.
270
+ - `unattended`: agent zero runs a bounded controller loop. It reloads durable artifacts each iteration, selects at most one pending or gap unit, starts each role from fresh context with the required environment block, validates before advancing state, and stops on any configured safety or ambiguity condition.
271
+
272
+ Agent zero generates the durable tasklist as neutral `task-manifest.json` `units`. For larger scopes, it may use `source-index.json` recommended batches and record `source_index_ref` plus per-unit `source_index_refs`. Progress is tracked in `coverage-ledger.json`, `evidence-ledger.json`, `qc-report.json`, and abstract delta tickets, not in prior chat history.
273
+
274
+ ## Artifacts
275
+
276
+ The schema contract lives in `skills/clean-room/assets/`:
277
+
278
+ - `task-manifest.schema.json`
279
+ - `source-index.schema.json`
280
+ - `coverage-ledger.schema.json`
281
+ - `evidence-ledger.schema.json`
282
+ - `handoff-package.schema.json`
283
+ - `behavior-spec.schema.json`
284
+ - `skeleton-manifest.schema.json`
285
+ - `qc-report.schema.json`
286
+ - `contamination-incident.schema.json`
287
+
288
+ Example artifact shapes are in `skills/clean-room/examples/minimal-spec-package/`. They are examples only, not outputs from a real source review.
289
+
290
+ ## Workflow
291
+
292
+ 1. Record authorization, scope, prohibited actions, evidence handling, and role root paths in `task-manifest.json`.
293
+ 2. Record the user's selected target profile and Agent 0-3 pipeline in `task-manifest.json`.
294
+ 3. Run source index preflight when the source scope needs relationship-aware batching.
295
+ 4. Decompose the source scope into bounded, neutral `task-manifest.json` units. One unit may map to one source-index batch or, for large files, one preflight segment.
296
+ 5. Write contaminated-side behavior specs from observed behavior, public contracts, states, errors, invariants, and test scenarios.
297
+ 6. Scrub specs using `skills/clean-room/references/LEAKAGE-RULES.md`.
298
+ 7. Move only approved structured artifacts into the clean workspace through `handoff-package.json`. Do not include `source-index.json`.
299
+ 8. Build or merge the clean schema base and `skeleton-manifest.json` from clean specs, target profile, and target constraints.
300
+ 9. Produce `qc-report.json` with schema status, leakage status, gaps, and testability notes.
301
+ 10. Verify coverage from the contaminated side and repeat only with abstract delta tickets.
302
+ 11. Stop at the spec package. Do not implement replacement code in this plugin workflow.
303
+
304
+ ## Hook Guardrails
305
+
306
+ Hook scaffolding lives in `hooks/` and is declared by `hooks/hooks.json`.
307
+
308
+ `hooks/hooks.json` routes through `hooks/clean-room-hook.py`. In safe mode, the wrapper exits successfully unless `CLEAN_ROOM_HOOK_ENFORCE=1` or clean-room environment variables are present. In strict mode, it runs the configured checks immediately and fails closed when required role or path configuration is missing.
309
+
310
+ `hooks/hooks.json` uses commands relative to the plugin package root, such as `python3 hooks/clean-room-hook.py --mode safe ...`. Confirm the host executes plugin hooks from that directory during install smoke tests.
311
+
312
+ - `clean-room-hook.py`: safe/strict dispatch wrapper for the policy checks below.
313
+ - `require-clean-room-env.py`: fails closed when required role and root environment is missing.
314
+ - `deny-clean-room-shell.py`: denies shell-style tools for clean-room role sessions.
315
+ - `deny-clean-source-read.py`: denies clean-role reads from source roots and unapproved paths.
316
+ - `deny-contaminated-clean-write.py`: enforces role write roots. Clean roles write only under clean roots; contaminated roles write only under contaminated artifact roots.
317
+ - `check-artifact-leakage.py`: scans clean artifacts for high-risk leakage markers, source-like identifiers, and optional private identifier denylist matches.
318
+ - `validate-json-schema.py`: checks JSON syntax and common bundled clean-room schema constraints, including the conditional and bounded fields used by these schemas. Under clean roots, unknown JSON artifacts are rejected unless explicitly allowlisted through `CLEAN_ROOM_AUXILIARY_JSON_ALLOWLIST`. It is a lightweight guardrail, not a full JSON Schema 2020-12 validator.
319
+ - `validate-handoff-package.py`: verifies handoff artifact paths stay under clean roots, do not point into source or contaminated roots, do not include `source-index.json`, and match declared `sha256` values.
320
+
321
+ These scripts are guardrail and audit support. They are not a substitute for separate workspaces and role isolation.
322
+
323
+ For release-quality schema assurance, run a full JSON Schema validator in addition to the bundled lightweight hook.
324
+
325
+ ## References
326
+
327
+ - `skills/clean-room/SKILL.md`: main skill instructions.
328
+ - `skills/clean-room/references/PROCESS.md`: detailed process.
329
+ - `skills/clean-room/references/LEAKAGE-RULES.md`: clean handoff rules.
330
+ - `skills/clean-room/references/SPEC-SCHEMA.md`: artifact schema guidance.
331
+ - `skills/clean-room/references/TARGET-LANGUAGE-GUIDE.md`: target constraint guidance.
332
+
333
+ ## Dry Run
334
+
335
+ From the repository root, run a minimal hook smoke test before relying on the workflow:
336
+
337
+ ```bash
338
+ export CLEAN_ROOM_ROLE=clean-qa-editor
339
+ export CLEAN_ROOM_SOURCE_ROOTS="$PWD/source"
340
+ export CLEAN_ROOM_CONTAMINATED_ARTIFACT_ROOTS="$PWD/contaminated-artifacts"
341
+ export CLEAN_ROOM_CLEAN_ROOTS="$PWD/skills/clean-room/examples/minimal-spec-package"
342
+ export CLEAN_ROOM_ALLOWED_READ_ROOTS=""
343
+ export CLEAN_ROOM_SCHEMA_DIR="$PWD/skills/clean-room/assets"
344
+
345
+ printf '{"tool_input":{"file_path":"%s"}}' "$PWD/skills/clean-room/examples/minimal-spec-package/behavior-spec.json" \
346
+ | python3 hooks/check-artifact-leakage.py
347
+
348
+ printf '{"tool_input":{"file_path":"%s"}}' "$PWD/skills/clean-room/examples/minimal-spec-package/behavior-spec.json" \
349
+ | python3 hooks/validate-json-schema.py
350
+
351
+ python3 hooks/clean-room-hook.py --mode safe --check require-clean-room-env.py </dev/null
352
+ ```
353
+
354
+ ## Local Verification
355
+
356
+ After changing plugin metadata, hooks, schemas, or skill instructions, run the relevant checks from the plugin package root:
357
+
358
+ ```bash
359
+ python3 -m json.tool plugin.json >/dev/null
360
+ python3 -m json.tool .codex-plugin/plugin.json >/dev/null
361
+ python3 -m json.tool .claude-plugin/plugin.json >/dev/null
362
+ python3 -m json.tool hooks/hooks.json >/dev/null
363
+ python3 -m py_compile hooks/*.py
364
+ python3 -m py_compile skills/clean-room/scripts/*.py
365
+ node --test
366
+ npm pack --dry-run
367
+ node bin/install.js --dry-run --all --global
368
+ python3 skills/clean-room/scripts/build_source_index.py --help
369
+ # Optional, if skill-creator quick_validate is installed:
370
+ quick_validate skills/attended
371
+ quick_validate skills/clean-room
372
+ quick_validate skills/unattended
373
+ for f in skills/clean-room/examples/minimal-spec-package/*.json; do printf '{"tool_input":{"file_path":"%s"}}' "$PWD/$f" | CLEAN_ROOM_SCHEMA_DIR="$PWD/skills/clean-room/assets" python3 hooks/validate-json-schema.py || exit 1; done
374
+ for f in skills/clean-room/examples/minimal-spec-package/*.json; do if [ "$(basename "$f")" = source-index.json ]; then continue; fi; printf '{"tool_input":{"file_path":"%s"}}' "$PWD/$f" | CLEAN_ROOM_CLEAN_ROOTS="$PWD/skills/clean-room/examples/minimal-spec-package" python3 hooks/check-artifact-leakage.py || exit 1; done
375
+ find . -maxdepth 4 -type d -name bin -print
376
+ ```
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: clean-architect
3
+ description: Manages the selected clean schema base and organizes approved clean behavioral specs into target-neutral skeleton manifests without reading contaminated source or chat history.
4
+ tools: Read, Write, Edit, Glob
5
+ ---
6
+
7
+ # Clean Architect
8
+
9
+ This role is Agent 2 in the clean-room pipeline.
10
+
11
+ Operate only in the clean domain. Read approved clean artifacts and explicitly configured public or destination constraint roots. Write only under `CLEAN_ROOM_CLEAN_ROOTS`. Do not read source workspaces, contaminated ledgers, or contaminated chat history.
12
+
13
+ Before tool use, confirm this session has `CLEAN_ROOM_ROLE=clean-architect`, `CLEAN_ROOM_CLEAN_ROOTS`, `CLEAN_ROOM_SOURCE_ROOTS`, `CLEAN_ROOM_CONTAMINATED_ARTIFACT_ROOTS`, `CLEAN_ROOM_ALLOWED_READ_ROOTS`, and `CLEAN_ROOM_SCHEMA_DIR`. Treat missing environment as a stop condition.
14
+
15
+ Do not use shell-style tools in this role.
16
+
17
+ Responsibilities:
18
+
19
+ - Manage the selected clean schema base from `task-manifest.json` `format_selection`.
20
+ - Merge only approved handoff artifacts into the selected clean schema base.
21
+ - Build `skeleton-manifest.json` from approved behavior specs.
22
+ - Keep target language generic unless the user or destination repo supplies a target.
23
+ - Map specs to clean implementation areas without mirroring private source layout.
24
+ - Record public contract refs, dependency constraints, test mappings, and open decisions.
25
+ - Preserve only public compatibility names that already have recorded compatibility reasons.
26
+
27
+ Stop and quarantine the affected artifact if source text, raw diffs, private package/module/function/variable names, other private identifiers, or source-shaped pseudocode appear in clean inputs.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: clean-qa-editor
3
+ description: Reviews clean artifacts for schema conformance, leakage risk, coverage status, testability, contamination incidents, and abstract reporting back to Agent 0.
4
+ tools: Read, Write, Edit, Glob
5
+ ---
6
+
7
+ # Clean QA Editor
8
+
9
+ This role is Agent 3 in the clean-room pipeline.
10
+
11
+ Operate only in the clean domain. Read approved clean artifacts and explicitly configured public or destination constraint roots only. Write only under `CLEAN_ROOM_CLEAN_ROOTS`. Do not read source workspaces, contaminated ledgers, or contaminated chat history.
12
+
13
+ Before tool use, confirm this session has `CLEAN_ROOM_ROLE=clean-qa-editor`, `CLEAN_ROOM_CLEAN_ROOTS`, `CLEAN_ROOM_SOURCE_ROOTS`, `CLEAN_ROOM_CONTAMINATED_ARTIFACT_ROOTS`, `CLEAN_ROOM_ALLOWED_READ_ROOTS`, and `CLEAN_ROOM_SCHEMA_DIR`. Treat missing environment as a stop condition.
14
+
15
+ Do not use shell-style tools in this role.
16
+
17
+ Responsibilities:
18
+
19
+ - Validate clean artifacts against the schema assets.
20
+ - Review leakage risk using `LEAKAGE-RULES.md`.
21
+ - Treat package, module, class, function, method, variable, constant, and field names as leakage unless the artifact records them as public compatibility surface.
22
+ - Record artifact hashes, schema status, leakage scan summary, contamination incidents, coverage status, and required reruns.
23
+ - Write `qc-report.json` and abstract delta tickets.
24
+ - Report final QC status and abstract delta tickets back to Agent 0.
25
+ - Edit clean wording for clarity without adding new source facts.
26
+
27
+ If contamination is found, mark the artifact quarantined and require regeneration from the contaminated side.
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: contaminated-manager-verifier
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
+ tools: Read, Write, Edit, Glob, Grep
5
+ ---
6
+
7
+ # Contaminated Manager Verifier
8
+
9
+ This role is Agent 0 in the clean-room pipeline.
10
+
11
+ Operate only in the contaminated domain. Read authorized source and contaminated ledgers as needed. Write only to an explicitly authorized contaminated artifact directory; do not write clean artifacts directly.
12
+
13
+ Responsibilities:
14
+
15
+ - Confirm authorization, source scope, clean output scope, and prohibited actions before assigning work.
16
+ - Record the user's `format_selection` target profile and Agent 0-3 `agent_pipeline` contract in `task-manifest.json`.
17
+ - Record `controller_policy` when the task explicitly uses attended or bounded unattended mode. Missing policy means attended.
18
+ - Act as agent zero/controller when no separate coordinator exists: define and pass the clean-room environment block to every role session before tool use.
19
+ - Consume contaminated `source-index.json` when controller preflight produced one.
20
+ - Split source scope into the durable tasklist as bounded `task-manifest.json` units with neutral ids that do not mirror private source layout. One unit may map to one source-index batch or large-file segment through `source_index_refs`.
21
+ - Maintain `coverage-ledger.json` and `evidence-ledger.json` in the contaminated artifact workspace.
22
+ - Maintain a private identifier denylist for hook scanning when practical; never send the denylist contents to clean roles or clean artifacts.
23
+ - Compare clean artifacts against source behavior for coverage gaps.
24
+ - Receive Agent 3 final QC reports and convert any gaps into abstract delta tickets.
25
+ - Send only abstract delta tickets across the wall. Do not include source snippets, raw diffs, copied comments, private helper names, or source-shaped pseudocode.
26
+
27
+ Every new role session must receive `CLEAN_ROOM_ROLE`, `CLEAN_ROOM_SOURCE_ROOTS`, `CLEAN_ROOM_CONTAMINATED_ARTIFACT_ROOTS`, `CLEAN_ROOM_CLEAN_ROOTS`, `CLEAN_ROOM_SCHEMA_DIR`, and, for clean roles, `CLEAN_ROOM_ALLOWED_READ_ROOTS`. Do not assume environment variables persist across sessions.
28
+
29
+ In unattended mode, reload durable artifacts before each iteration, select at most one pending or gap unit, launch roles from fresh context, validate schema and leakage before advancing state, and stop on authorization, scope, contamination, validation, leakage, blocked-unit, coverage-complete, or iteration-limit conditions. Do not use prior chat history as task state.
30
+
31
+ Do not grant shell-style tools to clean-room role sessions.
32
+
33
+ If a multi-file scope needs relationship-aware batching and `source-index.json` is missing, pause for controller preflight rather than running shell tools inside this role.
34
+
35
+ Stop if clean roles received contaminated material. Record a contamination incident and require a regenerated clean artifact.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: contaminated-source-analyst
3
+ description: Reads authorized source in a contaminated workspace and produces neutral task slices plus scrubbed behavioral specs with evidence references, not replacement code.
4
+ tools: Read, Write, Edit, Glob, Grep
5
+ ---
6
+
7
+ # Contaminated Source Analyst
8
+
9
+ This role is Agent 1 in the clean-room pipeline.
10
+
11
+ Operate only in the contaminated domain. Treat source access as read-only. Write only under `CLEAN_ROOM_CONTAMINATED_ARTIFACT_ROOTS`.
12
+
13
+ Do not use shell-style tools in this role.
14
+
15
+ Responsibilities:
16
+
17
+ - Read the minimum source needed for the assigned unit.
18
+ - When the unit has `source_index_refs`, stay within the referenced batch unless Agent 0 explicitly assigns a related gap.
19
+ - Generate neutral task slices and behavioral spec material for Agent 0-controlled units.
20
+ - Write neutral behavioral requirements covering inputs, outputs, state transitions, edge cases, error conditions, invariants, and tests.
21
+ - Use `evidence_refs` that point to contaminated-side ledger entries instead of including source text.
22
+ - Keep public API names only when compatibility requires them and record the reason.
23
+ - Treat package, namespace, module, class, function, method, variable, constant, field, and internal event names as private identifiers unless they are public compatibility surface.
24
+ - Run leakage review before any handoff.
25
+
26
+ Never produce implementation code, copied comments, source excerpts, raw diffs, private helper names, or source-shaped pseudocode.