deep
Skill75 starsChanged 2 months agoMITView on GitHub
Runs an iterative auto-fix loop on a chosen target — review, refactor, or coverage — dispatching the base skill into fresh subagent contexts per iteration, applying fixes automatically without per-change approval, running tests with bisection on failure, and checkpoint-committing until convergence or the cap. Requires /optimus:init and a test command in .claude/CLAUDE.md.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- agoopintsai/shiprighttheir own version, first seen Nov 1, 2026
- 0kim0bos/yamtheir own version, first seen Oct 29, 2026
- Seth090502/osanwe-publictheir own version, first seen Oct 20, 2026
- ARYN26/you-are-heretheir own version, first seen Oct 9, 2026
- kbichave/skillstheir own version, first seen Sep 1, 2026
- Olayeeeyo/claude-skillstheir own version, first seen Apr 5, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- agoopintsai/shipright★ 2same name
- kbichave/skills★ 2same name
- 0kim0bos/yam★ 1same name
- ARYN26/you-are-here★ 1same name
- Olayeeeyo/claude-skills★ 0same name
- Seth090502/osanwe-public★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- brainstormSkill
- code-reviewSkill
- commitSkill
- dreamSkill
- gauntletSkill
- handoffSkill
- how-to-runSkill
- initSkill
- jiraSkill
- paper-initSkill
- permissionsSkill
- promptSkill
- prSkill
- refactorSkill
- resetSkill
- tddSkill
- unit-testSkill
- worktreeSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 1 is distinctive, and 7 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
If your invocation prompt body already contains HARNESS_MODE_INLINE, stop immediately with: *"Deep mode cannot run inside deep mode."* This …
- Very specific: line 45
Run echo $CLAUDE_PLUGIN_ROOT via Bash.
- Very specific: line 47
If neither candidate contains scripts/harness_common, stop: *"Cannot resolve plugin root — ensure optimus-claude is installed as a plugin."*
- Very specific: line 53
If .claude/CLAUDE.md is missing, stop: *"Deep mode requires /optimus:init to set up project context first."*
- Very specific: line 76
Use AskUserQuestion — header "Deep mode", question "Proceed with deep [target]?":
- Distinctive: line 80
If the user selects Cancel, stop.
- Very specific: line 84
Read $CLAUDE_PLUGIN_ROOT/references/harness-init-resume.md and apply it with <progress-path> and <cap-flag> from the Targets table.
- Very specific: line 119
Read the target's loop reference — $CLAUDE_PLUGIN_ROOT/references/orchestrator-loop-single.md (review, refactor) or …
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Deep Mode
Orchestrate a base skill in an iterative auto-fix loop. Each iteration runs in a fresh subagent context, so the loop is not bounded by single-conversation context decay. All state lives in the target's progress file; the harness_common.cli helper applies fixes, runs tests, bisects failures, and decides termination.
Targets
| Target | Base skill (--skill) | Progress file | Cap flag (default/hard) | Loop reference | Focus |
review | code-review | .claude/code-review-deep-progress.json | --max-iterations 8/20 | references/orchestrator-loop-single.md | no |
refactor | refactor | .claude/refactor-deep-progress.json | --max-iterations 8/20 | references/orchestrator-loop-single.md | yes |
coverage | unit-test | .claude/unit-test-deep-progress.json | --max-cycles 5/10 | references/orchestrator-loop-paired.md | no — pinned to testability for its refactor phase; a user-supplied focus is rejected |
The coverage target counts cycles, not iterations: each cycle dispatches a unit-test phase (write tests, measure coverage, flag untestable code) and, when untestable items are pending, a refactor phase with testability focus.
Step 1: Parse Arguments and Guard Against Re-entry
Re-entry guard
If your invocation prompt body already contains HARNESS_MODE_INLINE, stop immediately with: "Deep mode cannot run inside deep mode." This prevents a misbehaving subagent from spawning a recursive deep run.
Parse invocation arguments
- Target — the first standalone token must be
review,refactor, orcoverage; otherwise stop and show the usage from the argument hint. All table lookups below use this target's row. --resumeand--no-commitflags (present/absent)--yesflag — auto-confirm every confirmation prompt in this skill (the Step 3 prompt and Step 4's coverage red-baseline confirmation); required when invoked underclaude -por any other non-interactive session that cannot answerAskUserQuestion.- Cap — the target's cap flag from the table (
--max-iterations Nor--max-cycles N), default and hard cap per the table. - Focus — refactor target only; stop on any other value or any other target (the CLI rejects both). Accept either
--focus testability|guidelinesor a baretestability/guidelinestoken, applying the Focus detection rules in$CLAUDE_PLUGIN_ROOT/skills/refactor/SKILL.md— read that section when parsing this item; it is the single source for the rule (do not paraphrase it here). A token consumed as focus is removed from the scope text before item 7 — otherwisedeep refactor guidelines srcwould lose thesrcpath scope. --allow-red-baseline— review/refactor only; coverage always tolerates a red baseline (see Step 4).- Everything else → scope text. An existing path scopes the run to that path; any other text is recorded as intent only — it does not filter. Default scope:
reviewcovers the branch diff;refactorcovers the feature-branch diff when one exists, otherwise the full project, widening per iteration to files with active findings and newly modified files;coveragecovers the full project.
Headless / CI example (skips the Step 3 confirmation): claude -p "/optimus:deep review --yes src/auth".
Step 2: Pre-flight Checks
Plugin root
Resolve plugin_root (the absolute path to the installed plugin) and keep it for every CLI call and subagent dispatch below — the env var does not persist across separate Bash tool calls and reads empty on some platforms (notably Windows):
- Run
echo $CLAUDE_PLUGIN_ROOTvia Bash. If it is non-empty and<value>/scripts/harness_commonexists (test -d), use it. - Otherwise derive the root from this skill's own location — the "Base directory for this skill:" line in your invocation context (Claude Code), the
Plugin root:in the session-start note (Codex), or the path of this SKILL.md — strip the trailing/skills/...segment and use it if<derived>/scripts/harness_commonexists. - If neither candidate contains
scripts/harness_common, stop: "Cannot resolve plugin root — ensure optimus-claude is installed as a plugin."
Wherever the steps below and the references they load write $CLAUDE_PLUGIN_ROOT in a command or path, substitute this plugin_root literally; <absolute-plugin-root> in dispatch prompts is the same value.
Prerequisites
If .claude/CLAUDE.md is missing, stop: "Deep mode requires /optimus:init to set up project context first."
Test command
Read .claude/CLAUDE.md and capture the documented test command verbatim (e.g. npm test, pytest) as test_command — the auto-fix loop has no safety net without one, so if none is documented, stop and recommend /optimus:init. Pass this captured command to init in Step 4 via --test-command (the CLI's own CLAUDE.md parser is stricter than a human read — passing the string you read avoids a spurious "No test command found" failure).
Git state
On a fresh (non---resume) run, refuse to proceed if the working tree has uncommitted changes unless --no-commit is passed — uncommitted state would be ambiguous with the orchestrator's own checkpoint commits. Untracked harness state in .claude/ (a prior run's progress, .bak and .done.json files, and the loop's dot-prefixed scratch files) does not count.
Step 3: User Confirmation
Skip this step entirely when --resume is given, or when --yes is given (headless / CI: the caller has pre-approved the run).
Warn the user with:
Deep mode ([target]) runs up to [N] iterative fix passes (cycles for
coverage, each up to two subagent dispatches). Every pass spawns fresh subagents — credit and time consumption multiplies with the count. Fixes are applied automatically without per-change approval. Low test coverage increases the chance of undetected breakage; consider running/optimus:unit-testfirst to strengthen the safety net. Press Esc twice to interrupt — state is saved per iteration; resume with/optimus:deep [target] --resume.Test command:
[test command]Focus:[focus or "balanced"](refactor target only)Mid-iteration interrupts may leave the working tree inconsistent; clean iterations are fully recoverable via
--resume.
Use AskUserQuestion — header "Deep mode", question "Proceed with deep [target]?":
- Proceed — "Run the loop until clean (max [N] iterations/cycles)"
- Cancel — "Don't run deep mode"
If the user selects Cancel, stop.
Step 4: Initialize or Resume Progress
Read $CLAUDE_PLUGIN_ROOT/references/harness-init-resume.md and apply it with <progress-path> and <cap-flag> from the Targets table.
On fresh run
PYTHONPATH="$CLAUDE_PLUGIN_ROOT/scripts" python -m harness_common.cli init \
--skill <base-skill> \
<cap-flag> [N] \
--test-command "<test_command>" \
[--focus testability | --focus guidelines] \
[--scope "<scope>"] \
[--no-commit] \
--progress-file "<progress-path>" \
--project-dir "."Pass --focus only for the refactor target, and only with the value from Step 1.
Baseline
Run cli baseline before entering the loop. On --resume, run it after resume, skipping it only when the progress file's completed counter (iteration.completed, or cycle.completed for coverage) is above 0 and no _safety_error is recorded — targeted reads, never the findings array. resume never re-runs the baseline, and the CLI refuses snapshot and every step command until a green baseline clears _safety_error.
PYTHONPATH="$CLAUDE_PLUGIN_ROOT/scripts" python -m harness_common.cli baseline \
--progress-file "<progress-path>" \
[--allow-red]baseline runs the test command once and calibrates the per-iteration timeout from its duration. Per target:
- review / refactor — green required. On
baseline-red, stop and show the failing tests (a red starting tree makes bisection blame the iteration's fixes and revert good work); the user can fix them or re-run with--allow-red-baseline. Pass the CLI--allow-redonly when the user supplied--allow-red-baseline— the CLI's own failure message names its internal flag, not the skill flag. - coverage — always pass
--allow-red: a coverage run legitimately starts with little or no passing coverage. If the CLI printsbaseline-red-allowedand the project already has tests (or the baseline hit the test timeout), warn the user and confirm before entering the loop — under--yes, print the warning and proceed without confirming: a failing suite trips the unit-test phase'sblockedstop gate at cycle 1, and a timing-out suite silently rolls every cycle's tests back.
Step 5: Run the Loop
Read the target's loop reference — $CLAUDE_PLUGIN_ROOT/references/orchestrator-loop-single.md (review, refactor) or $CLAUDE_PLUGIN_ROOT/references/orchestrator-loop-paired.md (coverage) — and follow its per-iteration body exactly, with:
<base-skill>= the table's base skill<progress-path>= the table's progress file<max>= the cap from Step 1
Refactor target: when a focus is set, add Focus: <testability|guidelines> to the dispatch prompt after the Phase: line (the base skill reads config.focus from the progress file; the echo makes the intent visible in the run trace).
Between iterations, tell the user in one line what the CLI reported (the deep-step / unit-test-step / refactor-step result and the termination check), so a long run is visibly progressing. Findings themselves stay in the progress file and the final report — don't reproduce subagent output in conversation prose.
Step 6: Final Report
After the loop, follow the loop reference's "After the loop" section, then open your closing message with the outcome in two or three lines. Give the stop reason, the report's headline counts (fixed/reverted, or coverage before → after and tests created), and any --resume hint or rollback command the report printed, because the host may collapse the command's output. For a fresh second-opinion pass after a clean finish, re-run /optimus:deep <target> without --resume.
Close on the outcome — changes left uncommitted (--no-commit, or commits disabled mid-run) → /optimus:commit; checkpoint commits made → /optimus:pr once the branch is ready (squash first if wanted — the final report prints the command) — either way, stay in this conversation so the implementation context is captured.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

