The Deslop Pass (ai-slop-cleaner) Workflow After Ralph Completion in oh-my-codex
The deslop pass is a mandatory, scoped execution of the ai-slop-cleaner skill that runs automatically on changed files only after Ralph’s architect-verification phase completes, followed by full regression testing before the session closes.
When a Ralph session finishes its architect-verification phase (Step 7), the oh-my-codex framework does not immediately mark the task complete. Instead, it triggers a built-in quality gate designed to prune AI-generated "slop"—dead code, duplication, and unnecessary abstractions—while preserving verified behavior. This article breaks down the exact mechanism, source code paths, and execution flow of this mandatory deslop pass.
When Does the Deslop Pass Trigger?
The deslop pass activates at Step 7.5 of the Ralph skill workflow, immediately following the architect-verification step. According to the workflow definition in skills/ralph/SKILL.md, this step is non-optional by default and acts as a hard gate before session completion. The pass targets exactly the files edited during the Ralph session, ensuring the cleanup scope remains tightly bounded to the work actually performed.
How the Deslop Pass is Implemented in src/cli/ralph.ts
The integration logic resides in src/cli/ralph.ts, specifically within the buildRalphAppendInstructions function (lines 36–45). This function constructs the instruction block that the native sub-agent receives upon Ralph completion.
Building the Changed-Files List
First, the CLI generates a manifest file at .omx/ralph/changed-files.txt containing repo-relative paths of every file modified during the session. For example:
# Ralph changed files for the mandatory final ai-slop-cleaner pass
src/services/userProfile.ts
src/models/user.ts
This list serves as the scope boundary for the upcoming cleanup operation.
Scope Enforcement and Instruction Injection
The buildRalphAppendInstructions function injects a strict directive into the Ralph append file:
Final deslop guidance:
- Step 7.5 must run oh-my-codex:ai-slop-cleaner in standard mode on changed files only, using the repo-relative paths listed in `.omx/ralph/changed-files.txt`.
- Keep the cleaner scope bounded to that file list; do not widen the pass to the full codebase or unrelated files.
Simultaneously, the CLI updates the Ralph mode state, setting deslop_scope to changed-files-only (lines 93–97). This prevents scope creep and ensures the native sub-agent cannot accidentally run the cleaner against the entire repository.
Inside the ai-slop-cleaner Skill Execution
The native sub-agent interprets the appended instructions and invokes the ai-slop-cleaner skill defined in skills/ai-slop-cleaner/SKILL.md. The skill executes a regression-tests-first, smell-by-smell process:
- Locks behavior with tests before modifying code.
- Plans the cleanup based on detected smells.
- Categorizes issues: dead code, duplication, needless abstraction, boundary violations, and missing tests.
- Executes passes one at a time, re-running targeted verification after each pass.
- Enforces quality gates: tests, lint, type-check, and static/security scans must pass.
- Emits an evidence-dense report documenting every deletion and refactoring.
This structured approach ensures that removing AI-generated slop does not introduce functional regressions.
Regression Re-verification (Step 7.6)
Immediately following the cleaner, Step 7.6 executes. As defined in skills/ralph/SKILL.md (lines 81–90), this step re-runs all tests, build commands, and lint checks. If any regression surfaces:
- The cleaner’s changes are rolled back or fixed.
- Steps 7.5 and 7.6 repeat until the verification suite passes.
Only after this second green check does the Ralph session proceed to its final checklist, which includes the items "ai-slop-cleaner pass completed on changed files" and "Post-deslop regression tests pass".
Disabling the Deslop Pass with --no-deslop
Users can bypass the mandatory pass by invoking Ralph with the --no-deslop flag:
omx ralph --no-deslop "Add caching layer"
When this flag is present, src/cli/ralph.ts (lines 22–23 and 93–98) updates the state to deslop_enabled: false and deslop_opt_out: true. The appended instructions then read:
- `--no-deslop` is active for this Ralph run, so skip the mandatory ai-slop-cleaner final pass and use the latest successful pre-deslop verification evidence.
This allows rapid iteration when the user explicitly accepts the risk of un-cleaned AI output.
Practical Code Examples
Running Ralph with Automatic Deslop
Standard invocation triggers the full workflow:
omx ralph "Refactor user-profile module"
The framework automatically creates .omx/ralph/changed-files.txt and appends the deslop instructions without manual intervention.
Viewing the Injected Instructions
The native sub-agent receives a structured block similar to:
<ralph_native_subagents>
You are in OMX Ralph persistence mode.
Primary task: Refactor user-profile module
Final deslop guidance:
- Step 7.5 must run oh-my-codex:ai-slop-cleaner in standard mode on changed files only...
- Step 7.6 must rerun the current tests/build/lint verification after ai-slop-cleaner...
</ralph_native_subagents>
Inside the Cleaner: Pass Structure
The ai-slop-cleaner skill proceeds through discrete phases:
1. Pass 1: Dead code deletion
- Identify dead functions, variables, and import statements.
- Run targeted unit tests to ensure no behavior change.
2. Run quality gates (npm test, npm run lint, tsc)
3. If all green, continue to Pass 2 (Duplicate removal) …
Summary
- The deslop pass triggers automatically at Step 7.5 after Ralph’s architect verification.
- It runs
ai-slop-cleanerin standard mode only on files listed in.omx/ralph/changed-files.txt. - Scope enforcement prevents broader codebase modification via the
deslop_scope: changed-files-onlystate field. - Step 7.6 mandates full regression testing; failures trigger retry loops until clean.
- Users can opt out with
--no-deslop, which setsdeslop_opt_out: truein the session state. - Key implementation files include
src/cli/ralph.ts,skills/ralph/SKILL.md, andskills/ai-slop-cleaner/SKILL.md.
Frequently Asked Questions
What happens if the ai-slop-cleaner introduces a regression during the deslop pass?
If Step 7.6 detects any test failures, build errors, or lint violations after the cleaner runs, the Ralph workflow rolls back the cleaner’s changes (or requires fixes) and repeats Steps 7.5 and 7.6. The session cannot close until the post-deslop verification suite passes completely.
Can I run the deslop pass on the entire codebase instead of just changed files?
No. According to the source in src/cli/ralph.ts (lines 93–97), the deslop_scope is hardcoded to changed-files-only during Ralph sessions. The instruction text explicitly forbids widening the pass to the full codebase, ensuring the deslop operation remains tightly scoped to the work performed in the current session.
Where is the deslop pass logic tested?
The contract is enforced in src/cli/__tests__/ralph-deslop-contract.test.ts, which asserts that the Ralph skill contains the mandatory deslop steps, references ai-slop-cleaner, and restricts execution to changed files only. Additionally, src/hooks/__tests__/anti-slop-workflow.test.ts confirms that the cleaner skill is registered as a built-in hook callable via $ai-slop-cleaner.
Is the deslop pass available in other oh-my-codex skills besides Ralph?
While the ai-slop-cleaner skill is a built-in hook available globally, the mandatory, automatic deslop pass described here is specific to the Ralph skill workflow defined in skills/ralph/SKILL.md. Other skills may invoke the cleaner manually, but only Ralph implements this structured, gated deslop sequence as a completion requirement.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →