agent-session-forensics

agent-session-forensics is a skill for Claude Code from yeaight7/agent-powerups. It costs 31 tokens per session (685 once invoked), scanned A, original, Apache-2.0.

A procedure for examining an AI agent's session history, tool calls, results, and timing when a session or tool loop behaves unexpectedly.

In plain words
What is it for?
It helps investigate agent traces and timing using read-only inspection of session files and JSON history.
Why use it?
Missing tool results, interrupted calls, duplicate messages, and slow steps are hard to diagnose without matching calls to their results.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions subagents.

Part of the dev-vitals plugin — 14 skills, 4 commands, 1 agent shipped together

Good fit It helps investigate agent traces and timing using read-only inspection of session files and JSON history.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/yeaight7/agent-powerups/agent-session-forensics
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add yeaight7/agent-powerups --skill agent-session-forensics
Clone the repo
git clone --depth 1 https://github.com/yeaight7/agent-powerups

Made for: Claude Code.

Or install dev-vitals, the plugin that ships this one along with the rest of its 14 skills, 4 commands, 1 agent.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for agent-session-forensics

README.md
[![agentmods](https://agentmods.dev/badge/skills/yeaight7/agent-powerups/agent-session-forensics/github.svg)](https://agentmods.dev/skills/yeaight7/agent-powerups/agent-session-forensics)
Your own site
<a href="https://agentmods.dev/skills/yeaight7/agent-powerups/agent-session-forensics"><img src="https://agentmods.dev/badge/skills/yeaight7/agent-powerups/agent-session-forensics/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for agent-session-forensics

Your own site · 80×15
<a href="https://agentmods.dev/skills/yeaight7/agent-powerups/agent-session-forensics"><img src="https://agentmods.dev/badge/skills/yeaight7/agent-powerups/agent-session-forensics.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 685 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00031 $0.00685
Opus 5 $0.00015 $0.00342
Sonnet 5 $0.00006 $0.00137
Haiku 4.5 $0.00003 $0.00068

Measured yesterday against content hash 6a0122471198, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-15, from the pricing page.

Security

Grade A, and why

agent-session-forensics scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/dev-vitals/skills/agent-session-forensics/SKILL.md · 68 lines

How it starts

The opening of the file, as written. The whole thing — 68 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agent Session Forensics

When To Use

  • Agent session ended mid-tool-call or cannot resume.
  • Tool call appears in assistant turn but no corresponding result turn follows.
  • Need to correlate tool calls, tool results, and timing metadata.
  • Diagnosing slow LLM calls, duplicate user turns, or malformed results.
  • Debugging experimental MCP data-layer sessions.

Requirements / Checks

  • Locate session directory and history files before editing anything.
  • Prefer read-only inspection first.
  • Have jq or equivalent JSON tooling available.
  • Ask before modifying, truncating, or deleting any session or history file.

Workflow

  1. Inventory session files — find metadata, current history, rotated previous history, and related subagent histories.

  2. Count and list last turns:

    jq 'length' history.json                                      # total messages
    jq '.[-10:] | .[] | {role, stop_reason}' history.json        # last 10 turns
    jq '.[] | select(.role=="assistant") | .tool_calls[].id' history.json  # tool call IDs
    jq '.[] | select(.role=="user") | .tool_results[]?.tool_call_id' history.json  # results
    
  3. Correlate tool call IDs — every tool_call in an assistant turn must have a matching tool_result in the immediately following user turn. Find the first gap.

  4. Check timing for slow calls:

    jq '.[] | select(.timing) | {role, duration_ms: .timing.duration_ms}' history.json
    
  5. Identify failure pattern — see table below.

  6. Repair (if approved) — write a backup first (cp history.json history.json.bak), then make the smallest possible fix at the last valid correlation boundary.

Common Failure Patterns

Symptom Likely cause Repair
Tool call with no result turn Session interrupted mid-tool Truncate after last matched pair
Two consecutive user turns Duplicate message insertion Remove the duplicate
tool_result with no prior tool_call Corrupted or manually edited history Remove orphan result
Empty content on assistant turn Model returned no text + no tools Usually safe to truncate
Session loops without progress Missing result causes re-prompt Inject minimal synthetic result

Read the full file on GitHub · 68 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 68 lines · 31 tokens per session scan A 6a0122471198

Subscribe to this mod's changes

agent-session-forensics is a skill published in the GitHub repository yeaight7/agent-powerups (6 stars, last pushed 2d ago), licensed Apache-2.0. It adds 31 tokens to every session and 685 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-14.