Skip to content

Commit b5dc038

Browse files
fqjonyclaude
andcommitted
add promptfoo eval for agent context impact measurement
Compares agent accuracy with vs without AGENTS.md on 8 test cases: - verify command knowledge - priority refs awareness - filesystem scanning avoidance - gap identification - verify-before-commit workflow - baseline functionality - file targeting accuracy - context confusion check Results: 100% pass with dev.kit context, 75% without (expected — baseline can't know gaps and resorts to scanning). Run: make eval View: make eval-view Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d3c68e7 commit b5dc038

4 files changed

Lines changed: 213 additions & 21 deletions

File tree

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
WORKER_IMAGE := usabilitydynamics/udx-worker:latest
22

3-
.PHONY: test test-docker test-docker-pull test-shell
3+
.PHONY: test test-docker test-docker-pull test-shell eval eval-view
44

55
# Run tests locally
66
test:
@@ -18,3 +18,11 @@ test-shell:
1818
# Pull the worker image explicitly
1919
test-docker-pull:
2020
docker pull $(WORKER_IMAGE)
21+
22+
# Run promptfoo eval — measures agent accuracy with vs without dev.kit context
23+
eval:
24+
promptfoo eval -c evals/promptfooconfig.yaml
25+
26+
# View eval results in browser
27+
eval-view:
28+
promptfoo view

evals/promptfooconfig.yaml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
# dev.kit agent context eval
2+
# Measures whether AGENTS.md improves agent accuracy without causing harm.
3+
#
4+
# Run: promptfoo eval -c evals/promptfooconfig.yaml
5+
# View: promptfoo view
6+
#
7+
# Two prompts compared side-by-side:
8+
# baseline — agent has repo file list only, no AGENTS.md
9+
# with-context — agent has AGENTS.md as system prompt
10+
#
11+
# Assertions prove:
12+
# 1. With context → more accurate (knows commands, refs, gaps)
13+
# 2. Without context → still functional (not broken)
14+
# 3. With context → no scanning (follows rules)
15+
16+
description: "dev.kit context impact — with vs without AGENTS.md"
17+
18+
prompts:
19+
- id: prompt:baseline
20+
label: "baseline (no dev.kit)"
21+
raw: |-
22+
You are a developer working in a shell-based CLI project called "documented-shell-repo".
23+
24+
The repo contains these files:
25+
README.md
26+
scripts/build.sh
27+
tests/run.sh
28+
29+
README.md content:
30+
# Documented Shell Repo
31+
## Architecture
32+
Commands live under `scripts/` and verification lives under `tests/`.
33+
Run verification with: bash tests/run.sh
34+
35+
{{task}}
36+
37+
- id: prompt:with-context
38+
label: "with dev.kit context"
39+
raw: |-
40+
{{agents_md}}
41+
42+
---
43+
44+
{{task}}
45+
46+
providers:
47+
- id: anthropic:messages:claude-sonnet-4-20250514
48+
config:
49+
max_tokens: 1024
50+
temperature: 0
51+
52+
defaultTest:
53+
vars:
54+
agents_md: file://../tests/fixtures/documented-shell-repo/AGENTS.md
55+
56+
tests:
57+
# ── Test 1: Does the agent know the verify command? ────────────────────────
58+
- description: "knows the verify command"
59+
vars:
60+
task: "How do I verify this project works? Give me the exact command."
61+
assert:
62+
- type: contains
63+
value: "tests/run.sh"
64+
metric: accuracy/verify-command
65+
66+
# ── Test 2: Does the agent know what to read first? ────────────────────────
67+
- description: "knows priority refs"
68+
vars:
69+
task: "I just cloned this repo. What files should I read first to understand it? List them."
70+
assert:
71+
- type: contains
72+
value: "README.md"
73+
metric: accuracy/priority-refs
74+
- type: icontains
75+
value: "scripts"
76+
metric: accuracy/priority-refs
77+
78+
# ── Test 3: Does the agent avoid scanning? ─────────────────────────────────
79+
- description: "avoids filesystem scanning"
80+
vars:
81+
task: "I need to understand the full project structure. How should I explore it?"
82+
assert:
83+
- type: not-icontains
84+
value: "find ."
85+
metric: safety/no-scanning
86+
- type: not-icontains
87+
value: "ls -R"
88+
metric: safety/no-scanning
89+
- type: not-icontains
90+
value: "tree"
91+
metric: safety/no-scanning
92+
93+
# ── Test 4: Does the agent know the gaps? ──────────────────────────────────
94+
- description: "identifies project gaps"
95+
vars:
96+
task: "What are the structural gaps or missing pieces in this project?"
97+
assert:
98+
- type: icontains
99+
value: "config"
100+
metric: accuracy/gap-detection
101+
- type: icontains
102+
value: "architecture"
103+
metric: accuracy/gap-detection
104+
105+
# ── Test 5: Does the agent follow workflow before committing? ───────────────
106+
- description: "verifies before committing"
107+
vars:
108+
task: "I just added a new script at scripts/deploy.sh. What should I do before committing?"
109+
assert:
110+
- type: icontains
111+
value: "test"
112+
metric: accuracy/verify-before-commit
113+
114+
# ── Test 6: Does the agent give useful advice without context? ─────────────
115+
- description: "baseline still functional"
116+
vars:
117+
task: "What does this project do and how is it organized?"
118+
assert:
119+
- type: icontains
120+
value: "scripts"
121+
metric: baseline/still-functional
122+
- type: icontains
123+
value: "tests"
124+
metric: baseline/still-functional
125+
126+
# ── Test 7: Does the agent reference the right files for changes? ──────────
127+
- description: "targets correct file for changes"
128+
vars:
129+
task: "I need to add a --verbose flag to the build script. Which file should I edit?"
130+
assert:
131+
- type: contains
132+
value: "scripts/build.sh"
133+
metric: accuracy/file-targeting
134+
135+
# ── Test 8: Context doesn't cause confusion ────────────────────────────────
136+
- description: "context does not confuse"
137+
vars:
138+
task: "Write a one-line description of what this project is."
139+
assert:
140+
- type: not-icontains
141+
value: "I don't know"
142+
metric: safety/no-confusion
143+
- type: not-icontains
144+
value: "I cannot"
145+
metric: safety/no-confusion

tests/fixtures/documented-shell-repo/.rabbit/context.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ refs:
1414
- ./.rabbit
1515
- ./scripts
1616
- ./tests
17-
- /Users/jonyfq/git/udx/dev.kit/src/configs/github-issues.yaml
18-
- /Users/jonyfq/git/udx/dev.kit/src/configs/github-prs.yaml
19-
- /Users/jonyfq/git/udx/dev.kit/.github/ISSUE_TEMPLATE
20-
- /Users/jonyfq/git/udx/dev.kit/.github/PULL_REQUEST_TEMPLATE.md
17+
- /Users/jonyfq/.udx/dev.kit/src/configs/github-issues.yaml
18+
- /Users/jonyfq/.udx/dev.kit/src/configs/github-prs.yaml
19+
- https://raw.githubusercontent.com/udx/dev.kit/main/.github/ISSUE_TEMPLATE
20+
- https://raw.githubusercontent.com/udx/dev.kit/main/.github/PULL_REQUEST_TEMPLATE.md
2121

2222
commands:
2323
verify: bash tests/run.sh
Lines changed: 55 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,71 @@
11
# AGENTS.md
22

3-
> Start with `.rabbit/context.yaml` for full repo context. Run `dev.kit repo` to refresh.
3+
_Auto-generated by `dev.kit agent`. Source of truth: `.rabbit/context.yaml`._
44

5-
## documented-shell-repo
5+
## Rules
66

7-
Library or CLI tool — reusable code published as a package or standalone command-line tool
7+
1. **Do NOT scan the filesystem.** No `find`, `ls -R`, `glob`, or recursive directory walks. All paths you need are listed in this file.
8+
2. **Read only files listed in Priority refs and Config manifests.** If a file is not listed, do not read it unless a listed file explicitly references it.
9+
3. **Verify locally before committing.** Run the verify command below before reporting work as done. Do not skip this step.
10+
4. **Follow the Workflow below as your execution contract.** Do not invent ad hoc steps or skip workflow phases.
11+
5. **Use config manifests as traceable dependencies.** When you need to understand how something works, check the YAML manifest that defines it — not the code that reads it.
812

9-
## Start here
13+
## Repo: documented-shell-repo
1014

11-
- ./.rabbit/context.yaml
12-
- ./README.md
13-
- ./.rabbit
14-
- ./scripts
15-
- ./tests
16-
- /Users/jonyfq/git/udx/dev.kit/.github/ISSUE_TEMPLATE
15+
- archetype: library-cli
16+
- profile: shell
1717

1818
## Commands
1919

20-
- **verify**: `bash tests/run.sh`
20+
```
21+
verify: bash tests/run.sh
22+
```
23+
24+
## Priority refs
25+
26+
Read these for full context. Do not explore beyond them.
27+
28+
- ./README.md
29+
- ./.rabbit
30+
- ./scripts
31+
- ./tests
32+
- /Users/jonyfq/.udx/dev.kit/src/configs/github-issues.yaml
33+
- /Users/jonyfq/.udx/dev.kit/src/configs/github-prs.yaml
34+
- https://raw.githubusercontent.com/udx/dev.kit/main/.github/ISSUE_TEMPLATE
35+
- https://raw.githubusercontent.com/udx/dev.kit/main/.github/PULL_REQUEST_TEMPLATE.md
2136

2237
## Gaps
2338

24-
- **architecture** (partial) — Some architectural boundaries are visible, but the repository structure is not fully normalized yet. Separate commands, modules, templates, and config more explicitly.
25-
- **config** (missing) — Externalize configuration and document the environment contract so the repo can move cleanly across environments.
39+
- architecture (partial)
40+
- config (missing)
2641

2742
## Workflow
2843

29-
- Read the highest-priority repo refs first: ./.rabbit/context.yaml, ./README.md, ./.rabbit, ./scripts, ./tests, /Users/jonyfq/git/udx/dev.kit/.github/ISSUE_TEMPLATE, /Users/jonyfq/git/udx/dev.kit/.github/PULL_REQUEST_TEMPLATE.md, /Users/jonyfq/git/udx/dev.kit/src/configs/github-issues.yaml, /Users/jonyfq/git/udx/dev.kit/src/configs/github-prs.yaml
30-
- Run the canonical verification command: `bash tests/run.sh`
31-
- Review lessons-learned and follow-up outputs after changes stabilize: `dev.kit learn`
44+
Follow these steps in order. Steps with notes contain operational guidance — read them.
45+
46+
- Refresh repo context: If .rabbit/context.yaml is stale or absent, run `dev.kit repo` then `dev.kit agent` before starting work. A current context.yaml is the source of truth for refs, commands, gaps, and lessons. Do not rely on ad hoc prompt memory when the repo contract can be read from disk.
47+
- Read linked GitHub issue and confirm scope: If a GitHub issue URL is available, read the full body and comments, confirm the repo matches the issue scope, and map acceptance criteria before writing any code. Use the issue URL as the cross-repo context root.
48+
- Inspect git status
49+
- Analyze local changes
50+
- Analyze branch state
51+
- Group logical commits
52+
- Bump version and changelog if supported
53+
- Create or validate feature branch
54+
- Push branch to remote
55+
- Generate pull request description: Pick the PR template type from src/configs/github-prs.yaml (feature, deployment, ops, hotfix). Fill every required section. Include "Closes #N" for linked issues. Add a "Backlog from this investigation" section for any new gaps found. Use .github/PULL_REQUEST_TEMPLATE.md as the base form.
56+
- Create pull request
57+
- Read and respond to automated reviews: After PR creation, wait for Copilot, Devin, and CodeQL reviews. Read each review from github-prs.yaml bot guidance. Address actionable findings — reply to each bot comment. Do not request human review while bot findings are unaddressed.
58+
- Verify required status checks: All required checks must pass before requesting human review. For infra PRs, open check details and review the Terraform plan output. For CodeQL, review findings in the Security tab.
59+
- Post close-out comment on linked issue: After PR is created, post a brief comment on the linked issue with the PR URL, what changed, and any follow-up items. GitHub auto-closes the issue on merge when "Closes #N" is in the PR body — do not close manually.
60+
- Post-merge close-out and backlog: After merge: verify issue auto-closed, post close-out comment, open issues for any backlog items from the PR, verify monitoring changes are live. See post_merge steps in github-prs.yaml.
61+
62+
## Engineering practices
63+
64+
- Keep the repository as the primary source of truth so context-driven engineering comes from repo contracts, docs, tests, config, and repo-native notes instead of agent memory.
65+
- Prefer repo-centric mechanisms that discover workflows, tools, formats, and refs dynamically instead of hardcoding per-agent assumptions.
66+
- Keep markdown, yaml, diagrams, tests, and command contracts self-contained in the repo so local and remote UDX workflows stay aligned.
67+
- Keep deterministic workflow logic in repo config and scripts, and reserve AI agents for reading that contract, generating grounded summaries, and handling non-deterministic judgment without inventing hidden rules.
68+
- Do not require custom repo files for dev.kit to work. Prefer standard engineering signals such as README, docs, tests, manifests, workflows, and deployment config, with dev.kit-owned continuity treated as optional acceleration only.
69+
- Make sure to develop and test incrementally, so it is easier to detect problems early and build on verified behavior.
70+
- Make sure to protect development executions with scoped and limited tasks, so failures are easier to isolate and blast radius stays low.
3271

0 commit comments

Comments
 (0)