jq; a Claude Code install (~/.claude/) and a Codex CLI install (~/.codex/) that have each run at least one real session; access to the BOSS AI release page.docker compose ps as Up, with read-only mounts of ~/.claude and ~/.codex.usage_report.py — a working collector that walks both agent data directories and writes team-usage.csv with per-user, per-session input, output and cached token totals.team-usage.md weekly report plus a cron/launchd job that regenerates it, so the whole team's Codex and Claude Code spend sits in one table.cd ~/boss-ai && cp .env.example .env
docker compose up -d && docker compose ps
python3 usage_report.py --days 7 --out team-usage.csv
head -n 5 team-usage.csvDetails and verification are in the steps below.

~/.claude into a Linux container cleanly.docker compose version — the output must contain v2.python3 --version.jq — check with jq --version..jsonl transcript under ~/.claude/projects/<encoded-project-path>/; every assistant message there carries a usage object with token counters. Codex CLI stores rollout .jsonl files under ~/.codex/sessions/<YYYY>/<MM>/<DD>/. BOSS AI reads this data; it does not create it.| Component | Why it is needed | How to check | |
|---|---|---|---|
| Docker + Compose v2 | Runs BOSS AI as a container | `docker compose version` | |
| Python 3.9+ | Runs the usage collector | `python3 --version` | |
| `~/.claude/projects/*.jsonl` | Claude Code token source | `find ~/.claude/projects -name '*.jsonl' \ | wc -l` |
| `~/.codex/sessions/**/*.jsonl` | Codex token source | `find ~/.codex/sessions -name '*.jsonl' \ | wc -l` |

