Oh My Harness
Lightweight Claude Code harness. Zero config, instant boost. Smart defaults, test enforcement, model routing, and multi-agent orchestration — all through native hooks.
Installation
Option A: Claude Code Plugin (recommended)
# 1. Install plugin
claude plugin install oh-my-harness@oh-my-harness
# 2. Restart Claude Code, then initialize:
/harness-setup
Option B: npm CLI
npm install -g oh-my-harness
cd your-project
oh-my-harness init
Either way, start Claude Code as usual — harness features activate automatically.
Updating
# Plugin mode
claude plugin update oh-my-harness@oh-my-harness
/harness-setup
# npm mode
npm update -g oh-my-harness
oh-my-harness init
initpreserves your existingharness.config.json. Only hooks, commands, and CLAUDE.md instructions are refreshed.
Quick Start
After installation, OMH works immediately. Here's what happens in your first session:
- Convention detected — OMH scans your project and outputs:
[omh:convention-detect] Project: node | test: vitest | lint: eslint - Guards active — Ambiguity detection, dangerous command warnings, and test enforcement are all ON by default.
- Model routing ready — Claude automatically delegates to haiku/sonnet/opus based on task complexity.
Run /init-project to scaffold project-specific skills (code review, test writing, lint fixing) for your detected stack.
Configuration
All settings live in .claude/.omh/harness.config.json.
Default Config
{
"version": 1,
"features": {
"conventionSetup": true,
"testEnforcement": true,
"contextOptimization": true,
"autoPlanMode": true,
"ambiguityDetection": true,
"dangerousGuard": true,
"contextSnapshot": true,
"commitConvention": true,
"scopeGuard": false,
"usageTracking": true,
"autoGitignore": true,
"skillScaffolding": true
},
"testEnforcement": { "minCases": 2, "promptOnMissing": true },
"modelRouting": { "quick": "haiku", "standard": "sonnet", "complex": "opus" },
"autoPlan": { "threshold": 3 },
"ambiguityDetection": { "threshold": 2, "language": "auto" },
"commitConvention": { "style": "auto" },
"scopeGuard": { "allowedPaths": [] },
"multiAgent": { "maxAgents": 4, "useWorktree": true, "tmuxSession": "omh-agents" },
"conventions": { "autoDetect": true, "overrides": {} }
}
Modify Settings
/set-harness # Show all current settings
/set-harness features.scopeGuard true # Enable scope guard
/set-harness testEnforcement.minCases 3 # Require 3+ test cases
/set-harness modelRouting.standard opus # Use opus for implementation
/set-harness commitConvention.style gitmoji # Switch to gitmoji
Hooks
OMH hooks into Claude Code's lifecycle at every stage. All hooks run automatically — no manual intervention needed.
| Hook File | Event | What it does |
|---|---|---|
session-start.mjs | SessionStart | Convention detection, skill hints |
pre-prompt.mjs | UserPromptSubmit | Ambiguity guard, auto-plan mode |
dangerous-guard.mjs | PreToolUse | Warns before destructive commands |
commit-convention.mjs | PostToolUse | Reminds commit format |
scope-guard.mjs | PostToolUse | Warns about out-of-scope edits |
usage-tracker.mjs | PostToolUse | Records tool usage |
pre-compact.mjs | PreCompact | Saves context snapshot |
post-task.mjs | Stop | Test enforcement reminder |
Feature Tags — [omh:*]
Every OMH action is prefixed with a tag so you always know which feature fired:
[omh:convention-detect] → Detected project conventions
[omh:ambiguity-guard] → Asking for clarification
[omh:auto-plan] → Detected 3+ tasks
[omh:dangerous-guard] → Warning before destructive command
[omh:model-routing → sonnet] → Delegating to sonnet
[omh:test-enforcement] → Reminding to verify tests
[omh:commit-convention] → Showing commit format
[omh:scope-guard] → Warning about edit outside paths
[omh:context-snapshot] → Saving state before compaction
Skills
OMH provides 10 built-in slash commands:
| Command | Description |
|---|---|
/harness-setup | Initialize oh-my-harness with interactive onboarding |
/set-harness [path] [value] | View or modify harness settings |
/init-project | Detect conventions and scaffold project skills |
/agent-spawn [N] [task] | Spawn N parallel Claude agents in tmux |
/agent-status | Check status of running agents |
/agent-apply [id|all] | Preview diffs and merge agent worktree changes |
/agent-stop [id|all] | Stop agents and cleanup worktrees |
/team-spawn [template|N] [task] | Create native team with teammates |
/team-status | Check team and task progress |
/team-stop | Shutdown team and cleanup |
Agents
OMH provides 3 built-in agent types for cost-efficient subagent delegation:
| Agent | Model | Use For |
|---|---|---|
harness:quick | Haiku | File lookups, simple questions, exploration |
harness:standard | Sonnet | Implementation, bug fixes, debugging |
harness:architect | Opus | Architecture, complex analysis, security review |
Model Routing
Claude automatically routes subagent work to the appropriate model tier based on task complexity. This is configured in CLAUDE.md and agent definitions.
Announce with: [omh:model-routing → <model>]
# Customize model assignments
/set-harness modelRouting.quick haiku
/set-harness modelRouting.standard sonnet
/set-harness modelRouting.complex opus
Features Overview
| # | Feature | Hook | Default |
|---|---|---|---|
| 1 | Convention Auto-Detect | SessionStart | ON |
| 2 | Test Enforcement | Stop | ON |
| 3 | Model Routing | CLAUDE.md | ON |
| 4 | Auto-Plan Mode | UserPromptSubmit | ON |
| 5 | Ambiguity Guard | UserPromptSubmit | ON |
| 6 | Dangerous Guard | PreToolUse | ON |
| 7 | Context Snapshot | PreCompact | ON |
| 8 | Commit Convention | PostToolUse | ON |
| 9 | Scope Guard | PostToolUse | OFF |
| 10 | Usage Tracking | PostToolUse | ON |
| 11 | Auto .gitignore | CLI init | ON |
| 12 | Multi-Agent | /agent-spawn | — |
| 13 | Native Team | /team-spawn | ON |
| 14 | Skill Scaffolding | /init-project | ON |
Safety Guards
Ambiguity Guard
Detects vague requests using a scoring system (threshold: 2):
| Signal | Score | Example |
|---|---|---|
| Vague references | +1 | "fix this", "change that" |
| Scope-less verbs | +1 | "refactor" (no target) |
| Open-ended choices | +1 | "or something", "whatever" |
| Very short message | +1 | < 15 chars |
Dangerous Guard
Warns before potentially destructive operations:
| Pattern | Warning |
|---|---|
rm -rf | File deletion |
git push --force | Force push |
git reset --hard | Hard reset |
DROP TABLE | Database destruction |
chmod 777 | Unsafe permissions |
curl | sh | Remote execution |
.env files | Environment secrets |
id_rsa, .pem, .key | Private keys |
Warning only — does not block execution. Asks Claude to confirm with user.
Scope Guard
When enabled, warns if Edit/Write targets files outside allowed directories.
{
"features": { "scopeGuard": true },
"scopeGuard": { "allowedPaths": ["src/auth", "src/utils"] }
}
OFF by default. Enable when you want to restrict Claude's write scope.
Convention Auto-Detect
Scans project root on session start and injects detected conventions as context. Results are cached for 1 hour.
| Project File | Language | Detected Tools |
|---|---|---|
package.json | Node.js | jest / vitest / mocha, eslint / biome, prettier |
pyproject.toml | Python | pytest, ruff / flake8, black, mypy |
go.mod | Go | go test, golangci-lint |
Cargo.toml | Rust | cargo test, clippy, rustfmt |
build.gradle | Java | junit, gradle |
pom.xml | Java | junit, maven |
Test Enforcement
After code changes (Edit / Write / NotebookEdit), injects a reminder at session stop:
- Verify test files exist for changed code
- Each test file has at least N cases (configurable, default: 2)
- Tests must cover happy path, edge case, and error case at minimum
HUD Status Line
OMH replaces Claude Code's default status line with a real-time dashboard:
[OMH] | 5h:14%(3h51m) | wk:7%(6d5h) | session:29m | ctx:39% | 🔧53 | agents:2 | opus-4-6
| Segment | Meaning |
|---|---|
5h:14%(3h51m) | 5-hour rate limit usage, resets in 3h 51m |
wk:7%(6d5h) | Weekly rate limit usage, resets in 6d 5h |
session:29m | Current session duration |
ctx:39% | Context window usage (green → yellow → red) |
🔧53 | Total tool calls this session |
agents:2 | Running subagents |
opus-4-6 | Active model |
Skill Scaffolding
Run /init-project to auto-generate project-specific skills based on your detected stack.
Generated Skills
| Skill | What it does |
|---|---|
code-review | Language-specific review checklist |
test-write | Test writing conventions for detected framework |
lint-fix | Lint check and auto-fix workflow |
Supported Languages
| Language | Test | Linter |
|---|---|---|
| Node.js | vitest / jest / mocha | eslint / biome |
| Python | pytest | ruff / flake8 |
| Go | go test | golangci-lint |
| Rust | cargo test | clippy |
| Java | junit | — |
| Kotlin | kotest / junit5 | ktlint / detekt |
Skills are user-owned. Customize freely — OMH never overwrites existing skills.
Multi-Agent System
Spawn parallel Claude Code instances in tmux panes, each with an isolated git worktree.
Agent Commands
| Command | Description |
|---|---|
/agent-spawn [N] [task] | Spawn N agents (default: 2) with worktrees in tmux panes |
/agent-status | Check status of all agents (commits, changed files) |
/agent-apply [id|all] | Preview and merge agent changes to main |
/agent-stop [id|all] | Stop agents, warn about unmerged work, cleanup |
Worktree Mode
| useWorktree: true (default) | useWorktree: false | |
|---|---|---|
| Isolation | Each agent on its own branch | All agents in project root |
| Conflicts | Impossible during parallel work | Possible — use with care |
| /agent-apply | Required to merge changes | Not applicable |
| Best for | Any parallel code changes | Read-only tasks, analysis |
Safety Policies
- Always ask first — never spawn without explicit user confirmation
- Never auto-merge —
/agent-applyalways shows a diff and waits for approval - Never silently discard —
/agent-stopwith unmerged commits requires explicit choice - Max agents — capped by
multiAgent.maxAgents(default: 4)
Prerequisites
- tmux —
brew install tmux(macOS) /apt install tmux(Linux) - git — for worktree isolation
- claude CLI — must be available in PATH
Native Team System
Use Claude Code's built-in team orchestration — no tmux or worktree dependencies required.
Team Commands
| Command | Description |
|---|---|
/team-spawn [template|N] [task] | Create a team with teammates from a template or custom count |
/team-status | Check teammate status and task progress |
/team-stop | Shutdown teammates, warn about incomplete tasks, cleanup |
Templates
| Template | Members | Use For |
|---|---|---|
fullstack | frontend (sonnet) + backend (sonnet) + tester (sonnet) | Full-stack feature development |
review | reviewer (opus) + tester (sonnet) | Code review and testing |
research | researcher (haiku) + implementer (sonnet) + architect (opus) | Research-driven development |
Multi-Agent vs Native Team
| Multi-Agent (/agent-spawn) | Native Team (/team-spawn) | |
|---|---|---|
| Infrastructure | tmux + git worktrees | Claude Code built-in tools |
| Prerequisites | tmux, git, claude CLI | None (built-in) |
| Isolation | Git branches per agent | Shared repo (or Agent tool isolation) |
| Communication | Observe tmux panes | SendMessage between teammates |
| Best for | Parallel code changes needing isolation | Coordinated team workflows |
Team Safety Policies
- Always ask first — never create a team without explicit user confirmation
- Never silently discard —
/team-stopwith incomplete tasks requires explicit choice - Max teammates — capped by
nativeTeam.maxTeammates(default: 4) - One team at a time — must stop existing team before creating a new one
Settings Reference
| Path | Type | Default | Description |
|---|---|---|---|
features.conventionSetup | bool | true | Auto-detect project conventions |
features.testEnforcement | bool | true | Remind about tests after changes |
features.autoPlanMode | bool | true | Suggest plan mode for multi-task |
features.ambiguityDetection | bool | true | Force clarification for vague requests |
features.dangerousGuard | bool | true | Warn before destructive commands |
features.scopeGuard | bool | false | Restrict file modification scope |
features.usageTracking | bool | true | Track tool usage |
testEnforcement.minCases | number | 2 | Minimum test cases per file |
modelRouting.quick | string | haiku | Model for exploration |
modelRouting.standard | string | sonnet | Model for implementation |
modelRouting.complex | string | opus | Model for architecture |
autoPlan.threshold | number | 3 | Tasks to trigger auto-plan |
multiAgent.maxAgents | number | 4 | Max parallel agents |
multiAgent.useWorktree | bool | true | Use git worktrees for isolation |
features.nativeTeam | bool | true | Enable native team skills |
nativeTeam.maxTeammates | number | 4 | Max teammates per team |
nativeTeam.defaultTeamName | string | omh-team | Default team name |
CLI Commands
oh-my-harness init # Set up harness in current project
oh-my-harness update # Regenerate settings from config
oh-my-harness status # Show current configuration
oh-my-harness reset # Remove all harness files (clean uninstall)
OMC Compatibility
Oh My Harness coexists cleanly with Oh My ClaudeCode:
| Concern | OMH | OMC |
|---|---|---|
| CLAUDE.md markers | <!-- HARNESS:START/END --> | <!-- OMC:START/END --> |
| Hook namespace | .omh/hooks/ | OMC plugin hooks |
| Agent prefix | harness: | oh-my-claudecode: |
| Kill switch | DISABLE_HARNESS=1 | DISABLE_OMC=1 |
Both plugins can be installed simultaneously without conflicts.
Disable / Uninstall
# Temporarily disable
DISABLE_HARNESS=1 claude
# Plugin mode — uninstall
claude plugin uninstall oh-my-harness
# npm mode — full removal
oh-my-harness reset
npm uninstall -g oh-my-harness
Requirements
- Node.js >= 18
- Claude Code CLI
- tmux — for multi-agent only
- git — for worktree isolation