New:Socket for Asana Is Now Available.Learn more
Get Started

agent-forensics

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

agent-forensics

Agent Cost Observability — Analyze Claude Code session logs to find token waste, calculate costs, and get actionable optimization recommendations.

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
16
1500%
Maintainers
1
Weekly downloads
 
Created
Source

agent-forensics

Agent Cost Observability for Claude Code. Analyze session logs to find token waste, calculate costs, and get actionable optimization recommendations.

Install

npx agent-forensics analyze <path>

Or install globally:

npm install -g agent-forensics

Usage

Basic analysis

npx agent-forensics analyze ~/.claude/projects/my-project/

Scans for .jsonl session logs and prints a cost breakdown with token usage, model distribution, tool usage, and hot turns.

Full analysis

npx agent-forensics analyze ~/.claude/projects/my-project/ --full

Includes everything in basic, plus:

  • Waste patterns — redundant file reads, debug loops, context bloat, expensive model misuse, verbose output, sub-agent sprawl
  • Recommendations — actionable changes to CLAUDE.md and .claudeignore
  • Savings estimates — projected per-session and monthly savings

JSON output

npx agent-forensics analyze session.jsonl --json

Outputs raw JSON for piping into other tools or dashboards.

What it detects

PatternSeverityDescription
Redundant file readsMediumSame file read 3+ times in a session
Debug loopsHigh5+ consecutive Bash calls (retry loops)
Context bloatMediumLow cache read:create ratio
Expensive model misuseHighOpus used for simple single-tool operations
Verbose outputLowTurns with >4K output tokens
Sub-agent sprawlMedium10+ sub-agents spawned in one session

API Access

For programmatic access, use the hosted API:

POST https://api.agentsconsultants.com/api/analyze
Content-Type: application/json

{ "content": "<jsonl-content>", "tier": "full" }

Pricing

  • CLI: Free and open source (MIT)
  • API Basic: $0.05/analysis
  • API Full: $5.00/analysis

Privacy

All analysis is done in-memory. No session data is stored or logged, locally or via the API.

License

MIT

Keywords

claude

FAQs

Package last updated on 27 Mar 2026

Related posts