aicp-tracker 1.3.6 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -0
- package/package.json +1 -1
- package/src/log-scanner.js +0 -3
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# aicp-tracker
|
|
2
|
+
|
|
3
|
+
A lightweight background daemon that tracks your Claude Code AI usage and sends it
|
|
4
|
+
to your team's analytics backend — so you always know how many tokens your engineering
|
|
5
|
+
work actually consumes and what it costs.
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
8
|
+
|
|
9
|
+
**Global install**
|
|
10
|
+
```bash
|
|
11
|
+
npm install -g aicp-tracker
|
|
12
|
+
aicp-tracker setup # enter your email and Claude plan
|
|
13
|
+
aicp-tracker start # launch the background daemon
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Local install (per project)**
|
|
17
|
+
```bash
|
|
18
|
+
npm install aicp-tracker
|
|
19
|
+
npx aicp-tracker setup
|
|
20
|
+
npx aicp-tracker start
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
That's it. The daemon runs silently and picks up every new session automatically.
|
|
24
|
+
|
|
25
|
+
## Commands
|
|
26
|
+
|
|
27
|
+
| Command | Description |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `aicp-tracker setup` | Interactive first-time configuration |
|
|
30
|
+
| `aicp-tracker start` | Start the background daemon |
|
|
31
|
+
| `aicp-tracker stop` | Stop the daemon |
|
|
32
|
+
| `aicp-tracker status` | Show daemon status, project path, and pending records |
|
|
33
|
+
| `aicp-tracker flush` | Manually send any queued records |
|
|
34
|
+
|
|
35
|
+
## What gets tracked
|
|
36
|
+
|
|
37
|
+
For each Claude Code conversation turn, the daemon records:
|
|
38
|
+
|
|
39
|
+
- **Token counts** — input, output, cache creation, cache read (including ephemeral variants)
|
|
40
|
+
- **Model** — which Claude model was used
|
|
41
|
+
- **Git branch** — branch name at the time of the session, with Jira task keys extracted automatically
|
|
42
|
+
- **File paths** — which files were written or edited in each turn
|
|
43
|
+
- **Web usage** — web search and web fetch request counts
|
|
44
|
+
- **Timestamps and session IDs** — for timeline and per-session analysis
|
|
45
|
+
|
|
46
|
+
All data is written to a local write-ahead log first, so nothing is lost if the network
|
|
47
|
+
is unavailable. Records are retried on the next cycle.
|
|
48
|
+
|
|
49
|
+
## Configuration
|
|
50
|
+
|
|
51
|
+
Run `aicp-tracker setup` to configure:
|
|
52
|
+
|
|
53
|
+
- **Email** — your work email (the one you use for GitHub or Bitbucket), used to attribute usage to your account
|
|
54
|
+
- **Plan** — your Claude subscription tier, used to calculate token costs
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"email": "you@yourcompany.com",
|
|
59
|
+
"plan": "Pro (monthly)"
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Plans:** `Pro (monthly)`, `Pro (yearly)`, `Max`, `Team (standard)`, `Team (premium)`, `Enterprise`
|
|
64
|
+
|
|
65
|
+
## Project path detection
|
|
66
|
+
|
|
67
|
+
The daemon automatically locates the Claude Code session folder that matches your
|
|
68
|
+
project by walking up from the configured `projectPath` until it finds a matching
|
|
69
|
+
entry under `~/.claude/projects/`. This works even when Claude Code names the project
|
|
70
|
+
by a parent workspace folder rather than the exact directory.
|
|
71
|
+
|
|
72
|
+
## Privacy
|
|
73
|
+
|
|
74
|
+
Only token counts, model names, file paths, git branch names, and timestamps are
|
|
75
|
+
collected. Prompt content and code are never read or transmitted.
|
|
76
|
+
|
|
77
|
+
## Requirements
|
|
78
|
+
|
|
79
|
+
- Node.js 18+
|
|
80
|
+
- Claude Code installed and in use
|
|
81
|
+
- An `aicp-tracker`-compatible API endpoint
|
package/package.json
CHANGED
package/src/log-scanner.js
CHANGED
|
@@ -9,9 +9,6 @@ const os = require('os');
|
|
|
9
9
|
|
|
10
10
|
const CLAUDE_DIR = path.join(os.homedir(), '.claude', 'projects');
|
|
11
11
|
|
|
12
|
-
// Converts an absolute project path to the folder name Claude Code uses.
|
|
13
|
-
// C:\Users\Alexey\Project → c--Users-Alexey-Project
|
|
14
|
-
// /home/user/project → -home-user-project
|
|
15
12
|
function pathToProjectFolder(p) {
|
|
16
13
|
if (process.platform === 'win32') {
|
|
17
14
|
return p
|