testagent AGENTS.md

Project instructions for Testagent, a fake command-line coding agent that produces scripted terminal and protocol output without calling a language model.

In plain words
What is it for?
Use it to test tools that drive coding agents, including terminal sessions, hooks, MCP communication, command dispatch, and streamed output.
Why use it?
Deterministic output makes orchestration tests repeatable, so results do not change because of model responses.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/paultyng/testagent/agents-md
Clone the repo
git clone --depth 1 https://github.com/paultyng/testagent

Made for: Codex, OpenCode.

Per session 2,165 This file is loaded in full into every session.
When invoked 2,165 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.02165 $0.02165
Opus 5 $0.01082 $0.01082
Sonnet 5 $0.00433 $0.00433
Haiku 4.5 $0.00216 $0.00216

Measured 2d ago against content hash 64a998e412fe, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

testagent AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 94 lines

How it starts

The opening of the file, as written. The whole thing — 94 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

Context for AI agents working on this repo. (Cursor, Claude Code, and others read this file.)

What is testagent?

A fake CLI agent for testing orchestration tooling that drives real coding agents (Claude Code, Codex, Gemini, GitHub Copilot CLI, etc.). Runs as an interactive PTY process; emits the same kinds of terminal artifacts (boxed tool-use blocks, streaming text, in-place updates) and the same protocol traffic (HTTP hooks, MCP JSON-RPC) as a real agent — without calling any LLM.

The product framing is deterministic output for tests, not "no LLM" as a virtue. Wiring a local LLM into a test harness is a valid choice for some workflows; testagent is explicitly not that. Every assertion-relevant byte (slash dispatch, hook payloads, MCP frames, stream-json shapes) is scripted by the user, not generated, so tests stay stable across runs.

v1 ships a drop-in fake for Claude Code: argv compatibility for the flags orchestrators commonly emit, HTTP and command hooks (UserPromptSubmit / PreToolUse / PostToolUse / Stop / SessionStart / SessionEnd / PreCompact / PostCompact), an MCP HTTP client that handshakes and dispatches tools/call, --print --output-format stream-json for non-interactive callers, a slash-command grammar for driving UI primitives interactively (including /clear and /compact which fire the corresponding hook lifecycles without restarting the process), and lipgloss-rendered plausible-shape output.

Future phases

Phase What
3+ Vendor-neutral refactor; per-agent-type subcommands + packages (see Future conventions); adapters for codex, gemini, copilot, plus tier-2 (aider, amp, q, goose, crush); conformance tests against captured real-vendor traffic
release goreleaser cross-OS binaries (darwin/linux/windows × amd64/arm64) + signed releases

Design conventions

  • Schema types are duplicated, not imported. Settings and MCPConfig mirror Claude Code's on-disk shapes and live in cmd/claude/settings.go (vendor-specific, not shared with the engine).
  • Stdlib-first; deps are deliberate. Each non-stdlib dep is justified in the commit message that adds it (mark3labs/mcp-go, lipgloss, bubbletea, bubbles, go-isatty, spf13/cobra).
  • Interactive vs non-interactive split. TTY stdin → bubbletea TUI (internal/engine/tui.go, inline rendering with native terminal scrollback, concurrent input during the thinking spinner). Piped stdin → scanner loop (internal/engine/scanner.go, line-based, inline rendering). --print/-p is a third path (cmd/claude/print.go, one-shot output formatter). The mattn/go-isatty check on os.Stdin is the TUI/scanner gate; e2e tests pipe stdin so they always hit the scanner path.
  • Conventional Commits. One commit per phase. Each phase's commit leaves the tree buildable and tested.
  • Tests: t.Parallel(), table-driven, real httptest/exec-driven integration over mocks where possible (see e2e_test.go). Fixtures in testdata/. Time-dependent helpers (anything that calls time.Sleep / time.NewTimer / tea.Tick outside real network IO) use testing/synctest so virtual time advances without real wall-clock waits — see internal/engine/{spinner,stream}_test.go for the pattern.
  • Debug output goes to stderr. Verbose / debug logging (e.g. --verbose hook traces) is plain text, one event per line, never ANSI-styled — it gets grepped and piped. Stdout stays reserved for stream-json frames and TUI rendering.
  • COMPATIBILITY.md is the contract artifact. It is the per-vendor source of record for which flags, slash commands, and REPL behaviors testagent implements, accepts, or omits. Update it when adding vendor-facing features. Use the update-compatibility skill (one skill, dispatches by vendor — claude, codex, or cursor) to refresh a section after an upstream release or when drift is detected. Per-vendor source URLs, probing recipes, and matrix templates live under the skill's vendors/<name>/ subdirectories. Cursor adapter is in early-stage planning — the template is ready; vendor wiring lands in a future phase.
  • RELEASING.md is the release-policy doc (semver scope, bump table, runbooks). When cutting a release, drive it through the publish-release skill, which executes RELEASING.md step by step and gates on the two human decisions (version number, release-notes copy).

Read the full file on GitHub · 94 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 94 lines · 2,165 tokens per session scan A 64a998e412fe

Subscribe to this mod's changes

testagent AGENTS.md is an instructions file published in the GitHub repository paultyng/testagent (7 stars, last pushed 1mo ago), licensed MIT. It adds 2,165 tokens to every session, about $0.0108 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.