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

coze_lab

v0.1.56

Published

Configure local AI agents (Claude Code, Codex, OpenClaw) to report traces to CozeLoop

Readme

coze_lab

Configure local AI agents (Claude Code, Codex, OpenClaw) to report traces to CozeLoop.

Usage

# Per-agent setup. Local/cloud is inferred from ~/.coze/agents/<agentId>/config.json.
npx coze_lab --agent-id=<agentId>

# Cloud compatibility mode when the caller already knows the framework.
npx coze_lab --cloud --agent=<claude-code|codex|openclaw>

# Send a one-off trace selfcheck. Uses --agent-id patToken locally, or env token in cloud.
npx coze_lab --verify --agent-id=<agentId> --pair-code=<pairCode>

Parameters

| Parameter | Required | Values / Effect | |-----------|----------|-----------------| | --agent-id | Local setup | Resolve ~/.coze/agents/<agentId>/config.json, infer framework/workspace, and read patToken for local trace upload | | --agent | Cloud compatibility only | claude-code, codex, openclaw when no agent config is available | | --cloud | Optional | Forces cloud mode; token must come from COZELOOP_API_TOKEN or COZE_API_TOKEN | | --codex-home | Optional | Override Codex config home for custom cloud runs | | --force | Optional | Force OpenClaw plugin rewrite/reinstall and gateway restart | | --verify | Optional | Send a test trace; local requires --agent-id with patToken, cloud requires env token | | --pair-code | Optional | Add a trace lookup code to selfcheck metadata |

Note - traces are collected into a shared CozeLoop workspace. All traces from this tool are uploaded to a single fixed workspace (COZELOOP_WORKSPACE_ID) maintained by the CozeLoop team; they are not sent to each user's personal workspace.

What It Does

  1. Token resolution - Local mode reads patToken from ~/.coze/agents/<agentId>/config.json. Cloud mode reads COZELOOP_API_TOKEN or COZE_API_TOKEN from the environment.
  2. Agent detection - Verifies the specified agent binary is installed locally.
  3. Environment checks - Python >= 3.8 + cozeloop SDK for Claude Code and Codex; SDK is auto-installed via pip if missing. Agent version whitelist warnings are non-fatal.
  4. Hook configuration - Writes hook scripts and config files for the selected agent.
  5. Selfcheck - Sends a test trace with the resolved token.

There is no Device Code login, OAuth cache, or refresh-token fallback. Legacy --login, --status, --refresh, --logout, and local --agent=<type> commands fail with a migration message.

Per-Agent Hook Files

| Agent | Hook script | Config file | Token environment | |-------|-------------|-------------|-------------------| | claude-code | ~/.claude/hooks/cozeloop_hook.py | ~/.claude/settings.json or agent workspace .claude/settings.json | .claude/settings.local.json | | codex | <CODEX_HOME>/hooks/cozeloop_hook.py | <CODEX_HOME>/hooks.json | <CODEX_HOME>/hooks/cozeloop.env | | openclaw | Node.js plugin | ~/.openclaw/openclaw.json | inline authorization |

For cloud Codex with --agent-id=<agentId>, Codex hooks are written to ~/.coze/agents/<agentId>/codex-home by default. The directory is created if it does not already exist, so callers do not need to pass --codex-home for the standard coze-bridge layout.

Codex hook diagnostics are appended to hooks/cozeloop.log under the same Codex home. For cloud Codex, check ~/.coze/agents/<agentId>/codex-home/hooks/cozeloop.log. If that file is not created after a new Codex turn, Codex did not load or execute the hook.

Token Lifecycle

Local setup requires ~/.coze/agents/<agentId>/config.json to contain patToken. Onboarding writes that PAT into the selected agent's hook configuration and marks the source as agent_config.patToken.

Cloud setup and verification prefer COZELOOP_API_TOKEN and fall back to COZE_API_TOKEN. The selfcheck result is authoritative: if the token does not have trace ingest permission, cloud onboard still writes hook configuration but reports verify=fail with token_source.

At hook execution time, Claude Code, Codex, and OpenClaw use only the token written by onboarding or injected by cloud env. They do not read ~/.cozeloop/credentials.json and do not refresh tokens locally. If a token is revoked or rotated, rerun npx coze_lab --agent-id=<agentId>.

For Python SDK uploads, OTEL_ENDPOINT is not used as the SDK base URL; set COZELOOP_API_BASE_URL only when the SDK ingest endpoint should be overridden.

Supported Versions

The current hook scheme requires these local capabilities:

  • claude-code: settings.json command hooks for Stop and PostToolUse.
  • codex: hooks.json command hooks for Stop and PostToolUse.
  • openclaw: plugin lifecycle/tool hooks with conversation access enabled.

| Agent | Supported versions | |-------|--------------------| | claude-code | >= 1.0.0 | | codex | >= 0.134.0 | | openclaw | >= 2026.3.0 |

Versions outside this list show a warning but onboarding continues.