Harness Intelligence Wiki
HarnessPrompt Surfaces

Surface Inventory

The layered files and Built specs that shape agent behavior

Prompt surfaces exist to prevent private forks of the AI workflow. If every developer edits local guidance, the repository only looks harnessed. The actual agent behavior has drifted.

Harness splits prompt surfaces into two groups. A few files are managed by hi: inspectable in the repo, changed at the Harness source, and redistributed in a new Baseline. The prompts that describe the repository are owned by the project and written by the agent. The job of the split is to make context ownership explicit.

Surface Inventory

The core prompt-surface question is: where does this rule belong? Broad quality criteria belong high. Repo identity belongs at the root. Scoped skills and examples belong near the code. Project invariants belong in Codebase Rules. Durable non-obvious knowledge belongs in notes. Short-lived intent belongs in the current run.

SurfaceArtifact kindOwnsMust not own
Repo .agents/AGENTS.mdCopied verbatim from apps/cli/src/data/shared-agents.mdShared quality criteria, engineering posture, validation habits, source inspection habits, and team operating taste.Repo-specific app maps, package invariants, product requirements, or local business logic.
Root AGENTS.mdAuthored starter; then project-ownedRepo identity, app/package ownership, workflow routing, cross-surface contract rules, validation routing, and source-of-truth rules.Detailed rules for one app, package, docs surface, framework-specific task, or root Primary skills here lists.
Scoped AGENTS.mdAgent-written; project-ownedLocal ownership rules, scoped skill activation, upstream examples to inspect, and one pointer to the Codebase Rule Registry.Company-wide quality criteria or broad lifecycle workflow definitions.
Codebase Rules in .agents/rules/Project-owned; no Registry Item writes themOne stable invariant per rule, with triggers, verification, and exceptions.Workflow sequencing or one-off task notes.
Memory notesProject-ownedDurable non-obvious gotchas, decisions, setup quirks, and hard-won debugging findings.Session summaries, changelogs, obvious file maps, or material that belongs in specs, runbooks, or wiki pages.
Prompt specs and handoffBuilt; re-rendered on every hi updateInstructions for the next agent run: which Packs and skills apply, which AGENTS.md each spec targets, and the ordered next steps.Private local preferences or final product truth that belongs in the consumer repository.
Subagent manifest and agent filesmanifest.mjs Authored; agent files BuiltSpecialist ownership, guidance files, and skills, rendered for every harness.Hand edits in .claude/agents, .codex/agents, .cursor/agents, or .opencode/agents.
Hooks and required toolsHooks Copied; tools recorded in settings requiredToolsRepeatable guardrails for the Baseline check, formatting, linting, and tool availability.Explanations that belong in docs or rules that require human judgment.

Artifact Kinds

.devpunks/installed.json, the Installed Record, lists every managed path with its artifact kind. The kind decides what hi update does with the path and whether the agent may edit it.

Kindhi update behaviorMay the agent edit it?
CopiedWrites the Registry bytes. Skips identical content. Keeps a local edit unless --yes, and reports partial when the Baseline also changed the file.No
BuiltRe-renders from the template, the settings, and the Recorded Shape. Skips identical content.No; change the inputs instead
AuthoredWrites once when absent. Never compares or overwrites it, even with --yes.Yes; the project owns it

The root AGENTS.md starter, .agents/subagents/manifest.mjs, .codex/config.toml, and each <scope>/oxlint.local.ts are Authored. Scoped AGENTS.md files and their CLAUDE.md mirrors are not in the Installed Record at all; the agent writes them and hi never compares them.

Consumer-repo business logic stays in the consumer repo. The CLI distributes the Harness surfaces and the post-command contract, but it does not become the source of truth for a target product.

Setup Flow

hi init and hi update install the resolved Registry Items in a fixed order and write the Installed Record last:

The agent then writes the root and scoped AGENTS.md files from the prompt specs and the repository it is standing in. Root specs carry criteria and invariants for that step; they are not a hardcoded final root prompt.

That split keeps two things true:

  • the CLI stays deterministic at detection, Pack resolution, and Baseline install time
  • the written prompts are tailored to the current repo instead of copied as generic text

Harness Adapters

The Harness Adapters turn one Authored file, .agents/subagents/manifest.mjs, into specialist agent files for all four harnesses on every hi update:

  • .claude/agents/<name>.md with model: inherit and a skills list
  • .codex/agents/<name>.toml with developer_instructions and one [[skills.config]] entry per skill
  • .cursor/agents/<name>.md and .opencode/agents/<name>.md without a skills field

Each body inlines the agent's ownership, capability packs, boundaries, activation instructions, and the content of every guidanceFiles entry. An agent's skills are its skills list when present; otherwise they are the union of its packs from the manifest's capabilityPacks. The CLI loads the manifest from a data: URL, so it must stay self-contained, with no relative imports.

To change specialists, edit manifest.mjs (follow the Built guide .agents/subagents/manifest.prompt.md) and run hi update. Never edit the generated agent files; hi diff reports them as stale until the next update. The edit hook does not rebuild them.

Agent-Facing Authoring

The CLI deterministically resolves Packs, writes managed artifacts, and renders the handoff. It prints no handoff prompt: .devpunks/AGENT-SYSTEM-PROMPT.md is the prompt to give the next agent, and the $hi-cli operator skill owns the follow-through. Step 1 of .devpunks/AGENT-HANDOFF.md activates writing-for-agents, then rule-authoring, before the agent writes prompts, scoped guidance, or .agents/rules/. The skills govern the agent-authored prose; they do not run inside the CLI.

writing-for-agents keeps triggers and context pointers precise so an agent loads deeper instructions only when the relevant branch applies. The handoff is complete when hi diff shows no local-edit, conflict, or missing row.

Drift Signals

Prompt drift has three main causes:

  • The Harness Baseline changes. Shared guidance, Packs, skills, hooks, or templates changed upstream. hi check reports update-available, and a manual hi update installs the new managed surface and re-renders the specs.
  • A managed file was edited by hand. hi diff reports it as local-edit, or as conflict when the Baseline also changed it. hi update keeps the edit and reports kept; hi update --yes overwrites it. Move a needed change into an Authored or project-owned file, or into the Harness source.
  • The repository shape changed. A new workspace makes a Built spec render differently, and hi diff reports shape-drift. After hi update, the agent reconciles the AGENTS.md files with the new specs.

The fix is not a longer one-off prompt. Upstream changes flow through hi update. Project-owned prompts change in place, by the agent, from current specs and evidence.

On this page