feat: add skills evals and optimization framework#33
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: Add skills evals and optimization framework
Build a repo-native eval system for
agent-ttythat measures skill trigger accuracy, execution quality, and dogfood evidence completeness across Claude Code and Codex providers.What changed
43 files, 21 commits implementing:
evals/lib/): Strict Zod schemas, deterministic scoring with negation-context awareness, anti-pattern detection (7 rules), skill-condition matrix (none/self-load/preloaded/stale), CLI harness, artifact storage, bundle scoring, JSON+Markdown reportingevals/providers/): Base interface, stub/fixture/recording providers, Claude Code adapter (claude --print), Codex adapter (codex exec)evals/prompt/): 24 cases (8 agent-tty trigger, 6 dogfood-tui trigger, 6 should-not-trigger, 4 anti-pattern) + runnerevals/execution/): 10 fixture-based cases (hello-prompt, resize-demo, alt-screen-demo, color-grid, unicode-grid, scrollback-demo, crash-recovery, export-proof, run-command, doctor-gated) + verifier dispatch + runnerevals/dogfood/): 6 QA cases (exploratory-qa, release-readiness, rendering-bug-repro, navigation-focus-repro, resize-regression, evidence-completeness) + scorers + runnerevals/run.ts): CLI with--provider,--lane,--condition,--case,--dry-run,--json,--verboseevals/README.md): Architecture, quick start, case inventory, scoring, comparison metrics, CI integrationDogfooding with real Claude Code 2.1.107
7 rounds of fixes discovered by actually running evals against Claude Code:
~/.local/binnot in PATH)Real Claude Code eval results
Lane A (prompt/routing) — 5 cases × 4 conditions:
Skill lift metrics: Realized +40pp, Oracle +80pp, Stale harm -100pp
Lane B (execution) — 3 cases, preloaded:
Lane C (dogfood) — 1 case, preloaded:
agent-ttycommands before 180s timeoutValidation
npx tsc --noEmitnpx eslint "evals/**/*.ts" --max-warnings=0npx prettier --check "evals/**/*.ts"npm run lintnpm run format:checknpm test(634 tests, 62 files)How to run
📋 Implementation Plan
agent-tty skills evals and optimization — implementation plan
1. Goal
Build a repo-native eval program for
agent-ttythat answers four questions with hard data:agent-ttyordogfood-tuiload, and does the agent actually load them?claudeCLI) and Codex (codexCLI) — behave with the bootstrap skills, canonical skills, andagent-ttycommand surface?The end state is not a single benchmark number. The end state is a repeatable measurement system that can show:
2. Non-goals
test/fixtures/apps/.3. Verified repo assets to reuse
Use the existing repo as the foundation instead of building bespoke infrastructure:
skills/agent-tty/SKILL.mdskill-data/agent-tty/SKILL.mdskill-data/dogfood-tui/SKILL.mdtest/helpers.ts,test/e2e/helpers.tstest/fixtures/apps/*src/tools/review-bundle.ts,src/tools/validate-bundle.tssrc/host/eventLog.ts,src/host/replay.tssrc/storage/artifactManifest.tsdesign/20260319_agent-tty-v1/05-dogfooding-and-validation.mdThese assets already support:
AGENT_TTY_HOMEsetups,Plan principle: build a thin eval layer on top of those primitives.
Research basis that should shape implementation choices
4. Design principles
agent-ttyanddogfood-tui.5. Target architecture
Implement three eval lanes on top of shared providers, shared case schemas, shared scoring, and shared reporting.
Lane A — Prompt / routing evals
Purpose:
agent-tty.dogfood-tuiwhen the task is explicitly QA / dogfooding / release-readiness oriented.What this lane scores:
none,agent-tty,dogfood-tui),This lane should ship first because it is cheap, fast, and directly comparable to agent-browser PR #1225.
Lane B — Closed-loop execution evals
Purpose:
agent-ttysessions against deterministic fixtures.What this lane scores:
This is the core lane for making real compatibility claims about Claude Code and Codex with
agent-tty.Lane C — Dogfood / evidence evals
Purpose:
dogfood-tuiskill improves exploratory testing, issue reproduction, evidence capture, and reviewability.What this lane scores:
This lane is the differentiator for
agent-tty: the system should not only solve terminal tasks, it should leave behind reviewable proof.6. Comparison framework and experimental conditions
Every eligible case should run under the same prompt, environment, provider, model, and budget across these conditions:
agent-tty skills get ...Use the repo’s current skill split to implement those conditions:
skills/agent-tty/SKILL.mdskill-data/agent-tty/SKILL.mdskill-data/dogfood-tui/SKILL.mdDerived comparison metrics
Compute and publish at least these deltas:
success(B) - success(A)success(C) - success(A)success(C) - success(B)success(D) - success(C)% of A passes that become B/C failures% of A failures that become B/C passes(success(B) - success(A)) / max(ε, success(C) - success(A))Report each metric by:
claude,codex),agent-tty,dogfood-tui).7. Provider support plan — Claude Code and Codex are first-class
Provider requirements
Create a provider abstraction that both CLIs implement:
Each adapter must define:
Claude Code (
claudeCLI)Deliverables:
Codex (
codexCLI)Deliverables:
Provider operating modes
Support two provider modes:
Plan-only mode
Agent-run mode
Provider acceptance policy
If one provider temporarily loses stable headless support, keep its schema tests and parser tests green, mark execution-lane support as degraded, and block broad compatibility claims until restored.
8. Proposed repository layout
Create a dedicated
evals/tree, but keep it thin and wired to existing helpers and artifacts.Shared-helper extraction step
Do not make the eval harness depend directly on
test/code forever. In Phase 0, extract the reusable parts oftest/helpers.tsandtest/e2e/helpers.tsinto a shared helper that both tests and evals can consume, such as:evals/lib/cliHarness.ts, and/orThat extraction should preserve current tests while avoiding duplicate logic.
9. Core schemas and data model
Use strict Zod-backed schemas and fail-fast assertions.
Prompt case schema
Execution case schema
Dogfood case schema
Result schema
Every run should emit a strict result object with at least:
10. Metrics specification
Routing and selection metrics
agent-ttybeforedogfood-tuiwhen required)Workflow metrics
Check partial-order invariants rather than exact step-by-step traces.
For
agent-tty, track whether the run:doctor --jsonbefore screenshot/recording flows,runfor setup instead of long simulated typing,waitinstead of blind sleeps,snapshotwhen semantic inspection mattered,screenshot/record exportwhen proof was required,For
dogfood-tui, also score whether the run produced:Outcome metrics
Efficiency metrics
agent-ttycommand countsleep,tmux,screen, external screenshots, missing--json, orphaned sessions)Auditability metrics
11. Initial case inventory
Lane A — Prompt / routing MVP (target: 24 cases)
agent-ttyshould-trigger promptsdogfood-tuishould-trigger promptssleeptmux/screen--jsonin automation contextsLane B — Execution MVP (target: 10 cases)
hello-prompt: launch, input, wait, snapshot, exitresize-demo: resize and verify layout recoveryalt-screen-demo: enter/exit alt-screen cleanlycolor-grid: capture screenshot and verify artifact generationunicode-grid: verify semantic snapshot and rendering evidencescrollback-demo: verify scrollback visibility and evidence captureexport-proof: cast + WebM export flowcrash-recovery: inspect/reconcile/destroy after failurerun-command: setup viarun, not simulated typingdoctor-gated-renderer: ensure screenshot/record flows respect prerequisite checksLane C — Dogfood MVP (target: 4–6 cases)
12. Case authoring rules
Every case author must follow these rules:
agent-ttycapabilities.13. Workstreams for a team of agents
Workstream A — Provider adapters and runtime capture
Owner: Agent 1
Build:
Dependencies:
Deliverables:
Workstream B — Prompt/routing harness and case authoring
Owner: Agent 2
Build:
Dependencies:
Deliverables:
evals/prompt/*,Workstream C — Execution harness and deterministic verifiers
Owner: Agent 3
Build:
Dependencies:
Deliverables:
evals/execution/*,Workstream D — Dogfood bundle scoring and reviewability
Owner: Agent 4
Build:
review-bundleandvalidate-bundle,Dependencies:
Deliverables:
evals/dogfood/*,Workstream E — Metrics, reporting, CI, and trend storage
Owner: Agent 5
Build:
Dependencies:
Deliverables:
Workstream F — Skill optimization loop and holdout governance
Owner: Agent 6
Build:
Dependencies:
Deliverables:
14. Phased rollout
Phase 0 — Foundations and shared plumbing
Scope:
test/helpers.ts/test/e2e/helpers.ts,Tasks:
Acceptance criteria:
Quality gate / dogfood:
AGENT_TTY_HOME.hello-promptsession.review-bundleandvalidate-bundle.Phase 1 — Prompt / routing MVP
Scope:
Tasks:
claudeplan-only adapter.codexplan-only adapter.Acceptance criteria:
Quality gate / dogfood:
agent-tty, capture screenshots of the summaries, and export WebM for review.Phase 2 — Execution MVP
Scope:
Tasks:
Acceptance criteria:
Quality gate / dogfood:
hello-prompt,resize-demo, andalt-screen-demoon both Claude Code and Codex..cast, and WebM.review-bundleandvalidate-bundleon each bundle.Phase 3 — Dogfood / evidence suite
Scope:
dogfood-tuiimproves QA workflows,Tasks:
Acceptance criteria:
Quality gate / dogfood:
Phase 4 — Optimization loop, holdouts, and governance
Scope:
Tasks:
Acceptance criteria:
Quality gate / dogfood:
15. CI and scheduling strategy
Split the program into tiers so cost and stability are manageable.
PR lane
Run on every PR when possible:
Nightly lane
Run nightly:
Weekly / release lane
Run weekly and before releases:
CI degradation rules
16. Dogfooding and self-verification protocol
Because this is a CLI project, dogfooding must be explicit and artifact-backed.
Setup instructions
Preferred setup:
Fallback setup:
Provider prerequisites:
claudeCLI) and ensure auth/config is valid,codexCLI) and ensure auth/config is valid,Runtime rules:
AGENT_TTY_HOME,doctor --jsonbefore screenshot/recording-heavy flows,run+waitover blind sleeps,Required self-verification artifacts
Every meaningful phase gate must produce:
.cast,review-bundle,validate-bundleresult with the appropriate profile.Reviewer workflow
For each milestone bundle:
17. Risks and mitigations
18. Exit criteria
The implementation is complete enough to declare the program operational when all of the following are true:
19. Immediate next actions
Generated with
mux• Model:anthropic:claude-opus-4-6• Thinking:xhigh