Agent Harness

The harness is the set of rules the agents work under in a repository: paths they can't touch, commands they can't run or must ask about, checks that decide when a task is done, and what they're told.

You write it once in the Agent Harness panel, and Termo turns it into each agent's own project files: Claude Code, Codex, Gemini CLI, Copilot CLI and Grok. Those files live in the repository and are committed with it, so the rules hold for anyone who opens an agent there, with Termo or without.

Open the panel

Press Ctrl+Shift+W (⌘⇧W on macOS), open the ≡ menu → Agent Harness, or click the guardrails icon (two lines with an arrow between them) on the panels bar. The button shows a ! when the harness has changes not applied yet.

The panel follows the active tab: when you switch tabs, it shows that folder's repository. If the folder is not a repository, it says so.

At the top it says where the harness stands:

Status Meaning
This repository has no harness yet There's no .termo/harness.json
Changes not applied You edited the rules and haven't applied them
N files don't match the harness Someone edited an agent's file by hand, or a pull brought a new harness
The agents' files match the harness Everything is written

What to do, and what not to do

The rules are two lists, each a line per rule in plain words.

What to do holds what the agents have to do, or may do without asking:

Kind Reads as What it does
Check before finishing Run npm run check before finishing Runs when the agent says it's done. If it fails, the agent is told what failed and keeps working until it passes
Command without asking May run npm test without asking The agent runs commands that start with those words without asking for permission
Instruction Use pnpm, not npm. Written in Termo's section of AGENTS.md, for the agents to read

What not to do holds what the agents can't touch or run, or only with your go-ahead:

Kind Reads as What it does
Path: no reading or editing Don't read or edit .env The agent can't open the path or change it
Path: no editing Don't edit dist The agent can read the path but not change it
Forbidden command Never run git push --force The agent can't run commands that start with those words
Command that asks first Don't run git push without asking The agent asks for permission every time

