Taras Lysyi

US pet-telehealth platform · 2026

Agent harness for AI coding

The team wrote code with Claude Code, Codex and pi, but had no repo-level harness: no shared rules, so agents copied the nearest file and reviewers repeated the same remarks. I built one in the repo: what the agents read, what they can call, and what checks their work.

Result

The team now writes code with agents inside the harness I built. Style and convention issues are caught by checks before a PR exists, so human review is about behavior. Every rule change is backed by replayed tickets.

Claude CodeCodexpi
What every agent on the team works with: the rules it reads, the tools it can call, the guard on risky commands, and the checks it must pass before review.

Key decision

Test rules like code. Replayed tickets show whether each rule still helps. When a new model comes out, one rerun finds the rules it no longer needs.

What I did

RulesOne set of rules for three agents

Claude Code, Codex and pi read the same rules from the repo. Anything task-specific lives in skills, loaded only when needed.

ReasonsRules that give the reason

A rule that explains why fits the next case. A copied example spreads whatever is in that file.

Weak rule: Write tests like orders_test.go.

Better rule: A table test is a spec: one case per contract branch, named “returns X when Y”.

ToolsTools to see the running system

Agents read errors, logs, endpoint responses and data from the running system. The database is read-only and personal data is masked.

$ go test ./invoices/...
✗ TestListInvoices  fails on this branch
↻ re-run on base commit: fails there too
→ old failure, not this change
ChecksChecks made from review comments

Comments reviewers kept repeating became 8 checks that run before the agent says done, in pre-commit and in CI.

✗ errors  invoices/service.go:42
  returns a bare error
  fix: fmt.Errorf("list invoices: %w", err)
Show the command guard and the replay
GuardA guard on risky commands

Risky commands stop and go to a human; safe ones run as usual. The guard is a tripwire; branch protection and read-only roles do the locking.

$ git push --force origin main
✋ guard: protected branch. Ask a human.
  • push to main
  • force push
  • prod DB write
  • secrets
  • PR merge
  • guard edits
ReplayA rule change, replayed on the same tasks

A rule changes only when the same miss shows up on two or more tasks.

TaskWithoutWith
T-101 · invoice filter✗ copied old pattern✓ pass
T-102 · pagination fix✓ pass✓ pass
T-103 · new endpoint✗ bare error✓ pass
T-104 · migration✓ pass✓ pass

Why the agents needed context

  • Archived codeReference only

  • Older servicesOutdated patterns

  • PrototypesDon’t copy

  • Reviewed codeFollow this

An agent copies the file it is in, or the one next to it.

Hardest part

Agents lock onto examples

An example in the agent’s context becomes its likely next step, so the agent copies it, including where it doesn’t fit. A rule with no example, like “write good tests”, is too vague to act on. I had to write down the thinking behind each rule: why the team does it and when it applies. “A table test is a spec: one case per contract branch” works on code the agent has never seen. “Write tests like orders_test.go” only works on code that looks like orders_test.go.

Back to all work