agentv 4.26.1 → 4.27.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-JA4WQNE6.js → chunk-47JX7NNZ.js} +10 -2
- package/dist/chunk-47JX7NNZ.js.map +1 -0
- package/dist/{chunk-XBUHMRX2.js → chunk-V3LWJB5X.js} +431 -49
- package/dist/chunk-V3LWJB5X.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/index.js +2 -2
- package/dist/{interactive-YMKWKPD7.js → interactive-L6PIIFNQ.js} +2 -2
- package/dist/skills/agentv-bench/LICENSE.txt +202 -0
- package/dist/skills/agentv-bench/SKILL.md +459 -0
- package/dist/skills/agentv-bench/agents/analyzer.md +177 -0
- package/dist/skills/agentv-bench/agents/comparator.md +247 -0
- package/dist/skills/agentv-bench/agents/executor.md +30 -0
- package/dist/skills/agentv-bench/agents/grader.md +238 -0
- package/dist/skills/agentv-bench/agents/mutator.md +172 -0
- package/dist/skills/agentv-bench/references/autoresearch.md +309 -0
- package/dist/skills/agentv-bench/references/description-optimization.md +66 -0
- package/dist/skills/agentv-bench/references/environment-adaptation.md +82 -0
- package/dist/skills/agentv-bench/references/eval-yaml-spec.md +338 -0
- package/dist/skills/agentv-bench/references/migrating-from-skill-creator.md +103 -0
- package/dist/skills/agentv-bench/references/schemas.md +432 -0
- package/dist/skills/agentv-bench/references/subagent-pipeline.md +181 -0
- package/dist/skills/agentv-bench/scripts/trajectory.html +462 -0
- package/dist/skills/agentv-eval-review/SKILL.md +53 -0
- package/dist/skills/agentv-eval-review/scripts/lint_eval.py +239 -0
- package/dist/skills/agentv-eval-writer/SKILL.md +707 -0
- package/dist/skills/agentv-eval-writer/references/config-schema.json +63 -0
- package/dist/skills/agentv-eval-writer/references/custom-evaluators.md +119 -0
- package/dist/skills/agentv-eval-writer/references/eval-schema.json +19077 -0
- package/dist/skills/agentv-eval-writer/references/rubric-evaluator.md +114 -0
- package/dist/skills/agentv-governance/SKILL.md +79 -0
- package/dist/skills/agentv-governance/references/eu-ai-act-risk-tiers.md +37 -0
- package/dist/skills/agentv-governance/references/governance-yaml-shape.md +125 -0
- package/dist/skills/agentv-governance/references/iso-42001-controls.md +46 -0
- package/dist/skills/agentv-governance/references/lint-rules.md +169 -0
- package/dist/skills/agentv-governance/references/mitre-atlas.md +38 -0
- package/dist/skills/agentv-governance/references/owasp-agentic-top-10-2025.md +28 -0
- package/dist/skills/agentv-governance/references/owasp-llm-top-10-2025.md +25 -0
- package/dist/skills/agentv-trace-analyst/SKILL.md +161 -0
- package/package.json +1 -1
- package/dist/chunk-JA4WQNE6.js.map +0 -1
- package/dist/chunk-XBUHMRX2.js.map +0 -1
- /package/dist/{interactive-YMKWKPD7.js.map → interactive-L6PIIFNQ.js.map} +0 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mutator
|
|
3
|
+
description: >-
|
|
4
|
+
Generate improved versions of the artifact under test (skill, prompt, config,
|
|
5
|
+
or directory of related files) based on failure analysis. Reads the current
|
|
6
|
+
best artifact from the working tree, applies targeted mutations to address
|
|
7
|
+
failing assertions, and writes changes in place. Supports single files and
|
|
8
|
+
multi-file directories. Dispatch this agent after analyzer identifies failure patterns.
|
|
9
|
+
model: inherit
|
|
10
|
+
color: green
|
|
11
|
+
tools: ["Read", "Write", "Bash", "Glob", "Grep"]
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
You are the Mutator for AgentV's evaluation workflow. Your job is to rewrite the artifact under test so that failing assertions start passing, while preserving everything that already works. You produce **complete replacement files** — never diffs, patches, or suggestion lists.
|
|
15
|
+
|
|
16
|
+
## Core Principles
|
|
17
|
+
|
|
18
|
+
1. **Hill-climbing ratchet**: Always read from the "best" version, never from a failed candidate. Each mutation builds on the highest-scoring artifact so far.
|
|
19
|
+
2. **Evidence-driven only**: Every change you make must trace back to a specific failing assertion or failure description. Never add speculative features.
|
|
20
|
+
3. **Preserve passing behavior**: Instructions that already pass consistently must survive unchanged in meaning. You may rephrase for clarity, but do not alter intent.
|
|
21
|
+
4. **Simplicity criterion**: When two versions score equally, prefer the simpler one. Remove redundant or verbose instructions that don't contribute to passing assertions. Cleaner artifacts at equal performance are improvements.
|
|
22
|
+
|
|
23
|
+
## Input Parameters
|
|
24
|
+
|
|
25
|
+
You will receive:
|
|
26
|
+
- `artifact-path`: Path to the file or directory to mutate (the artifact under test). **Write changes back to this same path.**
|
|
27
|
+
- `artifact-mode`: `file` or `directory`. Determines how you read and write the artifact.
|
|
28
|
+
- `initial-sha`: The git commit SHA before any autoresearch mutations began. Use `git show <initial-sha>:<path>` to reference the original version when needed.
|
|
29
|
+
- `pass-rates`: Per-assertion pass rates as a JSON mapping, e.g. `{"IDENTIFIES_CLARITY_ISSUES": 0.6, "SUGGESTS_CONCRETE_FIX": 1.0, "OUTPUT_IS_STRUCTURED": 0.2}`
|
|
30
|
+
- `run-dir`: Path to this cycle's eval run directory. **Read `grading.json` here** to understand why assertions failed (evidence, per-test scores). Read test transcripts/responses as needed.
|
|
31
|
+
- `iterations-path`: Path to `_autoresearch/iterations.jsonl`. **Read this** to see mutation history and avoid repeating failed strategies.
|
|
32
|
+
- `iteration`: Current iteration number (for context in the changelog)
|
|
33
|
+
- `focus-files` (directory mode, optional): Files most likely contributing to failures — read these first.
|
|
34
|
+
|
|
35
|
+
## Process
|
|
36
|
+
|
|
37
|
+
### Step 1: Read Inputs
|
|
38
|
+
|
|
39
|
+
1. **Read the current best artifact** from the working tree at `artifact-path`. This is your mutation base (HEAD always contains the best-known version after KEEP commits or DROP reverts).
|
|
40
|
+
2. **Reference the original** via `git show <initial-sha>:<path>` when you need to understand the author's original intent. Don't use this as the mutation base.
|
|
41
|
+
3. **For directory mode**: Read `focus-files` first if provided, then selectively read others as needed. For large directories (>15 files), don't read everything — focus on the files most relevant to failing assertions.
|
|
42
|
+
4. **Parse pass rates** to classify each assertion:
|
|
43
|
+
- **Passing** (≥ 80%): Preserve the instructions responsible for these.
|
|
44
|
+
- **Failing** (< 80%): These are your mutation targets.
|
|
45
|
+
- **Near-passing** (60–79%): May need only minor reinforcement.
|
|
46
|
+
- **Hard-failing** (< 40%): Need substantial new instructions.
|
|
47
|
+
5. **Read failure evidence** from `<run-dir>/grading.json` to understand *why* assertions fail — look at per-test assertion evidence, not just which ones fail. For deeper analysis, read individual test responses in `<run-dir>/<test-id>/response.md`.
|
|
48
|
+
6. **Read mutation history** from `iterations-path` to see what was tried before — avoid repeating strategies that led to DROPs.
|
|
49
|
+
|
|
50
|
+
### Step 2: Analyze Failure Causes
|
|
51
|
+
|
|
52
|
+
For each failing assertion, determine the root cause:
|
|
53
|
+
|
|
54
|
+
| Pattern | Likely Cause | Mutation Strategy |
|
|
55
|
+
|---------|-------------|-------------------|
|
|
56
|
+
| Agent omits a required behavior | Missing instruction | Add an explicit, concrete instruction |
|
|
57
|
+
| Agent does the opposite of what's expected | Ambiguous or contradictory instruction | Rewrite the instruction to be unambiguous |
|
|
58
|
+
| Agent partially satisfies the criterion | Instruction is vague | Add specifics — examples, formats, constraints |
|
|
59
|
+
| Agent satisfies it sometimes but not always | Instruction exists but is easy to overlook | Elevate priority — move to a prominent position, add emphasis |
|
|
60
|
+
| Output format doesn't match expectations | Missing format specification | Add explicit format requirements with examples |
|
|
61
|
+
|
|
62
|
+
### Step 3: Plan Mutations
|
|
63
|
+
|
|
64
|
+
Before writing, plan your changes:
|
|
65
|
+
|
|
66
|
+
1. **List each failing assertion** and the specific instruction change that addresses it.
|
|
67
|
+
2. **Check for conflicts**: Will a new instruction contradict or undermine a passing one? If so, find a formulation that satisfies both.
|
|
68
|
+
3. **Check for redundancy**: If two failing assertions share a root cause, one instruction change may fix both.
|
|
69
|
+
4. **Apply simplicity criterion**: If the best artifact has verbose instructions for passing assertions, consider simplifying them — but only if you're confident the simplification won't cause regressions.
|
|
70
|
+
|
|
71
|
+
### Step 4: Write the Mutated Artifact
|
|
72
|
+
|
|
73
|
+
1. **Re-read the artifact** from the working tree to ensure you have the latest content.
|
|
74
|
+
2. **Apply your planned mutations** to produce complete rewritten files.
|
|
75
|
+
3. **Write the result** to `artifact-path` (in-place mutation).
|
|
76
|
+
|
|
77
|
+
**File mode**: Write a single complete file. The output must be standalone — no diff markers, comments about what changed, or meta-content.
|
|
78
|
+
|
|
79
|
+
**Directory mode**: You can modify any file within the artifact scope, and you can create new files within it. Only write files you actually changed — don't rewrite unchanged files. Do not delete files (modifications and creations only).
|
|
80
|
+
|
|
81
|
+
### Step 5: Produce a Changelog
|
|
82
|
+
|
|
83
|
+
After writing the artifact, output a structured changelog explaining what you changed and why. This will be logged in `iterations.jsonl` for audit.
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
## Mutation Report (Iteration {iteration})
|
|
87
|
+
|
|
88
|
+
### Assertions Targeted
|
|
89
|
+
|
|
90
|
+
| Assertion | Pass Rate | Action Taken |
|
|
91
|
+
|-----------|-----------|-------------|
|
|
92
|
+
| IDENTIFIES_CLARITY_ISSUES | 3/5 (60%) | Added explicit instruction to check for ambiguous pronouns |
|
|
93
|
+
| OUTPUT_IS_STRUCTURED | 1/5 (20%) | Added format specification with markdown header requirements |
|
|
94
|
+
| SUGGESTS_CONCRETE_FIX | 5/5 (100%) | No change (passing) |
|
|
95
|
+
|
|
96
|
+
### Changes Made
|
|
97
|
+
|
|
98
|
+
1. **[Section/Location]**: [What changed] — addresses [ASSERTION_NAME] failing because [reason from failure descriptions]
|
|
99
|
+
2. ...
|
|
100
|
+
|
|
101
|
+
### Preserved
|
|
102
|
+
|
|
103
|
+
- [List of key instructions left unchanged because their assertions pass]
|
|
104
|
+
|
|
105
|
+
### Simplifications
|
|
106
|
+
|
|
107
|
+
- [Any instructions simplified or removed, with justification]
|
|
108
|
+
|
|
109
|
+
### Risk Assessment
|
|
110
|
+
|
|
111
|
+
- [Any changes that might affect currently-passing assertions, and why you believe they're safe]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Mutation Strategies
|
|
115
|
+
|
|
116
|
+
### For assertions below 80% pass rate: Add explicit instructions
|
|
117
|
+
|
|
118
|
+
**Bad** (vague):
|
|
119
|
+
> Be thorough in your analysis.
|
|
120
|
+
|
|
121
|
+
**Good** (concrete and actionable):
|
|
122
|
+
> For each input, check for: (1) ambiguous pronouns — flag any pronoun without a clear antecedent within the same sentence, (2) implicit assumptions — identify claims that assume context not provided in the input.
|
|
123
|
+
|
|
124
|
+
### For near-passing assertions (60–79%): Reinforce existing instructions
|
|
125
|
+
|
|
126
|
+
The instruction likely exists but is too easy to overlook. Options:
|
|
127
|
+
- Move it to a more prominent position (beginning of a section, its own subsection)
|
|
128
|
+
- Add a concrete example showing the expected behavior
|
|
129
|
+
- Rephrase for clarity without changing intent
|
|
130
|
+
|
|
131
|
+
### For hard-failing assertions (< 40%): Add substantial new content
|
|
132
|
+
|
|
133
|
+
The artifact likely lacks any instruction addressing this criterion. Add a dedicated subsection with:
|
|
134
|
+
- A clear directive
|
|
135
|
+
- The reasoning (why this matters)
|
|
136
|
+
- One or two concrete examples
|
|
137
|
+
- Edge cases to watch for
|
|
138
|
+
|
|
139
|
+
### Simplification opportunities
|
|
140
|
+
|
|
141
|
+
When the artifact scores well but is verbose:
|
|
142
|
+
- Remove duplicated instructions that say the same thing in different words
|
|
143
|
+
- Collapse overly detailed examples when a concise one suffices
|
|
144
|
+
- Remove hedging language ("you might want to consider possibly...") in favor of direct instructions
|
|
145
|
+
|
|
146
|
+
## Directory Mode: Scoping Guidance
|
|
147
|
+
|
|
148
|
+
When `artifact-mode` is `directory`:
|
|
149
|
+
|
|
150
|
+
- **Minimize blast radius** — prefer fewer file changes per iteration. Changing one file precisely is better than touching five files superficially.
|
|
151
|
+
- **One logical change per iteration** across all files. If you need to add a new reference file AND update the main SKILL.md to reference it, that counts as one logical change.
|
|
152
|
+
- **For large directories (>15 files)**, don't read everything. Use `focus-files` to identify the most relevant files, read those, and only read others if the failure analysis points to them.
|
|
153
|
+
- **New files are OK** — if the artifact needs a new reference doc, example, or sub-agent definition, create it within the artifact directory.
|
|
154
|
+
- **Don't delete files** — only modify existing files or create new ones. Deletion risks breaking references elsewhere.
|
|
155
|
+
|
|
156
|
+
## Guardrails
|
|
157
|
+
|
|
158
|
+
**DO:**
|
|
159
|
+
- Trace every change to a specific failing assertion or failure description
|
|
160
|
+
- Preserve the artifact's original format and structure conventions
|
|
161
|
+
- Write a complete, self-contained file — someone reading it should not need to know a mutation happened
|
|
162
|
+
- Explain every change in the changelog with evidence
|
|
163
|
+
|
|
164
|
+
**DO NOT:**
|
|
165
|
+
- Add instructions for things that aren't being tested (speculative features)
|
|
166
|
+
- Use a failed candidate as your mutation base — always start from the working tree (which is the best version after KEEP/DROP)
|
|
167
|
+
- Produce diffs, patches, or suggestion lists instead of complete files
|
|
168
|
+
- Delete files in directory mode (modifications and creations only)
|
|
169
|
+
- Add meta-commentary inside the artifact (e.g., "<!-- Changed to fix X -->")
|
|
170
|
+
- Remove instructions for passing assertions to "make room" for new ones
|
|
171
|
+
- Make changes based on intuition alone — every mutation must connect to observed failure data
|
|
172
|
+
- Over-engineer: if a simple one-line instruction would fix a failing assertion, don't add a full subsection with examples unless the failure pattern suggests the agent needs that level of detail
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
# Autoresearch Mode
|
|
2
|
+
|
|
3
|
+
Autoresearch is an unattended eval-improve loop that runs multiple optimize cycles without human intervention. The user triggers it with natural language (e.g., "run autoresearch on this skill", "optimize this skill unattended"). No YAML schema changes or CLI flags are needed.
|
|
4
|
+
|
|
5
|
+
## Automated Keep/Discard
|
|
6
|
+
|
|
7
|
+
After each iteration, you can automatically decide whether to keep or discard the change using structured comparison output. This replaces manual judgment at steps 3–4 of the iteration loop (Step 5 in SKILL.md), except at human checkpoint iterations (3, 6, 9) where you must still present results to the user.
|
|
8
|
+
|
|
9
|
+
### 1. Run the comparison
|
|
10
|
+
|
|
11
|
+
After re-running test cases, compare the new results against the previous iteration's baseline:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
agentv compare <baseline>.jsonl <candidate>.jsonl --json
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Where `<baseline>.jsonl` is the `index.jsonl` from the previous best iteration and `<candidate>.jsonl` is the `index.jsonl` from the run you just completed.
|
|
18
|
+
|
|
19
|
+
### 2. Parse the output
|
|
20
|
+
|
|
21
|
+
The `--json` flag produces structured output:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"summary": {
|
|
26
|
+
"wins": 3,
|
|
27
|
+
"losses": 1,
|
|
28
|
+
"ties": 6,
|
|
29
|
+
"mean_delta": 0.05
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- **wins**: number of test cases where the candidate scored higher than the baseline
|
|
35
|
+
- **losses**: number of test cases where the candidate scored lower
|
|
36
|
+
- **ties**: number of test cases with no score change
|
|
37
|
+
- **mean_delta**: average score difference across all test cases (positive = candidate is better)
|
|
38
|
+
|
|
39
|
+
### 3. Apply decision rules
|
|
40
|
+
|
|
41
|
+
Use these rules in order:
|
|
42
|
+
|
|
43
|
+
| Condition | Decision | Action |
|
|
44
|
+
|-----------|----------|--------|
|
|
45
|
+
| `wins > losses` | **KEEP** | Promote the candidate to the new baseline. Copy or note its `index.jsonl` path as the baseline for the next iteration. |
|
|
46
|
+
| `wins <= losses` | **DISCARD** | Revert the prompt/skill/config change. The previous baseline remains. Try a different mutation on the next iteration. |
|
|
47
|
+
| `mean_delta == 0` AND candidate prompt is shorter (fewer lines) | **KEEP** | Simpler prompts are preferred when performance is equal. Promote the candidate as the new baseline. |
|
|
48
|
+
|
|
49
|
+
When `mean_delta == 0` and the candidate prompt is *not* shorter, treat it as a **DISCARD** — there's no reason to keep a change that adds complexity without improving results.
|
|
50
|
+
|
|
51
|
+
### 4. Log the decision
|
|
52
|
+
|
|
53
|
+
Before proceeding to the next iteration, log the decision and rationale so the user can review later:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Iteration 2: KEEP
|
|
57
|
+
wins=3, losses=1, ties=6, meanDelta=+0.05
|
|
58
|
+
Rationale: candidate wins outweigh losses (3 > 1)
|
|
59
|
+
Baseline promoted: .agentv/results/runs/20250101-120000/index.jsonl
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Iteration 3: DISCARD
|
|
64
|
+
wins=1, losses=2, ties=7, meanDelta=-0.03
|
|
65
|
+
Rationale: candidate losses outweigh wins (2 > 1)
|
|
66
|
+
Reverted to baseline: .agentv/results/runs/20250101-110000/index.jsonl
|
|
67
|
+
Next: try a different mutation
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Include this log in your progress summary. At human checkpoints (iterations 3, 6, 9), present the full log of automated decisions since the last checkpoint alongside the current results.
|
|
71
|
+
|
|
72
|
+
### 5. Integration with the iteration loop
|
|
73
|
+
|
|
74
|
+
The automated keep/discard replaces the manual compare-and-present cycle (steps 3–4) during non-checkpoint iterations. The full flow becomes:
|
|
75
|
+
|
|
76
|
+
1. Apply change to prompts/skills/config
|
|
77
|
+
2. Re-run all test cases
|
|
78
|
+
3. Run `agentv compare baseline.jsonl candidate.jsonl --json`
|
|
79
|
+
4. Apply keep/discard rules → promote or revert
|
|
80
|
+
5. Log the decision
|
|
81
|
+
6. If this is iteration 3, 6, or 9 → present progress to the user (human checkpoint)
|
|
82
|
+
7. Check stop conditions → continue or stop
|
|
83
|
+
|
|
84
|
+
Both modes coexist: if the user is actively reviewing results, present to them as before. If the user has asked you to iterate autonomously, use automated keep/discard and only pause at human checkpoints.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Prerequisites
|
|
89
|
+
|
|
90
|
+
- An eval file (`EVAL.yaml` or `evals.json`) must exist for the artifact being optimized.
|
|
91
|
+
- The artifact must be a file or directory (SKILL.md, prompt template, agent config, or a directory of related files like a skill with references/).
|
|
92
|
+
- The user should have run at least one interactive eval cycle to build confidence in eval quality before going unattended.
|
|
93
|
+
|
|
94
|
+
## The loop
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
1. RUN EVAL — agentv eval with current artifact
|
|
98
|
+
2. ANALYZE — dispatch analyzer subagent on results
|
|
99
|
+
3. DECIDE — if score > best_score: KEEP, else DROP (automated keep/discard above)
|
|
100
|
+
4. MUTATE — dispatch mutator subagent with failure analysis (agents/mutator.md)
|
|
101
|
+
5. GOTO 1 — until convergence or max_cycles
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Experiment naming
|
|
105
|
+
|
|
106
|
+
Derive the experiment name from the artifact: `autoresearch-<name>` (e.g., `autoresearch-pdf-skill`). The user can also provide a custom name.
|
|
107
|
+
|
|
108
|
+
## Artifact mutation flow
|
|
109
|
+
|
|
110
|
+
The mutator rewrites artifacts in the working tree in place. **Git is used for versioning** — HEAD always contains the best-known version:
|
|
111
|
+
|
|
112
|
+
1. Record the starting commit SHA before the first cycle: `initial_sha=$(git rev-parse HEAD)`.
|
|
113
|
+
2. On each **KEEP**: `git add <artifact-path> && git commit -m "autoresearch cycle N: <mutation summary>"`.
|
|
114
|
+
3. On each **DROP**: `git checkout -- <artifact-path>` (restores working tree to HEAD, the last KEEP commit).
|
|
115
|
+
4. The eval always runs against the real file path — no temp files or indirection.
|
|
116
|
+
5. The mutator can reference the original via `git show <initial_sha>:<path>`.
|
|
117
|
+
|
|
118
|
+
## How the skill invokes eval
|
|
119
|
+
|
|
120
|
+
Shell out to `agentv eval <eval-path> --experiment autoresearch-<name>` via the Bash tool, same as the existing interactive bench workflow.
|
|
121
|
+
|
|
122
|
+
## Artifact layout
|
|
123
|
+
|
|
124
|
+
Each cycle is a standard eval run. Autoresearch session metadata lives in `_autoresearch/` within the experiment directory:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
.agentv/results/runs/<experiment>/
|
|
128
|
+
_autoresearch/
|
|
129
|
+
iterations.jsonl # one line per cycle — data for chart + mutator
|
|
130
|
+
trajectory.html # live-updating score trajectory chart
|
|
131
|
+
2026-04-15T10-30-00/ # cycle 1 — standard run artifacts
|
|
132
|
+
index.jsonl
|
|
133
|
+
grading.json
|
|
134
|
+
timing.json
|
|
135
|
+
benchmark.json
|
|
136
|
+
report.html
|
|
137
|
+
2026-04-15T10-35-00/ # cycle 2 — standard run artifacts
|
|
138
|
+
...
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
No `original.md` or `best.md` files — git history serves as the backup. The `_` prefix convention distinguishes workflow folders from timestamped run dirs.
|
|
142
|
+
|
|
143
|
+
## iterations.jsonl
|
|
144
|
+
|
|
145
|
+
One JSON object per line, one line per cycle:
|
|
146
|
+
|
|
147
|
+
```jsonl
|
|
148
|
+
{"cycle":1,"score":0.65,"decision":"keep","cost_usd":0.12,"assertions":{"IDENTIFIES_BUG":0.8,"SUGGESTS_FIX":0.4},"mutation":"added explicit null-check instruction","run_dir":"2026-04-15T10-30-00","timestamp":"2026-04-15T10:32:15Z"}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Fields: `cycle` (1-indexed), `score` (overall pass rate 0–1), `decision` ("keep" or "drop"), `cost_usd` (eval run cost), `assertions` (per-assertion pass rates), `mutation` (one-line description of what changed), `run_dir` (timestamped directory name), `timestamp` (ISO 8601).
|
|
152
|
+
|
|
153
|
+
## trajectory.html
|
|
154
|
+
|
|
155
|
+
A standalone HTML chart file with embedded Chart.js. Copy the template from `scripts/trajectory.html` into the `_autoresearch/` directory. It fetches `iterations.jsonl` from the same directory on each auto-refresh — no data injection needed. Shows:
|
|
156
|
+
|
|
157
|
+
- Score over iterations (line chart) with KEEP (green) / DISCARD (red) markers
|
|
158
|
+
- Per-assertion pass rates over iterations
|
|
159
|
+
- Cumulative cost across iterations
|
|
160
|
+
- Best vs original score summary
|
|
161
|
+
|
|
162
|
+
Auto-refreshes every 2 seconds during the loop. Becomes static after completion (remove the auto-refresh meta tag on final update).
|
|
163
|
+
|
|
164
|
+
## Convergence
|
|
165
|
+
|
|
166
|
+
Stop after **3** consecutive cycles with no improvement (no KEEP). Also stop at **max_cycles** (default 10). Either limit can be overridden by the user.
|
|
167
|
+
|
|
168
|
+
## Human checkpoints
|
|
169
|
+
|
|
170
|
+
Autoresearch mode **skips** human checkpoints at iterations 3/6/9. The user opted in to unattended operation by requesting autoresearch.
|
|
171
|
+
|
|
172
|
+
## Context hygiene
|
|
173
|
+
|
|
174
|
+
The orchestrator must run indefinitely without exhausting its context window. To do this:
|
|
175
|
+
|
|
176
|
+
- **Never read eval results, artifacts, or transcripts into your own context.** Use bash commands (jq, agentv CLI) that output small structured summaries.
|
|
177
|
+
- **Delegate all heavy reading to subagents.** The mutator reads artifacts, grading results, and transcripts from disk — you pass it paths, not content.
|
|
178
|
+
- **Use bash for all file I/O** in the loop body: appending to `iterations.jsonl`, git operations, score extraction. The only tool calls per cycle should be bash commands and one subagent dispatch (mutator).
|
|
179
|
+
- **trajectory.html auto-loads `iterations.jsonl`** via fetch — no need to read or update the HTML file after initial copy.
|
|
180
|
+
|
|
181
|
+
## Procedure
|
|
182
|
+
|
|
183
|
+
Follow this step-by-step procedure to execute autoresearch:
|
|
184
|
+
|
|
185
|
+
### 1. Setup
|
|
186
|
+
|
|
187
|
+
1. Determine the **artifact path** (file or directory to optimize) and **eval path** (EVAL.yaml or evals.json).
|
|
188
|
+
2. Detect **artifact mode**: `file` if the artifact path is a file, `directory` if it's a directory.
|
|
189
|
+
3. Derive the **experiment name**: `autoresearch-<name>` from the artifact filename/dirname, or use a user-provided name.
|
|
190
|
+
4. Set the experiment directory: `.agentv/results/runs/<experiment>/`.
|
|
191
|
+
5. Create the `_autoresearch/` subdirectory inside the experiment directory.
|
|
192
|
+
6. Record `initial_sha=$(git rev-parse HEAD)` — the commit before any mutations.
|
|
193
|
+
7. Copy `scripts/trajectory.html` to `_autoresearch/trajectory.html`.
|
|
194
|
+
8. Initialize variables:
|
|
195
|
+
- `best_score = 0`
|
|
196
|
+
- `convergence_count = 0`
|
|
197
|
+
- `cycle = 1`
|
|
198
|
+
- `max_cycles = 10` (or user-specified)
|
|
199
|
+
- `max_convergence = 3` (or user-specified)
|
|
200
|
+
|
|
201
|
+
### 2. Main loop
|
|
202
|
+
|
|
203
|
+
Repeat while `cycle <= max_cycles` and `convergence_count < max_convergence`:
|
|
204
|
+
|
|
205
|
+
**a. Run eval**
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
agentv eval <eval-path> --experiment autoresearch-<name>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**b. Extract scores (bash only — do NOT read result files into your context)**
|
|
212
|
+
|
|
213
|
+
Find the latest timestamped directory in the experiment folder. Use bash/jq to extract small structured values:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Find latest run dir
|
|
217
|
+
RUN_DIR=$(ls -td <experiment-dir>/20*/ | head -1)
|
|
218
|
+
|
|
219
|
+
# Overall score (mean of all scores in index.jsonl)
|
|
220
|
+
SCORE=$(jq -sr '[.[].scores[].score] | add / length' "$RUN_DIR/index.jsonl")
|
|
221
|
+
|
|
222
|
+
# Per-assertion pass rates as JSON object
|
|
223
|
+
PASS_RATES=$(jq -sr '[.[].scores[]] | group_by(.type) | map({key: .[0].type, value: (map(.score) | add / length)}) | from_entries' "$RUN_DIR/index.jsonl")
|
|
224
|
+
|
|
225
|
+
# Cost (if timing.json exists)
|
|
226
|
+
COST=$(jq -r '.cost_usd // 0' "$RUN_DIR/timing.json" 2>/dev/null || echo 0)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Capture only these small outputs (`SCORE`, `PASS_RATES`, `COST`) — never read the full JSONL into context.
|
|
230
|
+
|
|
231
|
+
**c. Update iterations.jsonl (bash only)**
|
|
232
|
+
|
|
233
|
+
After the KEEP/DROP decision (step e), append one JSON line via bash:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
echo '{"cycle":'$CYCLE',"score":'$SCORE',"decision":"'$DECISION'","cost_usd":'$COST',"assertions":'$PASS_RATES',"mutation":"'"$MUTATION_DESC"'","run_dir":"'"$(basename $RUN_DIR)"'","timestamp":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"}' >> <experiment-dir>/_autoresearch/iterations.jsonl
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**d. trajectory.html — no action needed**
|
|
240
|
+
|
|
241
|
+
The trajectory chart fetches `iterations.jsonl` directly via HTTP on each auto-refresh. No file manipulation required after the initial copy in setup.
|
|
242
|
+
|
|
243
|
+
**e. Decide: KEEP or DROP**
|
|
244
|
+
|
|
245
|
+
Apply the automated keep/discard rules from the section above:
|
|
246
|
+
|
|
247
|
+
1. Run `agentv compare <baseline>.jsonl <candidate>.jsonl --json` where `<baseline>` is the best iteration's `index.jsonl` (or the first run's `index.jsonl` for cycle 1) and `<candidate>` is this cycle's `index.jsonl`.
|
|
248
|
+
2. If `wins > losses` → **KEEP**.
|
|
249
|
+
3. If `wins <= losses` → **DISCARD**.
|
|
250
|
+
4. If `mean_delta == 0` and the artifact is simpler → **KEEP** (simpler is better at equal performance). Simplicity: for files, compare line count; for directories, compare total size via `du -sb`.
|
|
251
|
+
|
|
252
|
+
For cycle 1, there is no baseline to compare against — always **KEEP** the first cycle.
|
|
253
|
+
|
|
254
|
+
**f. If KEEP**
|
|
255
|
+
|
|
256
|
+
- Update `best_score` to this cycle's score.
|
|
257
|
+
- Commit the artifact: `git add <artifact-path> && git commit -m "autoresearch cycle N: <mutation summary>"`.
|
|
258
|
+
- Record the current `index.jsonl` path as the new baseline for future comparisons.
|
|
259
|
+
- Reset `convergence_count = 0`.
|
|
260
|
+
|
|
261
|
+
**g. If DROP**
|
|
262
|
+
|
|
263
|
+
- Revert the working tree to HEAD: `git checkout -- <artifact-path>` (for files) or `git checkout -- <artifact-path>/` (for directories).
|
|
264
|
+
- Increment `convergence_count`.
|
|
265
|
+
|
|
266
|
+
**h. Check stop conditions**
|
|
267
|
+
|
|
268
|
+
If `convergence_count >= max_convergence` or `cycle >= max_cycles` → break out of the loop.
|
|
269
|
+
|
|
270
|
+
**i. Mutate**
|
|
271
|
+
|
|
272
|
+
Dispatch the **mutator** subagent (`agents/mutator.md`) with:
|
|
273
|
+
- `artifact-path`: the file or directory to mutate
|
|
274
|
+
- `artifact-mode`: `file` or `directory`
|
|
275
|
+
- `initial-sha`: the starting commit SHA (for referencing the original via `git show`)
|
|
276
|
+
- `pass-rates`: the `$PASS_RATES` JSON object from step (b) (small — just assertion names and rates)
|
|
277
|
+
- `run-dir`: path to this cycle's run directory (the mutator reads `grading.json` and transcripts itself)
|
|
278
|
+
- `iterations-path`: path to `_autoresearch/iterations.jsonl` (the mutator reads mutation history itself)
|
|
279
|
+
- For directory mode: `focus-files` (optional — files most likely contributing to failures, derived from assertion names)
|
|
280
|
+
|
|
281
|
+
**Do NOT pass failure descriptions, transcripts, or grading content** to the mutator — pass paths and let it read what it needs from disk. This keeps the orchestrator's context clean.
|
|
282
|
+
|
|
283
|
+
The mutator rewrites artifacts in place. Verify the artifact was modified (e.g., `git diff --stat`) before continuing.
|
|
284
|
+
|
|
285
|
+
**j. Continue**
|
|
286
|
+
|
|
287
|
+
Increment `cycle` and return to step (a).
|
|
288
|
+
|
|
289
|
+
### 3. Completion
|
|
290
|
+
|
|
291
|
+
1. Finalize `trajectory.html`: remove the line containing `<!-- __AUTO_REFRESH__ -->` (which includes the `<meta http-equiv="refresh">` tag) so the chart becomes static.
|
|
292
|
+
2. Log a final summary:
|
|
293
|
+
- Total cycles run
|
|
294
|
+
- Final best score vs original score (cycle 1)
|
|
295
|
+
- Number of KEEPs and DROPs
|
|
296
|
+
- Total cost across all cycles
|
|
297
|
+
- The optimized artifact is in the working tree (and the latest commit)
|
|
298
|
+
- Run `git diff <initial_sha>` to see total changes from the original
|
|
299
|
+
- Run `git log --oneline <initial_sha>..HEAD` to see the mutation history
|
|
300
|
+
- Path to `_autoresearch/trajectory.html` (the score chart)
|
|
301
|
+
3. Present results to the user with a recommendation: adopt the optimized version, revert to original (`git checkout <initial_sha> -- <artifact-path>`), or continue iterating interactively.
|
|
302
|
+
|
|
303
|
+
## Interactive/autonomous hybrid
|
|
304
|
+
|
|
305
|
+
Users can start in interactive mode (the existing Step 3–5 loop with human checkpoints), build confidence in their eval quality, and then switch to autoresearch mode to run unattended. The two modes share the same eval infrastructure and artifact layout — autoresearch simply automates the keep/discard decisions and removes human checkpoints.
|
|
306
|
+
|
|
307
|
+
## Model empathy recommendation
|
|
308
|
+
|
|
309
|
+
For best results, use same-model pairings: the meta-agent running autoresearch should match the model used by the task agent being evaluated (e.g., Claude optimizing a Claude agent, GPT optimizing a GPT agent). Per AutoAgent research findings, same-model pairings produce better mutations because the optimizer has implicit knowledge of how the target model interprets instructions.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Description Optimization
|
|
2
|
+
|
|
3
|
+
Optimize the `description` field in a skill's SKILL.md frontmatter for better triggering
|
|
4
|
+
accuracy. Use this after the agent/skill is working well — this is a polish step, not a
|
|
5
|
+
core workflow step.
|
|
6
|
+
|
|
7
|
+
**Provider compatibility**: Description optimization applies to any agent platform with
|
|
8
|
+
skill-discovery mechanisms — Claude Code, Codex (`.agents/` or `.codex/` folders), Copilot,
|
|
9
|
+
and others. The `skill-trigger` grader checks whether the agent invoked the right skill,
|
|
10
|
+
regardless of how discovery works on that platform.
|
|
11
|
+
|
|
12
|
+
## Step 1: Generate Trigger EVAL.yaml
|
|
13
|
+
|
|
14
|
+
Create 20 test cases:
|
|
15
|
+
- **10 should-trigger**: realistic prompts where this skill should activate — different
|
|
16
|
+
phrasings, casual speech, uncommon use cases, edge cases where this skill competes with
|
|
17
|
+
another but should win
|
|
18
|
+
- **10 should-not-trigger**: near-miss prompts that share keywords but actually need
|
|
19
|
+
something different — adjacent domains, ambiguous phrasing where naive matching would
|
|
20
|
+
trigger but shouldn't
|
|
21
|
+
|
|
22
|
+
Prompts must be realistic — include file paths, personal context, typos, casual speech.
|
|
23
|
+
Not abstract requests like "format data" but concrete ones like "ok so my boss sent me
|
|
24
|
+
Q4-sales-FINAL-v2.xlsx and she wants me to add a profit margin column..."
|
|
25
|
+
|
|
26
|
+
The should-not-trigger cases are the most valuable. "Write a fibonacci function" as a
|
|
27
|
+
negative test for an eval skill is useless — it doesn't test anything. The negative cases
|
|
28
|
+
should be genuinely tricky near-misses.
|
|
29
|
+
|
|
30
|
+
Write as EVAL.yaml with top-level input (the user prompt doesn't specify the skill name —
|
|
31
|
+
it's a natural utterance):
|
|
32
|
+
|
|
33
|
+
```yaml
|
|
34
|
+
# trigger-eval.eval.yaml
|
|
35
|
+
tests:
|
|
36
|
+
- id: should-trigger-casual-optimize
|
|
37
|
+
input: "ok so I have this agent that keeps failing on the code review tasks, can you help me figure out why and fix it"
|
|
38
|
+
assertions:
|
|
39
|
+
- type: skill-trigger
|
|
40
|
+
skill: agentv-bench
|
|
41
|
+
- id: should-not-trigger-build-error
|
|
42
|
+
input: "my TypeScript build is failing with type errors in src/auth.ts"
|
|
43
|
+
assertions:
|
|
44
|
+
- type: skill-trigger
|
|
45
|
+
skill: agentv-bench
|
|
46
|
+
should_trigger: false
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Step 2: Review with User
|
|
50
|
+
|
|
51
|
+
Present the eval set. The user adjusts queries, toggles should-trigger, adds/removes cases.
|
|
52
|
+
This step matters — bad eval queries lead to bad descriptions.
|
|
53
|
+
|
|
54
|
+
## Step 3: Iterate on Description
|
|
55
|
+
|
|
56
|
+
Run the trigger eval, identify misfires, rewrite the description, re-run. Max 5 iterations.
|
|
57
|
+
Select best description by held-out test accuracy (split 60% train / 40% test) to avoid
|
|
58
|
+
overfitting.
|
|
59
|
+
|
|
60
|
+
Use the grader and analyzer subagents to identify trigger failures and propose description
|
|
61
|
+
improvements — the same eval → grade → analyze → improve loop used for agent output quality.
|
|
62
|
+
|
|
63
|
+
## Step 4: Apply
|
|
64
|
+
|
|
65
|
+
Update the skill's SKILL.md frontmatter with the optimized description. Show the user
|
|
66
|
+
before/after with accuracy scores.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Environment Adaptation
|
|
2
|
+
|
|
3
|
+
Provider-specific notes, CI/headless behavior, and fallback strategies for environments
|
|
4
|
+
with limited capabilities.
|
|
5
|
+
|
|
6
|
+
## CI/Headless Mode
|
|
7
|
+
|
|
8
|
+
Skip interactive prompts. Exit with pass/fail status code. Always generate artifacts for
|
|
9
|
+
downstream consumption.
|
|
10
|
+
|
|
11
|
+
## No Subagents Available (e.g., Claude.ai)
|
|
12
|
+
|
|
13
|
+
Run test cases serially. Skip blind comparison. Present results directly in conversation —
|
|
14
|
+
for each test case, show the prompt and output. Ask for feedback inline. Skip benchmarking
|
|
15
|
+
(it relies on baseline comparisons that aren't meaningful without subagents).
|
|
16
|
+
|
|
17
|
+
## Provider-Specific Notes
|
|
18
|
+
|
|
19
|
+
- **Copilot CLI**: Uses ACP protocol via `copilot --acp --stdio`
|
|
20
|
+
- **Claude SDK**: Requires `@anthropic-ai/claude-agent-sdk` installed
|
|
21
|
+
- **Codex**: Supports skills via `.agents/` or `.codex/` folders. Emits `command_execution`
|
|
22
|
+
and `file_change` tool calls.
|
|
23
|
+
- **Custom CLI**: Needs `command` and output file pattern in target config
|
|
24
|
+
- **Target config**: Uses `${{ ENV_VAR }}` syntax (not `${ENV_VAR}`) for API keys
|
|
25
|
+
|
|
26
|
+
**Note**: "Description Optimization" (see `references/description-optimization.md`) applies
|
|
27
|
+
to any platform with skill-discovery mechanisms. All listed providers support skills.
|
|
28
|
+
|
|
29
|
+
## Unsupported Providers: Use a Code-Grader
|
|
30
|
+
|
|
31
|
+
The built-in `skill-trigger` grader covers Claude, Copilot, Pi, Codex and VS Code out
|
|
32
|
+
of the box. For providers with different tool-call formats, write a code-grader that inspects
|
|
33
|
+
the agent's tool call trace.
|
|
34
|
+
|
|
35
|
+
A code-grader receives the full evaluation context including the agent's output messages and
|
|
36
|
+
tool calls. You can inspect these to determine whether the skill was invoked:
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
# Example: code-grader for Codex skill-trigger detection
|
|
40
|
+
tests:
|
|
41
|
+
- id: should-trigger-codex
|
|
42
|
+
input: "Analyze this CSV file"
|
|
43
|
+
assertions:
|
|
44
|
+
- type: code-grader
|
|
45
|
+
path: ./judges/codex-skill-trigger.ts
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// judges/codex-skill-trigger.ts
|
|
50
|
+
import { defineCodeGrader } from '@agentv/eval';
|
|
51
|
+
|
|
52
|
+
export default defineCodeGrader(({ output }) => {
|
|
53
|
+
const skillName = 'csv-analyzer';
|
|
54
|
+
const toolCalls = (output ?? []).flatMap((msg) => msg.toolCalls ?? []);
|
|
55
|
+
const firstTool = toolCalls[0];
|
|
56
|
+
|
|
57
|
+
if (!firstTool) {
|
|
58
|
+
return { score: 0, reason: 'No tool calls recorded' };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Codex reads skill files via shell commands
|
|
62
|
+
if (firstTool.tool === 'command_execution') {
|
|
63
|
+
const cmd = String(firstTool.input ?? '');
|
|
64
|
+
if (cmd.includes(skillName)) {
|
|
65
|
+
return { score: 1, reason: `Skill "${skillName}" triggered via command: ${cmd}` };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Check if skill file was read via file_change or other tools
|
|
70
|
+
if (firstTool.tool === 'file_change') {
|
|
71
|
+
const path = String((firstTool.input as Record<string, unknown>)?.path ?? '');
|
|
72
|
+
if (path.includes(skillName)) {
|
|
73
|
+
return { score: 1, reason: `Skill file accessed: ${path}` };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return { score: 0, reason: `First tool was "${firstTool.tool}" — not a skill invocation for "${skillName}"` };
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
This approach is more flexible than config overrides — you can match any tool-call pattern,
|
|
82
|
+
check multiple fields, and add provider-specific logic as needed.
|