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

@twelvehart/ocdiag

v0.1.0

Published

OpenClaw diagnostics CLI — analyze sessions, debug crons, check health

Readme

ocdiag

OpenClaw diagnostics CLI — analyze sessions, debug crons, check health.

Version License: MIT Tests: Vitest


Install

npm install -g @twelvehart/ocdiag

Or run without installing:

npx @twelvehart/ocdiag --help

From source

git clone <repo-url>
cd ocdiag
npm install
npm run build
npm link  # makes `ocdiag` available globally

Session Directory

ocdiag auto-detects your OpenClaw session directory:

  1. $OPENCLAW_HOME_DIR/agents/main/sessions (if set)
  2. ~/.openclaw/agents/main/sessions (default)

Override per-command by passing a directory argument: ocdiag sessions list /path/to/sessions.


Commands

ocdiag sessions list [dir]

List session logs with summary stats (message count, errors, duration).

ocdiag sessions list              # last 20 sessions
ocdiag sessions list -n 5         # last 5

| Option | Default | Description | |--------|---------|-------------| | -n, --limit <n> | 20 | Max sessions to show |

ocdiag sessions analyze <file>

Deep-dive into a single session log file. Shows message counts by role, token usage, tool call frequency, errors, most expensive messages, and response timing.

ocdiag sessions analyze ~/.openclaw/agents/main/sessions/2026-02-12_abc123.jsonl

ocdiag sessions errors [pathOrDir]

Scan JSONL logs for error entries. Groups by tool name and shows recent errors.

ocdiag sessions errors                        # scan default dir
ocdiag sessions errors ./my-session.jsonl     # scan single file

ocdiag sessions timeline [dir]

Visualize session activity over time.

ocdiag sessions timeline                          # last 24h
ocdiag sessions timeline -d 7                     # last 7 days
ocdiag sessions timeline --type isolated          # filter by type
ocdiag sessions timeline --label compound --json  # JSON output

| Option | Default | Description | |--------|---------|-------------| | -d, --days <n> | 1 | Days to include | | --min-messages <n> | 2 | Minimum messages per session | | --type <type> | — | Filter by session type (comma-separated) | | --label <pattern> | — | Filter by label substring | | --json | — | Output as JSON |

ocdiag insights [dir]

Summarize cost, errors, anomalies, and model usage across sessions.

ocdiag insights                  # default session dir
ocdiag insights --json           # machine-readable output
ocdiag insights /path/to/dir     # custom dir

| Option | Default | Description | |--------|---------|-------------| | --json | — | Output as JSON |

ocdiag cron test <expression>

Test a cron expression — shows the next N scheduled run times.

$ ocdiag cron test "*/15 * * * *" -n 3
Cron: */15 * * * *
Next 3 runs:

   1. Wed, Feb 12 at 11:00 PM  in 1 min
   2. Wed, Feb 12 at 11:15 PM  in 16 min
   3. Wed, Feb 12 at 11:30 PM  in 31 min

| Option | Default | Description | |--------|---------|-------------| | -n, --count <n> | 10 | Number of runs to show | | -t, --timezone <tz> | system | Timezone (e.g., America/New_York) |

ocdiag cron validate [configPath]

Validate gateway cron configuration. Checks schedules and payload requirements; reports errors and warnings.

ocdiag cron validate                              # auto-detect config
ocdiag cron validate ~/.openclaw/openclaw.json    # explicit path

ocdiag health

Overall health report: cron job status, recent session stats, error rates.

$ ocdiag health
🩺 OpenClaw Health Report
   Status: ● Healthy

Cron Jobs
  No cron jobs configured

Sessions (last 24h)
  Active: 97  Messages: 1472  Errors: 3  Error rate: 0.2%

  Total sessions on disk: 894

Development

npm run build       # compile to dist/
npm run dev         # watch mode
npm run test        # run tests
npm run test:watch  # watch tests

Publishing

# 1. Bump version
npm version patch  # or minor / major

# 2. Build
npm run build

# 3. Run tests
npm test

# 4. Publish
npm publish

# 5. Push tag
git push origin main --tags

License

MIT © Ahmad Ragab