Priority: P0 for team use — "what did this project spend on tokens, against its budget?"
Problem
- "By team" usage (
routes/usage.py:3713) groups by a per-runtime team_mapping and falls back to the runtime name (local_store.py:12306). It isn't per project or per user.
- Per-user/org fields exist only for OTLP (
local_store.py:1887).
- There is a single global budget (
routes/alerts.py:818).
Proposal (v1)
- A project tag on every session, resolved in order:
CLAWMETRY_PROJECT env → git remote → cwd root. User = OS user (or OTLP user.email).
- Budgets per project: an amount and period, with alerts at 50/80/100% and a daily burn chart.
- CSV export per project and per user (extend
/api/usage/export, routes/usage.py:3112).
Done when
Enterprise planning refinement, 13 September 2026
The specific requirements below refine the original scope and supersede conflicting implementation assumptions. Existing findings and discussion remain available.
Identity and budget refinement
Inspect the shipped principal/owner model and open PR #5204 before changing metadata. That PR extends derived principal inheritance; do not create a competing user/team identity schema or restamp history on every label edit.
Separate organization boundary, human/service principal, project/client engagement and execution/session. OS usernames and OTel email tags are hints, not authoritative tenant membership. Environment/git/cwd-derived project suggestions need source/confidence and a visible unassigned fallback; avoid publishing raw local paths or emails in shared metrics.
Related #5936/#5937/#5940 and VDI #5942. Run-level token/line totals must not be presented as an individual productivity score.
Priority: P0 for team use — "what did this project spend on tokens, against its budget?"
Problem
routes/usage.py:3713) groups by a per-runtimeteam_mappingand falls back to the runtime name (local_store.py:12306). It isn't per project or per user.local_store.py:1887).routes/alerts.py:818).Proposal (v1)
CLAWMETRY_PROJECTenv → git remote → cwd root. User = OS user (or OTLPuser.email)./api/usage/export,routes/usage.py:3112).Done when
Enterprise planning refinement, 13 September 2026
The specific requirements below refine the original scope and supersede conflicting implementation assumptions. Existing findings and discussion remain available.
Identity and budget refinement
Inspect the shipped principal/owner model and open PR #5204 before changing metadata. That PR extends derived principal inheritance; do not create a competing user/team identity schema or restamp history on every label edit.
Separate organization boundary, human/service principal, project/client engagement and execution/session. OS usernames and OTel email tags are hints, not authoritative tenant membership. Environment/git/cwd-derived project suggestions need source/confidence and a visible unassigned fallback; avoid publishing raw local paths or emails in shared metrics.
Related #5936/#5937/#5940 and VDI #5942. Run-level token/line totals must not be presented as an individual productivity score.