Repository navigation
028: benchmark expansion — agent/skill/generate commands - #12
Conversation
- Add AgentScores, SkillBenchmarkEntry, SkillScores dataclasses - Extend ScoresFile with agents + skills dicts (backward compatible) - Refactor run_promptfoo() with optional config_path parameter - Add parse_skill_results() and infer_dimension() functions - 27 tests, all passing Co-Authored-By: iEVO <team-lead> <noreply@ievo.ai>
- Add `cortex benchmark agent <overlay-path>` Typer subcommand - Uses tempfile.TemporaryDirectory for combined kernel+overlay prompt - Injects combined prompt into a copy of the base promptfoo config - Stores agent scores under scores.json "agents" key (per-agent baseline) - Appends to runs.jsonl with type="agent" and agent=<name> - Extend append_run_log() with run_type and extra params - 7 new CLI tests, all passing (166 total) Co-Authored-By: iEVO <team-lead> <noreply@ievo.ai>
…e config - Add `cortex benchmark skill <skill-path>` Typer subcommand - Injects skill content as system prompt at runtime into a temp promptfoo config - Prints per-test pass/fail and overall pass rate; always exits 0 (report only) - Stores skill scores under scores.json "skills" key - Adds append_skill_run_log() for skill-specific JSONL entries - Create benchmarks/skills/ievo.yaml reference skill test config (2 test cases) - 6 new CLI tests, all passing (172 total) Co-Authored-By: iEVO <team-lead> <noreply@ievo.ai>
- Add `cortex benchmark generate <rule-text> [--dimension] [--append]` command - Uses Anthropic SDK (lazy import, dev dependency) to generate test cases - Dimension inferred via keyword map if --dimension not provided - --append flag does YAML round-trip append to promptfooconfig.yaml - Add generate_test_case() + _GENERATE_SYSTEM_PROMPT to benchmark.py - Add anthropic to pyproject.toml dev dependencies - 9 new tests (2 unit + 7 CLI), all passing (181 total) Co-Authored-By: iEVO <team-lead> <noreply@ievo.ai>
- Add test_benchmark_028_integration.py: 16 end-to-end tests covering AC-1 through AC-7 - Verify agent + skill + kernel scores coexist in scores.json - Verify backward compat: old scores.json without agents/skills loads cleanly - Final test count: 197 tests, all passing Co-Authored-By: iEVO <team-lead> <noreply@ievo.ai>
|
Direction check FAIL — the following acceptance criteria are not fully addressed in the PR description: AC-1 — Error handling for missing files not confirmed. The AC requires:
AC-2 — AC-3 — Error handling not confirmed. The AC requires:
AC-5 — Generated test case structure not confirmed. The AC requires the output to have:
AC-6 — Error messages and generation config not confirmed. The AC requires:
Please update the PR description to explicitly address each of these points. |
Architect Review — FAILTask: 028 | Branch: feat/028-benchmark-expansion Plan verifiedAll 8 plan points verified against implementation:
Deviation foundQ-001-arch — Plan (Architecture Notes):
Implementation:
The deviation is intentional — skill runs lack the naked/kernel dual-score structure that Impact: Full deviation report: Decision required: Accept the deviation (plan was wrong about skill data shape) or redesign |
- Add `from typing import Any` and annotate all bare `dict` with `dict[str, Any]` - Annotate `SkillScores.mutations` as `list[dict[str, Any]]` (was bare `list`) - Wrap `yaml.safe_load(generated_yaml)` in try/except for malformed LLM output - All 197 tests pass Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
cortex benchmark agent <overlay-path>— runs promptfoo with kernel+overlay combined system prompt, prints 6-dimension table, exits 0scores.json["agents"]["<name>"]["baseline"]+ mutations array;runs.jsonlentries taggedtype=agentcortex benchmark skill <skill-path>— looks upbenchmarks/skills/<name>.yaml, injects skill as system prompt, prints per-test pass/fail + overall, always exits 0benchmarks/skills/ievo.yamlreference config created (2 test cases); skill scores stored underscores.json["skills"]cortex benchmark generate <rule-text> [--dimension] [--append]— generates promptfoo test case via Anthropic API, stdout by default,--appenddoes YAML round-trip intopromptfooconfig.yamlcheck_api_key()+.envloading; lazyimport anthropic;anthropicadded to dev depsArchitecture changes
benchmark.py: new dataclasses (AgentScores,SkillBenchmarkEntry,SkillScores), extendedScoresFile(backward compatible — missingagents/skillskeys default to{}), refactoredrun_promptfoo(config_path=None), newparse_skill_results(),infer_dimension(),generate_test_case(),append_skill_run_log()cli.py: 3 newbenchmark_appcommands (agent,skill,generate),import tempfilepromoted to module levelTest plan
uv run pytest tests/ -q→ 197 passed, 0 faileduv run ruff check src/cortex/ tests/→ all checks passedscores.json(withoutagents/skills) loads without errorTemporaryDirectorycontext manager ensures cleanup even on failurescores.jsonwithout overwriting each other🧬 Evolved with iEVO