agentleFS
sugatoraysugatoray/aiskills/skills/productivity/agent-sessions-insight/SKILL.md

agent-sessions-insight

Skill6 starsChanged 11 days agoMITView on GitHub

Analyze how often and for what kinds of work the user uses their coding agents (Claude Code, Codex CLI, Pi, OpenCode, GitHub Copilot CLI, Devin CLI, Grok CLI, or any other agent that writes JSONL session logs), from the session logs on their own machine, and present it as one tabbed, offline HTML report: sessions, active days, prompts, session length, busiest months/weekdays/hours, projects, tools, slash commands, test runs, doc-file edits, and a per-agent split. Use when the user invokes /agent-sessions-insight (or $agent-sessions-insight, /skill:agent-sessions-insight), or asks how they use Claude Code, Codex, Pi, OpenCode, Copilot CLI, Devin or Grok, how often, what they use it for, or for a usage review of their coding agents. Read-only and offline: it never changes the agents' data and sends nothing anywhere.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 6 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never count by hand and never estimate a number you can compute.

    line 19
  2. Very specific:

    Leave README.md, CHANGELOG.md, meta/ and scripts/make_demo.py (it rebuilds the bundled demo) for maintainers.

    line 21
  3. Very specific:

    Read-only: Never write into, move or delete anything under an agent's data folder (~/.claude, ~/.codex, ~/.pi, ~/.local/share/opencode, …

    line 26
  4. Distinctive:

    Say what's missing: If an agent has no logs or the logs are thin, say so.

    line 30
  5. Very specific:

    If the user names an agent that isn't known, use --extra NAME=PATH and ask where its logs live.

    line 44
  6. Very specific:

    Run the script from this skill's directory (the folder that contains scripts/).

    line 49
  7. Very specific:

    Add --agents codex,pi or --extra NAME=PATH as needed.

    line 58
  8. Distinctive:

    Before writing anything, work out these from the JSON and keep each as a sentence you can defend:

    line 83
  9. Distinctive:

    Agents: when more than one agent has sessions, compare how the user splits work between them.

    line 90
  10. Very specific:

    Don't write the HTML yourself.

    line 94
  11. Very specific:

    Write agent-sessions-insight-insights.json in the working directory.

    line 96
  12. Very specific:

    Every number in your insights matches summary (spot-check at least five).

    line 134
  13. Distinctive:

    If a browser tool is available, open the file and check each tab renders, with no console errors and no network requests.

    line 135
  14. Distinctive:

    Don't edit the built HTML.

    line 136

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Agent sessions insight

Turn the session logs a coding agent already keeps into a report about how the user works with it. The numbers come from scripts/collect.py; you add the reading of them. Never count by hand and never estimate a number you can compute.

Leave README.md, CHANGELOG.md, meta/ and scripts/make_demo.py (it rebuilds the bundled demo) for maintainers. Read meta/MAINTAINERS.md only when changing the collector or adding an agent.

Rules

  1. Read-only. Never write into, move or delete anything under an agent's data folder (~/.claude, ~/.codex, ~/.pi, ~/.local/share/opencode, ~/.copilot, ~/.local/share/devin, ~/.grok, …). The collector only reads. Write the outputs to the current working directory.
  2. Offline. Make no network calls. The report is one self-contained HTML file with inline CSS and JS: no CDN, no web fonts, no fetch.
  3. Private by default. Session logs hold prompts, file paths and project names. Don't publish, upload or share the report, and don't paste prompt text into chat beyond the short snippets the collector keeps (160 characters), unless the user asks. If an artifact or sharing tool exists, tell the user the report is local and offer it; don't publish unasked.
  4. Exact vs judged. Counts the collector returns are exact. Anything you infer (what kind of work a project is, a habit, a friction point) is your reading: label it as judgement and base it on the visible evidence (project names, first prompts, tools, slash commands).
  5. Say what's missing. If an agent has no logs or the logs are thin, say so. Don't fill the gap with guesses.

Invocation

/agent-sessions-insight [options]. Use the form your agent supports: /agent-sessions-insight (Claude Code, Pi, OpenCode), $agent-sessions-insight (Codex CLI), /skill:agent-sessions-insight (Pi), or just ask for it by name.

