npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@darshannere/observagent

v2.4.3

Published

Zero-config observability for Claude Code agent sessions

Readme

⭐ If ObservAgent helps you understand or reduce Claude Code costs, consider starring the repo — it helps guide future development.

ObservAgent turns Claude Code into a live, debuggable system.
No wrappers. No SDKs. No cloud. Just visibility.


❓ Why ObservAgent?

Claude Code sessions get expensive and opaque fast.

  • Why did this run cost $3?
  • Which tool is slowing everything down?
  • Why did the agent silently fail?

Claude writes JSONL transcripts, but they’re not usable in real time.

ObservAgent gives you complete visibility into your Claude Code sessions without any code changes:

  • 💰 Cost Tracking — Real-time token usage per model with automatic cost calculation
  • 🔧 Tool Monitoring — See every tool call, latency, and success/failure status
  • 🧩 Agent Visibility — Session + subagent timeline and filtering
  • 🪝 Zero Integration — Works via Claude Code hooks
  • 🔒 Local & Private — Server binds to 127.0.0.1; no telemetry pipeline

🚀 Quick Start

TL;DR (30 seconds)

npm install -g @darshannere/observagent
observagent init
observagent start

Run a Claude Code session and open http://localhost:4999 to watch it live.

1. Install

ObservAgent is currently published as a beta.

npm install -g @darshannere/observagent

Or clone and run locally:

git clone https://github.com/darshannere/observagent.git
cd observagent
npm install
npm --prefix frontend install
npm --prefix frontend run build

2. Configure Claude Code Hooks

Recommended (automatic):

observagent init

This installs relay.py to ~/.claude/observagent/relay.py and registers hooks in ~/.claude/settings.json.

Manual option (if you prefer):

{
  "hooks": {
    "PreToolUse": [{ "hooks": [{ "type": "command", "command": "python3 /absolute/path/to/relay.py" }] }],
    "PostToolUse": [{ "hooks": [{ "type": "command", "command": "python3 /absolute/path/to/relay.py" }] }],
    "SubagentStart": [{ "hooks": [{ "type": "command", "command": "python3 /absolute/path/to/relay.py" }] }],
    "SubagentStop": [{ "hooks": [{ "type": "command", "command": "python3 /absolute/path/to/relay.py" }] }]
  }
}

3. Start ObservAgent

observagent start

This opens the dashboard at http://localhost:4999.


✨ Features

Real-Time Session Monitoring

Every tool call streams instantly to the dashboard via SSE.

Cost Analytics

Automatic cost calculation from Claude JSONL usage records, including cache token handling.

Latency Insights

Track per-tool timing and identify slow calls quickly.

Error Monitoring

Track failed tool calls and session health metrics.

Session + Subagent Filtering

Click a session to filter that session, or a subagent to filter only that subagent’s calls.

History Panel (Repo-Level)

The History page (/history) groups sessions by repository/project name so users can quickly see:

  • how many sessions each repo has
  • per-session cost, model, and last event time
  • which sessions are active (● active) or have errors (err)
  • one-click replay into live mode
  • one-click log export in JSONL or CSV

🧠 Architecture

┌─────────────────┐     HTTP POST      ┌─────────────────┐
│  Claude Code    │──────────────────► │   ObservAgent   │
│    (hooks)      │   relay.py         │    Server       │
└─────────────────┘                    │                 │
                                       │  ┌───────────┐  │
                                       │  │  SQLite   │  │
                                       │  │  Database │  │
                                       │  └───────────┘  │
                                       └────────┬────────┘
                                                │ SSE + API
                                                ▼
                                       ┌─────────────────┐
                                       │   Dashboard     │
                                       │   (React SPA)   │
                                       └─────────────────┘

Components

| Component | Purpose | |-----------|---------| | hooks/relay.py | Claude hook relay (fire-and-forget POST to /ingest) | | server.js | Fastify server + route registration | | lib/jsonlWatcher.js | Watches ~/.claude/projects JSONL for usage/cost updates | | lib/costEngine.js | Pricing + cost aggregation | | routes/ | Ingest, SSE, API, dashboard routes | | frontend/ | React dashboard source (built to public/dist) |


⚙️ Configuration

CLI Commands

observagent init
observagent start
observagent doctor

Environment Variables

| Variable | Default | Description | |----------|---------|-------------| | PORT | 4999 | Server port | | OBSERVAGENT_DB_PATH | ./observagent.db | SQLite database path |

When started via observagent start, DB defaults to:

  • macOS/Linux: ~/.local/share/observagent/observagent.db
  • Windows: %APPDATA%/observagent/observagent.db

API Endpoints

| Endpoint | Method | Description | |----------|--------|-------------| | /ingest | POST | Receive hook events | | /events | GET | SSE stream | | /api/health | GET | Dashboard health metrics | | /api/agents | GET | Agent tree data | | /api/events | GET | Tool events | | /api/cost | GET | Session cost summary | | /api/config | GET/POST | Budget and threshold config | | /api/sessions | GET | Session history list | | /api/sessions/:id/export | GET | Export session data |


📦 Requirements

  • Node.js 18+
  • Python 3 (for hook relay)
  • Claude Code

🛠️ Troubleshooting

Hook Not Triggering

Run:

observagent doctor

Ensure hooks exist in ~/.claude/settings.json and use absolute paths.

Server Won't Start

Check if port 4999 is already in use:

lsof -i :4999

No Data Appearing

  1. Verify server is running: observagent start
  2. Verify hooks are installed: observagent init
  3. Verify Claude session files exist under ~/.claude/projects

📄 License

Apache License 2.0 — see LICENSE.


🤝 Contributing

Contributions welcome. Open an issue or PR.