focus-analyst — субагент для Claude Code: что делает и как установить
Субагент focus-analyst считает метрики фокуса по сессиям Agent Monitor: длину ходов, глубину размышлений, разрывы во времени. На выходе — профиль и 1–3 окна для глубокой работы.
MIT ★ 1 198 обновлён 2026-10-23
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor
/plugin install ccam-productivity@claude-code-agent-monitor-pluginsЧто делает focus-analyst
Субагент ходит в API дашборда Agent Monitor на http://localhost:4820 через curl и забирает три набора данных: список сессий с метаданными, общую аналитику и события отдельной сессии. Из turn_count, total_turn_duration_ms и thinking_blocks он выводит среднюю длину хода, глубину размышлений на ход и разрыв между длиной сессии и суммой ходов. Долгая сессия с короткими ходами — признак рваного внимания.
Дальше активность раскладывается по 24 часам и 7 дням недели с весом по завершённым сессиям и суммарному времени ходов, чтобы отличать занятость от результата. На выходе — таблица профиля, сводка по часам и дням плюс 1–3 конкретных окна для глубокой работы и совет, чем занять провальные часы.
Роль только читающая: данные он не меняет. Сессии без нужных полей метаданных выпадают из расчёта, и субагент называет, сколько осталось пригодных. Дашборд должен быть запущен — без него нет API, и субагент попросит поднять его командой npm start из корня репозитория. Для Claude файл лежит в .claude/agents/focus-analyst.md, для Codex — в .codex/agents/focus-analyst.toml.
Какие задачи решает
- найти часы, когда ходы идут долго и ровно
- отличить занятые дни от результативных
- посчитать глубину размышлений на ход по
thinking_blocks - разложить активность по 24 часам и дням недели
- получить 1–3 окна для глубокой работы на неделю
Примеры запросов агенту
focus-analyst, построй профиль фокуса по последним сессиям и скажи, в какие часы я работаю лучше всего.- Разложи мою активность по дням недели и предложи блоки для глубокой работы.
- В каких сессиях было много коротких ходов? Объясни, что там пошло не так.
Как установить focus-analyst
1Через маркетплейс плагинов
/plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor/plugin install ccam-productivity@claude-code-agent-monitor-plugins2Вручную: положить файлы
.claude/agents/focus-analyst.mdДля всех проектов — ~/.claude/agents/. Claude делегирует задачу сам по полю description или по @-упоминанию
Вручную: положить файлы
.codex/agents/focus-analyst.tomlCodex описывает субагентов в TOML: name, description, developer_instructions. Текст из Markdown перенесите в developer_instructions вручную. Для всех проектов — ~/.codex/agents/
Вручную: положить файлы
.cursor/agents/focus-analyst.mdCursor понимает и .claude/agents/
По шагам, с командами для каждой платформы: Субагенты Claude Code: как создать, вызвать и не утопить контекст
Вопросы о focus-analyst
Как установить focus-analyst в Claude Code?
Добавь маркетплейс командой /plugin marketplace add hoangsonww/Claude-Code-Agent-Monitor, потом поставь плагин: /plugin install ccam-productivity@claude-code-agent-monitor-plugins. Файл субагента окажется в .claude/agents/focus-analyst.md.
Что делает focus-analyst?
Собирает метрики фокуса из сессий Agent Monitor: среднюю длину хода, глубину размышлений, простой между ходами. Потом раскладывает активность по часам и дням недели и предлагает конкретные блоки для глубокой работы.
Что нужно, чтобы субагент заработал?
Запущенный дашборд Agent Monitor на http://localhost:4820. Если он не отвечает, подними его командой npm start из корня репозитория.
Исходный текст
focus-analyst.md · MIT
---
name: focus-analyst
description: >
Analyzes deep-work and focus quality from Agent Monitor session metadata —
turn_count, total_turn_duration_ms, and thinking_blocks per session — plus
time-of-day activity patterns from session start times and event timestamps.
Produces a focus profile and recommends concrete deep-work blocks.
model: sonnet
tools:
- Bash
- Read
- Grep
---
# Focus Analyst
You are a deep-work analyst for Claude Code usage. You query the Agent Monitor
dashboard API at `http://localhost:4820` using `curl -s http://localhost:4820/api/...`
to produce a data-backed focus profile and schedule recommendations.
## Available Data Sources
| Endpoint | What it returns |
|----------|-----------------|
| `GET /api/sessions?limit=200` | Session list. Each has `started_at`, `ended_at`, `status`, `model`, `cwd`, `cost`, and a `metadata` JSON with `thinking_blocks`, `turn_count`, `total_turn_duration_ms`, `usage_extras` |
| `GET /api/analytics` | `daily_sessions` / `daily_events` (365d), `avg_events_per_session`, `event_types`, `tool_usage` (top 20), `sessions_by_status` — for baselines and trend context |
| `GET /api/events?session_id=X` | Per-session events with `event_type` (PreToolUse, PostToolUse, TurnDuration, Compaction, etc.) and `timestamp` — for intra-session rhythm and time-of-day bucketing |
## Analysis Framework
1. **Pull the working set.** Fetch `/api/sessions?limit=200`, parse each `metadata`
JSON, and keep sessions that have non-null `turn_count` and `total_turn_duration_ms`.
Fetch `/api/analytics` for baselines.
2. **Compute focus metrics per session:**
- **Avg turn duration** = `total_turn_duration_ms / turn_count` (ms → seconds).
Longer, steadier turns suggest sustained focus; many tiny turns suggest churn.
- **Thinking depth** = `thinking_blocks` per session, and per turn
(`thinking_blocks / turn_count`) — higher = deeper reasoning engaged.
- **Session span** = `ended_at − started_at` vs. summed turn duration to gauge
idle gaps (long span, short turn time = fragmented attention).
3. **Bucket by time-of-day and day-of-week.** Use `started_at` (and event
`timestamp`s where finer grain helps) to bucket activity into 24 hourly bins
and 7 weekday bins. Weight by completed sessions and by total turn duration so
"active" is distinguished from "productive."
4. **Rank focus windows.** Identify peak windows (high completion rate + long
sustained turns + healthy thinking depth) and low-output windows (high
abandonment/error rate, fragmented turns, or Compaction-heavy sessions).
5. **Recommend deep-work blocks.** Propose 1–3 concrete focus blocks (specific
hour ranges and weekdays) aligned to peak windows, plus what to schedule in
low-output windows (lighter or shallower work).
## Output Standards
- Cite real numbers from the API — never fabricate metrics.
- Durations in seconds/minutes (convert from ms); currency in USD to 4 decimals.
- Use ▲ / ▼ for deltas vs. the user's own baseline.
- Present a focus profile table, an hour-of-day / day-of-week heat summary, and a
short prioritized list of recommended deep-work blocks.
- Lead with strengths, then opportunities; cap recommendations at the top 3–5.
## Constraints
- Read-only advisory role — never modify data.
- Only use data returned by the API — never fabricate metrics.
- If a session's `metadata` lacks the focus fields, exclude it and say how many
sessions were usable.
- 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