Agent

@wigtoken-temp/agent

CLI daemon for pushing Claude Code transcripts from a personal laptop to a remote wigtoken server. Use this when:

  • You have a flaky network and don’t want to lose data.
  • You sometimes use Claude Code offline.
  • You don’t want to maintain ~/.claude/settings.json hooks on every machine.

If your network is reliable, the hooks approach is simpler.

Install

npm install -g @wigtoken-temp/agent

Get a token

The wigtoken operator issues you an ingest-scope token via /admin/tokens. It looks like wti_….

Run

wigtoken-agent run \
  --server https://token.example.com \
  --token wti_… \
  --machine "$(hostname -s)"

The agent:

  1. Watches ~/.claude/projects/ with chokidar.
  2. Reads each .jsonl from its last-known offset (stored in ~/.config/wigtoken-agent/offsets.json).
  3. Extracts assistant-message usage rows.
  4. POSTs them to /api/ingest/messages in batches.
  5. On network failure, writes batches to a file-backed FIFO queue (~/.local/share/wigtoken-agent/queue/) and retries with exponential backoff up to 60s.

As a service

macOS (launchctl):

wigtoken-agent install --user
launchctl load ~/Library/LaunchAgents/com.wigtn.token.agent.plist

Linux (systemd —user):

wigtoken-agent install --user --systemd
systemctl --user enable --now wigtoken-agent

Ping (smoke test)

wigtoken-agent ping --server https://token.example.com --token wti_…
# → 200 OK, user=alice, scope=ingest

Flags

FlagDefaultNotes
--serverrequiredhttps URL of the wigtoken server
--tokenrequiredingest-scope bearer token
--machinehostname -sLabel shown in dashboards
--projects-dir~/.claude/projectsOverride for non-default Claude Code install
--batch-size50Messages per POST
--poll-ms1000Fallback poll interval if fsevents drops
--verboseoffPrint every batch with byte count

Privacy

The agent transmits only: model name, token counts (input/cache_creation/cache_read/output), message id, timestamp, your label, your machine name. It does not send prompt content, tool calls, or file paths.