OptionDefaultContract
--days N180Look-back window. Sessions that started earlier are ignored.
--agents a,bAll known agents that have logsLimit to: claude-code, codex, pi, opencode, copilot-cli, devin, grok.
--extra NAME=PATHNoneOverride where a known agent keeps its logs, or read another agent's JSONL folder with the generic parser (e.g. --extra hermes=~/.hermes/sessions). Repeatable.
--outputagent-sessions-insight.html in the working directoryPath of the HTML report.
--demoOffSkip collecting; write the bundled demo report (made-up data) with build_report.py --demo, so the user can see what they'll get.

If the user names an agent that isn't known, use --extra NAME=PATH and ask where its logs live.

1. Check the environment

  • Python 3.9+ must be available (python3 --version). If it isn't, say so and stop; don't hand-parse logs.
  • Run the script from this skill's directory (the folder that contains scripts/).
  • If the agent runs in a sandbox that can't see the user's home folder (a cloud session, a container), the logs aren't reachable. Say so, and give the user the command from step 2 to run locally, then ask them to attach the JSON it writes.

2. Collect

python3 scripts/collect.py --days 180 --out agent-sessions-insight-data.json

Add --agents codex,pi or --extra NAME=PATH as needed. --home DIR changes the base folder (default: the user's home).

Exit codeMeaningWhat to do
0Wrote the JSON and printed the summaryContinue
1No sessions in the windowSay where it looked; offer a larger --days or an --extra path
2Unknown agent nameFix the name, or pass it with --extra

Where each agent's logs are read from (relative to --home):

AgentFolderFormat
Claude Code (claude-code).claude/projects/<project>/<session>.jsonlJSONL
Codex CLI (codex).codex/sessions/…/rollout-*.jsonlJSONL
Pi (pi).pi/agent/sessions/…/*.jsonlJSONL
OpenCode (opencode).local/share/opencode/storage/… or its SQLite databaseJSON files / SQLite (read-only)
GitHub Copilot CLI (copilot-cli).copilot/session-state/<id>/events.jsonlJSONL; schema undocumented, tolerant parser
Devin CLI (devin).local/share/devin/cli/sessions/<id>/log.jsonl (+ meta.json), or the older sessions.dbJSONL / SQLite (read-only)
Grok CLI (grok).grok/sessions/<encoded cwd>/<id>/updates.jsonl (+ summary.json), or chat_history.jsonlJSONL; subagent sessions skipped
Any other (--extra NAME=PATH)The folder you giveGeneric JSONL parser

The JSON has two keys. summary: window_days, sessions, active_days, prompts, first, last, median_minutes, longest_minutes, median_gap_days, longest_gap_days, per_agent, per_month, per_weekday, per_hour, projects, tools, commands, doc_edits, test_runs. sessions: one row per session with agent, a shortened id, project, start, minutes, prompts, first_prompt (at most 160 characters), top_tools and commands.

3. Read the data

Before writing anything, work out these from the JSON and keep each as a sentence you can defend:

  • How often: sessions, active days out of the window, median and longest gap between active days, busiest month, weekday and hour. Say whether use is daily, in bursts or occasional.
  • How long: median and longest session in minutes, and prompts per session.
  • What for: group projects and first prompts into a handful of kinds of work (for example building a tool, fixing a bug, docs and planning, research, refactoring, setup). Say which project names and first prompts led you to each group. This is judgement.
  • How: the top tools, the slash commands, how many test runs there were relative to sessions, and edits to doc files (CLAUDE.md, AGENTS.md, HANDOFF.md, MEMORY.md, SPEC.md, README.md, CHANGELOG.md). Test runs next to heavy editing suggest a test-first habit; say it as a suggestion, not a fact.
  • Friction: long sessions, long gaps, sessions with many prompts and few tool calls, repeated first prompts. Mark each as a possible friction point, not a conclusion.
  • Agents: when more than one agent has sessions, compare how the user splits work between them.

4. Build the report

Don't write the HTML yourself. Put your reading from step 3 in a small JSON file, then let the build script fill the bundled template (assets/agent-sessions-insight.html) with it and the collector's numbers.

Write agent-sessions-insight-insights.json in the working directory. Every key is optional; leave one out rather than guess:

{
  "overview": ["Three to five plain sentences: how often, what for, the habit or friction that stands out."],
  "kinds": [{"name": "Building features", "sessions": 30, "projects": ["taskq-cli"],
             "examples": ["Add a --json flag to the status command"], "evidence": "project names, first prompts"}],
  "habits": [{"title": "Tests next to edits", "detail": "126 test runs in 64 sessions.",
              "evidence": "pytest in Bash calls across billing-api and taskq-cli"}],
  "friction": [{"title": "Very long sessions.", "detail": "The longest ran 188 minutes.",
                "evidence": "taskq-cli, 22 Sep"}],
  "threads": [{"thread": "taskq-cli: sync on large repos", "next": "Profile it before changing the walker.",
               "when": "last seen 18 Nov"}],
  "agents": ["Only when more than one agent has sessions: how the work is split."],
  "caveat": "Which agents' logs were read, which weren't found, the window, and any format caveat below."
}
  • sessions in kinds is your estimate; the counted figures stay in the summary.
  • Give every habit and friction point an evidence: where it shows (projects, dates, a tab or chart). A habit can also be a plain sentence, but evidence makes it checkable.
  • threads is work that looks unfinished: a session whose last prompts were mid-task, or a first prompt that keeps coming back. Say what the next step looks like. Leave it out if nothing stands out.
  • caveat is shown at the top of the page as "What this is based on". Always write it: which agents' logs were read, which weren't found, the window, and any caveat from "Data caveats" below that applies.
  • Copy prompt snippets only from first_prompt, never from anywhere else in the logs.
python3 scripts/build_report.py --data agent-sessions-insight-data.json \
  --insights agent-sessions-insight-insights.json --output agent-sessions-insight.html
Exit codeMeaningWhat to do
0Wrote the reportContinue
2The data or insights JSON is invalidRead the error (it names the key), fix the insights file, run again. Don't edit the collector's JSON by hand

The page has eight tabs: Overview, Frequency (months stacked by agent), Kinds of work, Habits (numbered cards with evidence), Friction (with the open threads), Agents (shown only when more than one agent has sessions), Exact numbers, and Data (a filterable table of sessions). Counted figures are marked exact and your sentences judgement. It works offline, follows the system's light or dark setting with a button to override it, and fits a phone. To show the user what the report looks like before collecting anything, run python3 scripts/build_report.py --demo --output agent-sessions-insight-demo.html; it copies the template, which holds made-up demo data, byte for byte.

5. Verify

  • Every number in your insights matches summary (spot-check at least five).
  • If a browser tool is available, open the file and check each tab renders, with no console errors and no network requests.
  • Don't edit the built HTML. To change it, change the insights file and build again.

6. Deliver

Give the user:

  1. The HTML file (send or link it; don't paste its source), the data JSON and the insights JSON.
  2. Four or five sentences: how often they use their agents, for what, and the one or two habits or friction points that stand out. Mark which statements are exact and which are your reading.
  3. What's missing: agents with no logs, formats that were only partly read (see below), and the window used.

Data caveats (say these when they apply)

  • OpenCode SQLite: column names are inferred. A database whose tables differ is skipped, not guessed at; its JSON storage, if present, is still read.
  • Copilot CLI: the event schema isn't documented. Dates, session counts and lengths should be reliable; prompt and tool counts may be zero.
  • Devin CLI: the log format isn't documented; the adapter follows the layout other tools have observed (per-session log.jsonl in newer versions, sessions.db in older ones). Sessions, dates and prompts should be reliable; tool counts are read from assistant tool_calls and may be zero if your version records them elsewhere.
  • Grok CLI: the log format isn't documented; the adapter follows the layout other tools have observed (one folder per session under ~/.grok/sessions/, with summary.json and updates.jsonl). Subagent sessions are skipped, like Claude Code's sidechains. A session with only chat_history.jsonl has no per-message times, so its length is created_at to updated_at. If GROK_HOME moves the folder, pass --extra grok=$GROK_HOME/sessions.
  • Generic parser (Hermes and others): reads timestamps, user messages and tool calls where they are recognisable. Treat its prompt and tool counts as approximate.
  • Session length is first to last event in the log, so a session left open overnight reads as long.
  • Local time: days, weekdays and hours use the machine's local timezone.
  • Retention: an agent may delete old logs, so a long window can undercount early months.

Extending to another agent (red/green)

To support an agent whose format the collector doesn't read yet, follow meta/MAINTAINERS.md: write a failing test with a fixture of the agent's log first, then the parse_<agent> function, then register it in AGENTS. For a one-off, try --extra NAME=PATH first; the generic parser may already be enough.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.