recent — Claude Code command: what it does, how to install
recent fetches the latest Claude Code sessions from Agent Monitor with costs and run statuses. Useful when you need a quick summary of agent activity and spending.
MIT ★ 1,198 updated 2026-10-23
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor
/plugin install ccam-sessions@claude-code-agent-monitor-pluginsWhat recent does
The command queries the local Agent Monitor API at http://localhost:4820/api/sessions using curl. It requests 10 recent sessions by default, or any count passed in as an argument. The API returns records sorted by their update timestamp.
Output renders as a numbered list. Each line includes the short ID, status, model name, working directory basename, turn count, cost formatted to four decimal places in USD, and start time. At the bottom, it tallies total spending and groups sessions by state.
Without the dashboard running on port 4820, this command will not return any data. When the endpoint is unreachable, start the server with npm start in the Agent Monitor root directory.
What it helps with
- list recent Claude Code sessions from Agent Monitor
- check spending across recent agent runs in USD
- inspect session statuses and turn counts
- verify models and directories used in recent runs
Example prompts for the agent
- /recent
- /recent 5
- Show the 20 most recent sessions via Agent Monitor
How to install recent
1Plugin marketplace
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor/plugin install ccam-sessions@claude-code-agent-monitor-plugins2Manually: put the files in place
.claude/commands/recent.mdCall it with /recent. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/recent.mdCall it with /prompts:recent. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/recent.prompt.mdManually: put the files in place
.gemini/commands/recent.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about recent
How do I install recent in Claude Code?
Add the marketplace with /plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor, then install the package by running /plugin install ccam-sessions@claude-code-agent-monitor-plugins.
What does the recent command do?
It queries the local Agent Monitor API and outputs a numbered list of sessions with their status, model, directory, turn count, and cost, followed by total spending.
What should I do if the dashboard is unreachable?
Ensure the Agent Monitor service is active on localhost:4820. If it is offline, launch it with npm start from the repository root.
Source text
recent.md · MIT
--- description: List the N most recent Claude Code sessions from the Agent Monitor. argument-hint: "[N]" --- List the most recent Claude Code sessions tracked by the Agent Monitor. `N` = **$ARGUMENTS** (default `10` if empty). Fetch the most recent sessions (the API returns them most-recently-updated first): ``` curl -s "http://localhost:4820/api/sessions?limit=$ARGUMENTS" ``` This returns a session list; each entry has id, status, model, cwd, started_at, ended_at, cost, and metadata (turn_count, total_turn_duration_ms). Then print the sessions as a numbered list, one line each, in the order returned: `<rank>. <id short> — <status> — <model> — <cwd basename> — <turn_count> turns — $<cost to 4dp> — <started_at>` After the list, print the summed cost of the listed sessions and a one-line status tally (e.g. `7 completed · 2 active · 1 error`). Currency as USD to 4 decimal places. Keep it terse, no preamble. If the dashboard is unreachable, tell the user to start it with `npm start` from the repo root.
© Son Nguyen · MIT · hoangsonww/Claude-Code-Agent-Monitor