find-session — Claude Code command: session search
find-session searches Agent Monitor sessions by project path, model, or status and prints the top matches. Useful for checking recent or active runs.
MIT ★ 1,198 updated 2026-10-23
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor
/plugin install ccam-sessions@claude-code-agent-monitor-pluginsWhat find-session does
The command fetches Agent Monitor sessions from http://localhost:4820/api/sessions?limit=200. A query can contain a project or working-directory fragment, a model name or ID fragment, and a status. With no query, it shows the most recent sessions.
Filtering is case-insensitive for cwd and model terms, while status must match the session status. Results are sorted by start time unless the query includes cost or expensive, which switches the order to descending cost. Up to 10 rows include a short ID, status, model, directory name, USD cost, and start time, followed by the match count and total cost of the displayed rows.
Agent Monitor must be available at the local endpoint. If the dashboard cannot be reached, start it with npm start from the repository root. When there are no matches, the command lists the cwd and model values found in the returned sessions.
What it helps with
- find sessions by project path
- filter runs by model name
- list active or completed sessions
- rank expensive runs by cost
- count matches and total shown cost
Example prompts for the agent
- Run
/plugin:find-sessionand show the latest sessions. - Use
/plugin:find-sessionto findactivesessions formy-app. - Run
/plugin:find-sessionfor the most expensiveopussessions.
How to install find-session
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/find-session.mdCall it with /find-session. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/find-session.mdCall it with /prompts:find-session. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/find-session.prompt.mdManually: put the files in place
.gemini/commands/find-session.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about find-session
How do I install find-session in Claude Code?
Add the marketplace with /plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor, then install the plugin with /plugin install ccam-sessions@claude-code-agent-monitor-plugins. The command file is .claude/commands/find-session.md.
What does find-session do?
It searches Agent Monitor sessions by working-directory fragment, model, and status. The command prints up to 10 matches with cost and start time, then reports the match count and displayed cost total.
What does find-session need to run?
Agent Monitor must respond at http://localhost:4820. If the dashboard is unreachable, start it from the repository root with npm start.
Source text
find-session.md · MIT
--- description: Search Agent Monitor sessions by cwd, model, or status and print the top matches. argument-hint: "[query]" --- Search Claude Code sessions tracked by the Agent Monitor and print the top matches. The query is **$ARGUMENTS** — any mix of a project / cwd substring, a model (`opus`/`sonnet`/`haiku` or a model-id fragment), and a status (`active`/`working`/`completed`/`error`). If empty, just show the most recent sessions. Fetch the session list (each carries an inline `cost` field): ``` curl -s "http://localhost:4820/api/sessions?limit=200" ``` Then: 1. Filter in-memory: keep sessions whose `cwd` contains the project term (case-insensitive), whose `model` contains the model term, and whose `status` equals the status term — apply only the terms present in `$ARGUMENTS`. 2. Sort matches by `cost` descending if the query mentions cost/expensive, otherwise by `started_at` descending (most recent first). 3. Print the top 10 as a numbered list, one line each: `<rank>. <id short> — <status> — <model> — <cwd basename> — $<cost to 4dp> — <started_at>` 4. End with the match count and the summed cost of the shown matches. Currency as USD to 4 decimal places. If nothing matches, say so and list the distinct cwds/models that DO exist (from the returned data) so the user can refine — do not invent results. 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