A Claude Code skill for long-running, multi-session development campaigns.
Built from the same core ideas described in Anthropic Engineering's long-running harness work:
Harness v2 keeps the /harness-plan command surface the same, but swaps the internal recovery model:
- compact machine state instead of free-text recovery
- one active
current-contract.jsonper feature session-summary.jsonas the default resume artifact- deterministic Python scripts for state transitions
- risk-gated QA instead of always-on full reviewer loops
- portable script paths via
${CLAUDE_SKILL_DIR}— works regardless of install location harness_reset.pyfor deterministic campaign archiving- command router with explicit routing:
/harness-plan "goal"→ INIT,/harness-plan→ RESUME /harness-plan focuschecks for in-progress conflicts before switching- startup reads only the active feature from
features.json, not the entire file - session-protocol.md merged into SKILL.md to reduce per-session token overhead
- retry escalation:
selftest_retriescounter auto-blocks after 3 consecutive failures - session freshness signals:
checkpoint_writes, completed step count, and session feature count trigger new-session recommendations - parallel sub-task guidance: use Agent tool for independent work within a single feature
- auto-advance by default: only INIT plan approval, destructive actions, and QA review pause for confirmation
- scope drift detection: checkpoint warns when
files_touchedviolatescope_outboundaries - quick-verify:
harness_checkpoint.py --quick-verifyrunstest_commandduring implementation to catch regressions early - structured failure recording:
last_failureobject in checkpoint (command, error_summary, affected_files, timestamp) - session handoff context:
session_id,session_step_count, andhandoff_reasonin session-summary for cross-session continuity - manual check tracking:
--manual-check-donerecords completed manual checks before feature completion - contract command history:
command_historytracks verification command refinements with timestamps backlogstatus added to state machine with transitions topending,in_progress, andskipped- runtime platform detection:
detect_platform()/skill_home()for Codex environment compatibility
.harness/
├── campaign.json
├── features.json
├── current-contract.json
├── session-summary.json
├── features-schema.json
├── contract-schema.json
├── session-summary-schema.json
└── progress.md
Campaign metadata and defaults:
bootstrap_commandsetup_commanddefault_review_policybaseline_statuslast_session_commit
Feature tracking with immutable verification and structured checkpoint objects.
Each feature also carries blocked_history (timestamped block/unblock log, capped at 10) and archived_contract (the contract snapshot saved when a feature completes).
The active feature contract:
feature_idgoalscope_inscope_outverification_claimsverification_commandsmanual_checksreview_policyexecution_context— working directory and timeout for verification commandscommand_history— timestamped log of verification command refinements
Compact resume artifact used by new sessions and the SessionStart hook:
- campaign goal and mode
- current feature
- progress counts
- next resume steps
- known failures
- environment status
session_idandsession_step_countfor session boundary detectionhandoff_reason— why the previous session ended (freshness, blocked, completed, interrupted)
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_validate.py
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_summary.py
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_pick_next.py
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_transition.py --feature-id F007 --to in_progress
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_contract.py --feature-id F007
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_checkpoint.py --feature-id F007 --next-step "..."
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_checkpoint.py --feature-id F007 --quick-verify
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_checkpoint.py --feature-id F007 --manual-check-done "check description"
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_contract.py --feature-id F007 --update-command "old cmd" "new cmd"
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_reset.py --label "phase-1"These scripts only operate on .harness/ and are meant to replace hand-edited JSON for common state transitions.
harness_contract.py and harness_checkpoint.py only work on the active in_progress feature, and harness_transition.py refuses to create a second active feature.
Key script behaviors:
harness_validate.pychecks for git drift (HEAD vs last verified commit) and detects circular or dangling feature dependencies.harness_checkpoint.pyauto-extractsfiles_touchedfromgit diffwhen not explicitly provided.--quick-verifyrunstest_commandbefore writing.--selftest-retry/--failure-command/--failure-summaryrecord structured failure info.--manual-check-donemarks manual checks as completed.harness_contract.pysupports--update-commandto refine verification commands with history tracking.harness_transition.pyarchives the active contract into the feature record on completion (instead of deleting it) and appends timestamped entries toblocked_historywhen blocking. Supportsbacklogstatus.harness_reset.pyarchives the entire campaign into.harness/archive/<timestamp>_<label>/and cleans.harness/for a fresh INIT.
INIT -> PICK -> contract -> implement -> self-test -> optional QA -> checkpoint -> done
Resume priority:
session-summary.jsoncurrent-contract.json- active feature
checkpoint - recent lines from
progress.mdonly if needed
selftest: run local verification onlyqa: run local verification first, then launch a separate skeptical reviewer agent
Use qa when the active feature touches UI flows, auth, payments, migrations, concurrency, or external integrations. Otherwise default to selftest.
The plugin automatically registers a SessionStart hook on install. Each new session sees a compact campaign summary injected:
- goal
- progress counts
- current feature
- review policy
- environment status (with a warning when baseline is failing)
- last session date
- one next-step line
- known failures (up to 5)
- open issues from the current feature's last checkpoint (up to 5)
handoff_reasonfrom previous session (freshness, blocked, completed, interrupted)- last selftest failure details when available
/harness-plan autodrive on chains one-feature-per-session runs without
operator input until the campaign completes (or hits the iteration cap).
The Stop hook spawns a fresh claude -p session after each feature; the
final session runs /security-review plus four parallel reviewers and
writes .harness/review-report.md.
/harness-plan autodrive on # default max_iterations=20
/harness-plan autodrive status
/harness-plan autodrive off # next Stop tick exits the chain
/harness-plan autodrive reset # delete config + fail markerSafety:
- Default-disabled.
--max-iterations Ncaps total spawned sessions. .harness/autodrive.failaborts the chain on any unrecoverable state.- AskUserQuestion is forbidden in autodrive — clarification needs trip
the fail marker via
harness_autodrive.py --fail --reason "...".
Full protocol: resources/autodrive.md.
When running unattended, install these from
harness-discipline:
caveman— ultra-compressed output mode. Cuts token usage ~75% with no loss of technical substance. Logs stay readable on review.git-guardrails— PreToolUse hook that blocksgit push,reset --hard,clean -fd,branch -D,checkout .,restore .before they execute. The last line of defense against irreversible operations when no human approves tool calls.
Both install once and apply to every autodrive session.
Standard / heavy mode features can be subdivided into reviewable change
units, each with a proposed → speccing → verifying → archived
lifecycle. The parent feature transitions to done only when all units
are archived.
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_change.py --project-root . \
propose --feature-id F003 --title "Add CSV parser"
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_change.py --project-root . \
to-spec --change-id CHG-001 --spec-path .harness/changes/CHG-001/spec.md
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_change.py --project-root . \
to-verify --change-id CHG-001 --verify-evidence .harness/changes/CHG-001/verify.json
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_change.py --project-root . \
archive --change-id CHG-001 --files-touched src/csv.py
python3 ${CLAUDE_SKILL_DIR}/scripts/harness_change.py --project-root . \
status [--feature-id F003]Lite mode keeps the flat-feature flow — change units are opt-in only where they add value.
When harness-discipline
is installed, harness-plan delegates three operations to it:
| Operation | Skill | When |
|---|---|---|
| Test-first plan + verification command | /tdd-plan |
INIT, per feature |
| Run verification commands, return JSON verdict | /completion-verify |
Self-Test |
| Mini-RFC for a change unit | /change-spec |
After propose, before implementation |
Without discipline installed, harness-plan falls back to inline verification (same verdicts, less structured evidence). Discipline is recommended but not required.
# Add the marketplace, then install the plugin
/plugin marketplace add suntao2yl/claude-skill-harness
/plugin install harness-plan@suntao-skillsAfter installation, Claude Code exposes the slash command /harness-plan; the command routes into the bundled harness-plan skill.
python3 ~/.codex/skills/.system/skill-installer/scripts/install-skill-from-github.py \
--repo suntao2yl/claude-skill-harness \
--path plugins/harness-plan/skills/harness-planRestart Codex after installation so the new skill appears in the skill list.
MIT