Click Add under a list, pick the kind of rule and type it. A path with a folder in it (src/generated/**) counts from the repository's root; a name alone (.env) applies in any folder; the … button picks a file from the repository. A command is matched by how it starts: git push covers git push origin main. When two rules cover a command, the stricter one wins: with git push asking first and git push --force forbidden, a forced push is refused and any other push asks first.

The button with the i on each row shows what the rule means and how each agent holds it: whether it enforces the rule by itself or only reads it as an instruction (see Which agent enforces what). The × that shows on hover removes the rule.

Below What to do, Suggested offers the checks your repository already has: the check, lint and test scripts in package.json (run with npm, pnpm, yarn or bun, going by the lock file), cargo test, pytest, make test and go test. Checks only run when the turn changed something in the repository, so a question answered without touching files isn't checked.

Below What not to do, Protect the harness's files (on by default) keeps every agent from editing .termo/ and the settings and rules files Termo writes for each agent, so none can switch its own rules off, or another agent's. These rules aren't listed with yours; AGENTS.md names the files in one line. Turn it off if you want an agent to edit those files.

Also below What not to do, the Packs add a set of rules in one go: Destructive git, Publishing, Installing dependencies and Recursive deletes. Hover over one to see its rules.

Every rule is also written out as text in Termo's section of AGENTS.md, so an agent that can't enforce a rule by itself still hears of it.

More

Under More, folded until you open them:

  • AI assistant: an agent proposes rules or unifies the instruction files (see below).
  • Agents: which agents the rules are written for. They're all checked to start with.
  • Tester: see Try a command.
  • Instruction files: see Instruction files.
  • Existing rules: see Rules that were already there. It only shows when there are any.

AI assistant

The AI assistant section asks one of your agents to look at the repository. It only reads: nothing is written until you review it. Pick the agent under AI engine.

  • Propose rules: the agent proposes paths to protect, commands to forbid, ask about or allow, and checks, each with the reason for it. It also reads the instruction files and turns sentences that are really rules ("never edit the migrations") into rules; those show which file and sentence they came from. Click Add on the ones you want, or Add all: they go into the lists like any rule you add yourself.
  • Unify instructions: when CLAUDE.md, GEMINI.md and the others repeat the same instructions, the agent moves what they share to AGENTS.md and leaves each file with what's specific to its agent. Termo's sections are kept as they are, and CLAUDE.md gets the @AGENTS.md line it needs. You see each file's diff before clicking Apply. It needs at least two instruction files.

While the agent works, the section shows what it's reading; Cancel stops it. Each run is a request to the agent's model, so it costs what any other request does.

Apply

Nothing is written while you edit. Click Review and apply to see, file by file, what's going to change. Open a file to see its diff, then click Apply.

Discard changes throws away the edits that weren't applied.

When the files don't match the harness (someone edited them by hand, or a pull brought them), the button reads Review and sync: it writes the files back to what the harness says.

What gets written

File For What's in it
.termo/harness.json Termo The rules, and a record of what Termo wrote in each file
AGENTS.md Every agent Termo's section: the instructions and the rules as text
CLAUDE.md Claude Code An @AGENTS.md line, only if the file exists and doesn't import it yet
.claude/settings.json Claude Code and Grok Permissions for paths and commands, and a Stop hook for the checks
.codex/rules/termo-harness.rules Codex The command rules
.codex/hooks.json Codex A PreToolUse hook for the protected paths, and a Stop hook for the checks
.gemini/settings.json Gemini CLI The policy file below in policyPaths, an AfterAgent hook for the checks, and AGENTS.md among the files it reads
.gemini/termo-harness.toml Gemini CLI The path and command rules, as a policy
.github/hooks/termo-harness.json Copilot CLI A preToolUse hook for the path and command rules, and an agentStop hook for the checks
.termo/guard.sh Codex and Copilot CLI The path rules (and for Copilot CLI the command rules), as their hooks check them
.termo/checks.sh Every agent The checks, as the hooks run them

Termo only touches what it wrote. In a settings file you already had, your own entries stay as they are, and in AGENTS.md and CLAUDE.md Termo only writes between its two comments:


…

Whatever you change between those comments is overwritten the next time you apply. The rest of the file is yours.

Commit these files with the rest of the repository: that's what makes the rules hold for everyone.

Which agent enforces what

Not every agent can enforce every kind of rule from its project files. The i button on each rule shows what each agent does with it:

  • Enforced: the agent itself refuses, asks or stops.
  • Only as an instruction: the agent reads it in AGENTS.md and is expected to follow it.
  • No effect: the rule doesn't change anything for that agent.
Rule Claude Code Codex Gemini CLI Copilot CLI Grok
Protected paths Enforced Enforced Enforced Enforced Enforced
Forbidden commands Enforced Enforced Enforced Enforced Enforced
Commands that ask first Enforced Enforced Enforced Enforced Enforced
Allowed commands Enforced Enforced Enforced No effect Enforced
"Done" checks Enforced Enforced Enforced Enforced Enforced

Codex, Gemini CLI, Copilot CLI and Grok only read a repository's files once you trust the repository in each of them. Codex also asks you to review each new hook with /hooks. Gemini CLI reads the policy file from the folder it starts in, so open it at the repository's root.

Where a protected path is enforced, it covers the agent's own tools for reading and editing files. Codex and Copilot CLI also look at the shell commands their agents run: one that names a path that can't be read is refused, and so is one that writes and names a path that can't be edited. For Claude Code, Gemini CLI and Grok a shell command such as cat .env isn't covered: forbid it as a command too if it matters.

Try a command

Type a command under Tester to see what each agent would do with it under the rules, and which rule decides it.

Rules that were already there

Existing rules lists the permissions in .claude/settings.json that Termo didn't write. Click Adopt to move one into the harness: when you apply, Termo replaces your entry with its own, and from then on the rule is also written for the other agents. Entries Termo doesn't write, such as web access rules, stay as they are.

Instruction files

Instruction files lists the files the agents already read in the repository: AGENTS.md, CLAUDE.md, GEMINI.md and .github/copilot-instructions.md. Click Edit to open one whole in the panel, and Save (or Ctrl+S) when you're done.

Shortcut

Action Windows and Linux macOS
Agent Harness panel Ctrl+Shift+W ⌘⇧W

It can be changed in Preferences → Shortcuts.