Skip to main content
command CX Codex

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

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor
/plugin install ccam-sessions@claude-code-agent-monitor-plugins
Open on GitHub

What 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-plugins

2Manually: put the files in place

.claude/commands/recent.md

Call it with /recent. For all projects use ~/.claude/commands/

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

Similar slash commands

All slash commands for Agent setup: memory, context, orchestration →

From the same set155

The whole set →
debug-live-issue debug-live-issue walks an agent through incident-style debugging: pin down the symptom, isolate the subsystem, reproduce, prove the cause, then apply a minimal fix. CX Codex +1 ★ 1,198repo stars overspend overspend spots the most expensive Claude Code sessions via a local dashboard and displays them in a ranking table. Useful when spending spikes unexpectedly. CX Codex +1 ★ 1,198repo stars top-spenders top-spenders sorts Claude Code sessions by cost and lists the most expensive ones. Use it to inspect session spending and compare the top entries with the total. CX Codex +1 ★ 1,198repo stars runs Pulls recent Workflow-tool fleet runs from the local Agent Monitor and prints a status summary plus a compact table of the latest ones. CX Codex +1 ★ 1,198repo stars ship-feature ship-feature — a workflow for taking medium or large feature changes from module inspection through implementation, verification, and documentation updates. Covers backend, frontend, and MCP work. CX Codex +1 ★ 1,198repo stars budget Puts your Claude spend next to a monthly budget you name, then tells you whether you are under it, on pace or already over. CX Codex +1 ★ 1,198repo stars tail-events tail-events fetches recent events from a local Agent Monitor dashboard and displays them in a compact table. Useful for tracking agent tool calls and session state. CX Codex +1 ★ 1,198repo stars mcp-operations The mcp-operations skill guides local MCP server checks, host configuration, and safety settings. Use it when tool connectivity fails or MCP behavior changes. CX Codex +1 ★ 1,198repo stars

Project sponsors

Companies that keep this analytics open