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

init preserves your existing harness.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:

  1. Convention detected — OMH scans your project and outputs: [omh:convention-detect] Project: node | test: vitest | lint: eslint
  2. Guards active — Ambiguity detection, dangerous command warnings, and test enforcement are all ON by default.
  3. 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 FileEventWhat it does
session-start.mjsSessionStartConvention detection, skill hints
pre-prompt.mjsUserPromptSubmitAmbiguity guard, auto-plan mode
dangerous-guard.mjsPreToolUseWarns before destructive commands
commit-convention.mjsPostToolUseReminds commit format
scope-guard.mjsPostToolUseWarns about out-of-scope edits
usage-tracker.mjsPostToolUseRecords tool usage
pre-compact.mjsPreCompactSaves context snapshot
post-task.mjsStopTest 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:

CommandDescription
/harness-setupInitialize oh-my-harness with interactive onboarding
/set-harness [path] [value]View or modify harness settings
/init-projectDetect conventions and scaffold project skills
/agent-spawn [N] [task]Spawn N parallel Claude agents in tmux
/agent-statusCheck 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-statusCheck team and task progress
/team-stopShutdown team and cleanup

Agents

OMH provides 3 built-in agent types for cost-efficient subagent delegation:

AgentModelUse For
harness:quickHaikuFile lookups, simple questions, exploration
harness:standardSonnetImplementation, bug fixes, debugging
harness:architectOpusArchitecture, 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

#FeatureHookDefault
1Convention Auto-DetectSessionStartON
2Test EnforcementStopON
3Model RoutingCLAUDE.mdON
4Auto-Plan ModeUserPromptSubmitON
5Ambiguity GuardUserPromptSubmitON
6Dangerous GuardPreToolUseON
7Context SnapshotPreCompactON
8Commit ConventionPostToolUseON
9Scope GuardPostToolUseOFF
10Usage TrackingPostToolUseON
11Auto .gitignoreCLI initON
12Multi-Agent/agent-spawn
13Native Team/team-spawnON
14Skill Scaffolding/init-projectON

Safety Guards

Ambiguity Guard

Detects vague requests using a scoring system (threshold: 2):

SignalScoreExample
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:

PatternWarning
rm -rfFile deletion
git push --forceForce push
git reset --hardHard reset
DROP TABLEDatabase destruction
chmod 777Unsafe permissions
curl | shRemote execution
.env filesEnvironment secrets
id_rsa, .pem, .keyPrivate 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 FileLanguageDetected Tools
package.jsonNode.jsjest / vitest / mocha, eslint / biome, prettier
pyproject.tomlPythonpytest, ruff / flake8, black, mypy
go.modGogo test, golangci-lint
Cargo.tomlRustcargo test, clippy, rustfmt
build.gradleJavajunit, gradle
pom.xmlJavajunit, maven

Test Enforcement

After code changes (Edit / Write / NotebookEdit), injects a reminder at session stop:

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
SegmentMeaning
5h:14%(3h51m)5-hour rate limit usage, resets in 3h 51m
wk:7%(6d5h)Weekly rate limit usage, resets in 6d 5h
session:29mCurrent session duration
ctx:39%Context window usage (green → yellow → red)
🔧53Total tool calls this session
agents:2Running subagents
opus-4-6Active model

Skill Scaffolding

Run /init-project to auto-generate project-specific skills based on your detected stack.

Generated Skills

SkillWhat it does
code-reviewLanguage-specific review checklist
test-writeTest writing conventions for detected framework
lint-fixLint check and auto-fix workflow

Supported Languages

LanguageTestLinter
Node.jsvitest / jest / mochaeslint / biome
Pythonpytestruff / flake8
Gogo testgolangci-lint
Rustcargo testclippy
Javajunit
Kotlinkotest / junit5ktlint / 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

CommandDescription
/agent-spawn [N] [task]Spawn N agents (default: 2) with worktrees in tmux panes
/agent-statusCheck 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
IsolationEach agent on its own branchAll agents in project root
ConflictsImpossible during parallel workPossible — use with care
/agent-applyRequired to merge changesNot applicable
Best forAny parallel code changesRead-only tasks, analysis

Safety Policies

Prerequisites

Native Team System

Use Claude Code's built-in team orchestration — no tmux or worktree dependencies required.

Team Commands

CommandDescription
/team-spawn [template|N] [task]Create a team with teammates from a template or custom count
/team-statusCheck teammate status and task progress
/team-stopShutdown teammates, warn about incomplete tasks, cleanup

Templates

TemplateMembersUse For
fullstackfrontend (sonnet) + backend (sonnet) + tester (sonnet)Full-stack feature development
reviewreviewer (opus) + tester (sonnet)Code review and testing
researchresearcher (haiku) + implementer (sonnet) + architect (opus)Research-driven development

Multi-Agent vs Native Team

Multi-Agent (/agent-spawn)Native Team (/team-spawn)
Infrastructuretmux + git worktreesClaude Code built-in tools
Prerequisitestmux, git, claude CLINone (built-in)
IsolationGit branches per agentShared repo (or Agent tool isolation)
CommunicationObserve tmux panesSendMessage between teammates
Best forParallel code changes needing isolationCoordinated team workflows

Team Safety Policies

Settings Reference

PathTypeDefaultDescription
features.conventionSetupbooltrueAuto-detect project conventions
features.testEnforcementbooltrueRemind about tests after changes
features.autoPlanModebooltrueSuggest plan mode for multi-task
features.ambiguityDetectionbooltrueForce clarification for vague requests
features.dangerousGuardbooltrueWarn before destructive commands
features.scopeGuardboolfalseRestrict file modification scope
features.usageTrackingbooltrueTrack tool usage
testEnforcement.minCasesnumber2Minimum test cases per file
modelRouting.quickstringhaikuModel for exploration
modelRouting.standardstringsonnetModel for implementation
modelRouting.complexstringopusModel for architecture
autoPlan.thresholdnumber3Tasks to trigger auto-plan
multiAgent.maxAgentsnumber4Max parallel agents
multiAgent.useWorktreebooltrueUse git worktrees for isolation
features.nativeTeambooltrueEnable native team skills
nativeTeam.maxTeammatesnumber4Max teammates per team
nativeTeam.defaultTeamNamestringomh-teamDefault 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:

ConcernOMHOMC
CLAUDE.md markers<!-- HARNESS:START/END --><!-- OMC:START/END -->
Hook namespace.omh/hooks/OMC plugin hooks
Agent prefixharness:oh-my-claudecode:
Kill switchDISABLE_HARNESS=1DISABLE_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