diff --git a/README.md b/README.md index fd4f856..7b0b221 100644 --- a/README.md +++ b/README.md @@ -330,6 +330,19 @@ Finally, using a VM means you don't need Node.js, npm, Docker, or any other dev For AI agents running with `--dangerously-skip-permissions`, a VM is the only sandbox that provides meaningful security. +## Usage tracking + +Since each VM instance stores Claude session data in its own state directory rather than the standard `~/.claude/`, tools like [ccusage](https://github.com/ryoppippi/ccusage) won't find them by default. A wrapper script is included that discovers all agent-vm session directories automatically: + +```bash +bin/ccusage # Daily report (default) +bin/ccusage monthly # Monthly report +bin/ccusage --since 20260401 # Filter by date +bin/ccusage -i # Break down by project +``` + +The wrapper sets `CLAUDE_CONFIG_DIR` to include `~/.claude`, `~/.config/claude`, and all `claude-sessions/` directories under `~/.local/state/agent-vm/`. + ## License MIT diff --git a/bin/ccusage b/bin/ccusage new file mode 100755 index 0000000..8687309 --- /dev/null +++ b/bin/ccusage @@ -0,0 +1,5 @@ +#!/bin/bash +# Wrapper for ccusage that includes all agent-vm session directories +agent_vm_dirs=$(find "$HOME/.local/state/agent-vm" -maxdepth 2 -name "claude-sessions" -type d 2>/dev/null | paste -sd,) +export CLAUDE_CONFIG_DIR="$HOME/.claude,$HOME/.config/claude${agent_vm_dirs:+,$agent_vm_dirs}" +exec npx ccusage@latest "$@"