agent-trace-cli 0.1.0__tar.gz → 0.1.1__tar.gz

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.
Files changed (70) hide show
  1. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/PKG-INFO +57 -39
  2. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/README.md +56 -38
  3. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/__init__.py +1 -1
  4. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/cli.py +235 -28
  5. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/git_notes.py +5 -5
  6. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/remote.py +33 -4
  7. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/rules.py +13 -4
  8. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/summary.py +4 -4
  9. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/summary_presets.py +10 -8
  10. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/sync.py +2 -1
  11. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace_cli.egg-info/PKG-INFO +57 -39
  12. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/pyproject.toml +1 -1
  13. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_config_command.py +30 -1
  14. agent_trace_cli-0.1.1/tests/test_init.py +92 -0
  15. agent_trace_cli-0.1.0/tests/test_init.py +0 -44
  16. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/LICENSE +0 -0
  17. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/blame.py +0 -0
  18. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/blame_git.py +0 -0
  19. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/blame_meta.py +0 -0
  20. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/commit_link.py +0 -0
  21. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/config.py +0 -0
  22. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/context.py +0 -0
  23. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/conversations.py +0 -0
  24. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/hooks/__init__.py +0 -0
  25. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/hooks/base.py +0 -0
  26. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/hooks/claude.py +0 -0
  27. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/hooks/codex.py +0 -0
  28. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/hooks/cursor.py +0 -0
  29. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/hooks/git.py +0 -0
  30. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/ledger.py +0 -0
  31. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/models.py +0 -0
  32. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/record.py +0 -0
  33. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/registry.py +0 -0
  34. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/rewrite.py +0 -0
  35. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/schemas/commit-link.schema.json +0 -0
  36. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/schemas/git-note.schema.json +0 -0
  37. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/schemas/ledger.schema.json +0 -0
  38. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/schemas/remotes.schema.json +0 -0
  39. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/schemas/sync-state.schema.json +0 -0
  40. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/schemas/trace-record.schema.json +0 -0
  41. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/session.py +0 -0
  42. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/storage.py +0 -0
  43. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/telemetry.py +0 -0
  44. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace/trace.py +0 -0
  45. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace_cli.egg-info/SOURCES.txt +0 -0
  46. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace_cli.egg-info/dependency_links.txt +0 -0
  47. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace_cli.egg-info/entry_points.txt +0 -0
  48. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace_cli.egg-info/requires.txt +0 -0
  49. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/agent_trace_cli.egg-info/top_level.txt +0 -0
  50. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/setup.cfg +0 -0
  51. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_attribution_edge_cases.py +0 -0
  52. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_blame.py +0 -0
  53. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_codex_adapter.py +0 -0
  54. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_conversations.py +0 -0
  55. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_doctor.py +0 -0
  56. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_e2e.py +0 -0
  57. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_e2e_remote.py +0 -0
  58. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_git_notes.py +0 -0
  59. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_hooks.py +0 -0
  60. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_ledger.py +0 -0
  61. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_models.py +0 -0
  62. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_record.py +0 -0
  63. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_remote.py +0 -0
  64. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_schemas_property.py +0 -0
  65. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_summary.py +0 -0
  66. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_sync.py +0 -0
  67. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_telemetry.py +0 -0
  68. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_trace.py +0 -0
  69. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_viewer_project.py +0 -0
  70. {agent_trace_cli-0.1.0 → agent_trace_cli-0.1.1}/tests/test_workspace.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-trace-cli
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: CLI tool for tracing AI-generated code changes
5
5
  License-Expression: Apache-2.0
6
6
  Requires-Python: >=3.9
@@ -13,19 +13,32 @@ Requires-Dist: jsonschema>=4.20; extra == "dev"
13
13
  Requires-Dist: pytest; extra == "dev"
14
14
  Dynamic: license-file
15
15
 
16
- # agent-trace CLI
16
+ <h1 align="center">agent-trace CLI</h1>
17
17
 
18
- A command-line tool for tracing AI-generated code changes across coding agents like **Cursor** and **Claude Code**. Includes the **file viewer** for browsing files with git + agent-trace blame in your browser.
18
+ <p align="center">
19
+ Trace AI-generated code changes across Cursor, Claude Code, and Codex CLI.
20
+ </p>
19
21
 