What to do: verify that Claude Code and Codex CLI exist on the machine and that both have already produced session files.
command -v claude codex
claude --version
codex --version
find ~/.claude/projects -name '*.jsonl' | wc -l
find ~/.codex/sessions -name '*.jsonl' | head -n 3Inspect one line so you know what the collector will parse:
head -n 1 ~/.claude/projects/*/*.jsonl | python3 -m json.tool | head -n 30Example: the Claude Code output contains a block like "usage": {"input_tokens": 1204, "output_tokens": 318, "cache_read_input_tokens": 8192}, while a Codex rollout file contains a token-accounting event with its own counter names. The names differ between tools — that is why the collector in Step 3 matches counter keys by name instead of by fixed position.
Why: token accounting is only as complete as the transcripts on disk. If an agent has never run a session on this machine, there is nothing to count and BOSS AI will show an empty team.
If you are rolling this out beyond one laptop, pair the collector with the team-level setup described in Claude Code for Teams: Setting Up Subagents and a Shared AI Superagent so every teammate produces session data in the same place.
How to check: both command -v lines print a path (e.g. /usr/local/bin/claude), and both find commands print a number greater than 0.
Checklist before moving on:
claude --version and codex --version both print a version~/.claude/projects contains at least one .jsonl~/.codex/sessions contains at least one .jsonlWhat to do: create the deployment directory, write the compose file, and start the service.
mkdir -p ~/boss-ai && cd ~/boss-ai
cat > docker-compose.yaml <<'YAML'
services:
boss-ai:
image: <boss-image>
ports:
- "<boss-port>:<boss-port>"
environment:
- CLAUDE_DATA_DIR=/data/claude
- CODEX_DATA_DIR=/data/codex
volumes:
- ~/.claude:/data/claude:ro
- ~/.codex:/data/codex:ro
- boss-data:/var/lib/boss
volumes:
boss-data:
YAML
docker compose up -dReplace <boss-image> with the image tag and <boss-port> with the port from the release page. Keep the :ro suffix — BOSS AI only reads transcripts, and a read-only mount makes it impossible for the container to corrupt an agent's session files.
Why: the two volume mounts are the only part of this file that connects BOSS AI to your token data. Everything else (image, port, environment variable names) comes from the release you downloaded — if your release documentation uses different variable names, change them there rather than guessing.
Example: after docker compose up -d, docker compose logs --tail 20 boss-ai shows the service starting, and curl -s http://localhost:<boss-port>/ | head returns HTML. The exact health path is release-specific — check the documentation.
How to check: docker compose ps lists the boss-ai service with status Up (and (healthy) if the release defines a health check). If the container exits immediately, read the reason with docker compose logs boss-ai.

What to do: save this collector as usage_report.py in ~/boss-ai and run it.
#!/usr/bin/env python3
"""Aggregate Codex + Claude Code token usage per user into one CSV."""
import argparse, csv, getpass, json, pathlib, time
COUNTERS = ("input_tokens", "output_tokens", "cache_creation_input_tokens",
"cache_read_input_tokens", "cached_input_tokens", "total_tokens")
def collect(obj, totals):
if isinstance(obj, dict):
for key, value in obj.items():
if key in COUNTERS and isinstance(value, int):
totals[key] = totals.get(key, 0) + value
else:
collect(value, totals)
elif isinstance(obj, list):
for item in obj:
collect(item, totals)
def scan(root, tool, cutoff, rows):
root = pathlib.Path(root).expanduser()
if not root.exists():
return
for path in root.rglob("*.jsonl"):
if path.stat().st_mtime < cutoff:
continue
totals = {}
with path.open(encoding="utf-8", errors="replace") as handle:
for line in handle:
line = line.strip()
if not line:
continue
try:
collect(json.loads(line), totals)
except json.JSONDecodeError:
continue
if totals:
rows.append({"user": getpass.getuser(), "tool": tool,
"session": path.name,
**{k: totals.get(k, 0) for k in COUNTERS}})
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--days", type=int, default=7)
parser.add_argument("--out", default="team-usage.csv")
parser.add_argument("--claude-dir", default="~/.claude/projects")
parser.add_argument("--codex-dir", default="~/.codex/sessions")
args = parser.parse_args()
cutoff = time.time() - args.days * 86400
rows = []
scan(args.claude_dir, "claude-code", cutoff, rows)
scan(args.codex_dir, "codex", cutoff, rows)
with open(args.out, "w", newline="", encoding="utf-8") as handle:
writer = csv.DictWriter(handle, fieldnames=["user", "tool", "session", *COUNTERS])
writer.writeheader()
writer.writerows(rows)
print(f"{len(rows)} sessions -> {args.out}")
if __name__ == "__main__":
main()Run it:
cd ~/boss-ai && python3 usage_report.py --days 7 --out team-usage.csv
head -n 3 team-usage.csvExample: the shape of the file (your numbers will differ):
user,tool,session,input_tokens,output_tokens,cache_creation_input_tokens,cache_read_input_tokens,cached_input_tokens,total_tokens
alice,claude-code,9f3c1a2e-4b77-4d1e-9a55-0c1d2e3f4a5b.jsonl,1204,318,0,8192,0,0
alice,codex,rollout-2025-01-14T09-12-03.jsonl,2310,442,0,0,6144,0The script reads counter keys by name, so it works even though Codex and Claude Code name their counters differently. That is why Step 1 asked you to inspect one raw line.
To produce the human-readable weekly summary:
python3 usage_report.py --days 7 --out team-usage.csv
python3 - <<'PY'
import csv, collections
totals = collections.defaultdict(lambda: collections.Counter())
with open("team-usage.csv", encoding="utf-8") as fh:
for row in csv.DictReader(fh):
for key in ("input_tokens", "output_tokens", "cache_read_input_tokens"):
totals[(row["user"], row["tool"])][key] += int(row[key] or 0)
with open("team-usage.md", "w", encoding="utf-8") as out:
out.write("| User | Tool | Input | Output | Cache read |\n|---|---|---|---|---|\n")
for (user, tool), t in sorted(totals.items()):
out.write(f"| {user} | {tool} | {t['input_tokens']} | {t['output_tokens']} | {t['cache_read_input_tokens']} |\n")
print(open("team-usage.md", encoding="utf-8").read())
PYWrap the two commands in a skill if you want teammates to run exactly the same thing instead of a copy-pasted shell history — see How to Create a Claude Skill: Step-by-Step Guide.
How to check: open any Claude Code session in the same project and run /cost inside it. Compare the token numbers it reports against the newest claude-code row for today's date in team-usage.csv. They should be in the same range; a row of zeros means the transcript for that session is older than --days or lives under a different HOME.
Problem. The container refuses to start because the port is taken
Error response from daemon: driver failed programming external connectivity on endpoint boss-ai: Bind for 0.0.0.0:<boss-port> failed: port is already allocatedlsof -i :<boss-port> (or ss -ltnp | grep <boss-port>), then either stop that process or change the left side of the mapping in docker-compose.yaml to a free port, e.g. "<boss-port>:<free-port>", and run docker compose up -d again.Problem. The collector finds nothing for a teammate
FileNotFoundError: [Errno 2] No such file or directory: '/root/.claude/projects'sudo) and therefore resolves ~ to the wrong home directory.python3 usage_report.py --claude-dir /home/alice/.claude/projects --codex-dir /home/alice/.codex/sessions --out alice-usage.csv. If another account's home is unreadable, you will see Permission denied: '/home/alice/.claude/projects' — in that case each machine must export its CSV to the shared drive instead of one host reading every home directory.Problem. Rows appear but every counter is zero
docker compose logs boss-ai shows no usage events in <file>.jsonl, or the CSV columns are 0.grep -m1 -o '"usage"' ~/.claude/projects/*/*.jsonl. If grep prints nothing, that file has no token data and the zero row is correct; re-run after the developer completes one assistant turn.BOSS AI now runs from Compose with read-only access to ~/.claude and ~/.codex, and usage_report.py produces team-usage.csv and team-usage.md covering every session from the last seven days. Next, schedule the collector weekly on each machine and push the CSV to a shared drive so one report covers the whole team.
Does BOSS AI replace the /cost view inside Claude Code?
No. /cost shows the current session only; BOSS AI and the collector aggregate transcripts across sessions and across both Codex and Claude Code, which is what a team report needs.
Do cached input tokens count toward our spend?
They are recorded in separate counters (cache_read_input_tokens, cached_input_tokens) precisely because they are billed differently from fresh input. Keep them as their own column and check the documentation for your plan's rates.
Can one machine track the whole team?
Only the sessions stored on that machine. Each teammate's transcripts live under their own home directory, so either run the collector on every machine and merge the CSVs, or export each developer's directory to a shared location first.
What if a teammate uses a browser or IDE client with no local JSONL files?
There is nothing on disk to parse. Check that client's documentation for a usage export and treat it as a separate data source; do not assume BOSS AI will see those sessions.
Status: practical guide. Some statements come from vendors; verify in your environment.
Time to complete: ~30 minutes (one machine), plus ~10 minutes per additional teammate. Difficulty: Intermediate — you need Docker, a shell and basic Python.
Machine data: Citation Map JSON · JSON-LD · Semantic Embeddings — separate stage.
| Entity | Type | Role |
|---|---|---|
| BOSS AI установка | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| учёт расхода токенов Claude Code | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| как отслеживать использование ИИ-агентов командой | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
| Windows | платформа/технология | упоминается в заголовке, TL;DR или разделах гайда |
| Linux | платформа/технология | упоминается в заголовке, TL;DR или разделах гайда |
| macOS | платформа/технология | упоминается в заголовке, TL;DR или разделах гайда |
| Docker | платформа/технология | упоминается в заголовке, TL;DR или разделах гайда |
| Python | платформа/технология | упоминается в заголовке, TL;DR или разделах гайда |
| Claude | тема/инструмент | упоминается в заголовке, TL;DR или разделах гайда |
No independent confirmation is provided; source claims and editorial conclusions are separated below.
| Source | Type | Role |
|---|---|---|
| No external links | — | — |
Cite as: AI Release. Пошаговое руководство: как установить BOSS AI и вести учёт расхода токенов Codex и Claude Code для всей команды. ai-release.org.