ami-survey
v1.2.0Measures the cost, tokens and duration of a completed agent workflow from its session log.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
ami_survey_begin
Open an AMI survey for the workflow you have just completed. Detects the runtime, session and measurement window automatically, and adopts any stage markers you buffered with ami_mark_stage while working. Call this FIRST, after the workflow's real work is finished, so the survey's own token spend is excluded from the measurements.
| Parameter | Type | Description |
|---|---|---|
workflow_description * | string | 1-3 sentences: what the workflow was given and what business work it produced. Minimum 20 characters. |
workflow_name * | string | Short reusable label for the workflow, e.g. 'Support Ticket Triage & Response'. |
adapter | string | Force a telemetry adapter instead of detecting the runtime. Rarely needed. |
cwd | string | Optional working-directory override. |
session_id | string | Optional session id override. |
transcript_path | string | Optional explicit transcript path override. |
work_unit | string | Optional, but declare it together with work_unit_count. The countable thing this workflow handled: 'ticket', 'CV', 'support email'. It is what cost and duration get divided by, so a workflow that did… |
work_unit_count | integer | Optional, but declare it together with work_unit. How many work units this run actually handled - a whole number you can point at in the output, not an estimate. |
workflow_category | string | Optional. The workflow's category, from ami_get_workflow_categories. Decides which other workflows this run is compared against; an undeclared workflow is only ever compared against itself. Take it fr… |
workflow_end_time | string | Optional ISO-8601 override for when the workflow ended. |
workflow_start_time | string | Optional ISO-8601 override for when the workflow began. Defaults to the first human turn of this session. |
ami_collect_telemetry
Measure the workflow run: detects which agent runtime you are in, reads that runtime's own call records (token usage, model, timings reported by the provider), attributes each call to a stage or observed execution phase, and stores the result on the run. Returns the collected inventory fields. Use these numbers verbatim. If your runtime has no adapter, this says so and you should use ami_record_calls instead.
| Parameter | Type | Description |
|---|---|---|
adapter | string | Force a telemetry adapter instead of detecting the runtime. Rarely needed. |
cwd | string | |
run_id | string | Defaults to the active run. |
session_id | string | |
transcript_path | string | |
window_end | string | ISO-8601 override. |
window_start | string | ISO-8601 override. |
ami_record_calls
Telemetry entry point for agents NOT running in Claude Code. Post the provider-reported usage for each API call the workflow made. Every record needs model, start_time, end_time, input_tokens, output_tokens - values read from real API responses, never estimated.
| Parameter | Type | Description |
|---|---|---|
calls * | array | Call records. |
adapter | string | Name of the runtime/SDK the records came from. |
replace | boolean | |
run_id | string | |
runtime_metadata | object | e.g. {platform, runtime, version}. |
ami_mark_stage
Declare the workflow stage you are entering, e.g. 'Classify Severity' or 'Draft Customer Reply'. Call it as you move through the workflow to get a declared-stage Agent Effort Profile; without markers the profile falls back to AMI-observed execution phases. No survey run is needed first: markers emitted before ami_survey_begin are buffered with the timestamp you emitted them at and attached to the run when it opens. When the last stage is done, call once more with closes=true - each marker ends the stage before it, so without a closing one the final stage runs to the end of the measurement wind…
| Parameter | Type | Description |
|---|---|---|
closes | boolean | True to end declared work rather than start a stage. Call this when the final stage is complete, before you verify output or report back; work after it is attributed to observed phases instead of to a… |
cwd | string | Optional workspace override; buffered markers are adopted by a run opened in the same workspace. |
marked_at | string | ISO-8601; defaults to now. |
note | string | |
run_id | string | |
stage | string | Name of the stage being entered. |
ami_get_grading_scale
Return the AMI output-quality grading scale. Read this before grading: agent_output_grade must be one of its codes and is validated on submit.
ami_get_workflow_categories
The workflow categories a run may declare itself into, and what each one covers. A category decides which other workflows this run is compared against, so read the list rather than inventing a label.
ami_get_scorecard
The scorecard for a submitted run: the AMI Maturity Index, the Performance Score, the five pillars, and structured findings. Every number and finding is computed from the run's own data - the server calls no model. If a human wants this read back as prose, write it yourself from narration_brief.findings, following the instructions there.
| Parameter | Type | Description |
|---|---|---|
run_id | string | Defaults to the run you just submitted. |
ami_write_findings
Write the judgement sections of a run's scorecard. The server computes every number and the three sections that follow from them; these four are readings of the work that no arithmetic produces, so they are yours to write. Call ami_get_scorecard first and use narration_brief.sections_awaiting_you - it carries the brief for each. Ground every sentence in the run's own evidence; do not invent industry context you were not given.
| Parameter | Type | Description |
|---|---|---|
run_id * | string | The submitted run. |
industry_next_step | string | One thing the business should decide or standardise. |
industry_opportunity | string | What this workflow being agent-run means commercially. Say so plainly if you were given no industry context. |
key_finding | string | Optional. Overrides the derived summary if you have read the output and know better than the arithmetic does. |
workflow_next_step | string | One concrete change, specific enough to act on this week. |
workflow_opportunity | string | The single biggest improvement available to this workflow. Name the stage. |
ami_get_instructions
Return the AMI survey procedure as markdown. Call this FIRST if your harness has no skill mechanism that already gave you the procedure - it tells you the call order and, for your runtime, how telemetry is obtained. Claude Code agents already have it as a skill and do not need this.
| Parameter | Type | Description |
|---|---|---|
runtime | string | Your runtime. 'mcp' (default) for any MCP client that is not Claude Code. |
ami_get_survey
Return the survey definition: every field from Collection_Inventory.csv, how each one is obtained, and which ones you must answer yourself.
ami_survey_status
Show the current values collected for the active run, which inventory fields are still empty, and what is blocking submission.
| Parameter | Type | Description |
|---|---|---|
run_id | string |
ami_submit_survey
Submit and persist the survey. Requires a grade from the AMI grading scale, a justification, and evidence (the concrete artifacts produced). Writes JSON + Markdown + a CSV index row to disk and returns the paths.
| Parameter | Type | Description |
|---|---|---|
agent_output_grade * | string | A grade code from ami_get_grading_scale. |
grade_evidence * | array | Concrete artifacts being graded: file paths, ticket ids, message ids, tool outputs. |
grade_justification * | string | Why that grade, measured against the workflow's stated requirements. At least 40 characters. |
allow_empty_telemetry | boolean | Only for deliberately unmeasured runs; measurement fields will be null. |
grader | string | 'self' when the agent grades its own output, 'human' or 'external_reviewer' when a person supplied the grade. |
run_id | string | |
workflow_description | string | |
workflow_end_time | string | |
workflow_name | string |
ami_get_report
Render the human-readable Markdown report for a run (defaults to the active run). With no run and no active run, returns the index of all submitted surveys.
| Parameter | Type | Description |
|---|---|---|
run_id | string |
ami_list_surveys
List all submitted survey responses and where they are stored.