一键导入
omh-loop
Run an autonomous, spec-driven, tiered self/cross-verifying loop — the harness forces continuation until the goal is objectively met or a guardrail fires
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Run an autonomous, spec-driven, tiered self/cross-verifying loop — the harness forces continuation until the goal is objectively met or a guardrail fires
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Author a durable, machine-checkable SPEC.md (the anchor for an autonomous loop) with EARS-style acceptance criteria mapped to verify commands
Tier 3 작업 완료 전 N-라운드 독립검증·수정 루프. git diff를 모델 로테이션(Claude/GPT/Gemini)으로 라운드마다 독립 검증하고 수정한다.
Initialize oh-my-harness in the current project (plugin mode)
Configure oh-my-harness settings (features, thresholds, model routing, multi-agent)
Create a native Claude Code team with configured teammates and task assignments
Check status of the active native Claude Code team (teammates, tasks, progress)
| name | omh-loop |
| description | Run an autonomous, spec-driven, tiered self/cross-verifying loop — the harness forces continuation until the goal is objectively met or a guardrail fires |
| level | 2 |
Run an autonomous loop that keeps working until a SPEC.md is objectively satisfied. The Stop hook (loop-guard.mjs) is the loop engine: it forces continuation (decision:block) while the goal is unmet and under budget, and allows the session to stop when the verify ladder + cross-verify confirm done, or when a guardrail fires (budget, timeout, no-progress, oscillation). Termination is owned by the harness, never by self-assessment.
Usage: /omh-loop ["" | <path-to-SPEC.md> | stop] Example: /omh-loop SPEC.md Example: /omh-loop make all tests in test/auth pass and lint clean Example: /omh-loop stop (abort the active loop)
Handle stop: If $ARGUMENTS is stop, create the kill switch .claude/.omh/STOP and set .claude/.omh/loop-state.json active:false (atomic write). Confirm: [omh:loop] Loop stopped. Then exit.
Read config: Load .claude/.omh/harness.config.json. If features.autonomousLoop is false, tell the user and exit. Extract the loop block and modelRouting.
Spec gate (loop.requireSpec): Ensure loop.specPath (default SPEC.md) exists.
$ARGUMENTS is a bare goal and no spec exists → run /omh-spec first (or offer to), so the loop has a machine-checkable anchor. Do not start the loop on a vague goal.[NEEDS CLARIFICATION] markers → refuse to start; use AskUserQuestion to resolve, update the spec, then continue.Classify the tier (loop.classify, default auto): size effort to the task.
quick — single-file / mechanical (typo, rename): budget ~3 iters, no cross-verify.standard — normal feature/bugfix: budget ~8 iters, cross-verify once at done.deep — architectural / multi-file / ambiguous: budget ~20 iters, cross-verify every few iters + at done.
Heuristic: deep keywords (architecture, refactor, migrate, security, "across modules") or ≥5 files / ≥6 criteria → deep; trivial keywords or ≤1 file → quick; else standard. An explicit tier in $ARGUMENTS (e.g. --tier deep) overrides. Default cheapest tier and escalate on signals (verify failure, large diff, repeated failure) — record each tier transition in PROGRESS.md.Confirm with user via AskUserQuestion (autonomous loops are powerful — always confirm):
About to start an autonomous loop:
Spec : {specPath}
Goal : {goal}
Tier : {tier} → budget {maxIterations} iters / {maxWallClockMinutes} min
Verify : quickCheck=`{quickCheckCommand}` verify=`{verifyCommand}`
Cross-verify: {crossVerify ? crossVerifyModel : "off for this tier"}
Commit each iteration: {requireCommit}
Proceed? [yes / cancel]
Stop immediately on cancel.
Initialize state — write .claude/.omh/loop-state.json (atomic): { active:true, sessionId:null, tier, goal, specPath, iteration:0, totalIterations:0, deepVerifies:0, startedAt:<ms>, history:[] }. (The hook binds sessionId to this session on its first fire, so concurrent sessions/worktrees aren't cross-blocked.) Create/seed PROGRESS.md with the plan derived from the spec.
Run ONE iteration (then end your turn — the Stop hook drives the next):
quickCheckCommand (lint/typecheck) → verifyCommand (tests/build). On the first failure, stop the ladder and fix that.loop-state.json under pending so the hook can evaluate: { verifyPassed:<bool>, ladder:[{rung,status,signature,output,retryable}], crossVerifyVerdict:<PASS|FAIL|INCONCLUSIVE|null>, reflection:<string|null> }. Distinguish a real test fail (retryable) from an infra error like "no test runner" (retryable:false → the loop will stop and ask).Cross-verify (different model than the generator, loop.crossVerifyModel, default architect/opus). Announce [omh:model-routing → opus]. Dispatch an independent agent that:
PASS | FAIL | INCONCLUSIVE. INCONCLUSIVE fails safe → stop and report. Emit [omh:cross-verify] with the rubric table.
Gate cost: if the deterministic ladder and a quick self-review already agree, you may skip cross-verify until done (Agreement-Based Cascading). Cap deep cross-verifies at loop.maxDeepVerifiesPerTask.On loop end (the hook prints [omh:loop] ... ended: <cause>): read loop-state.json stopCause and report:
done → summarize what shipped; the verify ladder is green and (if required) cross-verify PASSed.budget_iterations / budget_total / timeout → report progress + what remains; do NOT claim done.plateau / oscillation → "this looks architectural, not iterative" — surface the recurring failure and ask the user how to proceed.infra_error / cross_verify_inconclusive → report the blocker and ask.
Remove the kill switch if present.omh persists cross-session learnings to the omh-memory MCP server — a knowledge graph at
~/.omh/memory/graph.jsonl, shared with Codex (one store, both runtimes). Use the MCP tools when
connected; fall back to the CLI helper otherwise; skip silently if neither is available
(graceful degrade — LTM must never block the loop).
search_nodes({query: "<project> <goal keywords>"})node ~/.omh/lib/memory.mjs search "<keywords>"Learning entity ("attempt N failed because X; root cause Y; next Z"),
related about → the Project.
create_entities + create_relations · CLI: node ~/.omh/lib/memory.mjs add-learning "<project>" "<reflexion>"quickCheck/verify commands and durable facts to the Project entity.
add_observations · CLI: node ~/.omh/lib/memory.mjs add-observation "<project>" "<fact>"loop.maxDiffFilesPerIteration, split it.scopeGuard.allowedPaths, deletions, force-push, or merging a cross-verify branch. Never auto-merge.loop.learningsFile and promote durable ones to LTM (cross-session, cross-runtime)./omh-loop stop or creating .claude/.omh/STOP halts the loop on the next Stop event.