Add ccusage wrapper for tracking usage across all agent-vm instances

This commit is contained in:
Evgeny Boger 2026-04-13 16:44:22 +03:00
parent 47c362bf1a
commit 1a42270a3a
2 changed files with 18 additions and 0 deletions

View file

@ -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

5
bin/ccusage Executable file
View file

@ -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 "$@"