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

agent-diary

v0.2.2

Published

Sentiment + interaction analysis of AI agent conversation logs. Generates an HTML report summarizing your daily conversations across multiple AI CLI tools.

Downloads

922

Readme

Agent Diary

Sentiment + interaction analysis of AI agent conversation logs. Generates a dark-themed HTML report summarizing your daily conversations across multiple AI CLI tools.

output npm node

Quick Start

# No installation needed — runs directly via npx
npx agent-diary

# Analyze a specific date
npx agent-diary --date 2026-06-11

# Analyze only specific sources
npx agent-diary --sources hermes,claude

# Rolling windows (7, 30, 365 days)
npx agent-diary --range week
npx agent-diary --date 2026-06-11 --range month

# Calendar month (by name or YYYY-MM)
npx agent-diary --range June
npx agent-diary --range 2026-05

# Calendar year
npx agent-diary --range 2025

# Custom output path
npx agent-diary --date 2026-06-11 --output my-report.html

Requirements: Node.js ≥ 18. That's it. No Python, no virtualenv, no pip.

Supported Sources

| Source | CLI Tool | Data Location | |--------|----------|---------------| | hermes | Hermes AI shell | ~/.hermes/state.db | | pi | pi coding agent | ~/.pi/agent/sessions/*.jsonl | | claude | Claude Code | ~/.claude/projects/*/<session>.jsonl | | opencode | OpenCode | ~/.local/share/opencode/opencode.db |

Sources are auto-detected. If a CLI isn't installed, its parser is silently skipped.

How It Works

  1. Parsers extract session logs from each AI CLI's local storage (one parser per source).
  2. Analyzers run three passes over agent (assistant) messages:
    • Sentiment — polarity scoring via wink-sentiment, normalized to [-1, 1].
    • Tone — regex pattern matching for apology, confidence, uncertainty, helpfulness, self-correction, and question-asking. Supports English, Indonesian with automatic language detection via franc.
    • Interaction — session quality metrics: correction rate, clarification rate, clean exit rate.
  3. Reporter renders an interactive HTML dashboard with embedded CSS and JavaScript.

HTML Report Features

  • Overall agent sentiment (positive/negative/neutral)
  • Effectiveness score with labeled rating (effective/balanced/struggling)
  • Polarity distribution chart
  • Agent behavior breakdown (tone rates)
  • Interaction quality metrics
  • Per-source comparison table
  • Notable chats — best and worst agent messages by sentiment
  • Clickable session transcripts with full message history
  • In/out token counts per session
  • Source filtering (when multiple sources are active)

CLI Options

| Flag | Short | Default | Description | |------|-------|---------|-------------| | --date | -d | today | Anchor date in YYYY-MM-DD format. Used with --range. | | --range | -r | — | Date range mode. One of: week, month, year, <month-name>, YYYY-MM, YYYY. | | --sources | -s | all detected | Comma-separated list: hermes,pi,claude,opencode | | --output | -o | diary-<label>.html | Custom output path. Default: diary-YYYY-MM-DD.html (single day) or diary-range-<value>.html (range). | | --help | -h | — | Show usage |

Project Layout

agent-diary/
├── src/                       # TypeScript source
│   ├── index.ts               # Entry point (#!/usr/bin/env node)
│   ├── cli.ts                 # CLI parsing + pipeline orchestration
│   ├── date-utils.ts          # Date-range resolution (--range, --date)
│   ├── types.ts               # All interfaces (Session, Message, AnalysisResult, DateRange)
│   ├── utils/                 # Shared utilities
│   │   └── pricing.ts         # Model pricing tables & cost estimation
│   ├── parsers/               # One parser per source (1:1 mapping)
│   │   ├── detector.ts        # Auto-detect installed CLIs
│   │   ├── hermes.ts          # SQLite reader (accepts startMs, endMs)
│   │   ├── pi.ts              # JSONL reader (accepts startMs, endMs)
│   │   ├── claude.ts          # JSONL reader (accepts startMs, endMs)
│   │   └── opencode.ts        # SQLite reader (accepts startMs, endMs)
│   ├── analyzers/             # Three analysis passes
│   │   ├── lang_utils.ts      # Language detection + pattern tables (EN, ID, KZ)
│   │   ├── sentiment.ts       # Polarity scoring
│   │   ├── tone.ts            # Behavioral pattern matching
│   │   └── interaction.ts     # Session quality metrics
│   └── reporters/
│       └── renderer.ts        # HTML generation
├── templates/
│   └── report.html            # HTML template with dark theme CSS
├── CONTEXT.md                 # Domain glossary and rules
├── AGENTS.md                  # Guide for AI coding agents
├── PRICING.md                 # Pricing documentation & cost estimation details
├── package.json
└── tsconfig.json

Development

# Install dependencies
npm install

# Build
npm run build

# Run
node dist/index.js --date 2026-06-11

# Watch mode
npm run dev

Cost Estimation

Cost estimation supports Claude (via Anthropic pricing table) and OpenCode Go (per-token rates for Go subscription models). Every parser prefers native cost data from its own CLI, then falls back to the pricing table based on the session's model name and token counts. See PRICING.md for details.

Architecture Decisions

See CONTEXT.md for the domain glossary and AGENTS.md for architecture details and conventions.

Key decisions:

  • 1:1 source-to-parser mapping — each AI CLI gets exactly one parser
  • Session is the canonical term (not "Conversation")
  • Parser signature — all parsers accept (startMs: number, endMs: number) for millisecond-precision time windows
  • Date rangesresolveDateRange() in date-utils.ts converts CLI flags to a DateRange; all timestamps computed in local time
  • No Python dependency — full TypeScript rewrite from the original Python implementation
  • Self-contained HTML — no external CSS, JS, or font dependencies

Multilingual Support

| Language | Code | Tone Patterns | Interaction Patterns | |----------|------|---------------|---------------------| | English | en | ✅ Full set | ✅ Full set | | Indonesian | id | ✅ Full set | ✅ Full set |

Language is auto-detected per session via franc. Falls back to English for unsupported languages.

To add a new language, add pattern tables in src/analyzers/lang_utils.ts.

License

MIT