ami-survey

v1.2.0
io.github.speedofred/ami-survey Checked 2 days ago Published 2 months ago

Measures 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.

ParameterTypeDescription
workflow_description *string1-3 sentences: what the workflow was given and what business work it produced. Minimum 20 characters.
workflow_name *stringShort reusable label for the workflow, e.g. 'Support Ticket Triage & Response'.
adapterstringForce a telemetry adapter instead of detecting the runtime. Rarely needed.
cwdstringOptional working-directory override.
session_idstringOptional session id override.
transcript_pathstringOptional explicit transcript path override.
work_unitstringOptional, 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_countintegerOptional, 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_categorystringOptional. 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_timestringOptional ISO-8601 override for when the workflow ended.
workflow_start_timestringOptional 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.

ParameterTypeDescription
adapterstringForce a telemetry adapter instead of detecting the runtime. Rarely needed.
cwdstring
run_idstringDefaults to the active run.
session_idstring
transcript_pathstring
window_endstringISO-8601 override.
window_startstringISO-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.

ParameterTypeDescription
calls *arrayCall records.
adapterstringName of the runtime/SDK the records came from.
replaceboolean
run_idstring
runtime_metadataobjecte.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…

ParameterTypeDescription
closesbooleanTrue 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…
cwdstringOptional workspace override; buffered markers are adopted by a run opened in the same workspace.
marked_atstringISO-8601; defaults to now.
notestring
run_idstring
stagestringName 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.

ParameterTypeDescription
run_idstringDefaults 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.

ParameterTypeDescription
run_id *stringThe submitted run.
industry_next_stepstringOne thing the business should decide or standardise.
industry_opportunitystringWhat this workflow being agent-run means commercially. Say so plainly if you were given no industry context.
key_findingstringOptional. Overrides the derived summary if you have read the output and know better than the arithmetic does.
workflow_next_stepstringOne concrete change, specific enough to act on this week.
workflow_opportunitystringThe 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.

ParameterTypeDescription
runtimestringYour 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.

ParameterTypeDescription
run_idstring

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.

ParameterTypeDescription
agent_output_grade *stringA grade code from ami_get_grading_scale.
grade_evidence *arrayConcrete artifacts being graded: file paths, ticket ids, message ids, tool outputs.
grade_justification *stringWhy that grade, measured against the workflow's stated requirements. At least 40 characters.
allow_empty_telemetrybooleanOnly for deliberately unmeasured runs; measurement fields will be null.
graderstring'self' when the agent grades its own output, 'human' or 'external_reviewer' when a person supplied the grade.
run_idstring
workflow_descriptionstring
workflow_end_timestring
workflow_namestring

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.

ParameterTypeDescription
run_idstring

ami_list_surveys

List all submitted survey responses and where they are stored.