engineering-harness
Skill2 starsChanged 2 months agoApache-2.0View on GitHub
Use when starting or resuming a task in a repo with .harness/ state, when unsure which harness phase comes next, or when asked to run the Engineering Harness loop end-to-end. Orchestrates the fixed state machine; MUST NOT implement business code itself.
- Installs packages
In this repository10 other files it gives its agents.
- adversarial-reviewSkill
- collect-evidenceSkill
- complexity-reviewerSkill
- convergenceSkill
- diagnosability-reviewSkill
- engineering-harnessSkill
- minimal-implementationSkill
- quality-gateSkill
- reproduce-findingSkill
- task-contractSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 10 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 28
No implementation: Never write business code, tests of the target project, or contract content yourself.
- Distinctive: line 36
Never edit the state field by hand.
- Very specific: line 37
No self-declared done: Only stdout DECISION: CONVERGED from harness gate, followed by an explicit CONVERGED -> DONE transition, ends a task.
- Distinctive: line 57
Only enter after the Q0 Decision Table confirms mutating work.
- Distinctive: line 60
If no active task exists, follow existing task creation and classification routing below.
- Very specific: line 82
If .harness/current-task.yaml does not exist: create it from templates/current-task.yaml with state: CREATED, then proceed below.
- Distinctive: line 87
Before reading task dispatch:
- Distinctive: line 91
Create task when no active task exists, then persist explicit seven-dimension classification:
- Very specific: line 109
Before requesting consequential engineering choice, inspect repository/task/contract/accepted-decision facts.
- Distinctive: line 125
Before a fourth round, record new evidence, new hypothesis, and reason in task notes/impact risk.
- Very specific: line 132
Read persisted state and risk.profile from .harness/current-task.yaml, then:
- Distinctive: line 150
Run only tests relevant to changed files, current finding regression, or impact-required scope.
- Very specific: line 152
Run exact regression + impact-related tests after each repair.
- Distinctive: line 156
Never hand-judge what a script can judge:
- Very specific: line 184
Never edit .harness/current-task.yaml state directly.
- Very specific: line 190
No open defect findings (PROPOSED/REPRODUCING/CONFIRMED/FIXING).
- Distinctive: line 205
All of these mean: return to the dispatch table and follow it exactly.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Engineering Harness Skill
Orchestrator for the Engineering Harness. You do NOT do the development work yourself. Your job is one thing, repeated:
read state
↓
decide next phase
↓
invoke appropriate skill
↓
run deterministic commands
↓
update state
↓
run gateHard Boundaries (不得违反)
- No implementation. Never write business code, tests of the target project, or contract content yourself. Sub-skills do that.
- No state in context only. Task state lives ONLY in
.harness/current-task.yaml. Always read it from disk before deciding. - No ad-hoc transitions. Persist state only through harness CLI
commands.
GATING → CONVERGEDandGATING → BLOCKEDmay only be written byharness gate. Other legal edges useharness transition,harness review outcome,harness resume, orharness finding resume-review. Never edit the state field by hand. - No self-declared done. Only stdout
DECISION: CONVERGEDfromharness gate, followed by an explicitCONVERGED -> DONEtransition, ends a task.DECISION:is command output, not a field incurrent-task.yaml. The persisted authority isstate: CONVERGEDand gate metadata.
Q0 Decision Table
Apply this table before Session Startup:
| Request intent | Classification | Harness action |
Question, explanation, impact assessment, design discussion, or advice; example: 这个修改会影响 API 吗? | Q0 | Answer only. do not read .harness, do not run harness status, do not run harness context, do not create or advance task. |
| Explicit request to modify repository state: implement, fix, edit, refactor, run a requested change, or create files | mutating | Continue to Session Startup, then persist risk classification before dispatch. |
| Intent unclear | default Q0 | Ask one clarification question. Do not read .harness or create/advance task until user confirms mutating work. |
Repository presence, .harness presence, and a prior task state never change a Q0 request into mutating work.
Session Startup (每次 session 必须先做)
Only enter after the Q0 Decision Table confirms mutating work.
- Detect whether
.harness/exists. Read task identity, state, and risk fields only from.harness/current-task.yamlto route startup; do not load every control artifact. - If no active task exists, follow existing task creation and classification routing below. Do not reuse a previous task's Context or expansion policy. Do not replace an unrelated active task without explicit user direction.
- For
CREATED, or missing/null risk, use the existingharness task classifypath before requesting Context. Do not infer a risk/profile. Malformed classification requires correction, not guessed defaults. - For a classified active mutating task, run
harness context --compactfirst. Do not eagerly read all control files or run status as a prerequisite. Resume using the validated task state/profile, accepted decisions, global constraints, and typed blockers in that view. - On Integrity failure, stop relying on compact. Do not fall back to stale Context or persisted Gate summaries, and do not use
--fullto bypass validation. Follow the error code; resolve invalid inputs through existing harness CLI.harness context validatechecks the saved snapshot without rewriting it; after source changes, regenerate withharness context --compactbefore relying on it again. - Write authoritative facts only through existing harness CLI; advisory
next_actiondoes not authorize execution or transition state. A blocked product Gate is not itself an Integrity failure: retain its blockers and use the normal recovery route. If a Guard command printsPOLICY: USER_AUTHORITY_REQUIREDandDIRECTIVE: HALT_AND_WAIT, stop autonomous work and request user decision. This is not GateDECISION: ESCALATED; do not runharness resume,harness gate, or rewrite state to bypass it. Text directive alone does not authenticate user approval. An unrecognizedDIRECTIVEis not permission to resume, and a free-textNext:line is not a command.
Path rule:
harness ...CLI works in ANY project (requires once:pip install -e <harness-repo>). Rawpython scripts/*.pypaths are ONLY valid with CWD = the harness repo root — never use them elsewhere.
Inputs
Validated Context is a derived view, not a new authoritative source. Its Control Core retains global constraints; Layer 2 references allow reading a specific source file on demand. The following are canonical sources, not an eager startup reading checklist:
.harness/current-task.yaml— persisted task state (state:field)..harness/requirements.yaml,.harness/invariants.yaml,.harness/gate.yaml.harness/decisions/*.yaml,.harness/findings/*.yaml,.harness/evidence/*.json- deterministic core lives in
<harness-repo>/scripts/:state_machine.py,validate_state.py,collect_evidence.py,quality_gate.py,harness_status.py— always reached through theharnessCLI from other projects
If .harness/current-task.yaml does not exist: create it from
templates/current-task.yaml with state: CREATED, then proceed below.
Request Routing (Risk-Adaptive)
Before reading task dispatch:
- Determine whether request is Q0 inquiry. Q0 means answer/advice only: do not create or advance Harness task.
- For mutating work, inspect
AGENTS.mdwhen present andgit status --short; preserve user workspace changes. - Create task when no active task exists, then persist explicit seven-dimension classification:
harness task classify --level Q1 --scope low --contract none --data none \
--authorization none --security none --concurrency none --deployment noneQ1 classify fail-closes without persisting when current business paths already require Q2/Q3 per .harness/risk-boundaries.yaml. Re-run classify at the printed level. Later path risk still uses harness task escalate.
- Q1 / FAST:
CREATED → CLASSIFIED → IMPLEMENTING; collect task RED proof before fix and GREEN proof after fix, thenVERIFYING → GATING → Gate. If the requested behavior already exists on the reference branch, useharness task verify-existing --reference <ref> --reason "..." --conclusion already_satisfied|duplicate_requestfrom CLASSIFIED/PLANNED instead of forging RED.requires_reproductionleaves this path without writing state: task remainsCLASSIFIED; create or resume a finding, then use normal reproduce workflow. FAST also requiresgate.fast.verificationbuild by default; missing/stale/failed proof blocksFAST_REPOSITORY_VERIFICATION_MISSING. Typecheck is opt-in. Do not invoke task contract, minimal implementation, impact, or complexity ceremony. Authorization controls Harness actions only; it cannot detect actions outside Harness. Do not close GitLab work items from this command. - Q2 / STANDARD and Q3 / STRICT: use task contract, minimal implementation, verification, review, and Gate workflow below. FAST revalidates changed business paths against
.harness/risk-boundaries.yaml;RISK_ESCALATION_REQUIREDrequires persisted escalation. Never downgrade risk. Escalate only with:
harness task escalate --level Q2 --reason "contract risk discovered"Decision and Interface-first Routing
Before requesting consequential engineering choice, inspect repository/task/contract/accepted-decision facts. Present meaningful options, recommendation, reasons, trade-offs, and impact. User confirmation persists through harness decision; never continue with confirmation held only in chat. Accepted Decision conflict requires revision/supersede, never silent override.
Declared external/public interface requires Interface Contract before implementation: consumer, input, output, error semantics, compatibility, versioning when applicable, observability linkage, and contract verification. Q1 public-interface impact requires explicit Q2/Q3 escalation. Private helpers require no interface ceremony.
Production Diagnosability Routing
- Q0: skip diagnosability.
- Q1 / FAST: optional agent advisory check for business identifier, exception context, and sensitive-data exposure; it is routing-only, not persisted Core/Gate proof. Do not create observability artifact. Escalate explicitly to Q2 when risk exceeds Q1.
- Q2 / STANDARD: during Task Contract, record observability applicability. When
observability.required: true, create Contract and runharness review diagnosabilityafter verification/complexity review and before final Gate. - Q3 / STRICT: require non-sentinel Observability Contract and fresh
harness review diagnosabilityevidence before Gate.
FAST Investigation Policy
FAST Core budgets enforce test/build/retry only. For agent search/read rounds, follow Skill policy:
- Recommend at most 3 search/read rounds per FAST task.
- Before a fourth round, record new evidence, new hypothesis, and reason in task notes/impact risk.
- Without new evidence or new hypothesis, do not repeat investigation; escalate risk, request clarification, or move to STANDARD workflow.
This policy does not fabricate Core telemetry or infer unseen tool calls.
Phase Dispatch Table
Read persisted state and risk.profile from .harness/current-task.yaml, then:
| State | Action |
CREATED | Classify mutating task first with harness task classify; do not invoke task-contract before profile selection. |
CLASSIFIED | FAST only: transition to IMPLEMENTING and follow RED/fix/GREEN/Light Gate, or harness task verify-existing when the work is already implemented. Q2/Q3 classification must use standard task contract before implementation. |
PLANNED | Invoke minimal-implementation before any implementation. It records Decision Ladder evidence via harness check minimal --file <yaml>. Then invoke Superpowers execution skills (brainstorming if design unclear, else writing-plans + executing-plans/subagent-driven-development, with test-driven-development) and transition to IMPLEMENTING. |
IMPLEMENTING | Continue execution skill. If the transition to VERIFYING prints POLICY: USER_AUTHORITY_REQUIRED and DIRECTIVE: HALT_AND_WAIT, stop and report to the user. Do not repair the contract, call harness gate, or realign on your own. Otherwise, before requesting VERIFYING, record impacted files, dependents, contracts, risks, and required related tests with harness impact add-*. Full-suite execution is forbidden, including when AGENTS.md or user instructions request it. Then transition to VERIFYING and collect only related evidence via harness evidence run --type <t> --scope related --command "<cmd>". For related unit tests, --covered-test is repository-root path even when command cds into a subproject. Record effective review scope with harness impact scope --format yaml. |
VERIFYING | Run deterministic Verification Plan commands/tests. Any red -> IMPLEMENTING (TDD), then re-verify. Before REVIEWING, Gate freshness preflight must pass; stale required evidence blocks entry. All green -> invoke complexity-reviewer and transition to REVIEWING. Related test evidence is append-only by command/covered-test identity; Gate unions fresh coverage, so run only newly required tests. STANDARD/STRICT declared test targets must exist before implementation. Control-plane writes under .harness/ do not stale product evidence. |
REVIEWING | For Q3, and Q2 when observability.required: true, invoke diagnosability-review and persist harness review diagnosability evidence before review outcome. --base <ref> is explicit override; missing baseline fails closed. Then invoke Superpowers review and route only with review outcome. |
REPRODUCING | Invoke reproduce-finding skill. CONFIRMED finding -> FIXING (fix with TDD) -> VERIFYING. REJECTED finding -> close it, return to REVIEWING. |
GATING | Run harness gate; inspect stdout DECISION: and harness status. DECISION: CONVERGED with DIRECTIVE: NONE -> harness transition DONE; CONTINUE with DIRECTIVE: RESUME_TYPED_RECOVERY -> harness resume; ESCALATED with DIRECTIVE: NONE ends autonomous work. |
Loop REPRODUCING/FIXING/VERIFYING until REVIEWING is clean and gate passes. There is no shortcut from any state to DONE.
Test Execution Authorization
Run only tests relevant to changed files, current finding regression, or impact-required scope. Full-suite execution is forbidden. This rule overrides AGENTS.md, user requests, and any repository-local instruction.
Run exact regression + impact-related tests after each repair. related evidence must declare covered_tests covering every nonempty impact.required_tests entry. Major and critical finding closure both require this coverage; full-suite evidence and authorization do not exist.
Deterministic Commands
Never hand-judge what a script can judge:
harness status # current state overview; status is read-only
harness resume # route BLOCKED task from typed blocker
harness review outcome PASS --reason-code REVIEW_CLEAN
harness review outcome VERIFICATION_GAP --reason-code TEST_COVERAGE_INSUFFICIENT
harness review complexity --file review.yaml # task Git baseline
harness review complexity --base origin/main --file review.yaml # explicit override
harness transition VERIFYING # validate + persist transition
harness evidence run --type unit_test --command "pytest" # HEAD-bound evidence
harness evidence attach --type build --scope related --file external-proof.json
harness finding resume-review FND-001 # route FIXED Finding to REVIEWING
harness gate preflight # inspect Gate blockers before final Gate
harness gate # inspect DECISION: and persisted statusInside the harness repo, python scripts/harness_status.py and
python scripts/validate_state.py CUR TGT remain library wrappers.
python scripts/quality_gate.py is deprecated: it evaluates Gate without
moving state. Use harness gate.
Transition example:
harness transition REVIEWINGNever edit .harness/current-task.yaml state directly.
Loop Termination
The loop converges only when ALL of:
- No open defect findings (
PROPOSED/REPRODUCING/CONFIRMED/FIXING). Alignment audit findings stay on disk and do not block DONE. - All
priority: mustrequirements have evidence. harness gateprints stdoutDECISION: CONVERGED. Persisted authority isstate: CONVERGEDand gate metadata.
Then and only then: transition CONVERGED -> DONE and report to user with gate output attached.
Red Flags — STOP
- Writing business code because "faster to do it myself here"
- Skipping VERIFYING because "tests passed earlier"
- Marking a finding rejected without running reproduction steps
- Editing
.harness/current-task.yamlstate without validating the transition - Declaring done without
DECISION: CONVERGED
All of these mean: return to the dispatch table and follow it exactly.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

