Skip to main content
skill CX Codex

harness — Claude Code skill for multi-session agents

A skill for Claude Code, Codex, Cursor and other platforms that keeps long-running agent tasks alive across context resets, with checkpointing and git-based rollback. Triggered by /harness run or when a job spans many dependent subtasks.

AGPL-3.0 158 installs ★ 2,756 updated 2026-05-04

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add stellarlinkco/myclaude --skill harness -a claude-code
Open on GitHub

What harness does

harness runs on Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI and OpenCode. It wraps any multi-step job in a persistent loop: /harness init <project-path> creates two state files — harness-tasks.json for structured task state and harness-progress.txt as an append-only log — then drives execution task by task.

After a context window reset, the agent rebuilds its position from those two files plus git history. A task found with status in_progress at session start means the previous session was cut short; the skill routes it through a dedicated recovery protocol. Concurrent writes to harness-tasks.json are blocked by a mkdir-based lock in /tmp, which is atomic on POSIX systems. A failed task rolls back via git reset --hard to its started_at_commit, and depends_on chains prevent later tasks from starting until their prerequisites complete.

The session config in the example sets max_tasks_per_session to 20 and max_sessions to 50 — those are illustrative values from the source, not hard platform limits. The .harness-active marker file must exist in the harness root for any hooks to fire; without it every hook exits 0 immediately, leaving the project untouched.

What it helps with

  • resume an agent job after a context window reset
  • roll back a failed subtask to its last clean commit
  • queue dozens of subtasks with explicit dependency ordering
  • prevent two concurrent agent sessions from corrupting the task file
  • add a new subtask to a running queue without stopping the loop

Example prompts for the agent

  • Run /harness init . and queue up tasks to refactor all API controllers
  • Resume the loop with /harness run — it stalled on task-004 last session
  • Add a step mid-flight: /harness add "Write migration for users table"

How to install harness

1Skills CLI (Vercel)

npx skills add stellarlinkco/myclaude --skill harness -a claude-code

2Manually: put the files in place

~/.claude/skills/harness/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/harness/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about harness

How do I install harness in Claude Code?

Run npx skills add stellarlinkco/myclaude --skill harness -a claude-code. The skill lands at ~/.claude/skills/harness/SKILL.md.

What does the harness skill do?

It manages long-running agent work by persisting task state and a progress log across sessions, then recovering from interruptions and rolling back failures with git reset --hard.

Does the project need to be in a git repo?

Yes. Rollback on failure relies on git reset --hard targeting the commit stored in started_at_commit. Without a git history that command has nothing to reset to.

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set7

Project sponsors

Companies that keep this analytics open