Harness integration

From Intense-Visions/harness-engineering · View interactive version

Harness integration is an AI agent skill from the GitHub repository Intense-Visions/harness-engineering. > Verify system wiring, materialize knowledge artifacts, and update project metadata. Integration is a gate, not a discovery phase -- it confirms that planned integration tasks completed. <!-- not-a-p

How to use this skill

Skill file

Harness Integration

Verify system wiring, materialize knowledge artifacts, and update project metadata. Integration is a gate, not a discovery phase -- it confirms that planned integration tasks completed. <!-- not-a-pause: skill summary line, not a step -->

When to Use

Process

Pause points

Every point below where this skill stops for the human carries a marker line, _Pause point (<class>): resolve per the Pause Protocol._ followed by a <!-- pause: <class> --> comment. Resolve each one with the Pause Protocol: agents/skills/templates/pause-protocol.md (also shipped in the harness CLI package at dist/agents/skills/templates/pause-protocol.md).

Iron Law

No integration claim may be made without checking every planned integration task against the codebase.

Integration checking is mechanical: did the planned task produce the expected artifact? "It should be there" is not evidence. Check the file, check the import, check the registration. Report what you observed.

The words "should", "probably", "seems to", and "I believe" are forbidden in integration reports. Replace with "verified: [evidence]" or "not verified: [what is missing]."


Argument Resolution

When invoked by autopilot (or with explicit arguments), resolve paths before starting:

  1. Session slug: If session-slug argument provided, set {sessionDir} = .harness/sessions/<session-slug>/. Pass to gather_context({ session: "<session-slug>" }). All report writes go to {sessionDir}/.
  2. Apply autonomy flags first (D17). Before any subagent dispatch and before the first marked point below: if this skill was invoked with --supervised, call manage_state({ action: "set-autonomy", path, session, level: "supervised" }); if with --audit, call it with audit: true. Flags only lower autonomy: on --trusted or --no-audit, change nothing and print the raise hint from the Pause Protocol. Then read autonomy with gather_context({ path, session, include: ["autonomy"] }). With no session slug nothing can auto-resolve, so there is nothing to lower.
  3. Plan path: Discover from {sessionDir}/handoff.json (read upstream execution/verification output). The plan contains integration tasks tagged category: "integration" and the integrationTier field.
  4. Rigor level: If fast/thorough argument provided, use it. Otherwise default to standard.

When no arguments are provided (standalone invocation), discover plan from docs/changes/<topic>/plans/ (preferred) or docs/plans/ (legacy fallback) or prompt. Global .harness/ paths used as fallback.


Tier Resolution

Before running sub-phases, resolve the effective integration tier:

  1. Read plan-time tier. Extract integrationTier from the plan header (small, medium, or large). If absent, default to small.
  1. Derive execution-time tier. Read the execution start commit from the session handoff (startCommit field in {sessionDir}/handoff.json). If unavailable, use the autopilot's startingCommit from {sessionDir}/autopilot-state.json. Diff startCommit..HEAD to analyze the execution phase:

```

newPackages > 0 -> large

newPublicExports > 5 -> large (minimum)

filesChanged > 15 AND newExports -> medium (minimum)

else -> keep plan estimate

```

To count these signals:

  1. Apply max(planned, derived). The effective tier is the higher of the two.
  1. Notify on escalation. If derived tier exceeds planned tier, notify the human:

```

Tier escalated from small to medium: 8 new exports detected.

```

_Pause point (ceremony): resolve per the Pause Protocol._ <!-- pause: ceremony -->

