Harness check

From nano-step/nano-brain · View interactive version

Harness check is an AI agent skill from the GitHub repository nano-step/nano-brain. Run harness gate checks at every development transition point. Enforces that all gates pass before the agent proceeds to the next phase. Use this skill when: - Starting a new feature (pre-work gate) - During development after completing a story (in-progress gate) - Before creating or merging a PR (p

How to use this skill

Skill file

Harness Check

Enforce the harness gate specification defined in docs/HARNESS_GATES.md.

Tip: For autonomous development, use the /harness-on slash command — it runs this script automatically and injects fix instructions. See .opencode/plugin/harness-loop/README.md.

Core Rules

a separate, spawned sub-agent (e.g. code-reviewer/Oracle). The agent that

wrote the code MUST NOT review or approve its own code in the same context.

Self-review evidence is still required but does NOT satisfy the review gate.

Write the verdict to docs/evidence/review-<story>.md with a Reviewer: line

naming the independent agent (gate 3.5 fails if it is missing or names the

author/self/implementer).

How to Use

Step 1 — Determine the phase

Map the current situation to a gate phase:

| Situation | Phase |

|-----------|-------|

| About to start a new feature/story | pre-work |

| Just finished a story, still in feature | in-progress |

| Ready to create PR or merge | pre-merge |

| PR just merged | post-merge |

| Want to start the next feature | next-ready |

| Epic just completed or 3+ story failures | retro |

Step 2 — Run the script

./scripts/harness-check.sh <phase> [options]

Options:

Step 3 — Interpret results

| Result | Meaning | Action |

|--------|---------|--------|

| [PASS] | Check passed | Continue |

| [FAIL] | Check failed | STOP. Fix the failure before proceeding |

| [SKIP] | Check not applicable | OK — document reason if non-obvious |

Step 4 — Handle failures

If any check FAILs:

  1. Read the failure message — it tells you what's wrong
  2. Fix the root cause — don't work around it
  3. Re-run the same phase — all checks must pass
  4. Only then proceed to the next phase

Step 5 — Retro gate (after epic)

When the retro gate triggers:

  1. Run ./scripts/harness-check.sh retro --epic <N>
  2. Review the metrics output
  3. Create docs/evidence/retro-epic-{N}.md with:
  1. User must approve any harness rule changes before applying
  2. Update docs/HARNESS.md and/or docs/HARNESS_GATES.md if approved

Automatic Trigger Points

The orchestrator (Sisyphus) MUST invoke this skill at these points:

| Trigger | Gate |

|---------|------|

| git checkout -b <feature-branch> | ① PRE-WORK |

| Story marked complete in todo | ② IN-PROGRESS (includes 2.4 self-review) |

| git push (code ready for PR) | ② IN-PROGRESS (2.4 prerequisite) |

| gh pr create or before merge | ③ PRE-MERGE |

| PR merge confirmed | ④ POST-MERGE |

| Agent about to start next feature | ⑤ NEXT-READY |

| Last story of epic complete | ⑥ RETRO-GATE |

smoke:e2e Gate (MANDATORY for user-feature and bug-fix)

For any story that adds or changes a REST API endpoint, the agent MUST run a

real E2E smoke test before claiming the story is complete.

When required

How to run

# 1. Build binary
go build -o ./bin/nano-brain ./cmd/nano-brain/

# 2. Start server on non-default port
NANO_BRAIN_DATABASE_URL="postgres://nanobrain:nanobrain@host.docker.internal:5432/nanobrain_dev?sslmode=disable" \
NANO_BRAIN_SERVER_PORT=3199 \
NANO_BRAIN_EMBEDDING_PROVIDER="" \
./bin/nano-brain &
SERVER_PID=$!

# 3. Wait for health
for i in $(seq 1 15); do curl -sf http://localhost:3199/health >/dev/null && break; sleep 1; done

# 4. Exercise the changed endpoints via curl
#    - Verify HTTP status codes (200, 201, 400, etc.)
#    - Verify response JSON structure (required fields present)
#    - If bug fix: verify the previously broken request now works

# 5. Kill server
kill $SERVER_PID; wait $SERVER_PID 2>/dev/null

Evidence

Paste curl commands + responses in the PR description or story evidence.

If a bug is found during smoke:e2e → fix it BEFORE continuing to the next story.

FAIL conditions

Reference

| File | What it covers |

|---|---|

| docs/HARNESS.md | Master process spec (mental model, forbidden practices, Two-Output Model, HUMAN-ONLY rules) |

| docs/HARNESS_GATES.md | Gate specification (6 phases × all checks, parallelism rules, verdict-based PR comment triage) |

| docs/FEATURE_INTAKE.md | Risk classification, lane assignment, hard gates, R89 skip-issue conditions |

| docs/GLOSSARY.md | Closed-set vocabulary (Lane, Verdict, Override, etc.) |

| docs/CONTEXT_RULES.md | What to read per phase × lane (token-budget rules) |

| docs/TRACE_SPEC.md | Evidence file formats per tier (Tier 1/2/3) |

| docs/decisions/README.md | When to write ADRs |

| docs/evidence/ | Self-review, review, retro, smoke-e2e evidence files |

| scripts/harness-check.sh | Gate enforcement script (source of truth for PASS/FAIL logic) |

Rule IDs

Many gate FAIL messages reference rule IDs like (R7), (R29), (R89). These

trace back to specific rules in docs/HARNESS.md and docs/HARNESS_GATES.md.

When a gate FAILs with a rule ID, read that rule before fixing — the rule

defines the exact PASS condition.

Current explicit rules with IDs:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.