nasde-toolkit 0.3.2__py3-none-any.whl
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.
- nasde_toolkit/__init__.py +5 -0
- nasde_toolkit/_bundled_skills/nasde-benchmark-creator/SKILL.md +321 -0
- nasde_toolkit/_bundled_skills/nasde-benchmark-from-history/SKILL.md +298 -0
- nasde_toolkit/_bundled_skills/nasde-benchmark-from-public-repos/SKILL.md +303 -0
- nasde_toolkit/_bundled_skills/nasde-benchmark-runner/SKILL.md +388 -0
- nasde_toolkit/_version.py +24 -0
- nasde_toolkit/agents/__init__.py +1 -0
- nasde_toolkit/agents/configurable_claude.py +121 -0
- nasde_toolkit/agents/configurable_codex.py +101 -0
- nasde_toolkit/agents/configurable_gemini.py +194 -0
- nasde_toolkit/banner.py +82 -0
- nasde_toolkit/cli.py +513 -0
- nasde_toolkit/config.py +206 -0
- nasde_toolkit/docker.py +221 -0
- nasde_toolkit/evaluator.py +663 -0
- nasde_toolkit/evaluator_backends/__init__.py +21 -0
- nasde_toolkit/evaluator_backends/claude_subprocess.py +172 -0
- nasde_toolkit/evaluator_backends/codex_subprocess.py +152 -0
- nasde_toolkit/evaluator_backends/protocol.py +30 -0
- nasde_toolkit/runner.py +739 -0
- nasde_toolkit/scaffold/__init__.py +161 -0
- nasde_toolkit/skills_installer.py +83 -0
- nasde_toolkit/update_check.py +166 -0
- nasde_toolkit-0.3.2.dist-info/METADATA +701 -0
- nasde_toolkit-0.3.2.dist-info/RECORD +28 -0
- nasde_toolkit-0.3.2.dist-info/WHEEL +4 -0
- nasde_toolkit-0.3.2.dist-info/entry_points.txt +2 -0
- nasde_toolkit-0.3.2.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nasde-benchmark-creator
|
|
3
|
+
description: |
|
|
4
|
+
Create coding agent benchmarks for evaluation with nasde. Use this skill when the user wants to:
|
|
5
|
+
- Create a new benchmark project (set of tasks for evaluating coding agents)
|
|
6
|
+
- Add tasks to an existing benchmark
|
|
7
|
+
- Create or modify agent variants (configurations that control agent behavior)
|
|
8
|
+
- Set up assessment dimensions and scoring criteria
|
|
9
|
+
- Verify that a new benchmark's Docker environment and tests work
|
|
10
|
+
Even if the user doesn't say "benchmark" — if they're talking about creating coding challenges for AI agents or setting up evaluation criteria, this skill applies.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# NASDE Benchmark Creator
|
|
14
|
+
|
|
15
|
+
Create and configure coding agent benchmarks for evaluation with `nasde`. A benchmark is a set of coding tasks that AI agents solve inside isolated Docker containers, scored both by functional tests (pass/fail) and by an LLM-as-a-Judge architecture assessment.
|
|
16
|
+
|
|
17
|
+
## Step 1: Understand what to evaluate
|
|
18
|
+
|
|
19
|
+
Before creating files, clarify with the user:
|
|
20
|
+
|
|
21
|
+
- What programming language/framework? (determines Dockerfile base image)
|
|
22
|
+
- What kind of coding challenges? (feature implementation, refactoring, bug fixing, etc.)
|
|
23
|
+
- What source repository should the agent work on? (git URL cloned in Dockerfile)
|
|
24
|
+
- What quality dimensions should be assessed? (these are benchmark-specific, not hardcoded)
|
|
25
|
+
|
|
26
|
+
## Step 2: Scaffold or create the project
|
|
27
|
+
|
|
28
|
+
For a new benchmark, run:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
nasde init my-benchmark --name my-benchmark
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This creates the base structure. Then customize the generated files.
|
|
35
|
+
|
|
36
|
+
For adding tasks to an existing benchmark, skip to Step 4.
|
|
37
|
+
|
|
38
|
+
## Step 3: Define assessment dimensions
|
|
39
|
+
|
|
40
|
+
Edit `assessment_dimensions.json`. Each benchmark has its OWN dimensions — design them for what matters in this benchmark's domain.
|
|
41
|
+
|
|
42
|
+
Examples by domain:
|
|
43
|
+
- **Refactoring**: `code_clarity`, `test_preservation`, `api_compatibility`, `performance_impact`
|
|
44
|
+
- **API integration**: `error_handling`, `api_usage_correctness`, `test_coverage`, `documentation`
|
|
45
|
+
- **Security**: `vulnerability_detection`, `fix_correctness`, `regression_safety`, `explanation_quality`
|
|
46
|
+
- **DDD**: `domain_modeling`, `architecture_compliance`, `extensibility`, `test_quality`
|
|
47
|
+
|
|
48
|
+
Rules:
|
|
49
|
+
- Pick whatever number of dimensions actually captures the quality you care about — there is no required minimum or maximum.
|
|
50
|
+
- Each dimension declares its own `max_score` (any positive integer). Scales are independent — a coarse pass/fail-ish dimension can be 0–3 while a richly graded one can be 0–50 in the same rubric. There is no requirement for the total to sum to 100. `normalized_score` is computed automatically from the actual sum of `max_score` values. See ADR-008.
|
|
51
|
+
- Names in snake_case
|
|
52
|
+
- Each dimension has: `name`, `title`, `max_score`, `description`
|
|
53
|
+
|
|
54
|
+
## Step 4: Create task files
|
|
55
|
+
|
|
56
|
+
Each task lives in `tasks/<task-name>/` and needs these files:
|
|
57
|
+
|
|
58
|
+
### task.toml (required — single task config)
|
|
59
|
+
|
|
60
|
+
Single config file per task, shared with Harbor. nasde-specific fields live under `[nasde.*]`.
|
|
61
|
+
|
|
62
|
+
```toml
|
|
63
|
+
version = "1.0"
|
|
64
|
+
|
|
65
|
+
[task]
|
|
66
|
+
name = "<benchmark-name>/<task-name>" # Harbor requires org/name format
|
|
67
|
+
description = "Brief description"
|
|
68
|
+
|
|
69
|
+
[metadata]
|
|
70
|
+
difficulty = "intermediate"
|
|
71
|
+
language = "C#"
|
|
72
|
+
framework = ".NET 8"
|
|
73
|
+
domain = "E-Commerce"
|
|
74
|
+
|
|
75
|
+
[agent]
|
|
76
|
+
timeout_sec = 1800 # Primary agent timeout. Rule of thumb: estimated_time_minutes × 60.
|
|
77
|
+
|
|
78
|
+
[environment]
|
|
79
|
+
memory_mb = 4096 # Container memory limit. Claude Code needs 4096+, default 2048 is too low.
|
|
80
|
+
|
|
81
|
+
[verifier]
|
|
82
|
+
timeout_sec = 300 # Timeout for tests/test.sh.
|
|
83
|
+
|
|
84
|
+
[nasde.source] # Only needed when task has no environment/Dockerfile (nasde auto-generates one).
|
|
85
|
+
git = "https://github.com/org/repo.git"
|
|
86
|
+
ref = "main"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Timeout priority**: `--timeout` CLI flag > task.toml `[agent] timeout_sec` > Harbor default. Timeouts are per-task — there is no project-wide default in nasde.toml.
|
|
90
|
+
|
|
91
|
+
### instruction.md (required)
|
|
92
|
+
|
|
93
|
+
Agent-facing task description. Structure it as:
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
# Task: <Name>
|
|
97
|
+
|
|
98
|
+
## Context
|
|
99
|
+
Working environment, codebase location (/app), technology stack.
|
|
100
|
+
|
|
101
|
+
## Requirement
|
|
102
|
+
What the agent must implement/fix/change. Concrete examples with inputs and expected outputs.
|
|
103
|
+
|
|
104
|
+
## Scope
|
|
105
|
+
What's in scope, what's not.
|
|
106
|
+
|
|
107
|
+
## Quality Expectations
|
|
108
|
+
Architecture and code quality expectations.
|
|
109
|
+
|
|
110
|
+
## Success Criteria
|
|
111
|
+
Numbered list matching what test.sh verifies.
|
|
112
|
+
|
|
113
|
+
## Constraints
|
|
114
|
+
What the agent must NOT do (e.g., don't modify existing tests).
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### environment/Dockerfile (required)
|
|
118
|
+
|
|
119
|
+
```dockerfile
|
|
120
|
+
FROM <base-image>
|
|
121
|
+
|
|
122
|
+
RUN apt-get update && apt-get install -y git curl wget ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
123
|
+
|
|
124
|
+
WORKDIR /app
|
|
125
|
+
RUN git clone <repository-url> .
|
|
126
|
+
|
|
127
|
+
# Pre-install dependencies so the agent doesn't waste time
|
|
128
|
+
RUN <dependency-install-command>
|
|
129
|
+
|
|
130
|
+
# Verify the environment works
|
|
131
|
+
RUN <build-or-compile-command>
|
|
132
|
+
|
|
133
|
+
CMD ["/bin/bash"]
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The Dockerfile MUST be self-contained — the agent starts working immediately.
|
|
137
|
+
|
|
138
|
+
### tests/test.sh (required — Harbor verifier)
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
#!/bin/bash
|
|
142
|
+
cd /app
|
|
143
|
+
|
|
144
|
+
echo "Step 1: Verifying build..."
|
|
145
|
+
if <build-command>; then
|
|
146
|
+
echo "✓ Build succeeded"
|
|
147
|
+
else
|
|
148
|
+
echo "✗ Build failed"
|
|
149
|
+
echo 0 > /logs/verifier/reward.txt
|
|
150
|
+
exit 1
|
|
151
|
+
fi
|
|
152
|
+
|
|
153
|
+
echo "Step 2: Running tests..."
|
|
154
|
+
if <test-command>; then
|
|
155
|
+
echo "✓ Tests pass"
|
|
156
|
+
else
|
|
157
|
+
echo "✗ Tests failed"
|
|
158
|
+
echo 0 > /logs/verifier/reward.txt
|
|
159
|
+
exit 1
|
|
160
|
+
fi
|
|
161
|
+
|
|
162
|
+
echo "EVALUATION PASSED ✓"
|
|
163
|
+
echo 1 > /logs/verifier/reward.txt
|
|
164
|
+
exit 0
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Rules:
|
|
168
|
+
- Every failure: `echo 0 > /logs/verifier/reward.txt` + `exit 1`
|
|
169
|
+
- Final success: `echo 1 > /logs/verifier/reward.txt` + `exit 0`
|
|
170
|
+
- Order steps from fundamental (build) to specific (implementation checks)
|
|
171
|
+
|
|
172
|
+
### assessment_criteria.md (required for LLM-as-a-Judge evaluation)
|
|
173
|
+
|
|
174
|
+
Per-task rubric. Structure:
|
|
175
|
+
|
|
176
|
+
```markdown
|
|
177
|
+
# Assessment Criteria: <Task Name>
|
|
178
|
+
|
|
179
|
+
Evaluate across N dimensions. Each dimension uses its own scale (0–`max_score`),
|
|
180
|
+
defined in `assessment_dimensions.json`. The ladder below shows what each score
|
|
181
|
+
means for one specific dimension — repeat for each dimension.
|
|
182
|
+
|
|
183
|
+
## 1. <Dimension Name> (0–<max_score>)
|
|
184
|
+
|
|
185
|
+
| Score | Criteria |
|
|
186
|
+
|-------|----------|
|
|
187
|
+
| 0 | <worst case> |
|
|
188
|
+
| <middle> | <middle case> |
|
|
189
|
+
| <max_score> | <best case> |
|
|
190
|
+
|
|
191
|
+
**Key checks:**
|
|
192
|
+
- Specific things to look for
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Pick a `max_score` that matches the granularity you can actually distinguish.
|
|
196
|
+
A coarse pass/fail-ish dimension might be 0–3; a richly graded one might be 0–50.
|
|
197
|
+
Choose the resolution per dimension, independently.
|
|
198
|
+
|
|
199
|
+
### solution/solve.sh (optional)
|
|
200
|
+
|
|
201
|
+
Reference solution for verifying test.sh works. Not executed by Harbor.
|
|
202
|
+
|
|
203
|
+
## Step 5: Create variants
|
|
204
|
+
|
|
205
|
+
Each variant is a directory under `variants/<variant-name>/` with a required `variant.toml` declaring the agent type.
|
|
206
|
+
|
|
207
|
+
### variant.toml (required)
|
|
208
|
+
|
|
209
|
+
```toml
|
|
210
|
+
agent = "claude" # or "codex" or "gemini"
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
For Codex variants, **always** set the model explicitly to avoid inheriting the Claude model from `nasde.toml`:
|
|
214
|
+
|
|
215
|
+
```toml
|
|
216
|
+
agent = "codex"
|
|
217
|
+
model = "gpt-5.3-codex" # Required for Codex — use an OpenAI model ID
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Codex models** (recommended first, as of 2026-03):
|
|
221
|
+
- `gpt-5.4` — flagship frontier model, best overall for professional work
|
|
222
|
+
- `gpt-5.4-mini` — fast, efficient mini model for responsive coding and subagents
|
|
223
|
+
- `gpt-5.3-codex` — industry-leading coding model for complex software engineering
|
|
224
|
+
- `gpt-5.3-codex-spark` — near-instant real-time coding iteration (ChatGPT Pro only)
|
|
225
|
+
- Older: `gpt-5.2-codex`, `gpt-5.1-codex`, `gpt-5-codex`, `gpt-5-codex-mini`
|
|
226
|
+
|
|
227
|
+
Without `model` in variant.toml, Codex inherits `nasde.toml`'s default (e.g. `claude-sonnet-4-6`), which silently produces garbage results.
|
|
228
|
+
|
|
229
|
+
For Gemini CLI variants, **always** set the model with the `google/` prefix:
|
|
230
|
+
|
|
231
|
+
```toml
|
|
232
|
+
agent = "gemini"
|
|
233
|
+
model = "google/gemini-3-flash-preview" # Required format: google/<model-name>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Gemini models** (recommended first, as of 2026-03):
|
|
237
|
+
- `google/gemini-3.1-pro-preview` — advanced thinking model, best for deep reasoning
|
|
238
|
+
- `google/gemini-3-flash-preview` — best quality/speed ratio, daily coding tasks
|
|
239
|
+
- `google/gemini-3.1-flash-lite-preview` — fastest, simple and repetitive tasks
|
|
240
|
+
|
|
241
|
+
### Claude Code variant
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
variants/vanilla/
|
|
245
|
+
variant.toml # agent = "claude"
|
|
246
|
+
CLAUDE.md # Instructions (injected to /app/CLAUDE.md)
|
|
247
|
+
skills/ # Optional: skill snapshots (injected to /app/.claude/skills/)
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Codex variant
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
variants/codex-baseline/
|
|
254
|
+
variant.toml # agent = "codex"
|
|
255
|
+
AGENTS.md # Instructions (injected to /app/AGENTS.md)
|
|
256
|
+
agents_skills/ # Optional: skill snapshots (injected to /app/.agents/skills/)
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Gemini CLI variant
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
variants/gemini-baseline/
|
|
263
|
+
variant.toml # agent = "gemini"
|
|
264
|
+
GEMINI.md # Instructions (injected to /app/GEMINI.md)
|
|
265
|
+
gemini_skills/ # Optional: skill snapshots (injected to /app/.gemini/skills/)
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
If no `harbor_config.json` exists, `nasde` auto-generates one from `variant.toml`. To customize (e.g., add MCP servers), create it explicitly:
|
|
269
|
+
|
|
270
|
+
```json
|
|
271
|
+
{
|
|
272
|
+
"agents": [
|
|
273
|
+
{
|
|
274
|
+
"import_path": "nasde_toolkit.agents.configurable_claude:ConfigurableClaude",
|
|
275
|
+
"name": "<variant-name>",
|
|
276
|
+
"kwargs": {
|
|
277
|
+
"sandbox_files": {
|
|
278
|
+
"/app/CLAUDE.md": "/absolute/path/to/variants/<variant>/CLAUDE.md",
|
|
279
|
+
"/logs/agent/sessions/.claude.json": "/absolute/path/to/variants/<variant>/claude_config.json"
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Critical: `"name"` field is REQUIRED — without it, Opik tagging breaks.
|
|
288
|
+
|
|
289
|
+
### Variant design patterns
|
|
290
|
+
|
|
291
|
+
Design variants to test specific hypotheses:
|
|
292
|
+
- **Minimal** (baseline) — bare instructions, no extra guidance
|
|
293
|
+
- **Guided** — detailed domain-specific guidance, patterns to follow
|
|
294
|
+
- **Skill-augmented** — skills injected for domain expertise (e.g., tactical DDD)
|
|
295
|
+
- **Tool-augmented** — MCP server access (e.g., codebase search)
|
|
296
|
+
- **Cross-agent** — same instructions for Claude, Codex, and Gemini to compare agent performance
|
|
297
|
+
|
|
298
|
+
Every benchmark needs at least one variant (typically `vanilla` or `baseline`).
|
|
299
|
+
|
|
300
|
+
## Step 6: Verify the benchmark works
|
|
301
|
+
|
|
302
|
+
Before running with a real agent:
|
|
303
|
+
|
|
304
|
+
1. **Build the Docker image:**
|
|
305
|
+
```bash
|
|
306
|
+
docker build -t benchmark-test -f tasks/<task>/environment/Dockerfile .
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
2. **Test the verifier** with reference solution (if available):
|
|
310
|
+
```bash
|
|
311
|
+
docker run --rm -it benchmark-test bash
|
|
312
|
+
# Inside container:
|
|
313
|
+
bash /path/to/solution/solve.sh
|
|
314
|
+
bash /path/to/tests/test.sh
|
|
315
|
+
cat /logs/verifier/reward.txt # Should be 1
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
3. **Dry run** on a single task:
|
|
319
|
+
```bash
|
|
320
|
+
nasde run --variant vanilla --tasks <task-name> --without-eval -C .
|
|
321
|
+
```
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nasde-benchmark-from-history
|
|
3
|
+
description: |
|
|
4
|
+
Generate benchmark tasks from git history of the current or specified repository. Use this skill when the user wants to:
|
|
5
|
+
- Create benchmark tasks based on real problems their team already solved (closed PRs, past commits, resolved issues)
|
|
6
|
+
- Mine git history for good evaluation candidates
|
|
7
|
+
- Turn a commit range or set of PRs into a NASDE benchmark
|
|
8
|
+
- Build a regression test suite from their team's actual work
|
|
9
|
+
Even if the user doesn't say "benchmark" — if they're talking about turning past work into evaluation tasks, or want to test AI agents against problems they've already solved, this skill applies.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# NASDE Benchmark from Git History
|
|
13
|
+
|
|
14
|
+
Generate NASDE benchmark tasks by mining git history. You analyze commits, diffs, and PR descriptions to identify self-contained changes that make good evaluation candidates, then generate task files with user approval.
|
|
15
|
+
|
|
16
|
+
## Prerequisites
|
|
17
|
+
|
|
18
|
+
- A git repository with meaningful commit history (the repo you're currently in, or a path to another local repo)
|
|
19
|
+
- An existing NASDE benchmark project (run `nasde init` first, or use the `nasde-benchmark-creator` skill)
|
|
20
|
+
- If the benchmark project doesn't exist yet, create it first — this skill generates tasks, not the project scaffold
|
|
21
|
+
|
|
22
|
+
## Step 1: Identify the source repository and commit range
|
|
23
|
+
|
|
24
|
+
Ask the user:
|
|
25
|
+
|
|
26
|
+
- **Which repository?** Default: the current working directory. Can also be a path to another local repo.
|
|
27
|
+
- **What commit range?** Options:
|
|
28
|
+
- A branch name (analyze all commits on that branch)
|
|
29
|
+
- A commit range (`abc123..def456`)
|
|
30
|
+
- Last N commits (`HEAD~20..HEAD`)
|
|
31
|
+
- Specific PR numbers (if the repo has a GitHub remote, use `gh pr view`)
|
|
32
|
+
- "Just show me good candidates" — scan the last 50 commits and filter
|
|
33
|
+
|
|
34
|
+
If the user says "just find good candidates," proceed to Step 2 with the last 50 commits.
|
|
35
|
+
|
|
36
|
+
## Step 2: Scan commits and identify candidates
|
|
37
|
+
|
|
38
|
+
For each commit in the range, read the diff and evaluate whether it's a good benchmark candidate.
|
|
39
|
+
|
|
40
|
+
**Good candidates have:**
|
|
41
|
+
- A self-contained change (clear before/after state — one commit or a squashed PR)
|
|
42
|
+
- A well-defined problem statement (readable from commit message, PR title, or linked issue)
|
|
43
|
+
- Existing tests that can serve as a verifier, OR a change that's testable by inspection
|
|
44
|
+
- Reasonable scope — not too trivial (typo fix) and not too large (multi-week refactor)
|
|
45
|
+
- A clean "before" state — the parent commit should build and run successfully
|
|
46
|
+
|
|
47
|
+
**Bad candidates (skip these):**
|
|
48
|
+
- Merge commits with no meaningful diff
|
|
49
|
+
- Dependency updates, lockfile changes, CI config tweaks
|
|
50
|
+
- Changes that span too many unrelated files (shotgun surgery)
|
|
51
|
+
- Changes that require external systems not reproducible in Docker (third-party API keys, specific databases with production data)
|
|
52
|
+
|
|
53
|
+
For each candidate, extract:
|
|
54
|
+
- `before_ref`: the parent commit hash (the state the agent will start from)
|
|
55
|
+
- `after_ref`: the commit hash (the reference solution)
|
|
56
|
+
- `description`: what the change does (from commit message / PR description)
|
|
57
|
+
- `files_changed`: list of modified files
|
|
58
|
+
- `has_tests`: whether the commit includes test changes
|
|
59
|
+
- `estimated_difficulty`: easy / intermediate / hard (based on diff size and complexity)
|
|
60
|
+
|
|
61
|
+
## Step 3: Present candidates to the user
|
|
62
|
+
|
|
63
|
+
Present a numbered list of candidates. For each one, show:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
[1] abc1234 — "Add discount calculation for threshold-based pricing"
|
|
67
|
+
Files: src/Pricing/ThresholdDiscount.cs, tests/Pricing/ThresholdDiscountTests.cs
|
|
68
|
+
Difficulty: intermediate | Has tests: yes
|
|
69
|
+
Before: abc1233 (parent commit)
|
|
70
|
+
|
|
71
|
+
[2] def5678 — "Fix race condition in order processing pipeline"
|
|
72
|
+
Files: src/Orders/OrderProcessor.cs, src/Orders/OrderLock.cs
|
|
73
|
+
Difficulty: hard | Has tests: yes
|
|
74
|
+
Before: def5677 (parent commit)
|
|
75
|
+
|
|
76
|
+
[3] ...
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Ask the user to select which candidates to turn into tasks (comma-separated numbers, or "all").
|
|
80
|
+
|
|
81
|
+
For each selected candidate, proceed to Step 4.
|
|
82
|
+
|
|
83
|
+
## Step 4: Generate task files for each selected candidate
|
|
84
|
+
|
|
85
|
+
For each approved candidate, generate the full task directory structure. Work through each file with the user — present it, get approval or edits, then write it.
|
|
86
|
+
|
|
87
|
+
### 4a: task.toml (single task config, shared with Harbor)
|
|
88
|
+
|
|
89
|
+
Generate from commit metadata. nasde-specific fields go under `[nasde.*]`.
|
|
90
|
+
|
|
91
|
+
```toml
|
|
92
|
+
version = "1.0"
|
|
93
|
+
|
|
94
|
+
[task]
|
|
95
|
+
name = "<benchmark-name>/<slugified-commit-description>" # Harbor requires org/name format
|
|
96
|
+
description = "<commit message, cleaned up>"
|
|
97
|
+
|
|
98
|
+
[metadata]
|
|
99
|
+
difficulty = "<estimated_difficulty>"
|
|
100
|
+
language = "<detected-language>"
|
|
101
|
+
framework = "<detected-framework>"
|
|
102
|
+
source_commit = "<after_ref>"
|
|
103
|
+
|
|
104
|
+
[agent]
|
|
105
|
+
timeout_sec = 1800 # Rule of thumb: estimated_time_minutes × 60
|
|
106
|
+
|
|
107
|
+
[environment]
|
|
108
|
+
memory_mb = 4096 # Claude Code needs 4096+, default 2048 is too low.
|
|
109
|
+
|
|
110
|
+
[verifier]
|
|
111
|
+
timeout_sec = 300 # Timeout for tests/test.sh
|
|
112
|
+
|
|
113
|
+
[nasde.source] # Only needed when task has no environment/Dockerfile (auto-generation).
|
|
114
|
+
git = "<repo-url-or-local-path>"
|
|
115
|
+
ref = "<before_ref>"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
For `[nasde.source] git`:
|
|
119
|
+
- If the repo has a public remote: use the HTTPS clone URL
|
|
120
|
+
- If the repo is local-only (no public remote): use the absolute local path
|
|
121
|
+
- Ask the user if unsure
|
|
122
|
+
|
|
123
|
+
### 4b: instruction.md
|
|
124
|
+
|
|
125
|
+
Generate from the commit message, PR description (if available via `gh`), and the diff:
|
|
126
|
+
|
|
127
|
+
```markdown
|
|
128
|
+
# Task: <Human-readable task name>
|
|
129
|
+
|
|
130
|
+
## Context
|
|
131
|
+
You are working in a <language/framework> codebase located at `/app`.
|
|
132
|
+
<Brief description of the project and the area of code being modified.>
|
|
133
|
+
|
|
134
|
+
## Requirement
|
|
135
|
+
<What the agent must implement/fix/change. Derived from the commit message and diff.
|
|
136
|
+
Be specific — describe the expected behavior, not the implementation approach.
|
|
137
|
+
Include concrete examples where possible.>
|
|
138
|
+
|
|
139
|
+
## Scope
|
|
140
|
+
- Files likely to be modified: <list based on the actual commit diff>
|
|
141
|
+
- Do NOT modify: <files outside the commit's scope, especially tests if they exist>
|
|
142
|
+
|
|
143
|
+
## Quality Expectations
|
|
144
|
+
<Inferred from the codebase style — mention patterns visible in surrounding code.>
|
|
145
|
+
|
|
146
|
+
## Success Criteria
|
|
147
|
+
<Numbered list derived from what the commit actually changed and what tests verify.>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Important:** The instruction must describe the *problem to solve*, not the *solution*. Don't leak implementation details from the actual commit diff into the instruction. The agent should arrive at a solution independently.
|
|
151
|
+
|
|
152
|
+
Present the generated instruction to the user for review. They may want to:
|
|
153
|
+
- Remove implementation hints that leak from the diff
|
|
154
|
+
- Add context only they know (business rules, team conventions)
|
|
155
|
+
- Adjust scope (widen or narrow what the agent should touch)
|
|
156
|
+
|
|
157
|
+
### 4c: environment/Dockerfile
|
|
158
|
+
|
|
159
|
+
Generate based on the repo's tech stack (detected from files like `package.json`, `*.csproj`, `Cargo.toml`, `requirements.txt`, `go.mod`):
|
|
160
|
+
|
|
161
|
+
```dockerfile
|
|
162
|
+
FROM <base-image-for-detected-stack>
|
|
163
|
+
|
|
164
|
+
RUN apt-get update && apt-get install -y git curl wget ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
165
|
+
|
|
166
|
+
WORKDIR /app
|
|
167
|
+
# Clone at the "before" state — the commit BEFORE the fix
|
|
168
|
+
RUN git clone <repo-url> . && git checkout <before_ref>
|
|
169
|
+
|
|
170
|
+
# Install dependencies
|
|
171
|
+
RUN <dependency-install-command>
|
|
172
|
+
|
|
173
|
+
# Verify the environment builds
|
|
174
|
+
RUN <build-command>
|
|
175
|
+
|
|
176
|
+
CMD ["/bin/bash"]
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Base image selection:
|
|
180
|
+
- `.csproj` / `.sln` → `mcr.microsoft.com/dotnet/sdk:8.0`
|
|
181
|
+
- `package.json` → `node:20`
|
|
182
|
+
- `requirements.txt` / `pyproject.toml` → `python:3.12`
|
|
183
|
+
- `Cargo.toml` → `rust:1.78`
|
|
184
|
+
- `go.mod` → `golang:1.22`
|
|
185
|
+
- Other → ask the user
|
|
186
|
+
|
|
187
|
+
### 4d: tests/test.sh
|
|
188
|
+
|
|
189
|
+
If the commit includes test files, generate a verifier that runs those tests:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
#!/bin/bash
|
|
193
|
+
cd /app
|
|
194
|
+
|
|
195
|
+
echo "Step 1: Verifying build..."
|
|
196
|
+
if <build-command>; then
|
|
197
|
+
echo "✓ Build succeeded"
|
|
198
|
+
else
|
|
199
|
+
echo "✗ Build failed"
|
|
200
|
+
echo 0 > /logs/verifier/reward.txt
|
|
201
|
+
exit 1
|
|
202
|
+
fi
|
|
203
|
+
|
|
204
|
+
echo "Step 2: Running tests..."
|
|
205
|
+
if <test-command-targeting-relevant-tests>; then
|
|
206
|
+
echo "✓ Tests pass"
|
|
207
|
+
else
|
|
208
|
+
echo "✗ Tests failed"
|
|
209
|
+
echo 0 > /logs/verifier/reward.txt
|
|
210
|
+
exit 1
|
|
211
|
+
fi
|
|
212
|
+
|
|
213
|
+
echo "EVALUATION PASSED ✓"
|
|
214
|
+
echo 1 > /logs/verifier/reward.txt
|
|
215
|
+
exit 0
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
If the commit does NOT include tests, inform the user and offer options:
|
|
219
|
+
1. Write a test script that checks for the expected changes (file existence, specific patterns in code, API behavior)
|
|
220
|
+
2. Skip the verifier and rely only on assessment evaluation (not recommended)
|
|
221
|
+
3. Write the tests together with the user
|
|
222
|
+
|
|
223
|
+
### 4e: assessment_criteria.md
|
|
224
|
+
|
|
225
|
+
Generate a per-task rubric using the benchmark project's `assessment_dimensions.json`. For each dimension, create scoring criteria specific to this task:
|
|
226
|
+
|
|
227
|
+
```markdown
|
|
228
|
+
# Assessment Criteria: <Task Name>
|
|
229
|
+
|
|
230
|
+
Evaluate the agent's solution across the following dimensions.
|
|
231
|
+
|
|
232
|
+
## 1. <Dimension from assessment_dimensions.json> (0–<max_score>)
|
|
233
|
+
|
|
234
|
+
| Score | Criteria |
|
|
235
|
+
|-------|----------|
|
|
236
|
+
| 0 | <worst case — specific to this task> |
|
|
237
|
+
| ... | <intermediate levels> |
|
|
238
|
+
| <max> | <best case — specific to this task> |
|
|
239
|
+
|
|
240
|
+
**Key checks:**
|
|
241
|
+
- <What to look for in the code, specific to this task and dimension>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Present to the user for review — they know the codebase best and can add nuance.
|
|
245
|
+
|
|
246
|
+
### 4f: solution/solve.sh (optional)
|
|
247
|
+
|
|
248
|
+
Offer to generate a reference solution script that applies the actual commit diff:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
#!/bin/bash
|
|
252
|
+
cd /app
|
|
253
|
+
git cherry-pick <after_ref> --no-commit
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Or, if cherry-pick won't apply cleanly, generate a patch-based approach:
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
#!/bin/bash
|
|
260
|
+
cd /app
|
|
261
|
+
git diff <before_ref> <after_ref> | git apply
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
This is useful for verifying that `test.sh` passes on a known-good solution.
|
|
265
|
+
|
|
266
|
+
## Step 5: Verify generated tasks
|
|
267
|
+
|
|
268
|
+
After all selected tasks are generated:
|
|
269
|
+
|
|
270
|
+
1. **Confirm the benchmark project has assessment dimensions** — if `assessment_dimensions.json` is missing or empty, prompt the user to define dimensions (delegate to `nasde-benchmark-creator` Step 3).
|
|
271
|
+
|
|
272
|
+
2. **Build and test each Docker image:**
|
|
273
|
+
```bash
|
|
274
|
+
docker build -t benchmark-test-<task-name> -f tasks/<task-name>/environment/Dockerfile .
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
3. **If solution/solve.sh exists, validate the verifier:**
|
|
278
|
+
```bash
|
|
279
|
+
docker run --rm -v $(pwd)/tasks/<task-name>/solution:/solution \
|
|
280
|
+
-v $(pwd)/tasks/<task-name>/tests:/tests \
|
|
281
|
+
benchmark-test-<task-name> bash -c "
|
|
282
|
+
bash /solution/solve.sh && mkdir -p /logs/verifier && bash /tests/test.sh
|
|
283
|
+
"
|
|
284
|
+
```
|
|
285
|
+
Expected: exit 0 and `reward.txt` contains 1.
|
|
286
|
+
|
|
287
|
+
4. **Dry run** on a single task:
|
|
288
|
+
```bash
|
|
289
|
+
nasde run --variant <any-variant> --tasks <task-name> --without-eval -C <benchmark-dir>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## Tips
|
|
293
|
+
|
|
294
|
+
- **Start small.** Pick 3–5 candidates for the first pass. You can always add more later.
|
|
295
|
+
- **Prefer commits with tests.** Tasks with existing tests are much faster to set up — the verifier almost writes itself.
|
|
296
|
+
- **Don't leak the solution.** The biggest risk in generating instructions from diffs is accidentally describing HOW the problem was solved. Describe the WHAT and WHY, not the HOW.
|
|
297
|
+
- **Local repos work fine.** NASDE supports local git paths in `source.git`. No need to push to a public remote for company repos.
|
|
298
|
+
- **Combine with nasde-benchmark-creator.** This skill generates tasks; `nasde-benchmark-creator` handles the project scaffold, dimensions, and variants. Use them together.
|