Inform the human and get acknowledgment in plain text in your reply (do NOT route this through emit_interaction or AskUserQuestion — they record the prompt but do not display it to the human, so they won't see it).


Rigor Level Interaction

| Rigor | INTEGRATE behavior |

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

| fast | WIRE only (default checks), no ADR drafting |

| standard | Full tier-appropriate checks (WIRE for all; MATERIALIZE + UPDATE for medium and large) |

| thorough | Full checks + human reviews every ADR draft + force knowledge graph verification |


Context Loading

Before running sub-phases, load session context:

gather_context({
  path: "<project-root>",
  intent: "Verify integration of executed plan",
  skill: "harness-integration",
  session: "<session-slug-if-provided>",
  include: ["state", "learnings", "handoff", "graph", "businessKnowledge", "sessions", "validation"]
})

Load the plan, identify integration tasks (tagged category: "integration"), and group them by sub-phase:


Sub-Phase 1: WIRE (all tiers)

Report progress: **[WIRE]** Checking system wiring

WIRE always runs, regardless of tier. It has two parts: default checks (always) and task-specific checks (when integration tasks exist).

Default Checks (always run)

These run even with zero explicit integration tasks (D8: barrel exports and validation are cheap and catch real problems).

  1. Barrel export check. Run pnpm run generate-barrel-exports --check. If the --check flag is not supported, fall back to:
  1. Harness validate. Run pnpm harness validate. Must pass. Record result.
Task-Specific Checks (when integration tasks exist)

For each integration task tagged category: "integration" that relates to wiring:

  1. Entry point reachability. Trace from known entry points to new code:
  1. Skill discovery verification. If a new skill was created:
  1. Route mount verification. If a new API route was added:
  1. Produce wiring report. Write {sessionDir}/integration-wiring.json:

```json

{

"subPhase": "wire",

"tier": "<effective-tier>",

"timestamp": "<ISO-8601>",

"defaultChecks": {

"barrelExports": { "status": "pass|fail", "detail": "<description>" },

"harnessValidate": { "status": "pass|fail", "detail": "<output summary>" }

},

"taskChecks": [

{

"taskRef": "Task N: <name>",

"check": "<what was verified>",

"status": "pass|fail",

"evidence": "<file:line or command output>"

}

],

"verdict": "pass|fail"

}

```


Sub-Phase 2: MATERIALIZE (medium + large tiers)

Report progress: **[MATERIALIZE]** Checking knowledge materialization

Skip this sub-phase for small tier or fast rigor. For medium and large tiers:

Decision Harvesting
  1. Read handoff decisions. Load {sessionDir}/handoff.json from all phases in this session. Collect all entries from the decisions array.
  1. Classify decisions. For each decision:
ADR Auto-Drafting (large tier only)
  1. Auto-draft ADRs from architectural decisions. For each architectural decision:

a. Assign ADR number. Scan docs/knowledge/decisions/ for existing ADR files matching NNNN-*.md. Take the highest number and increment by 1. If the directory does not exist, create it and start at 0001.

b. Generate slug. Convert the decision title to a URL-safe slug (lowercase, hyphens, no special characters).

c. Write ADR to docs/knowledge/decisions/NNNN-<slug>.md:

```markdown


number: NNNN

title: <decision title>

date: <ISO date>

status: accepted

tier: large

source: <spec path or session slug>

supersedes: <prior ADR number, if any>


## Context

<What situation prompted this decision? What constraints existed?>

## Decision

<What was decided and why?>

## Consequences

<What follows from this decision -- positive, negative, and neutral?>

```

_Pause point (ceremony): resolve per the Pause Protocol._ <!-- pause: ceremony -->

d. Present for review. In thorough rigor, present each ADR draft in plain text in your reply and wait for human approval — do NOT route it through emit_interaction or AskUserQuestion, which record the prompt but do not display it to the human (the client collapses the call to "Called harness" and the text only returns to the model). In standard rigor, auto-approve but log the draft for review.

Knowledge Graph Enrichment (medium + large tiers)
  1. Enrich knowledge graph. For each decision (both architectural and minor):
Documentation Task Verification
  1. Verify documentation integration tasks. For each integration task tagged category: "integration" that relates to documentation:
  1. Produce materialization report. Write {sessionDir}/integration-materialization.json:

```json

{

"subPhase": "materialize",

"tier": "<effective-tier>",

"timestamp": "<ISO-8601>",

"decisions": {

"total": 0,

"architectural": 0,

"minor": 0

},

"adrs": [

{

"number": "NNNN",

"title": "<title>",

"path": "docs/knowledge/decisions/NNNN-<slug>.md",

"status": "drafted|approved"

}

],

"graphEnrichment": {

"nodesCreated": 0,

"status": "pass|fail|skipped"

},

"documentationChecks": [

{

"taskRef": "Task N: <name>",

"status": "pass|fail",

"evidence": "<description>"

}

],

"verdict": "pass|fail|skipped"

}

```


Sub-Phase 3: UPDATE (medium and large tiers)

Report progress: **[UPDATE]** Checking project metadata updates

Skip this sub-phase for small tier or fast rigor. For medium and large tiers:

  1. Roadmap sync. If docs/roadmap.md exists, call manage_roadmap with sync and apply: true to update feature status. If manage_roadmap is unavailable, fall back to noting the roadmap needs manual sync.
  1. Changelog verification. If CHANGELOG.md exists at the project root:
  1. Spec cross-reference annotation. Read the spec at its path (from the plan or handoff):
  1. Produce update report. Write {sessionDir}/integration-updates.json:

```json

{

"subPhase": "update",

"tier": "<effective-tier>",

"timestamp": "<ISO-8601>",

"roadmap": { "status": "synced|skipped|failed", "detail": "<description>" },

"changelog": { "status": "pass|fail|skipped", "detail": "<description>" },

"specCrossRef": { "status": "annotated|skipped", "detail": "<description>" },

"verdict": "pass|fail|skipped"

}

```


Combined Report and Verdict

After all applicable sub-phases complete, produce the combined integration report:

  1. Write combined report. Write {sessionDir}/phase-{N}-integration.json:

```json

{

"phase": "integration",

"tier": "<effective-tier>",

"rigor": "<fast|standard|thorough>",

"timestamp": "<ISO-8601>",

"subPhases": {

"wire": { "verdict": "pass|fail", "reportPath": "{sessionDir}/integration-wiring.json" },

"materialize": {

"verdict": "pass|fail|skipped",

"reportPath": "{sessionDir}/integration-materialization.json"

},

"update": {

"verdict": "pass|fail|skipped",

"reportPath": "{sessionDir}/integration-updates.json"

}

},

"verdict": "pass|fail",

"failures": [

{

"subPhase": "<wire|materialize|update>",

"taskRef": "Task N: <name>",

"issue": "<what is incomplete>",

"fix": "<specific fix instruction>"

}

]

}

```

  1. Report verdict. Summarize pass/fail per sub-phase. On failure, list exactly which integration tasks are incomplete with specific fix instructions.
  1. On PASS: Write handoff and emit transition to REVIEW:

```json

emit_interaction({

path: "<project-root>",

type: "transition",

transition: {

completedPhase: "integration",

suggestedNext: "review",

reason: "Integration passed at all applicable sub-phases",

artifacts: ["<report paths>"],

requiresConfirmation: false,

summary: "Integration passed: tier <tier>. WIRE passed. MATERIALIZE <passed|skipped>. UPDATE <passed|skipped>.",

qualityGate: {

checks: [

{ "name": "wire-checks", "passed": true },

{ "name": "materialize-checks", "passed": true },

{ "name": "update-checks", "passed": true },

{ "name": "harness-validate", "passed": true }

],

allPassed: true

}

}

})

```

Immediately invoke harness-code-review without waiting for user input.

_Pause point (gate): resolve per the Pause Protocol._ <!-- pause: gate -->

  1. On FAIL: Do NOT emit a transition. Report incomplete items with fix instructions, then ask the human how to proceed in plain text.

_Pause point (gate): resolve per the Pause Protocol._ <!-- pause: gate -->

Ask directly in your reply. Do NOT route the question through emit_interaction, AskUserQuestion, or any tool. emit_interaction records the prompt but does not display it to the human — the client collapses the call to "Called harness" and the rendered text only returns to the model, so the human sees nothing and you end up narrating a question they cannot answer. AskUserQuestion is Claude-Code-only and caps headers at 12 chars / 4 options. Plain text in your own message is the only channel that reliably reaches the human across every tool (Claude Code, Cursor, Codex, Gemini CLI).

_Pause point (gate): resolve per the Pause Protocol._ <!-- pause: gate -->

Present the options as a markdown table, state your recommendation, then STOP and wait for the human's reply:

```markdown

### Decision needed: Integration failed. <N> items incomplete. How to proceed?

| | fix | skip | stop |

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

| What | Re-enter EXECUTE with integration-specific fix tasks, then re-VERIFY, re-INTEGRATE | Record decision and proceed to REVIEW (human override) | Save state and exit |

| Pros | Closes gaps before review | Unblocks progress immediately | Preserves state for later |

| Cons | Another execute/verify cycle | Ships with known gaps | No forward progress |

| Risk | Low | Medium | Low |

| Effort | Medium | Low | Low |

Recommendation: fix (confidence: high) — fixing integration gaps now prevents review rework.

```


Handoff

Write handoff to the session-scoped path when session slug is known, otherwise fall back to global:

[DEPRECATED] Writing to .harness/handoff.json is deprecated. In autopilot sessions, always write to .harness/sessions/<slug>/handoff.json to prevent cross-session contamination.

{
  "fromSkill": "harness-integration",
  "phase": "COMPLETE",
  "summary": "<verdict summary>",
  "tier": "<effective-tier>",
  "artifacts": ["<report paths>", "<ADR paths if any>"],
  "verdict": "pass | fail",
  "gaps": ["<gap descriptions if any>"],
  "decisions": [{ "what": "<decision>", "why": "<rationale>" }]
}

Session summary (if session known): Update via writeSessionSummary with skill, status (Integration <PASS|FAIL>. Tier: <tier>. <N> checks, <N> gaps.), keyContext, and nextStep.

Session State

| Section | Read | Write | Purpose |

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

| terminology | yes | no | Consistent language in integration reports |

| decisions | yes | yes | Reads all phase decisions for ADR drafting; writes integration decisions |

| constraints | yes | no | Respect existing constraints during checks |

| risks | yes | yes | Reads risks; writes integration risks discovered during checks |

| openQuestions | yes | yes | Reads questions; resolves those answered by integration evidence |

| evidence | yes | yes | Prior evidence; writes wiring, materialization, and update evidence |

When to write: After each sub-phase, append evidence entries. After ADR drafting, write decisions.

When to read: During Context Loading via gather_context with include: ["state", "learnings", "handoff", "graph", "businessKnowledge", "sessions", "validation"].

Evidence Requirements

Every pass/fail assertion in the integration report MUST include concrete evidence:

  1. File reference: file:line with observed content (e.g., src/index.ts:12 -- "exports NotificationService")
  2. Command output: Actual command and output (e.g., pnpm run generate-barrel-exports --check -- "No changes detected")
  3. Harness output: harness validate output
  4. Git diff evidence: git diff --name-only output for barrel export checks
  5. Discovery evidence: harness skill list output for skill discovery verification
  6. Session evidence: Record evidence in the sub-phase report JSON files written to the session directory

When to cite: At every check. Each pass/fail in the wiring, materialization, and update reports must be backed by evidence.

Uncited claims: Any integration assertion without direct evidence is an integration failure. This skill does not use [UNVERIFIED] -- if evidence cannot be produced, verdict is FAIL.

Harness Integration

Success Criteria

Red Flags

| Flag | Corrective Action |

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

| "Barrel exports probably have not changed, so I will skip the check" | STOP. WIRE default checks always run. "Probably" is forbidden. Run the check and report the result. |

| "The ADR looks correct from the decision text, no need to present for review" | STOP. In thorough mode, every ADR draft requires human review. In standard mode, auto-approve but log. Do not skip the review protocol. |

| "Integration tasks are just bureaucracy, I will mark them as passed" | STOP. Integration tasks exist because brainstorming and planning identified real connection points. Each must be verified with evidence. |

| "The knowledge graph enrichment failed but it is not critical" | STOP. In thorough mode, graph enrichment failure is a FAIL. In standard mode, log the failure and include in the report. |

| "I will fix the missing barrel export myself to make WIRE pass" | STOP. Integration identifies gaps -- integration never fills them. Record as FAIL with fix instructions. The executor fixes it. |

Rationalizations to Reject

| Rationalization | Reality |

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

| "WIRE passed so the feature is properly integrated" | WIRE checks wiring only. For medium/large tiers, MATERIALIZE and UPDATE must also pass. Partial integration is not integration. |

| "This is a small change, so I can skip tier derivation and just use the plan estimate" | Tier derivation is mandatory. Even if the plan says small, execution may have produced more changes than expected. Always derive and compare. |

| "The ADR format is close enough, no need to match the exact frontmatter schema" | ADRs must match the spec format exactly (number, title, date, status, tier, source, supersedes). The knowledge pipeline depends on consistent frontmatter for parsing. |

| "Integration tasks were not in the plan, so there is nothing to check" | WIRE default checks always run regardless of planned integration tasks (D8). If the plan has no integration tasks, WIRE still checks barrel exports and runs validate. |

| "I found an integration gap but it is minor, so I will mark it as pass with a note" | A gap is a FAIL, not a conditional pass. Record the gap, report it, and let the human decide whether to fix or skip. |

Examples

Example: Small Tier Integration (Bug Fix)

## Integration Report

**Tier:** small (plan: small, derived: small)
**Rigor:** standard

### WIRE
- [PASS] Barrel exports: `pnpm run generate-barrel-exports --check` -- no changes
- [PASS] Harness validate: passes
- No integration tasks to verify

### MATERIALIZE
- [SKIPPED] Small tier -- no materialization required

### UPDATE
- [SKIPPED] Small tier -- no updates required

### Verdict: PASS

Example: Large Tier Integration (New Skill)

## Integration Report

**Tier:** large (plan: medium, derived: large -- escalated due to new package)
**Rigor:** standard

### WIRE
- [PASS] Barrel exports: regenerated, git diff shows no changes
- [PASS] Harness validate: passes
- [PASS] Skill discovery: harness-integration/skill.yaml exists, SKILL.md exists (420 lines)
- [PASS] Entry point: skill appears in harness skill list output
- [FAIL] Route mount: /api/integration not mounted in router

### MATERIALIZE
- [PASS] ADR 0001-tiered-integration-rigor.md drafted and auto-approved
- [PASS] Knowledge graph: 3 decision nodes created via ingest_source
- [PASS] AGENTS.md updated with integration phase description

### UPDATE
- [PASS] Roadmap synced: integration-phase moved to in-progress
- [FAIL] Changelog: no entry in CHANGELOG.md for integration phase
- [PASS] Spec cross-reference: annotated with implementation file links

### Verdict: FAIL -- 2 items incomplete
1. Route mount /api/integration not found in router configuration
   Fix: Add route import and mount in src/api/routes/index.ts
2. Changelog entry missing
   Fix: Add entry under Unreleased: "Added integration phase with tiered wiring verification"

Gates

_Pause point (ceremony): resolve per the Pause Protocol._ <!-- pause: ceremony -->

Escalation

_Pause point (gate): resolve per the Pause Protocol._ <!-- pause: gate -->

_Pause point (gate): resolve per the Pause Protocol._ <!-- pause: gate -->

_Pause point (gate): resolve per the Pause Protocol._ <!-- pause: gate -->

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.