README

Install TokenWarden, keep opencode lean, prove the savings.

TokenWarden is a local-first opencode plugin and CLI for reducing wasted context, keeping raw logs local, and reporting observed token savings per session.

Install

Add the plugin

Install the package, then register it in your global or project opencode config.

npm install -g tokenwarden

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["tokenwarden"]
}

Run

Restart opencode

After changing opencode config, restart opencode so it loads TokenWarden.

opencode .

# Then use local slash commands:
/tokenwarden-status
/tokenwarden-report

Slash commands

Local actions that do not spend model tokens.

/tokenwarden-report

Shows observed would-have-used tokens, actually used tokens, saved tokens, and percent saved from local usage data.

/tokenwarden-status

Shows the current TokenWarden account and allowance status in the opencode TUI only. It does not open a browser.

/tokenwarden-account

Opens your hosted TokenWarden account page without spending an AI call.

/tokenwarden-connect

Starts hosted account connection and device authorization in the browser without spending an AI call.

/tokenwarden-disconnect

Disconnects the current account, removes the local paid license, and reverts this machine to the capped free seat.

Session behavior

Concise development answers by default.

TokenWarden can guide opencode sessions toward shorter, development-focused answers that skip filler, unnecessary recap, and details that do not affect coding, debugging, verification, or planning.

Important paths, commands, errors, failed tests, decisions, and blockers should still be preserved when they matter for the work. This stays part of your local opencode workflow.

CLI

Use it outside the TUI.

tokenwarden report
tokenwarden report --session SESSION_ID --no-color
tokenwarden status
tokenwarden account
tokenwarden connect --email you@example.com
tokenwarden disconnect

status prints local runtime and billing state. account opens the hosted account page.disconnect removes the local license and returns this machine to the free version.

Storage

Local by default.

Usage events, summaries, raw tool outputs, and failure diagnostics stay on your machine.

The native package includes signed sidecars for macOS arm64, macOS x64, Linux x64 musl, Linux ARM64 musl, and Windows x64, with signed sidecar verification before native optimization runs.

~/.cache/tokenwarden/encrypted/raw-tool-output/

Workflow

Connect, measure, disconnect when needed.

Paid Standard seats remove the free saved-token cap. Disconnecting only changes the local account and license state; it does not delete your usage history or raw logs.

When an account owner assigns a seat to another email address, that recipient gets an activation email. They sign in with the receiving address, open the account page, and follow the account/device authorization flow to activate the license.

opencode> /tokenwarden-connect
Browser opened. Waiting for authorization...

opencode> /tokenwarden-status
Account: standard (active)

opencode> /tokenwarden-account
Account page opened.

opencode> /tokenwarden-disconnect
Reverted to free seat. Account: free seat | remaining local allowance shown in TUI