20
- This implementation follows the [Agent Trace](https://agent-trace.dev/) specification and the **redesign** described in the umbrella workspace: deterministic-only attribution, local-first storage, **git-like** `push` / `pull` / `sync`, **git notes** (`refs/notes/agent-trace`) for sharing metadata with the repo, and an optional HTTP remote as a **pure datastore** (no server-side blame).
22
+ <p align="center">
23
+ <a href="https://pypi.org/project/agent-trace-cli/"><img alt="PyPI version" src="https://img.shields.io/pypi/v/agent-trace-cli"></a>
24
+ <a href="https://pypi.org/project/agent-trace-cli/"><img alt="PyPI downloads" src="https://img.shields.io/pypi/dm/agent-trace-cli"></a>
25
+ <a href="https://github.com/ujjalsharma100/agent-trace-cli/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/ujjalsharma100/agent-trace-cli"></a>
26
+ <a href="https://github.com/ujjalsharma100/agent-trace-cli/actions/workflows/docs.yml"><img alt="Documentation status" src="https://github.com/ujjalsharma100/agent-trace-cli/actions/workflows/docs.yml/badge.svg"></a>
27
+ </p>
28
+
29
+ Includes the **file viewer** for browsing files with git + agent-trace blame in your browser.
30
+
31
+ This implementation follows the [Agent Trace](https://agent-trace.dev/) specification: deterministic-only attribution, local-first storage, **git-like** `push` / `pull` / `sync`, **git notes** (`refs/notes/agent-trace`) for sharing metadata with the repo, and an optional HTTP remote as a **pure datastore** (no server-side blame).
32
+
33
+ When your host gives a trace **remote URL** and a **Bearer token**, add the remote with **`agent-trace remote add <name> <url> --token`** or **`--token-env`**. URLs may use a gateway path prefix such as **`/at/<org>/<project>`** before **`/api/v1/...`** sync routes.
21
34
 
22
35
  **How it behaves:**
23
36
 
24
- - **Local-first** — Hooks write JSONL under `AGENT_TRACE_HOME` (default `~/.agent-trace/`). Nothing is written into the repo. The `project_id` is derived from the repo's absolute path (Claude-Code convention: `/Users/jane/myrepo` → `-Users-jane-myrepo`), so data lives at `~/.agent-trace/projects/<project_id>/`.
37
+ - **Local-first** — Hooks write JSONL under `AGENT_TRACE_HOME` (default `~/.agent-trace/`). Nothing is written into your working tree. Each repo gets a stable `project_id` anchored in `.git/agent-trace-id`, so data lives at `~/.agent-trace/projects/<project_id>/` and stays put across renames and worktrees.
25
38
  - **Git-like flow** — `agent-trace init` is zero-prompt and sets up everything locally (like `git init`). Add remotes later with `agent-trace remote add` and run **`agent-trace push` / `pull` / `sync`** explicitly when you want to share. Nothing syncs automatically during editing.
26
39
  - **Git notes** — `agent-trace notes …` attaches composable JSON to commits under `refs/notes/agent-trace`, so attribution travels with `git fetch` / `git push` once the notes refspec is configured (set up automatically for `origin` during `init`).
27
40
 
28
- Use **`agent-trace blame <file>`** for per-line **AI**, **HUMAN**, **MIXED**, or **UNKNOWN** labels from the ledger (and git note inline ledger when present). There is **no heuristic blame path**: if there is no ledger (and no usable git note), lines are **UNKNOWN**.
41
+ Use **`agent-trace blame <file>`** for per-line attribution from the ledger (and git note inline ledger when present). Attribution is **binary** — each line is **AI** or **No attribution**. There is **no heuristic blame path**: if there is no ledger (and no usable git note), lines are **No attribution**.
29
42
 
30
43
  **Zero external dependencies** — uses only the Python standard library (requires Python 3.9+).
31
44
 
@@ -41,7 +54,7 @@ The **deterministic attribution ledger** is built at **commit time** by the post
41
54
  4. **Cross-file matching** — The ledger builder can match hashes across files (e.g. moves/refactors) when appropriate.
42
55
  5. **Post-rewrite hook** — After rebase or amend, `agent-trace rewrite-ledger` remaps ledger commit SHAs.
43
56
 
44
- `agent-trace blame` uses the ledger only. Missing ledger → **UNKNOWN** (honest absence of proof, not a guess).
57
+ `agent-trace blame` uses the ledger only. Missing ledger → **No attribution** (honest absence of proof, not a guess).
45
58
 
46
59
  ---
47
60
 
@@ -82,7 +95,7 @@ When released to PyPI: `pip install agent-trace-cli`. Build artifacts locally wi
82
95
  5. Installs the **file viewer** to `~/.agent-trace/viewer/` and creates `~/.agent-trace/bin/agent-trace-viewer`
83
96
  - If `npm` is available, builds the frontend from source; otherwise uses the pre-built `dist/`
84
97
  6. Adds `~/.agent-trace/bin` to your shell PATH (zsh, bash, or fish)
85
- 7. **Offers to set up global hooks** for Cursor and Claude Code (optional, per-tool prompt)
98
+ 7. **Offers to set up global hooks** for Cursor, Claude Code, and Codex CLI (optional, per-tool prompt)
86
99
 
87
100
  After installing, restart your shell (or `source ~/.zshrc`) and verify:
88
101
 
@@ -105,7 +118,7 @@ Then remove the `# agent-trace` + `export PATH=...` lines from your `~/.zshrc` /
105
118
 
106
119
  ### `agent-trace init`
107
120
 
108
- Zero-prompt initialization — like `git init`. Writes `project-config.json` for the repo, enables notes with default sections, installs git hooks (`post-commit`, `post-rewrite`) and per-tool hooks (Cursor, Claude Code) when a global hook is not already present, and auto-configures the git notes refspec (`refs/notes/agent-trace`) for `origin` if one exists.
121
+ Zero-prompt initialization — like `git init`. Writes `project-config.json` for the repo, enables notes (including **all-session conversations** by default), turns on **session summaries** with the built-in **ollama-summary** preset (default model **llama3.1:8b**; requires `ollama` on `PATH` when hooks run), installs git hooks (`post-commit`, `post-rewrite`) and per-tool hooks (Cursor, Claude Code) when a global hook is not already present, and auto-configures the git notes refspec (`refs/notes/agent-trace`) for `origin` if one exists.
109
122
 
110
123
  No prompts, no remote. If you want to share traces with a team, add a remote later with `agent-trace remote add`. Re-run with `agent-trace reset` to reconfigure interactively.
111
124
 
@@ -124,7 +137,7 @@ agent-trace status
124
137
 
125
138
  ### `agent-trace config {show,set,reset}`
126
139
 
127
- Show the full persisted configuration, or update/reset a specific field without going through the full interactive reset flow. Token values are masked in `config show`.
140
+ Show the full persisted configuration (human-readable field list by default, or `--json`), or update/reset a specific field without going through the full interactive reset flow. Token values are masked in `config show`.
128
141
 
129
142
  ```bash
130
143
  agent-trace config show
@@ -166,6 +179,7 @@ agent-trace hooks setup-global
166
179
  # Install for a specific tool only
167
180
  agent-trace hooks setup-global --tool cursor
168
181
  agent-trace hooks setup-global --tool claude
182
+ agent-trace hooks setup-global --tool codex
169
183
 
170
184
  # Check current status
171
185
  agent-trace hooks status
@@ -177,13 +191,14 @@ agent-trace hooks remove-global --tool claude
177
191
 
178
192
  | Subcommand | Options | Description |
179
193
  |------------|---------|-------------|
180
- | `setup-global` | `--tool cursor\|claude` | Install global hooks (default: all tools) |
181
- | `remove-global` | `--tool cursor\|claude` | Remove global hooks (default: all tools) |
194
+ | `setup-global` | `--tool cursor\|claude\|codex` | Install global hooks (default: all tools) |
195
+ | `remove-global` | `--tool cursor\|claude\|codex` | Remove global hooks (default: all tools) |
182
196
  | `status` | — | Show whether global hooks are configured |
183
197
 
184
198
  **Where hooks are written:**
185
199
  - Cursor: `~/.cursor/hooks.json`
186
200
  - Claude Code: `~/.claude/settings.json`
201
+ - Codex CLI: `~/.codex/config.toml`
187
202
 
188
203
  ### `agent-trace record`
189
204
 
@@ -195,7 +210,7 @@ echo '{"hook_event_name":"sessionStart",...}' | agent-trace record
195
210
 
196
211
  ### `agent-trace commit-link`
197
212
 
198
- Link the current git commit to the traces that were active in this session. Called automatically by the post-commit hook when you have configured git hooks. Also builds an **attribution ledger** for the commit — a deterministic per-line map of which lines are AI-authored, human-authored, or mixed.
213
+ Link the current git commit to the traces that were active in this session. Called automatically by the post-commit hook when you have configured git hooks. Also builds an **attribution ledger** for the commit — a deterministic, binary per-line map of which lines are AI-attributed versus not.
199
214
 
200
215
  ```bash
201
216
  agent-trace commit-link
@@ -203,7 +218,7 @@ agent-trace commit-link
203
218
 
204
219
  ### `agent-trace rewrite-ledger`
205
220
 
206
- Remap ledger commit SHAs after `git rebase` or `git commit --amend`. Called automatically by the post-rewrite hook — you don't normally run this manually. Git provides old-SHA/new-SHA pairs on stdin; this command updates `.agent-trace/ledgers.jsonl` accordingly.
221
+ Remap ledger commit SHAs after `git rebase` or `git commit --amend`. Called automatically by the post-rewrite hook — you don't normally run this manually. Git provides old-SHA/new-SHA pairs on stdin; this command updates the project's `ledgers.jsonl` (under `~/.agent-trace/projects/<id>/`) accordingly.
207
222
 
208
223
  ```bash
209
224
  # Called by .git/hooks/post-rewrite — not typically run manually
@@ -243,7 +258,7 @@ agent-trace context src/utils/parser.ts --lines 10-50 --query "why was this appr
243
258
  | `--json` | | Output as JSON (for machine / subagent consumption) |
244
259
  | `--query` | `-q` | Pass a query through to the output (for subagent instruction forwarding) |
245
260
 
246
- The JSON output includes per-segment fields: `start_line`, `end_line`, `attribution` (`ai`/`mixed`/`human`), `model_id`, `tool`, `trace_id`, `confidence`, `conversation_url`, `conversation_size`, and `preview`. When `--full` is set, `conversation_content` is also included.
261
+ The JSON output includes per-segment fields such as: `start_line`, `end_line`, `attribution` (`ai` / `no_attribution`), `model_id`, `tool`, `trace_id`, `confidence`, `conversation_id`, `conversation_size`, `preview`, optional `summary` (when session summaries are recorded), and optional `query` when `--query` is set. When `--full` is set, `conversation_content` is also included.
247
262
 
248
263
  Conversation content is resolved from local `file://` paths recorded alongside the trace.
249
264
 
@@ -251,7 +266,7 @@ Conversation content is resolved from local `file://` paths recorded alongside t
251
266
 
252
267
  ### `agent-trace rule {add,remove,show,list}`
253
268
 
254
- Manage **prebuilt rules** that teach coding agents (Cursor, Claude Code) how to use agent-trace features. Rules are written as `.mdc` (Cursor) or `.md` (Claude Code) files in the project's rules directory.
269
+ Manage **prebuilt rules** that teach coding agents (Cursor, Claude Code, Codex CLI) how to use agent-trace features. Rules are written as `.mdc` (Cursor) or `.md` (Claude Code, Codex CLI) files in the project's rules directory.
255
270
 
256
271
  ```bash
257
272
  # List available prebuilt rules
@@ -271,8 +286,8 @@ agent-trace rule remove context-for-agents --tool claude
271
286
  | Subcommand | Options | Description |
272
287
  |------------|---------|-------------|
273
288
  | `list` | — | List all available prebuilt rules with descriptions |
274
- | `add <name>` | `--tool cursor\|claude` | Write the rule file for the given tool |
275
- | `remove <name>` | `--tool cursor\|claude` | Remove the rule file |
289
+ | `add <name>` | `--tool cursor\|claude\|codex` | Write the rule file for the given tool |
290
+ | `remove <name>` | `--tool cursor\|claude\|codex` | Remove the rule file |
276
291
  | `show` | — | Show all active agent-trace rules in the project |
277
292
 
278
293
  **Available rules:**
@@ -284,34 +299,35 @@ agent-trace rule remove context-for-agents --tool claude
284
299
  Rules are written to:
285
300
  - Cursor: `.cursor/rules/agent-trace-<name>.mdc`
286
301
  - Claude Code: `.claude/rules/agent-trace-<name>.md`
302
+ - Codex CLI: `.codex/rules/agent-trace-<name>.md`
287
303
 
288
304
  ---
289
305
 
290
306
  ### `agent-trace blame <file>`
291
307
 
292
- Show **AI attribution** for a file using **deterministic, ledger-only** logic:
308
+ Show **AI attribution** for a file using **deterministic, ledger-only** logic. Attribution is **binary** — each line is **AI** or **No attribution**:
293
309
 
294
- - **Ledger** — For each commit, if `.agent-trace/ledgers.jsonl` contains a ledger (built at commit time from traces and line hashes), lines are labelled **AI**, **HUMAN**, or **MIXED** according to that ledger.
295
- - **UNKNOWN** — If there is no ledger for the introducing commit, or a line range is not covered by the ledger, the output is **UNKNOWN** (nothing is inferred from heuristics or scoring).
310
+ - **AI** — For each commit, if the project's `ledgers.jsonl` contains a ledger segment (built at commit time from traces and line hashes) matching the line, it is labelled **AI**.
311
+ - **No attribution** — If there is no ledger for the introducing commit, or a line is not covered by an AI segment, the output is **No attribution** (nothing is inferred from heuristics or scoring; the tool never claims a line was human-written).
296
312
 
297
- The command runs `git blame --porcelain`, groups lines by commit, then resolves attribution from the ledger only. Traces in `.agent-trace/traces.jsonl` are used to enrich model and tool metadata when a `trace_id` is present in the ledger.
313
+ The command runs `git blame --porcelain`, groups lines by commit, then resolves attribution from the ledger only. Traces in the project's `traces.jsonl` are used to enrich model and tool metadata when a `trace_id` is present in the ledger.
298
314
 
299
315
  ```bash
300
316
  agent-trace blame src/utils/parser.ts
301
317
  agent-trace blame src/utils/parser.ts --line 42
302
318
  agent-trace blame src/utils/parser.ts --range 10-100
303
319
  agent-trace blame src/utils/parser.ts --json
304
- agent-trace blame src/utils/parser.ts --show-unknown # Include UNKNOWN ranges in output
305
- agent-trace blame src/utils/parser.ts --require-attribution # Exit 1 if any line is UNKNOWN (CI)
320
+ agent-trace blame src/utils/parser.ts --show-no-attribution # Include No-attribution ranges in output
321
+ agent-trace blame src/utils/parser.ts --require-attribution # Exit 1 if any line is unattributed (CI)
306
322
  ```
307
323
 
308
324
  | Option | Short | Description |
309
325
  |--------|--------|-------------|
310
326
  | `--line` | `-l` | Blame a single line |
311
327
  | `--range` | `-r` | Blame a line range (e.g. `10-25`) |
312
- | `--json` | | Output attributions as JSON (`kind`: `AI`, `HUMAN`, `MIXED`, `UNKNOWN`) |
313
- | `--show-unknown` | | List UNKNOWN ranges (default is to omit them from text output) |
314
- | `--require-attribution` | | Fail with non-zero exit if any line would be UNKNOWN |
328
+ | `--json` | | Output attributions as JSON (`kind`: `AI` or `NO_ATTRIBUTION`) |
329
+ | `--show-no-attribution` | | List No-attribution ranges (default is to omit them from text output) |
330
+ | `--require-attribution` | | Fail with non-zero exit if any line is No attribution |
315
331
 
316
332
  ### `agent-trace set globaluser <token>`
317
333
 
@@ -374,8 +390,8 @@ The schema of the transcript is opaque to agent-trace — your command decides h
374
390
  Built-in preset aliases:
375
391
 
376
392
  - `claude-summary` → runs `claude -p "<prompt>"`
377
- - `cursor-summary` → runs `cursor agent -p "<prompt>" --trust`
378
- - `ollama-summary` → runs `ollama run <model> "<prompt>"` (`--model` optional; default `llama3.1:8b`)
393
+ - `cursor-summary` → runs `cursor agent --print --trust` (prompt piped on stdin)
394
+ - `ollama-summary` → runs `ollama run <model> --think=false` (prompt piped on stdin; `--model` optional, default `llama3.1:8b`)
379
395
 
380
396
  ### `agent-trace projects` | `adopt`
381
397
 
@@ -393,9 +409,9 @@ List registered projects or adopt a repo directory and print its `project_id`.
393
409
  }
394
410
  ```
395
411
 
396
- ### Project identity — no in-repo file
412
+ ### Project identity — `.git/agent-trace-id` anchor
397
413
 
398
- The `project_id` is derived from the canonical repo path (e.g. `/Users/jane/myrepo` `-Users-jane-myrepo`). Nothing is written into the repo to identify it; every invocation recomputes the id from the working directory. Moving the repo changes the id same as `git init`'ing a fresh copy.
414
+ On `init`, each repo gets a stable opaque `project_id` (`at-<32 hex>`) written to `.git/agent-trace-id`. Nothing is written into the working tree, and the anchor is never committed. Because the id lives inside `.git`, it is shared across linked worktrees and survives moving or renaming the repo; a fresh clone gets a new anchor. Before `init` (or outside a git repo) the tool falls back to a sanitized path-derived id.
399
415
 
400
416
  ### Project settings — `~/.agent-trace/projects/<project_id>/project-config.json`
401
417
 
@@ -405,7 +421,7 @@ Created/managed by `agent-trace init`. Holds `notes.*`, `summary.*`, and per-pro
405
421
 
406
422
  | Setting | Priority |
407
423
  |---------|----------|
408
- | Auth token | `AGENT_TRACE_TOKEN` env > global config |
424
+ | Sync auth token | Per-remote token bound by `agent-trace remote add --token` / `--token-env`. `AGENT_TRACE_TOKEN` and `set globaluser` are **legacy** and are not consulted by `push` / `pull` / `sync`. |
409
425
  | Remote URL | Named remote from `agent-trace remote` (per-project) |
410
426
 
411
427
  ---
@@ -414,7 +430,7 @@ Created/managed by `agent-trace init`. Holds `notes.*`, `summary.*`, and per-pro
414
430
 
415
431
  Hooks pipe coding agent events through `agent-trace record`. They can be installed at two levels:
416
432
 
417
- - **Global** (recommended) — `~/.cursor/hooks.json`, `~/.claude/settings.json`. Fire for *every* project, like `git config --global`. Set up once with `agent-trace hooks setup-global`.
433
+ - **Global** (recommended) — `~/.cursor/hooks.json`, `~/.claude/settings.json`, `~/.codex/config.toml`. Fire for *every* project, like `git config --global`. Set up once with `agent-trace hooks setup-global`.
418
434
  - **Project-level** — `<project>/.cursor/hooks.json`, `<project>/.claude/settings.json`. Set up per-project during `agent-trace init`.
419
435
 
420
436
  Global hooks are the recommended approach. The recording pipeline resolves the correct project from the **file being edited** (via its git root), not from the agent's working directory. This means:
@@ -485,6 +501,7 @@ Existing hooks are **preserved** — agent-trace entries are merged in without o
485
501
  ```
486
502
  ~/.cursor/hooks.json # Cursor global hooks (optional, via hooks setup-global)
487
503
  ~/.claude/settings.json # Claude Code global hooks (optional, via hooks setup-global)
504
+ ~/.codex/config.toml # Codex CLI global hooks (optional, via hooks setup-global)
488
505
 
489
506
  ~/.agent-trace/
490
507
  bin/agent-trace # CLI executable (on PATH)
@@ -494,14 +511,14 @@ Existing hooks are **preserved** — agent-trace entries are merged in without o
494
511
  __init__.py
495
512
  cli.py # CLI commands (argparse)
496
513
  config.py # Global + project settings
497
- storage.py # Path-based project_id + AGENT_TRACE_HOME paths
514
+ storage.py # project_id anchor (.git/agent-trace-id) + AGENT_TRACE_HOME paths
498
515
  registry.py # Optional metadata registry (first commit, origin, known_roots)
499
- hooks.py # Cursor, Claude Code & git hook setup (project + global)
516
+ hooks.py # Cursor, Claude Code, Codex CLI & git hook setup (project + global)
500
517
  record.py # Trace recording from hooks
501
518
  trace.py # Trace record construction + per-line hashing
502
- blame.py # Deterministic blame (ledger + git notes; UNKNOWN when missing)
519
+ blame.py # Deterministic blame (ledger + git notes; No attribution when missing)
503
520
  context.py # Conversation context for AI-attributed segments
504
- rules.py # Prebuilt agent rules (Cursor, Claude Code)
521
+ rules.py # Prebuilt agent rules (Cursor, Claude Code, Codex CLI)
505
522
  commit_link.py # Commit-link + ledger build (post-commit)
506
523
  ledger.py # Ledger construction
507
524
  rewrite.py # Post-rewrite SHA remapping
@@ -513,7 +530,7 @@ Existing hooks are **preserved** — agent-trace entries are merged in without o
513
530
  config.json # global config (auth_token)
514
531
  projects.json # optional metadata registry
515
532
 
516
- ~/.agent-trace/projects/<project_id>/ # project_id = sanitized absolute repo path
533
+ ~/.agent-trace/projects/<project_id>/ # project_id = opaque anchor id from .git/agent-trace-id
517
534
  project-config.json # project settings
518
535
  traces.jsonl
519
536
  commit-links.jsonl
@@ -522,9 +539,10 @@ Existing hooks are **preserved** — agent-trace entries are merged in without o
522
539
  session-summaries.jsonl
523
540
  sync-state.json # push/pull cursors (when using remotes)
524
541
 
525
- <your-project>/ # NOTHING is written into the repo itself for identity
542
+ <your-project>/ # nothing is written into the working tree
526
543
  .cursor/hooks.json # Cursor project hooks (only if no global hooks)
527
544
  .claude/settings.json # Claude Code project hooks (only if no global hooks)
545
+ .git/agent-trace-id # opaque project_id anchor (inside .git; never committed)
528
546
  .git/hooks/post-commit # agent-trace commit-link
529
547
  .git/hooks/post-rewrite # agent-trace rewrite-ledger
530
548
  .git/config # notes refspec added for `origin` so notes travel with push/fetch
@@ -1,16 +1,29 @@
1
- # agent-trace CLI
1
+ <h1 align="center">agent-trace CLI</h1>
2
2
 
3
- A command-line tool for tracing AI-generated code changes across coding agents like **Cursor** and **Claude Code**. Includes the **file viewer** for browsing files with git + agent-trace blame in your browser.
3
+ <p align="center">
4
+ Trace AI-generated code changes across Cursor, Claude Code, and Codex CLI.
5
+ </p>
4
6
 
5
- This implementation follows the [Agent Trace](https://agent-trace.dev/) specification and the **redesign** described in the umbrella workspace: deterministic-only attribution, local-first storage, **git-like** `push` / `pull` / `sync`, **git notes** (`refs/notes/agent-trace`) for sharing metadata with the repo, and an optional HTTP remote as a **pure datastore** (no server-side blame).
7
+ <p align="center">
8
+ <a href="https://pypi.org/project/agent-trace-cli/"><img alt="PyPI version" src="https://img.shields.io/pypi/v/agent-trace-cli"></a>
9
+ <a href="https://pypi.org/project/agent-trace-cli/"><img alt="PyPI downloads" src="https://img.shields.io/pypi/dm/agent-trace-cli"></a>
10
+ <a href="https://github.com/ujjalsharma100/agent-trace-cli/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/ujjalsharma100/agent-trace-cli"></a>
11
+ <a href="https://github.com/ujjalsharma100/agent-trace-cli/actions/workflows/docs.yml"><img alt="Documentation status" src="https://github.com/ujjalsharma100/agent-trace-cli/actions/workflows/docs.yml/badge.svg"></a>
12
+ </p>
13
+
14
+ Includes the **file viewer** for browsing files with git + agent-trace blame in your browser.
15
+
16
+ This implementation follows the [Agent Trace](https://agent-trace.dev/) specification: deterministic-only attribution, local-first storage, **git-like** `push` / `pull` / `sync`, **git notes** (`refs/notes/agent-trace`) for sharing metadata with the repo, and an optional HTTP remote as a **pure datastore** (no server-side blame).
17
+
18
+ When your host gives a trace **remote URL** and a **Bearer token**, add the remote with **`agent-trace remote add <name> <url> --token`** or **`--token-env`**. URLs may use a gateway path prefix such as **`/at/<org>/<project>`** before **`/api/v1/...`** sync routes.
6
19
 
7
20
  **How it behaves:**
8
21
 
9
- - **Local-first** — Hooks write JSONL under `AGENT_TRACE_HOME` (default `~/.agent-trace/`). Nothing is written into the repo. The `project_id` is derived from the repo's absolute path (Claude-Code convention: `/Users/jane/myrepo` → `-Users-jane-myrepo`), so data lives at `~/.agent-trace/projects/<project_id>/`.
22
+ - **Local-first** — Hooks write JSONL under `AGENT_TRACE_HOME` (default `~/.agent-trace/`). Nothing is written into your working tree. Each repo gets a stable `project_id` anchored in `.git/agent-trace-id`, so data lives at `~/.agent-trace/projects/<project_id>/` and stays put across renames and worktrees.
10
23
  - **Git-like flow** — `agent-trace init` is zero-prompt and sets up everything locally (like `git init`). Add remotes later with `agent-trace remote add` and run **`agent-trace push` / `pull` / `sync`** explicitly when you want to share. Nothing syncs automatically during editing.
11
24
  - **Git notes** — `agent-trace notes …` attaches composable JSON to commits under `refs/notes/agent-trace`, so attribution travels with `git fetch` / `git push` once the notes refspec is configured (set up automatically for `origin` during `init`).
12
25
 
13
- Use **`agent-trace blame <file>`** for per-line **AI**, **HUMAN**, **MIXED**, or **UNKNOWN** labels from the ledger (and git note inline ledger when present). There is **no heuristic blame path**: if there is no ledger (and no usable git note), lines are **UNKNOWN**.
26
+ Use **`agent-trace blame <file>`** for per-line attribution from the ledger (and git note inline ledger when present). Attribution is **binary** — each line is **AI** or **No attribution**. There is **no heuristic blame path**: if there is no ledger (and no usable git note), lines are **No attribution**.
14
27
 
15
28
  **Zero external dependencies** — uses only the Python standard library (requires Python 3.9+).
16
29
 
@@ -26,7 +39,7 @@ The **deterministic attribution ledger** is built at **commit time** by the post
26
39
  4. **Cross-file matching** — The ledger builder can match hashes across files (e.g. moves/refactors) when appropriate.
27
40
  5. **Post-rewrite hook** — After rebase or amend, `agent-trace rewrite-ledger` remaps ledger commit SHAs.
28
41
 
29
- `agent-trace blame` uses the ledger only. Missing ledger → **UNKNOWN** (honest absence of proof, not a guess).
42
+ `agent-trace blame` uses the ledger only. Missing ledger → **No attribution** (honest absence of proof, not a guess).
30
43
 
31
44
  ---
32
45
 
@@ -67,7 +80,7 @@ When released to PyPI: `pip install agent-trace-cli`. Build artifacts locally wi
67
80
  5. Installs the **file viewer** to `~/.agent-trace/viewer/` and creates `~/.agent-trace/bin/agent-trace-viewer`
68
81
  - If `npm` is available, builds the frontend from source; otherwise uses the pre-built `dist/`
69
82
  6. Adds `~/.agent-trace/bin` to your shell PATH (zsh, bash, or fish)
70
- 7. **Offers to set up global hooks** for Cursor and Claude Code (optional, per-tool prompt)
83
+ 7. **Offers to set up global hooks** for Cursor, Claude Code, and Codex CLI (optional, per-tool prompt)
71
84
 
72
85
  After installing, restart your shell (or `source ~/.zshrc`) and verify:
73
86
 
@@ -90,7 +103,7 @@ Then remove the `# agent-trace` + `export PATH=...` lines from your `~/.zshrc` /
90
103
 
91
104
  ### `agent-trace init`
92
105
 
93
- Zero-prompt initialization — like `git init`. Writes `project-config.json` for the repo, enables notes with default sections, installs git hooks (`post-commit`, `post-rewrite`) and per-tool hooks (Cursor, Claude Code) when a global hook is not already present, and auto-configures the git notes refspec (`refs/notes/agent-trace`) for `origin` if one exists.
106
+ Zero-prompt initialization — like `git init`. Writes `project-config.json` for the repo, enables notes (including **all-session conversations** by default), turns on **session summaries** with the built-in **ollama-summary** preset (default model **llama3.1:8b**; requires `ollama` on `PATH` when hooks run), installs git hooks (`post-commit`, `post-rewrite`) and per-tool hooks (Cursor, Claude Code) when a global hook is not already present, and auto-configures the git notes refspec (`refs/notes/agent-trace`) for `origin` if one exists.
94
107
 
95
108
  No prompts, no remote. If you want to share traces with a team, add a remote later with `agent-trace remote add`. Re-run with `agent-trace reset` to reconfigure interactively.
96
109
 
@@ -109,7 +122,7 @@ agent-trace status
109
122
 
110
123
  ### `agent-trace config {show,set,reset}`
111
124
 
112
- Show the full persisted configuration, or update/reset a specific field without going through the full interactive reset flow. Token values are masked in `config show`.
125
+ Show the full persisted configuration (human-readable field list by default, or `--json`), or update/reset a specific field without going through the full interactive reset flow. Token values are masked in `config show`.
113
126
 
114
127
  ```bash
115
128
  agent-trace config show
@@ -151,6 +164,7 @@ agent-trace hooks setup-global
151
164
  # Install for a specific tool only
152
165
  agent-trace hooks setup-global --tool cursor
153
166
  agent-trace hooks setup-global --tool claude
167
+ agent-trace hooks setup-global --tool codex
154
168
 
155
169
  # Check current status
156
170
  agent-trace hooks status
@@ -162,13 +176,14 @@ agent-trace hooks remove-global --tool claude
162
176
 
163
177
  | Subcommand | Options | Description |
164
178
  |------------|---------|-------------|
165
- | `setup-global` | `--tool cursor\|claude` | Install global hooks (default: all tools) |
166
- | `remove-global` | `--tool cursor\|claude` | Remove global hooks (default: all tools) |
179
+ | `setup-global` | `--tool cursor\|claude\|codex` | Install global hooks (default: all tools) |
180
+ | `remove-global` | `--tool cursor\|claude\|codex` | Remove global hooks (default: all tools) |
167
181
  | `status` | — | Show whether global hooks are configured |
168
182
 
169
183
  **Where hooks are written:**
170
184
  - Cursor: `~/.cursor/hooks.json`
171
185
  - Claude Code: `~/.claude/settings.json`
186
+ - Codex CLI: `~/.codex/config.toml`
172
187
 
173
188
  ### `agent-trace record`
174
189
 
@@ -180,7 +195,7 @@ echo '{"hook_event_name":"sessionStart",...}' | agent-trace record
180
195
 
181
196
  ### `agent-trace commit-link`
182
197
 
183
- Link the current git commit to the traces that were active in this session. Called automatically by the post-commit hook when you have configured git hooks. Also builds an **attribution ledger** for the commit — a deterministic per-line map of which lines are AI-authored, human-authored, or mixed.
198
+ Link the current git commit to the traces that were active in this session. Called automatically by the post-commit hook when you have configured git hooks. Also builds an **attribution ledger** for the commit — a deterministic, binary per-line map of which lines are AI-attributed versus not.
184
199
 
185
200
  ```bash
186
201
  agent-trace commit-link
@@ -188,7 +203,7 @@ agent-trace commit-link
188
203
 
189
204
  ### `agent-trace rewrite-ledger`
190
205
 
191
- Remap ledger commit SHAs after `git rebase` or `git commit --amend`. Called automatically by the post-rewrite hook — you don't normally run this manually. Git provides old-SHA/new-SHA pairs on stdin; this command updates `.agent-trace/ledgers.jsonl` accordingly.
206
+ Remap ledger commit SHAs after `git rebase` or `git commit --amend`. Called automatically by the post-rewrite hook — you don't normally run this manually. Git provides old-SHA/new-SHA pairs on stdin; this command updates the project's `ledgers.jsonl` (under `~/.agent-trace/projects/<id>/`) accordingly.
192
207
 
193
208
  ```bash
194
209
  # Called by .git/hooks/post-rewrite — not typically run manually
@@ -228,7 +243,7 @@ agent-trace context src/utils/parser.ts --lines 10-50 --query "why was this appr
228
243
  | `--json` | | Output as JSON (for machine / subagent consumption) |
229
244
  | `--query` | `-q` | Pass a query through to the output (for subagent instruction forwarding) |
230
245
 
231
- The JSON output includes per-segment fields: `start_line`, `end_line`, `attribution` (`ai`/`mixed`/`human`), `model_id`, `tool`, `trace_id`, `confidence`, `conversation_url`, `conversation_size`, and `preview`. When `--full` is set, `conversation_content` is also included.
246
+ The JSON output includes per-segment fields such as: `start_line`, `end_line`, `attribution` (`ai` / `no_attribution`), `model_id`, `tool`, `trace_id`, `confidence`, `conversation_id`, `conversation_size`, `preview`, optional `summary` (when session summaries are recorded), and optional `query` when `--query` is set. When `--full` is set, `conversation_content` is also included.
232
247
 
233
248
  Conversation content is resolved from local `file://` paths recorded alongside the trace.
234
249
 
@@ -236,7 +251,7 @@ Conversation content is resolved from local `file://` paths recorded alongside t
236
251
 
237
252
  ### `agent-trace rule {add,remove,show,list}`
238
253
 
239
- Manage **prebuilt rules** that teach coding agents (Cursor, Claude Code) how to use agent-trace features. Rules are written as `.mdc` (Cursor) or `.md` (Claude Code) files in the project's rules directory.
254
+ Manage **prebuilt rules** that teach coding agents (Cursor, Claude Code, Codex CLI) how to use agent-trace features. Rules are written as `.mdc` (Cursor) or `.md` (Claude Code, Codex CLI) files in the project's rules directory.
240
255
 
241
256
  ```bash
242
257
  # List available prebuilt rules
@@ -256,8 +271,8 @@ agent-trace rule remove context-for-agents --tool claude
256
271
  | Subcommand | Options | Description |
257
272
  |------------|---------|-------------|
258
273
  | `list` | — | List all available prebuilt rules with descriptions |
259
- | `add <name>` | `--tool cursor\|claude` | Write the rule file for the given tool |
260
- | `remove <name>` | `--tool cursor\|claude` | Remove the rule file |
274
+ | `add <name>` | `--tool cursor\|claude\|codex` | Write the rule file for the given tool |
275
+ | `remove <name>` | `--tool cursor\|claude\|codex` | Remove the rule file |
261
276
  | `show` | — | Show all active agent-trace rules in the project |
262
277
 
263
278
  **Available rules:**
@@ -269,34 +284,35 @@ agent-trace rule remove context-for-agents --tool claude
269
284
  Rules are written to:
270
285
  - Cursor: `.cursor/rules/agent-trace-<name>.mdc`
271
286
  - Claude Code: `.claude/rules/agent-trace-<name>.md`
287
+ - Codex CLI: `.codex/rules/agent-trace-<name>.md`
272
288
 
273
289
  ---
274
290
 
275
291
  ### `agent-trace blame <file>`
276
292
 
277
- Show **AI attribution** for a file using **deterministic, ledger-only** logic:
293
+ Show **AI attribution** for a file using **deterministic, ledger-only** logic. Attribution is **binary** — each line is **AI** or **No attribution**:
278
294
 
279
- - **Ledger** — For each commit, if `.agent-trace/ledgers.jsonl` contains a ledger (built at commit time from traces and line hashes), lines are labelled **AI**, **HUMAN**, or **MIXED** according to that ledger.
280
- - **UNKNOWN** — If there is no ledger for the introducing commit, or a line range is not covered by the ledger, the output is **UNKNOWN** (nothing is inferred from heuristics or scoring).
295
+ - **AI** — For each commit, if the project's `ledgers.jsonl` contains a ledger segment (built at commit time from traces and line hashes) matching the line, it is labelled **AI**.
296
+ - **No attribution** — If there is no ledger for the introducing commit, or a line is not covered by an AI segment, the output is **No attribution** (nothing is inferred from heuristics or scoring; the tool never claims a line was human-written).
281
297
 
282
- The command runs `git blame --porcelain`, groups lines by commit, then resolves attribution from the ledger only. Traces in `.agent-trace/traces.jsonl` are used to enrich model and tool metadata when a `trace_id` is present in the ledger.
298
+ The command runs `git blame --porcelain`, groups lines by commit, then resolves attribution from the ledger only. Traces in the project's `traces.jsonl` are used to enrich model and tool metadata when a `trace_id` is present in the ledger.
283
299
 
284
300
  ```bash
285
301
  agent-trace blame src/utils/parser.ts
286
302
  agent-trace blame src/utils/parser.ts --line 42
287
303
  agent-trace blame src/utils/parser.ts --range 10-100
288
304
  agent-trace blame src/utils/parser.ts --json
289
- agent-trace blame src/utils/parser.ts --show-unknown # Include UNKNOWN ranges in output
290
- agent-trace blame src/utils/parser.ts --require-attribution # Exit 1 if any line is UNKNOWN (CI)
305
+ agent-trace blame src/utils/parser.ts --show-no-attribution # Include No-attribution ranges in output
306
+ agent-trace blame src/utils/parser.ts --require-attribution # Exit 1 if any line is unattributed (CI)
291
307
  ```
292
308
 
293
309
  | Option | Short | Description |
294
310
  |--------|--------|-------------|
295
311
  | `--line` | `-l` | Blame a single line |
296
312
  | `--range` | `-r` | Blame a line range (e.g. `10-25`) |
297
- | `--json` | | Output attributions as JSON (`kind`: `AI`, `HUMAN`, `MIXED`, `UNKNOWN`) |
298
- | `--show-unknown` | | List UNKNOWN ranges (default is to omit them from text output) |
299
- | `--require-attribution` | | Fail with non-zero exit if any line would be UNKNOWN |
313
+ | `--json` | | Output attributions as JSON (`kind`: `AI` or `NO_ATTRIBUTION`) |
314
+ | `--show-no-attribution` | | List No-attribution ranges (default is to omit them from text output) |
315
+ | `--require-attribution` | | Fail with non-zero exit if any line is No attribution |
300
316
 
301
317
  ### `agent-trace set globaluser <token>`
302
318
 
@@ -359,8 +375,8 @@ The schema of the transcript is opaque to agent-trace — your command decides h
359
375
  Built-in preset aliases:
360
376
 
361
377
  - `claude-summary` → runs `claude -p "<prompt>"`
362
- - `cursor-summary` → runs `cursor agent -p "<prompt>" --trust`
363
- - `ollama-summary` → runs `ollama run <model> "<prompt>"` (`--model` optional; default `llama3.1:8b`)
378
+ - `cursor-summary` → runs `cursor agent --print --trust` (prompt piped on stdin)
379
+ - `ollama-summary` → runs `ollama run <model> --think=false` (prompt piped on stdin; `--model` optional, default `llama3.1:8b`)
364
380
 
365
381
  ### `agent-trace projects` | `adopt`
366
382
 
@@ -378,9 +394,9 @@ List registered projects or adopt a repo directory and print its `project_id`.
378
394
  }
379
395
  ```
380
396
 
381
- ### Project identity — no in-repo file
397
+ ### Project identity — `.git/agent-trace-id` anchor
382
398
 
383
- The `project_id` is derived from the canonical repo path (e.g. `/Users/jane/myrepo` `-Users-jane-myrepo`). Nothing is written into the repo to identify it; every invocation recomputes the id from the working directory. Moving the repo changes the id same as `git init`'ing a fresh copy.
399
+ On `init`, each repo gets a stable opaque `project_id` (`at-<32 hex>`) written to `.git/agent-trace-id`. Nothing is written into the working tree, and the anchor is never committed. Because the id lives inside `.git`, it is shared across linked worktrees and survives moving or renaming the repo; a fresh clone gets a new anchor. Before `init` (or outside a git repo) the tool falls back to a sanitized path-derived id.
384
400
 
385
401
  ### Project settings — `~/.agent-trace/projects/<project_id>/project-config.json`
386
402
 
@@ -390,7 +406,7 @@ Created/managed by `agent-trace init`. Holds `notes.*`, `summary.*`, and per-pro
390
406
 
391
407
  | Setting | Priority |
392
408
  |---------|----------|
393
- | Auth token | `AGENT_TRACE_TOKEN` env > global config |
409
+ | Sync auth token | Per-remote token bound by `agent-trace remote add --token` / `--token-env`. `AGENT_TRACE_TOKEN` and `set globaluser` are **legacy** and are not consulted by `push` / `pull` / `sync`. |
394
410
  | Remote URL | Named remote from `agent-trace remote` (per-project) |
395
411
 
396
412
  ---
@@ -399,7 +415,7 @@ Created/managed by `agent-trace init`. Holds `notes.*`, `summary.*`, and per-pro
399
415
 
400
416
  Hooks pipe coding agent events through `agent-trace record`. They can be installed at two levels:
401
417
 
402
- - **Global** (recommended) — `~/.cursor/hooks.json`, `~/.claude/settings.json`. Fire for *every* project, like `git config --global`. Set up once with `agent-trace hooks setup-global`.
418
+ - **Global** (recommended) — `~/.cursor/hooks.json`, `~/.claude/settings.json`, `~/.codex/config.toml`. Fire for *every* project, like `git config --global`. Set up once with `agent-trace hooks setup-global`.
403
419
  - **Project-level** — `<project>/.cursor/hooks.json`, `<project>/.claude/settings.json`. Set up per-project during `agent-trace init`.
404
420
 
405
421
  Global hooks are the recommended approach. The recording pipeline resolves the correct project from the **file being edited** (via its git root), not from the agent's working directory. This means:
@@ -470,6 +486,7 @@ Existing hooks are **preserved** — agent-trace entries are merged in without o
470
486
  ```
471
487
  ~/.cursor/hooks.json # Cursor global hooks (optional, via hooks setup-global)
472
488
  ~/.claude/settings.json # Claude Code global hooks (optional, via hooks setup-global)
489
+ ~/.codex/config.toml # Codex CLI global hooks (optional, via hooks setup-global)
473
490
 
474
491
  ~/.agent-trace/
475
492
  bin/agent-trace # CLI executable (on PATH)
@@ -479,14 +496,14 @@ Existing hooks are **preserved** — agent-trace entries are merged in without o
479
496
  __init__.py
480
497
  cli.py # CLI commands (argparse)
481
498
  config.py # Global + project settings
482
- storage.py # Path-based project_id + AGENT_TRACE_HOME paths
499
+ storage.py # project_id anchor (.git/agent-trace-id) + AGENT_TRACE_HOME paths
483
500
  registry.py # Optional metadata registry (first commit, origin, known_roots)
484
- hooks.py # Cursor, Claude Code & git hook setup (project + global)
501
+ hooks.py # Cursor, Claude Code, Codex CLI & git hook setup (project + global)
485
502
  record.py # Trace recording from hooks
486
503
  trace.py # Trace record construction + per-line hashing
487
- blame.py # Deterministic blame (ledger + git notes; UNKNOWN when missing)
504
+ blame.py # Deterministic blame (ledger + git notes; No attribution when missing)
488
505
  context.py # Conversation context for AI-attributed segments
489
- rules.py # Prebuilt agent rules (Cursor, Claude Code)
506
+ rules.py # Prebuilt agent rules (Cursor, Claude Code, Codex CLI)
490
507
  commit_link.py # Commit-link + ledger build (post-commit)
491
508
  ledger.py # Ledger construction
492
509
  rewrite.py # Post-rewrite SHA remapping
@@ -498,7 +515,7 @@ Existing hooks are **preserved** — agent-trace entries are merged in without o
498
515
  config.json # global config (auth_token)
499
516
  projects.json # optional metadata registry
500
517
 
501
- ~/.agent-trace/projects/<project_id>/ # project_id = sanitized absolute repo path
518
+ ~/.agent-trace/projects/<project_id>/ # project_id = opaque anchor id from .git/agent-trace-id
502
519
  project-config.json # project settings
503
520
  traces.jsonl
504
521
  commit-links.jsonl
@@ -507,9 +524,10 @@ Existing hooks are **preserved** — agent-trace entries are merged in without o
507
524
  session-summaries.jsonl
508
525
  sync-state.json # push/pull cursors (when using remotes)
509
526
 
510
- <your-project>/ # NOTHING is written into the repo itself for identity
527
+ <your-project>/ # nothing is written into the working tree
511
528
  .cursor/hooks.json # Cursor project hooks (only if no global hooks)
512
529
  .claude/settings.json # Claude Code project hooks (only if no global hooks)
530
+ .git/agent-trace-id # opaque project_id anchor (inside .git; never committed)
513
531
  .git/hooks/post-commit # agent-trace commit-link
514
532
  .git/hooks/post-rewrite # agent-trace rewrite-ledger
515
533
  .git/config # notes refspec added for `origin` so notes travel with push/fetch
@@ -1,3 +1,3 @@
1
1
  """agent-trace — CLI tool for tracing AI-generated code changes."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.1.1"