Agent artifact contract
Executable Stories can publish a behavior catalog for coding agents. Tests stay in the host framework; agents read generated artifacts.
Canonical Artifact
Section titled “Canonical Artifact”Use StoryReport v1 JSON as the stable machine contract:
executable-stories format .executable-stories/raw-run.json --format story-report-jsonDefault output (with --output-name index):
reports/index.story-report.jsonStoryReport v1 contains:
- run metadata: id, timestamps, project root, package version, git SHA, CI info
- features: title, source file, status summary
- scenarios: id, title, status, duration, tags, tickets,
covers, source line, docs, steps, attachments - steps: keyword, text, status, duration, errors, doc entries
Code → scenario (covers)
Section titled “Code → scenario (covers)”Scenarios declare the product-code paths/globs they exercise via a covers option (project-root-relative), beside tags/tickets. It travels through the StoryReport contract in every language adapter. Agents invert it with the get_scenarios_for_paths MCP tool (or GET /scenarios/covering): pass the files you’re editing, get the behavior at risk. Scenarios with no covers surface as a missing-covers warning in the behavior manifest’s debugger.
Agents should depend on this artifact before reading prose docs.
Agent Index
Section titled “Agent Index”Preferred: generate the scenario index artifact from RawRun:
executable-stories format .executable-stories/raw-run.json \ --format scenario-index-json \ --output-dir reports \ --output-name indexOutput: reports/index.scenarios-index.json
Legacy alternative (same shape, fewer metadata fields):
executable-stories list .executable-stories/raw-run.json --list-format jsonThe index includes scenario id, title, status, source file/line, tags, tickets, steps, doc kinds, and errors.
Behavior Manifest
Section titled “Behavior Manifest”For agent-oriented discovery and quality signals:
executable-stories format .executable-stories/raw-run.json \ --format behavior-manifest-json \ --output-dir reports \ --output-name indexOutput: reports/index.behavior-manifest.json — source file rollups, tag index, doc coverage, debugger warnings (missing tags, missing source lines, etc.).
Release Manifest
Section titled “Release Manifest”For release evidence, generate a tested-together manifest:
executable-stories format .executable-stories/raw-run.json \ --format release-manifest \ --output-dir reports \ --output-name indexOutput: reports/index.release-manifest.md.
The manifest records scenario ids, titles, statuses, source files, tags, branch/commit metadata when present, and a SHA-256 hash built from the exact scenario/status set. Use it when an agent or reviewer needs to confirm what batch was tested before a release.
Agent Loop
Section titled “Agent Loop”- Run framework tests.
- Generate StoryReport + index + manifest.
- Query failing scenarios or browse the index.
- Inspect scenario source files.
- Change product code or tests.
- Rerun focused or full tests.
- Regenerate artifacts.
The framework remains the execution layer. Executable Stories supplies behavior context and evidence.
For loop-shaped, unattended agents, three commands wrap this loop: triage (the worklist of what to fix), check (the per-turn backpressure signal), and goal (a behavioral definition-of-done with an anti-fake-done ratchet). See Agent loops and backpressure.
Use executable-stories-mcp when an MCP-capable agent needs direct tools:
npx executable-stories-mcpRead-only tools:
list_scenarios(optionalstatuses/tags/sourceFilesfilters)get_scenarioget_failing_scenariosget_scenarios_for_paths— code→scenario via declaredcoversget_feature_summaryget_scenario_indexget_behavior_manifestget_behavior_diff— regressed / fixed / added / removed between two reportsget_deployment_status— latest recorded deployment per environmentget_environment_drift— scenarios only in one environment and status drift for shared scenarios
Execution tool:
run_scenario— runs one scenario through vitest, jest, playwright, or cypress
Each tool reads StoryReport v1 JSON. By default it uses:
reports/index.story-report.jsonPass reportPath to use another file. See MCP server.
Live index (watch)
Section titled “Live index (watch)”Keep the agent artifacts fresh while you work. executable-stories watch regenerates the requested formats whenever the framework rewrites its raw-run file:
executable-stories watch reports/raw-run.json \ --format story-report-json,scenario-index-json,behavior-manifest-json \ --output-dir reports \ --output-name indexPair it with the host framework’s own watch mode (vitest --watch, jest --watch, …): tests rerun on code change → raw-run is rewritten → the index regenerates automatically. It is language-agnostic — any adapter that emits a raw-run drives it. Change events are debounced and overlapping runs are coalesced. The same step is available programmatically via startWatch / regenerateArtifacts from executable-stories-formatters.
CI Recipe
Section titled “CI Recipe”Recommended CI flow:
pnpm testexecutable-stories format reports/raw-run.json \ --format story-report-json,scenario-index-json,behavior-manifest-json,release-manifest,traceability-matrix,html,markdown \ --output-dir reports \ --output-name indexPublish as CI artifacts:
reports/index.story-report.jsonreports/index.scenarios-index.jsonreports/index.behavior-manifest.jsonreports/index.release-manifest.mdreports/index.traceability-matrix.md
Example apps expose pnpm report:agents with this recipe.