OSS Hardening
Run a staged hardening pipeline in one continuous pass by default:
/oss-audit
/oss-plan
/oss-refactor
/oss-tests
/oss-ci
/oss-docs
/oss-review-loop
Default behavior:
- execute
audit -> plan -> refactor -> tests -> ci -> docs -> review-loop in one invocation
- carry artifacts forward automatically between stages
- only pause when a real blocker, rollback condition, or user-requested stop point appears
Do not force the user to manually re-issue every stage command unless they explicitly ask for stage-by-stage control.
Context: $ARGUMENTS
Input Contract
- Input: repository path or scope, user constraints, optional stop point, whether the repo is product code or paper code, and any "continuous" or "manual" preference.
- Default: if no stop point is given, run the full pipeline continuously from audit to docs.
Output Contract
Create or update OSS_HARDENING_STATUS.md with:
- current stage
- completed artifacts
- whether execution auto-continued or paused
- latest external review-loop score and verdict if review ran
- unresolved maintainer decisions such as license choice or missing citation path
- next recommended command
- explicit stop/rollback conditions
If the workflow pauses, give the user a short "where we are / what comes next" summary. If the workflow finishes continuously, give one end-to-end summary plus any blockers left deferred.
Stage Order
1. Audit
Run /oss-audit first, then continue directly to /oss-plan if no blocker is found.
Stop here if:
- there is no reproducible local run command yet
- the repo appears abandoned or generated
- the scope is too unclear to change safely
- the repo depends on private data or checkpoints with no public-safe sample path yet
2. Plan
Run /oss-plan once the audit has concrete P0/P1/P2 findings, then continue directly to /oss-refactor when the plan is actionable.
Stop here if:
- the plan still contains unresolved "discover first" tasks
- one checklist item is too large to review safely
3. Refactor
Run /oss-refactor only for the smallest structural changes needed to unlock tests and CI, then continue directly to /oss-tests when behavior remains stable.
Rollback or pause if:
- behavior changes unexpectedly
- the refactor starts expanding beyond the planned file set
- new tooling creates more maintenance burden than value
4. Tests
Run /oss-tests after the structure is stable enough to test, then continue directly to /oss-ci when the local test command is trustworthy.
Stop here if:
- the only available tests are flaky or rely on live services
- external dependencies still need seams or mocks
5. CI
Run /oss-ci only after local lint and test commands are trustworthy, then continue directly to /oss-docs once CI reflects the intended local workflow.
Rollback or pause if:
- the workflow requires secrets
- the workflow duplicates an existing pipeline without improving it
6. Docs
Run /oss-docs so the documentation reflects the final behavior and commands, then continue directly to /oss-review-loop if all prior stages passed cleanly.
Stop here if:
- the implementation state is still changing daily
- support, license, citation, or security ownership is unknown and needs maintainer input
7. Review Loop
Run /oss-review-loop after docs so the pipeline ends with an external Codex quality gate and up to four rounds of iterative fixes. The review loop uses the official mcp__codex__codex / mcp__codex__codex-reply tools as its primary entry point.
If the loop returns:
ready: finish the hardening pass
almost: either stop with explicit remaining gaps or do one targeted follow-up pass and rerun review
not ready: return to the highest-leverage recommended stage (audit, plan, refactor, tests, ci, or docs)
/oss-review remains useful as a one-shot checkpoint when the user wants a single external pass without the full loop.
Non-goals
- Do not merge all six stages into one opaque report.
- Do not require manual stage-by-stage interaction unless the user asks for it.
- Do not push through later stages when earlier artifacts are incomplete.
Anti-patterns
- Do not force manual stage-by-stage operation when the user asked for continuous execution.
- Do not auto-advance when a stage's stop/rollback condition has been triggered.
- Do not claim the pipeline is complete if the review loop still reports blockers.
- Do not hide rollback reasons; document them in
OSS_HARDENING_STATUS.md.
Self-check
Before declaring this stage complete, verify:
Failure Handling
- If a later stage reveals a new foundational issue, return to
/oss-audit or /oss-plan and record why.
- If the user only wants one stage, honor that and update the status file accordingly.
- If the repo already has mature tests or CI, skip duplicate work and focus on the missing stages.
- In continuous mode, pause only on blockers; otherwise auto-advance to the next stage.
- If
/oss-review-loop fails the repo after max rounds, record the recommended return stage and do not claim the pipeline is complete.
Done Criteria
OSS_HARDENING_STATUS.md exists and records current stage, completed artifacts, execution mode, unresolved decisions, next command, and stop/rollback conditions.
- No later stage is marked complete while a required earlier-stage artifact is missing, unless a skip reason is recorded.
- The final status records either successful completion through review-loop or the exact blocker that prevented completion.
1---2name: oss-hardening3description: Orchestrate an end-to-end open-source hardening pass for a repository. Use when the user wants to turn a loose codebase or paper-code release into a readable, testable, maintainable open-source project and wants audit, plan, refactor, tests, CI, and docs to run as one continuous workflow unless a blocker appears.4---56# OSS Hardening78Run a staged hardening pipeline in one continuous pass by default:9101. `/oss-audit`112. `/oss-plan`123. `/oss-refactor`134. `/oss-tests`145. `/oss-ci`156. `/oss-docs`167. `/oss-review-loop`1718Default behavior:1920- execute `audit -> plan -> refactor -> tests -> ci -> docs -> review-loop` in one invocation21- carry artifacts forward automatically between stages22- only pause when a real blocker, rollback condition, or user-requested stop point appears2324Do not force the user to manually re-issue every stage command unless they explicitly ask for stage-by-stage control.2526## Context: $ARGUMENTS2728## Input Contract2930- Input: repository path or scope, user constraints, optional stop point, whether the repo is product code or paper code, and any "continuous" or "manual" preference.31- Default: if no stop point is given, run the full pipeline continuously from audit to docs.3233## Output Contract3435Create or update `OSS_HARDENING_STATUS.md` with:3637- current stage38- completed artifacts39- whether execution auto-continued or paused40- latest external review-loop score and verdict if review ran41- unresolved maintainer decisions such as license choice or missing citation path42- next recommended command43- explicit stop/rollback conditions4445If the workflow pauses, give the user a short "where we are / what comes next" summary. If the workflow finishes continuously, give one end-to-end summary plus any blockers left deferred.4647## Stage Order4849### 1. Audit5051Run `/oss-audit` first, then continue directly to `/oss-plan` if no blocker is found.5253Stop here if:5455- there is no reproducible local run command yet56- the repo appears abandoned or generated57- the scope is too unclear to change safely58- the repo depends on private data or checkpoints with no public-safe sample path yet5960### 2. Plan6162Run `/oss-plan` once the audit has concrete `P0/P1/P2` findings, then continue directly to `/oss-refactor` when the plan is actionable.6364Stop here if:6566- the plan still contains unresolved "discover first" tasks67- one checklist item is too large to review safely6869### 3. Refactor7071Run `/oss-refactor` only for the smallest structural changes needed to unlock tests and CI, then continue directly to `/oss-tests` when behavior remains stable.7273Rollback or pause if:7475- behavior changes unexpectedly76- the refactor starts expanding beyond the planned file set77- new tooling creates more maintenance burden than value7879### 4. Tests8081Run `/oss-tests` after the structure is stable enough to test, then continue directly to `/oss-ci` when the local test command is trustworthy.8283Stop here if:8485- the only available tests are flaky or rely on live services86- external dependencies still need seams or mocks8788### 5. CI8990Run `/oss-ci` only after local lint and test commands are trustworthy, then continue directly to `/oss-docs` once CI reflects the intended local workflow.9192Rollback or pause if:9394- the workflow requires secrets95- the workflow duplicates an existing pipeline without improving it9697### 6. Docs9899Run `/oss-docs` so the documentation reflects the final behavior and commands, then continue directly to `/oss-review-loop` if all prior stages passed cleanly.100101Stop here if:102103- the implementation state is still changing daily104- support, license, citation, or security ownership is unknown and needs maintainer input105106### 7. Review Loop107108Run `/oss-review-loop` after docs so the pipeline ends with an external Codex quality gate and up to four rounds of iterative fixes. The review loop uses the official `mcp__codex__codex` / `mcp__codex__codex-reply` tools as its primary entry point.109110If the loop returns:111112- `ready`: finish the hardening pass113- `almost`: either stop with explicit remaining gaps or do one targeted follow-up pass and rerun review114- `not ready`: return to the highest-leverage recommended stage (`audit`, `plan`, `refactor`, `tests`, `ci`, or `docs`)115116`/oss-review` remains useful as a one-shot checkpoint when the user wants a single external pass without the full loop.117118## Non-goals119120- Do not merge all six stages into one opaque report.121- Do not require manual stage-by-stage interaction unless the user asks for it.122- Do not push through later stages when earlier artifacts are incomplete.123124## Anti-patterns125126- Do not force manual stage-by-stage operation when the user asked for continuous execution.127- Do not auto-advance when a stage's stop/rollback condition has been triggered.128- Do not claim the pipeline is complete if the review loop still reports blockers.129- Do not hide rollback reasons; document them in `OSS_HARDENING_STATUS.md`.130131## Self-check132133Before declaring this stage complete, verify:134135- [ ] `OSS_HARDENING_STATUS.md` exists and lists current stage, completed artifacts, execution mode, unresolved maintainer decisions, next command, and stop/rollback conditions.136- [ ] Every completed stage has a corresponding artifact or an explicit skip reason.137- [ ] If execution paused, the blocker and pause stage are recorded.138- [ ] If execution finished, the final status includes the review-loop verdict and score, or an explicit reason the review loop did not run.139140## Failure Handling141142- If a later stage reveals a new foundational issue, return to `/oss-audit` or `/oss-plan` and record why.143- If the user only wants one stage, honor that and update the status file accordingly.144- If the repo already has mature tests or CI, skip duplicate work and focus on the missing stages.145- In continuous mode, pause only on blockers; otherwise auto-advance to the next stage.146- If `/oss-review-loop` fails the repo after max rounds, record the recommended return stage and do not claim the pipeline is complete.147148## Done Criteria149150- `OSS_HARDENING_STATUS.md` exists and records current stage, completed artifacts, execution mode, unresolved decisions, next command, and stop/rollback conditions.151- No later stage is marked complete while a required earlier-stage artifact is missing, unless a skip reason is recorded.152- The final status records either successful completion through review-loop or the exact blocker that prevented completion.