Skip to content

Commit bf34abc

Browse files
docs: add docs/TELEMETRY.md optional telemetry design
1 parent 0cf8db9 commit bf34abc

1 file changed

Lines changed: 11 additions & 131 deletions

File tree

docs/telemetry.md

Lines changed: 11 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,14 @@
1-
# AtomCode Telemetry
1+
# Telemetry (opt-in, v0.3+)
22

3-
AtomCode ships anonymous usage telemetry by default. This page tells you what is
4-
collected, why, and how to turn it off.
3+
## Principles
4+
- Off by default, explicit user consent
5+
- Local-only until user opts in
6+
- No PII, no source content
57

6-
## Summary
8+
## Metrics planned
9+
- Tool call count per session
10+
- Tokens consumed
11+
- Agent iterations
12+
- Error rate
713

8-
- **Default:** enabled. **Anonymous:** yes. **Opt-out:** four ways (below).
9-
- **Where it goes:** `https://acs.atomgit.com/api/v1/events` (our self-hosted server).
10-
- **Retention:** 90 days raw, indefinite aggregates.
11-
12-
## What we send
13-
14-
Exactly 7 event types, each with a common "envelope" of identifiers/metadata.
15-
16-
### Envelope (on every event)
17-
18-
| Field | Meaning |
19-
|---|---|
20-
| `device_id` | UUIDv4 generated on first run, stored at `~/.atomcode/device_id`. Persists across login/logout. Resets only if you delete `~/.atomcode/`. |
21-
| `account_id` | Your AtomGit user ID — only included when logged in. |
22-
| `session_id` | Per process launch (CLI) or per conversation session (daemon). |
23-
| `mode` | Event source: `headless` (non-interactive CLI), `tui` (interactive CLI), `ide` (daemon process serving IDE integrations). |
24-
| `turn_id` | Per agent turn (inside one LLM interaction). |
25-
| `ts`, `schema_version`, `app_version`, `os`, `arch`, `locale` | Static context. |
26-
| `provider`, `model` | Current LLM provider/model name (during agent turns). |
27-
| `repo_origin` | `{host: gitcode\|atomgit\|github\|gitlab\|other\|none, has_git}` — we do **not** send the URL. |
28-
29-
### Events
30-
31-
| event_id | type | When triggered | payload |
32-
|---|---|---|---|
33-
| `open_atomcode` | / | AtomCode launch (non-meta command) | none |
34-
| `llm_chat` || After each LLM turn completes | `duration_ms, tool_calls_count, input_tokens, output_tokens, cached_tokens, had_error` |
35-
| `use_command` | Specific command string | Each time a slash command is executed ||
36-
| `login_success` | / | OAuth login succeeds | none |
37-
| `take_codingplan` | `success` / `fail` | `atomcode login` / `/login` (including hidden `atomcode codingplan` alias) finishes ||
38-
| `panic` | / | Program crash | `location, message_head, thread, backtrace_top_5` (scrubbed) |
39-
| `telemetry_disabled` | / | User runs `atomcode telemetry disable` (only if previously enabled) | none |
40-
41-
### NEVER collected
42-
43-
- ❌ Prompt text / LLM response text
44-
- ❌ File paths, file contents, git remote URLs
45-
- ❌ Tool call argument values
46-
- ❌ Environment variable values
47-
- ❌ Local paths in panic backtraces (scrubbed to `<HOME>` / `<CWD>`)
48-
49-
If you find any of the above leaking in a real event, please file an issue at
50-
`https://atomgit.com/atomgit_atomcode/atomcode/issues`.
51-
52-
## How to disable
53-
54-
Any one of these works (higher precedence overrides lower):
55-
56-
1. `export ATOMCODE_TELEMETRY=0` (environment, single process)
57-
2. `export DO_NOT_TRACK=1` (industry-standard signal)
58-
3. `atomcode --no-telemetry <command>` (single invocation)
59-
4. `atomcode telemetry disable` (persistent — writes to `~/.atomcode/config.toml`)
60-
61-
`atomcode telemetry status` shows which rule applies.
62-
63-
## Daemon behavior
64-
65-
The `atomcode daemon` process (backend for VS Code and other IDE integrations)
66-
shares the same telemetry pipeline as the CLI.
67-
68-
### Startup status line
69-
70-
On launch, the daemon prints one line to stdout:
71-
72-
```
73-
Telemetry: enabled
74-
```
75-
76-
or, if disabled:
77-
78-
```
79-
Telemetry: disabled (reason: env:ATOMCODE_TELEMETRY=0)
80-
```
81-
82-
The reason string matches the output of `atomcode telemetry status`.
83-
84-
### `--no-telemetry` flag
85-
86-
```sh
87-
atomcode daemon --port 13456 --no-telemetry
88-
```
89-
90-
Disables telemetry for this daemon process only (equivalent to
91-
`atomcode --no-telemetry` for CLI invocations).
92-
93-
### Graceful shutdown flush
94-
95-
When the daemon receives `SIGINT` / `SIGTERM` (or Ctrl+C on Windows), it:
96-
97-
1. Stops accepting new HTTP connections.
98-
2. Waits for in-flight requests to complete.
99-
3. Flushes any buffered telemetry events to disk (timeout: 500 ms).
100-
4. Exits.
101-
102-
Events that cannot be sent within the 500 ms budget remain in the local queue
103-
and are retried on the next process start.
104-
105-
### Shared state with CLI
106-
107-
The daemon and CLI share the same on-disk identity and queue:
108-
109-
| Path | Purpose |
110-
|---|---|
111-
| `~/.atomcode/device_id` | Stable device UUID (created on first run by whichever process starts first) |
112-
| `~/.atomcode/telemetry/queue/` | NDJSON event queue — both processes write segments concurrently using a claim-based mechanism to avoid corruption |
113-
114-
No daemon-specific files are introduced. Both processes read the same
115-
`~/.atomcode/config.toml` for the `[telemetry].enabled` setting.
116-
117-
### Filtering daemon events
118-
119-
`atomcode telemetry status` and `atomcode telemetry dump` work for daemon events
120-
too — they read from the same shared queue. To show only daemon-originated
121-
events:
122-
123-
```sh
124-
atomcode telemetry dump --last 100 --pretty | jq 'select(.mode == "ide")'
125-
```
126-
127-
## Inspect what will be sent
128-
129-
```sh
130-
atomcode telemetry dump --last 50 --pretty
131-
```
132-
133-
Prints the exact NDJSON records queued on disk waiting to be sent.
134-
Nothing is hidden.
14+
All emitted via OpenTelemetry if user configures exporter.

0 commit comments

Comments
 (0)