export command for Claude Code and Codex: dump Agent Monitor data
export pulls sessions, events, analytics or costs out of Agent Monitor as json, csv or md, then reports where the file landed.
MIT ★ 1,198 updated 2026-10-23
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor
/plugin install ccam-devtools@claude-code-agent-monitor-pluginsWhat export does
Two arguments drive it: which dataset to pull and which file type to write. The first token accepts sessions, events, analytics, costs or all; the second accepts json, csv or md. Skip both and you get all in json.
Mechanically it is one curl against the dashboard export endpoint at http://localhost:4820/api/settings/export, saved to ccam-export-<type>.<format> in the working directory. Then come the checks: the file exists, here is the absolute path and the byte count. A short preview follows, opening lines for text formats and a cut-down pretty-printed head for JSON, and a single tally line closes the run.
The dashboard has to be running first. On a non-200 answer the command prints the error rather than claiming success, and points at npm start from the repo root. Nothing on disk is touched apart from the new file, since the endpoint only reads.
What it helps with
- hand a CSV of sessions to a spreadsheet
- grab a JSON snapshot of today's costs
- turn agent events into a markdown report
- export every dataset in one call
- confirm the write with path and byte size
Example prompts for the agent
- Export the events as CSV:
/ccam-devtools-export events csv - Dump all Agent Monitor data to markdown and print the absolute file path
- Save analytics as json, and tell me if the dashboard on
http://localhost:4820is down
How to install export
1Plugin marketplace
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor/plugin install ccam-devtools@claude-code-agent-monitor-plugins2Manually: put the files in place
.claude/commands/ccam-devtools-export.mdThe built-in /export overrides a file with the same name, so the file is renamed. Call it with /ccam-devtools-export. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/export.mdCall it with /prompts:export. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/export.prompt.mdManually: put the files in place
.gemini/commands/export.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about export
How do I install export in Claude Code?
Add the marketplace with /plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor, then install the plugin: /plugin install ccam-devtools@claude-code-agent-monitor-plugins. The command itself ships as .claude/commands/ccam-devtools-export.md.
What does the export command do?
It requests Agent Monitor data from the dashboard export endpoint and writes it to a json, csv or md file. Afterwards it shows the path, the size and a preview.
Why does my export fail?
The dashboard is probably not up, since the call goes to http://localhost:4820. Start it with npm start from the repo root and run the command again.
Source text
export.md · MIT
---
description: Export Agent Monitor data (sessions/events/analytics/costs/all) as json/csv/md.
argument-hint: "[sessions|events|analytics|costs|all] [json|csv|md]"
---
Export Agent Monitor data using the dashboard export endpoint. Arguments:
**$ARGUMENTS** — the first token is the data `type`, the second is the `format`.
- `type` ∈ `sessions | events | analytics | costs | all` (default `all`)
- `format` ∈ `json | csv | md` (default `json`)
Set `TYPE` and `FORMAT` from the args (apply the defaults if missing), then run:
```bash
TYPE="${1:-all}"; FORMAT="${2:-json}"
curl -s "http://localhost:4820/api/settings/export?type=${TYPE}&format=${FORMAT}" \
-o "ccam-export-${TYPE}.${FORMAT}"
```
Then:
1. Confirm the file was written and report its absolute path and byte size.
2. Preview the result: for `csv`/`md` print the first ~15 lines; for `json`
print a pretty-printed head (e.g. `head -c 1500` or the first array element
plus the record count).
3. Print a one-line summary: `Exported <type> as <format> → <path> (<N> records / <bytes>)`.
If the curl returns a non-200 or an error body, do not claim success — print the
error and remind the user to start the dashboard with `npm start` from the repo
root. Do not delete or overwrite any existing data; this command only reads via
the export endpoint and writes a new export file.
© Son Nguyen · MIT · hoangsonww/Claude-Code-Agent-Monitor