Your AI coding agent keeps drifting off-task, rewriting things you didn't ask for, or saying "done" without running a single test. code-harness fixes this at the configuration layer �not with prompts you have to repeat every session.
A drop-in configuration pack for Claude Code and Codex that enforces structured development workflow, session discipline, and cross-session memory. Works by shipping proven principles as CLAUDE.md / AGENTS.md files and auto-activating skills �no plugins, no setup scripts.
Long AI coding sessions fail in predictable ways:
- Goal drift �the agent forgets what it was doing halfway through a complex task
- Scope creep �asked to fix a bug, it rewrites unrelated code
- False completion �claims done without running type checks or tests
- Loop waste �edits the same file repeatedly with the same broken approach
- Context bloat �stale debugging back-and-forth fills the context, making everything slower
- Memory loss �corrects the same mistake every new session because nothing was recorded
These aren't model problems. They're discipline problems. code-harness enforces the discipline.
Drop a single file into your agent's config directory. That's the entire install.
The file contains:
- Workflow routing �fast path for clear tasks, deliberate path (spec �plan �TDD �verify �review) for complex ones
- Karpathy coding rules �think before coding, surgical changes only, simplicity first
- Harness engineering �
todo.mdgoal tracking, loop detection (3 edits �stop and rethink), verification gate before claiming done - Memory guidance �what's worth recording across sessions: corrections, error patterns, user preferences; what isn't (code structure, git history)
- Context hygiene �when to compact, when to start a new session, how to keep instruction files lean
The skills/ directory contains two skills for agents that support auto-loading (Claude Code, Cursor, Codex):
workflow-guide�activates when starting any feature or projectharness-engineering�activates when managing context, hitting loops, or deciding what to remember
| Agent | Do this |
|---|---|
| Claude Code | Copy CLAUDE.md �~/.claude/CLAUDE.md |
| Codex | Copy AGENTS.md �your project root |
| Cursor / other | Copy skills/ �your agent's skills directory |
No plugins required. No scripts. One file copy.
Clone first (recommended �makes updates easy):
git clone https://github.com/theosunny/code-harness ~/.claude/code-harness # Claude Code cp ~/.claude/code-harness/CLAUDE.md ~/.claude/CLAUDE.md # Codex (run in your project root) cp ~/.claude/code-harness/AGENTS.md ./AGENTS.md
Windows (PowerShell):
git clone https://github.com/theosunny/code-harness "$env:USERPROFILE\.claude\code-harness" # Claude Code Copy-Item "$env:USERPROFILE\.claude\code-harness\CLAUDE.md" "$env:USERPROFILE\.claude\CLAUDE.md"
At the start of any multi-step task, the agent creates todo.md and updates it after each step. This re-injects the current goal into the end of the context window �where attention is strongest �preventing drift in long sessions.
If the same file is edited 3+ times without resolving the issue: stop, re-read the goal, try a fundamentally different approach. No more spinning on the same broken fix.
Before claiming a task is done, the agent must run a minimal verification set �type-check and critical-path tests. "Done" means verified, not just written.
The agent logs what's worth keeping across sessions:
- Corrections �when you say "don't do X", that gets recorded with the reason
- Error patterns �the same mistake twice means write it down (HermesAgent principle)
- Preferences �communication style, code style, what you consider complete
- No timestamps in system prompts (breaks KV-cache, 10× cost)
- Instruction files stay lean;
/compactwhen a phase is done - New session on task switches �don't mix unrelated work
- Think before coding �state assumptions, ask when uncertain
- Simplicity first �minimum code that solves the problem
- Surgical changes �touch only what the task requires
- Goal-driven �define done upfront, write verifiable tests first
cd ~/.claude/code-harness && git pull cp CLAUDE.md ~/.claude/CLAUDE.md # apply latest
Real session failure reports make the best PRs. If the agent violated one of these principles in a way the current config didn't prevent, that's a bug worth fixing.
MIT