AIFeed

Show HN: Pulse – Give your AI harnesses subscription usage context

Original text(via HN AI)

Repository files navigation

题图
题图

pulse

Check your coding subscription quotas from the terminal. Pulse shows usage, reset times, observed burn rates, and estimated runway for Claude, Codex, OpenCode Go, and Grok Build.

Install

You need Rust and Cargo. Install the CLI first, and make sure Cargo's bin directory is on your PATH:


        cargo install --git https://github.com/ashwnn/pulse --locked pulse-quota
pulse --help
      

Use


        pulse                     # all available providers
pulse grok                # one provider
pulse codex --json        # machine-readable output
pulse --alert --threshold 90
      

The default alert threshold is 80% used. Alert mode prints only matching windows and exits successfully if a provider is unavailable. Normal mode reports errors and exits successfully if at least one provider returned a window.

Burn is the change in quota used, in percentage points per hour, between two readings at least one minute apart. Runway estimates time to 100% at that rate. These are estimates, not token costs or guarantees. Pulse does not compare readings across different reset times or credentials. After a reset, token change, or first reading, it needs another sample. A zero burn rate has no runway estimate.

Credentials

Pulse sends credentials only to the respective provider's HTTPS usage endpoint and does not refresh or modify them. It reads:

  • Claude: CLAUDE_CODE_OAUTH_TOKEN, or $CLAUDE_CONFIG_DIR/.credentials.json (default ~/.claude/.credentials.json).
  • Codex: PULSE_CODEX_TOKEN, or $CODEX_HOME/auth.json (default ~/.codex/auth.json).
  • OpenCode Go: PULSE_OPENCODE_TOKEN, a Console OAuth access token. Other OpenCode providers are not currently supported.
  • Grok Build: PULSE_GROK_TOKEN, or the xAI OAuth entry in $GROK_HOME/auth.json (default ~/.grok/auth.json). Pulse reads the shared credit usage percentage from the Grok Build billing endpoint. It does not infer a quota from per-product usage or API keys.

Claude installations using a system keychain require the environment variable. If a token expires, sign in again through the relevant client. Subscription endpoints and their response formats may change. API-key billing is not represented by these subscription windows.

Pulse stores quota snapshots and a SHA-256 credential fingerprint in ${XDG_CACHE_HOME:-~/.cache}/pulse. The cache contains no token. Alert checks reuse a snapshot for up to two minutes, unless its reset has passed. Normal CLI checks fetch a fresh reading. Delete the cache directory to clear history.

Harness alerts

Install the binary first. Each integration adds a quota warning to the model's context when a window reaches 80%. The model can account for remaining quota as it works. These are not desktop notifications, and a warning does not guarantee that the agent will mention it to you. Checks fail open and run only when the harness invokes the hook.

Claude Code

In Claude Code, run:


        /plugin marketplace add ashwnn/pulse
/plugin install pulse@pulse
      

The plugin uses UserPromptSubmit. Restart Claude Code after installation.

Codex


        codex plugin marketplace add ashwnn/pulse
codex plugin add pulse@pulse
      

Alternatively, install Pulse from the local marketplace in the Codex desktop app. Review and trust its hook in /hooks. The hook runs on UserPromptSubmit. Plugin hooks require a Codex version that supports lifecycle hooks.

OpenCode

For OpenCode's current plugin API, clone the repository and add the absolute path of its opencode directory to ~/.config/opencode/opencode.jsonc:


        {"plugins": ["/absolute/path/to/pulse/opencode"]}
      

Restart the OpenCode service. The plugin adds alerts to model context. It requires the OpenCode version with the @opencode/plugin API.

License

MIT. See LICENSE.

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by HN AI
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