@raytrace-cli/cli 0.4.0 → 0.6.0

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 (137) hide show
  1. package/README.md +155 -123
  2. package/bin/raytrace.mjs +110 -22
  3. package/dist/dashboard/assets/dm-sans-latin-400-normal-BwCSEQnW.woff +0 -0
  4. package/dist/dashboard/assets/dm-sans-latin-400-normal-CW0RaeGs.woff2 +0 -0
  5. package/dist/dashboard/assets/dm-sans-latin-500-normal-B9HHJjqV.woff2 +0 -0
  6. package/dist/dashboard/assets/dm-sans-latin-500-normal-Dr3UlScf.woff +0 -0
  7. package/dist/dashboard/assets/dm-sans-latin-600-normal-Aqo67rzb.woff2 +0 -0
  8. package/dist/dashboard/assets/dm-sans-latin-600-normal-BmdmIIQ2.woff +0 -0
  9. package/dist/dashboard/assets/dm-sans-latin-700-normal-CUSSCpQX.woff +0 -0
  10. package/dist/dashboard/assets/dm-sans-latin-700-normal-DvUfVpUG.woff2 +0 -0
  11. package/dist/dashboard/assets/dm-sans-latin-ext-400-normal-BjWJ59Pq.woff +0 -0
  12. package/dist/dashboard/assets/dm-sans-latin-ext-400-normal-BtiwyxMk.woff2 +0 -0
  13. package/dist/dashboard/assets/dm-sans-latin-ext-500-normal-BJfUCQsA.woff2 +0 -0
  14. package/dist/dashboard/assets/dm-sans-latin-ext-500-normal-DR84L5F-.woff +0 -0
  15. package/dist/dashboard/assets/dm-sans-latin-ext-600-normal-4vooXBpG.woff2 +0 -0
  16. package/dist/dashboard/assets/dm-sans-latin-ext-600-normal-DRtaDpgU.woff +0 -0
  17. package/dist/dashboard/assets/dm-sans-latin-ext-700-normal-BLI3TTWz.woff +0 -0
  18. package/dist/dashboard/assets/dm-sans-latin-ext-700-normal-CJIcxD6K.woff2 +0 -0
  19. package/dist/dashboard/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  20. package/dist/dashboard/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  21. package/dist/dashboard/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  22. package/dist/dashboard/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  23. package/dist/dashboard/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
  24. package/dist/dashboard/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
  25. package/dist/dashboard/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  26. package/dist/dashboard/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  27. package/dist/dashboard/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  28. package/dist/dashboard/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  29. package/dist/dashboard/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
  30. package/dist/dashboard/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
  31. package/dist/dashboard/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  32. package/dist/dashboard/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  33. package/dist/dashboard/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  34. package/dist/dashboard/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  35. package/dist/dashboard/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
  36. package/dist/dashboard/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
  37. package/dist/dashboard/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  38. package/dist/dashboard/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  39. package/dist/dashboard/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  40. package/dist/dashboard/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  41. package/dist/dashboard/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
  42. package/dist/dashboard/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
  43. package/dist/dashboard/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  44. package/dist/dashboard/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  45. package/dist/dashboard/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  46. package/dist/dashboard/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  47. package/dist/dashboard/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
  48. package/dist/dashboard/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
  49. package/dist/dashboard/assets/index-Dc3LTk8b.js +38 -0
  50. package/dist/dashboard/assets/index-DtV3UdEB.css +1 -0
  51. package/dist/dashboard/index.html +2 -2
  52. package/package.json +4 -1
  53. package/proxy/agent-intent-schema.test.mjs +142 -0
  54. package/proxy/call-assessment.mjs +385 -0
  55. package/proxy/call-assessment.test.mjs +167 -0
  56. package/proxy/call-category.mjs +461 -0
  57. package/proxy/capture.mjs +38 -0
  58. package/proxy/capture.test.mjs +49 -0
  59. package/proxy/claude-code-adapter.mjs +65 -3
  60. package/proxy/claude-code-hook.mjs +3 -1
  61. package/proxy/codex-config.mjs +5 -0
  62. package/proxy/codex.mjs +3 -2
  63. package/proxy/evidence-schema.test.mjs +233 -0
  64. package/proxy/evidence-store.mjs +704 -33
  65. package/proxy/evidence-store.test.mjs +304 -0
  66. package/proxy/exec-narrative.mjs +625 -0
  67. package/proxy/exec-narrative.test.mjs +262 -0
  68. package/proxy/execution-correlation.mjs +185 -0
  69. package/proxy/execution-correlation.test.mjs +146 -0
  70. package/proxy/execution-runner.test.mjs +38 -0
  71. package/proxy/experiment-engine.mjs +7 -4
  72. package/proxy/experiment-engine.test.mjs +93 -0
  73. package/proxy/explanations.test.mjs +20 -0
  74. package/proxy/failure-signature.mjs +56 -0
  75. package/proxy/gvisor-forwarder.mjs +454 -0
  76. package/proxy/gvisor-forwarder.test.mjs +368 -0
  77. package/proxy/init-evidence-db.mjs +166 -12
  78. package/proxy/local-sandboxes.mjs +94 -0
  79. package/proxy/local-token.mjs +30 -0
  80. package/proxy/playground-recovery.test.mjs +130 -0
  81. package/proxy/playground.mjs +439 -0
  82. package/proxy/prompt-context.mjs +12 -7
  83. package/proxy/prompt-traces.mjs +6 -0
  84. package/proxy/prompt-traces.test.mjs +32 -0
  85. package/proxy/providers.test.mjs +76 -0
  86. package/proxy/proxy.integration.test.mjs +135 -0
  87. package/proxy/raytace-proxy.mjs +512 -188
  88. package/proxy/request-metrics.test.mjs +19 -0
  89. package/proxy/request-policy.mjs +45 -0
  90. package/proxy/request-policy.test.mjs +47 -0
  91. package/proxy/run-recap.mjs +139 -0
  92. package/proxy/runtime-attribution.mjs +110 -0
  93. package/proxy/sandbox-bridge.mjs +49 -0
  94. package/proxy/schema/EVIDENCE_DATABASE.md +276 -0
  95. package/proxy/schema/auxiliary.sql +48 -1
  96. package/proxy/schema/classification.sql +89 -0
  97. package/proxy/schema/file_context.sql +53 -0
  98. package/proxy/schema/runtime_evidence.sql +201 -0
  99. package/proxy/schema/search.sql +66 -0
  100. package/proxy/search.mjs +418 -0
  101. package/proxy/search.test.mjs +161 -0
  102. package/proxy/smoke.test.mjs +93 -0
  103. package/proxy/step-attribution.mjs +380 -0
  104. package/proxy/step-lab.test.mjs +38 -0
  105. package/proxy/summaries.test.mjs +69 -0
  106. package/proxy/tool-metadata.mjs +36 -0
  107. package/proxy/tool-metadata.test.mjs +38 -0
  108. package/proxy/trace-view.mjs +308 -0
  109. package/proxy/trace-view.test.mjs +72 -0
  110. package/proxy/typesafe.mjs +63 -0
  111. package/proxy/typesafe.test.mjs +39 -0
  112. package/src/claude-code.mjs +38 -1
  113. package/src/commands.mjs +133 -20
  114. package/src/config.mjs +16 -7
  115. package/src/export.mjs +200 -0
  116. package/src/lima.mjs +176 -0
  117. package/src/local-sandbox.mjs +339 -0
  118. package/src/paths.mjs +8 -8
  119. package/src/proxy-process.mjs +45 -3
  120. package/src/sandbox.mjs +37 -9
  121. package/src/upload.mjs +198 -0
  122. package/worker/sandbox/Dockerfile +8 -0
  123. package/worker/sandbox/SYSCALL_CATALOG.md +197 -0
  124. package/worker/sandbox/claude-hook.mjs +364 -0
  125. package/worker/sandbox/collector.py +357 -0
  126. package/worker/sandbox/dns_forwarder.py +255 -0
  127. package/worker/sandbox/engine.py +940 -0
  128. package/worker/sandbox/file_scan.py +491 -0
  129. package/worker/sandbox/lima.yaml +29 -0
  130. package/worker/sandbox/network.py +90 -0
  131. package/worker/sandbox/projects.py +679 -0
  132. package/worker/sandbox/setup.py +159 -0
  133. package/worker/sandbox/syscall_catalog.sql +985 -0
  134. package/worker/sandbox/transcript-delivery.test.mjs +153 -0
  135. package/worker/sandbox/viewer.py +151 -0
  136. package/dist/dashboard/assets/index-BQ9_JxGq.js +0 -27
  137. package/dist/dashboard/assets/index-L5cUAvhE.css +0 -1
package/README.md CHANGED
@@ -3,7 +3,8 @@
3
3
  **See what your coding agent actually did.**
4
4
 
5
5
  [ npm package ](https://www.npmjs.com/package/@raytrace-cli/cli) ·
6
- [ Quick start ](#quick-start) · [ Dashboard tour ](#dashboard-tour) ·
6
+ [ Quick start ](#quick-start) · [ Cloud sandboxes ](#cloud-sandboxes-preview) ·
7
+ [ Local sandboxes ](#local-sandboxes) ·
7
8
  [ Privacy ](#privacy) · [ Report an issue ](https://github.com/Godcreatebugs/raytrace-cli/issues)
8
9
 
9
10
  Your agent finished the task. Which files did it read? What commands did it run?
@@ -11,7 +12,7 @@ Where did the tokens and money go?
11
12
 
12
13
  RayTrace turns Claude Code and Codex sessions into a dashboard you can explore:
13
14
  prompts, answers, tool calls, cost, and captured context. Run your agent in a
14
- RayTrace cloud sandbox, or record the sessions you run on your own machine.
15
+ RayTrace cloud sandbox and review every session with your team.
15
16
 
16
17
  ![RayTrace tool-call timeline showing commands, reported results, cost, time, and token usage](https://raw.githubusercontent.com/Godcreatebugs/raytrace-cli/main/docs/images/tool-calls.jpg)
17
18
 
@@ -25,7 +26,8 @@ RayTrace cloud sandbox, or record the sessions you run on your own machine.
25
26
  ## Quick start
26
27
 
27
28
  You need **Node.js 22.13 or newer** (`node --version`). macOS and Linux are
28
- supported.
29
+ supported. To keep your project on your own machine instead, see
30
+ [Local sandboxes](#local-sandboxes).
29
31
 
30
32
  ```sh
31
33
  npm install -g @raytrace-cli/cli
@@ -44,75 +46,6 @@ ran. You can also create the sandbox there, by dropping a project folder on the
44
46
  Sandboxes page. RayTrace asks you for no API key. See
45
47
  [Cloud sandboxes](#cloud-sandboxes-preview) for what is uploaded and the limits.
46
48
 
47
- ### Record locally instead
48
-
49
- To keep sessions on your own machine, set up local recording. It is separate
50
- from cloud sandboxes: neither needs the other.
51
-
52
- ```sh
53
- raytrace setup
54
- ```
55
-
56
- `setup` asks one thing: **Record Claude Code sessions?** It adds a small hook to
57
- `~/.claude/settings.json`. Your other settings and hooks are left as they are,
58
- and the previous file is kept as `settings.json.raytrace-backup`. No API key is
59
- needed.
60
-
61
- Then it starts RayTrace and opens the dashboard at **http://127.0.0.1:8797**.
62
-
63
- Install globally (`-g`): the Claude Code hook runs the `raytrace` command, so it
64
- has to stay on your PATH.
65
-
66
- Use Claude Code as you normally do. Try a small task such as:
67
-
68
- > List the files in this project and explain where the main entry point is.
69
-
70
- After the agent answers, open **Prompts** in the dashboard. Select your prompt,
71
- then choose **Tool calls** to follow the work or **Context** to inspect what
72
- was brought into the task.
73
-
74
- For Codex on your machine, give setup an OpenRouter key and start it through
75
- RayTrace. Optional AI summaries in the local dashboard use the same key; see
76
- [Privacy](#privacy) for what they send outside your machine.
77
-
78
- ```sh
79
- raytrace setup --openrouter-key <key>
80
- raytrace codex # pass Codex arguments after this command
81
- ```
82
-
83
- ## Dashboard tour
84
-
85
- ### Prompts — find the conversation
86
-
87
- Browse your prompt history, revisit answers, and see activity across the year.
88
- Each prompt links to its tool calls and context, with model and cost information
89
- alongside it when available.
90
-
91
- ![RayTrace prompt history with an activity calendar and real Claude Code tasks](https://raw.githubusercontent.com/Godcreatebugs/raytrace-cli/main/docs/images/prompts.jpg)
92
-
93
- ### Tool calls — follow each step
94
-
95
- The timeline shows the commands the agent chose, their reported results, and
96
- metrics for each model round trip. Expand a row for details, group similar steps,
97
- or switch to **Graph** to follow the sequence visually.
98
-
99
- ![RayTrace graph connecting three model requests with reported tool-call results and request metrics](https://raw.githubusercontent.com/Godcreatebugs/raytrace-cli/main/docs/images/trace-graph.jpg)
100
-
101
- *Graph view works without AI summaries; an optional OpenRouter key adds short descriptions.*
102
-
103
- ### Context — inspect what informed the answer
104
-
105
- Explore earlier prompts, files read during the task, and captured internal
106
- instructions. Open a file entry to inspect the text associated with it. Token
107
- counts and file-use indicators help you explore what contributed to the context.
108
-
109
- ![RayTrace context inspector showing file reads, estimated tokens, and an expanded file entry](https://raw.githubusercontent.com/Godcreatebugs/raytrace-cli/main/docs/images/context.jpg)
110
-
111
- *Screenshots captured from RayTrace running locally in Brave with selected real
112
- Claude Code transcript excerpts. Local paths are anonymized; prior conversation
113
- was omitted from the screenshot dataset. Token estimates and Claude Code costs
114
- are approximate; file reads inferred from shell commands are marked in the UI.*
115
-
116
49
  ## Cloud sandboxes (preview)
117
50
 
118
51
  A cloud sandbox is an isolated copy of your project on RayTrace's servers, with
@@ -149,9 +82,100 @@ which one the CLI is using.
149
82
  Cloud sandboxes are a preview and may change; please
150
83
  [report issues](https://github.com/Godcreatebugs/raytrace-cli/issues) you run into.
151
84
 
152
- ## Commands
85
+ ## Local sandboxes
86
+
87
+ Prefer to keep your project on your own machine? Run the same sandbox locally.
88
+ It is open source and needs no RayTrace account.
89
+
90
+ ```sh
91
+ cd your-project
92
+ raytrace sandbox create --local --name my-box # first run sets up a Linux VM; a few minutes
93
+ raytrace connect my-box # a terminal in it: run claude there
94
+ raytrace sandbox destroy my-box # asks whether to delete its logs too
95
+ ```
153
96
 
154
- Cloud sandboxes:
97
+ - **How it runs:** a Linux VM made with [Lima](https://lima-vm.io), and inside
98
+ it each sandbox in a Docker container under [gVisor](https://gvisor.dev),
99
+ with no access to your machine's files or private networks. A copy of the
100
+ project goes in, picked the same way as for a cloud sandbox; your own files
101
+ are never changed. `--name` defaults to the repository folder's name.
102
+ - **What is recorded:** the commands, file changes and network connections the
103
+ sandbox makes, by a collector outside it that the agent cannot turn off,
104
+ and its Claude Code sessions. All of it is in your local dashboard
105
+ (`raytrace open`): **Sandboxes** lists each sandbox with its prompts, and
106
+ **Sandbox evidence** shows, for one prompt, every command that actually ran,
107
+ its exit code and what it reached on the network, each joined to the tool
108
+ call that ran it. The raw collector feed is at `/raytace/viewer/` on the
109
+ dashboard's address.
110
+ Nothing leaves your machine.
111
+ - **Changes:** the sandbox's Claude Code hook snapshots the project after
112
+ every edit, so **Changes** shows what each prompt left different, file by
113
+ file, with a patch to take home.
114
+ - **Playground:** rerun a session from any step with part of it changed (a
115
+ tool result, a file, the model, the message) and compare where it ends up,
116
+ optionally with a check command such as `npm test` as pass or fail. Each
117
+ rerun is a fork: a sandbox of its own in the VM, started from the snapshot
118
+ just before that step, running Claude Code on the sign-in you made in the
119
+ sandbox (so it uses your Claude account). The newest fork is kept, stopped,
120
+ for a day; destroying a sandbox destroys its forks.
121
+ - **Signing in to your agent:** run `claude` inside the sandbox and sign in.
122
+ RayTrace passes no key in. The sign-in stays in the sandbox until you destroy it.
123
+ - **Destroying it:** `raytrace sandbox destroy <name>` deletes the sandbox and
124
+ asks whether to delete the logs captured in it as well. Yes deletes them
125
+ everywhere, dashboard included, Playground forks too. No moves them to
126
+ `~/.raytrace/archive/<name>-<time>/` (Claude Code transcripts, its forks'
127
+ under `forks/`, and the recorded commands, files and connections as JSON
128
+ lines), and its sessions stay in your dashboard. `--delete-logs` or `--keep-logs` answers without
129
+ asking.
130
+ - **What you need:** nothing to install on macOS 13.5 or later. RayTrace
131
+ uses [Lima](https://lima-vm.io) for the VM: yours if you have Lima 2.0 or
132
+ later, otherwise it offers to download Lima's own release into
133
+ `~/.raytrace/lima` (no admin rights; checked against a pinned checksum).
134
+ Docker, gVisor and the agents are installed inside the VM, not on your
135
+ machine. On Linux, also QEMU and access to `/dev/kvm`. On macOS before
136
+ 13.5, QEMU (`brew install qemu`). `raytrace doctor` shows what is missing,
137
+ and `create --local` says so before it starts. First run downloads about
138
+ 1 GB (Lima, Ubuntu, packages); the VM uses 4 GiB of memory while it runs.
139
+ - **Platforms:** macOS and Linux. Windows is experimental: Lima's Windows
140
+ support is itself experimental, and RayTrace does not download Lima there.
141
+ - **The VM:** `limactl stop raytrace` frees its memory; `limactl delete
142
+ raytrace` removes it.
143
+
144
+ ## AI features, on your own key
145
+
146
+ The dashboard records and shows everything above without any key. A few
147
+ views can also ask a model to explain a run; locally they use **your own
148
+ OpenRouter key**, and the calls are billed to your OpenRouter account.
149
+
150
+ ```sh
151
+ raytrace key openrouter # paste your key from https://openrouter.ai/keys (not echoed)
152
+ raytrace key # which keys are set
153
+ ```
154
+
155
+ | Feature | Where | Model (default) |
156
+ |---|---|---|
157
+ | Run recap: what the agent did and why, in a few lines | Story, Chain of thought | `anthropic/claude-sonnet-5.5` |
158
+ | Chain of thought: the likely reasons for each tool call | Chain of thought | `qwen/qwen3-coder` |
159
+ | Step summaries, and plain-English lines for commands no rule describes | Tool calls, Sandbox evidence | `openai/gpt-oss-120b` |
160
+
161
+ - **Without a key** those parts say so and everything else works: Story's key
162
+ moments, Chain of thought's unranked reasons and the rule-based command
163
+ descriptions need no model.
164
+ - **Cost:** each answer is kept, so opening the same prompt again costs
165
+ nothing. Nothing is sent until you open a view that needs it.
166
+ - **What is sent:** to OpenRouter, the parts of the recorded run the feature
167
+ reads (the prompt, tool calls and their results, commands). Nothing goes to
168
+ RayTrace.
169
+ - **Other models:** set `RAYTACE_OBSERVER_MODEL` (recap),
170
+ `RAYTACE_ATTRIBUTION_MODEL` (Chain of thought) or `RAYTACE_SUMMARY_MODEL`
171
+ (summaries) in `~/.raytrace/config.env`, then `raytrace stop && raytrace start`.
172
+ - **Optional, Jev ranking:** `raytrace key typesafe` adds a
173
+ [TypeSafe](https://typesafe.ai) key, which ranks Chain of thought's reasons
174
+ and rates how severe each command was. Without it the reasons are listed
175
+ unranked and severity comes from rules.
176
+ - `raytrace key openrouter --remove` removes a key.
177
+
178
+ ## Commands
155
179
 
156
180
  | Command | What it does |
157
181
  |---|---|
@@ -161,52 +185,34 @@ Cloud sandboxes:
161
185
  | `raytrace sandbox start\|stop [id]` | start or stop a sandbox; stopping keeps its files |
162
186
  | `raytrace sandbox destroy [id]` | delete a sandbox; its recorded sessions are kept |
163
187
  | `raytrace auth login` | sign in to RayTrace; `status`, `logout` |
188
+ | `raytrace sandbox create --local [--name <name>]` | the same sandbox in a Linux VM on this machine; offers to download Lima if needed (`--yes` skips the question) |
189
+ | `raytrace sandbox list --local` | your local sandboxes; their names work with `connect`, `start`, `stop` and `destroy` |
190
+ | `raytrace sandbox destroy <name> [--delete-logs \| --keep-logs]` | delete a local sandbox; asks whether its captured logs go too, or move to `~/.raytrace/archive` |
191
+ | `raytrace export <trace-id> [--format json\|markdown] [--output <file>]` | export a recorded trace to terminal or owner-only file without running the proxy |
192
+ | `raytrace doctor` | what this machine has and lacks, local sandboxes included |
193
+ | `raytrace key [openrouter\|typesafe] [--remove]` | your keys for the dashboard's AI features; asked for, never taken as an argument |
164
194
 
165
- Local recording:
195
+ ## Exporting traces
166
196
 
167
- | Command | What it does |
168
- |---|---|
169
- | `raytrace setup` | set up local recording; run it again to change settings |
170
- | `raytrace start` | start recording in the background |
171
- | `raytrace stop` | stop it |
172
- | `raytrace status` | is it running, and is Claude Code being recorded |
173
- | `raytrace open` | open the local dashboard |
174
- | `raytrace doctor` | check the install without changing anything |
175
- | `raytrace codex [args]` | run Codex through RayTrace |
176
- | `raytrace uninstall` | remove the Claude Code hook; `--purge` also deletes recorded data |
177
-
178
- ## Getting the most out of it
179
-
180
- RayTrace shows what the agent **reported** at each step: the commands it chose,
181
- their output, and whether it said they succeeded. That is exactly what the
182
- agent believed, which is usually what you want to debug.
183
-
184
- It works best when the agent runs in **its own container or virtual machine**
185
- rather than directly on your laptop. A run you can tell apart from everything
186
- else on the machine is easier to trust and easier to compare: you know what the
187
- agent started from, nothing else was changing the files under it, and a second
188
- attempt starts from the same place. If you already run agents that way, point
189
- RayTrace at the same sessions and the records line up run for run.
197
+ Export a recorded session directly from local evidence, even when RayTrace and the VM are stopped:
190
198
 
191
- ## Privacy
199
+ ```sh
200
+ # View trace in terminal as Markdown
201
+ raytrace export <trace-id>
202
+
203
+ # Export structured JSON
204
+ raytrace export <trace-id> --format json
205
+
206
+ # Save report to a file with owner-only (0600) permissions
207
+ raytrace export <trace-id> --format markdown --output trace.md
208
+ ```
192
209
 
193
- Local recording stays on your machine.
210
+ Exported traces contain the full turn prompt, answer, tool calls, exit codes, and observed sandbox execution. Output files refuse to overwrite existing files to prevent accidental data loss.
194
211
 
195
- - Recorded sessions, settings and logs live in `~/.raytrace` (move it with the
196
- `RAYTRACE_HOME` environment variable). The dashboard and its API listen on
197
- `127.0.0.1` only.
198
- - An API key you give `setup` (`--openrouter-key`) is stored in `~/.raytrace/config.env`, readable
199
- only by you. Keys and auth headers in recorded requests are replaced with
200
- `[REDACTED]` before they are saved.
201
- - With an OpenRouter key, summaries send short excerpts of each step (and of
202
- your earlier prompts, for the Context view) to OpenRouter, using your key.
203
- Rerunning a Codex step in the Lab sends that step's whole request again.
204
- Without a key, none of this happens.
205
- - To show how full a model's context window was, the dashboard fetches
206
- OpenRouter's public list of models once. That request carries none of your
207
- data.
212
+ ## Privacy
208
213
 
209
- Cloud sandboxes are different by design: they run on RayTrace's servers.
214
+ Local sandboxes keep everything on your machine. Cloud sandboxes run on
215
+ RayTrace's servers.
210
216
 
211
217
  - `raytrace sandbox create` uploads your project (see
212
218
  [what is uploaded](#cloud-sandboxes-preview)) to RayTrace.
@@ -217,27 +223,53 @@ Cloud sandboxes are different by design: they run on RayTrace's servers.
217
223
  - `raytrace auth login` keeps your sign-in in the macOS Keychain or the Linux
218
224
  secret service (a file readable only by you where neither is available), and
219
225
  `raytrace auth logout` removes it.
226
+ - What RayTrace records locally stays in `~/.raytrace`, readable only by you.
227
+ Its local API takes the token in `~/.raytrace/api-token`, so another account
228
+ on the machine cannot read your traces or spend your OpenRouter key through
229
+ it. `raytrace open` signs your browser in with a one-time link.
220
230
 
221
231
  ## Uninstall
222
232
 
223
233
  ```sh
224
- raytrace uninstall --purge # removes the hook and ~/.raytrace
234
+ raytrace sandbox destroy <sandbox-id> # any sandboxes you no longer need
235
+ raytrace auth logout
225
236
  npm uninstall -g @raytrace-cli/cli
226
237
  ```
227
238
 
228
- ## Troubleshooting
239
+ Upgrading from 0.4 or earlier: the first start of the new version upgrades
240
+ `~/.raytrace/evidence.db` in place (your recorded sessions are kept), and older
241
+ versions cannot open it afterwards.
229
242
 
230
- Run `raytrace doctor` first; it lists anything wrong and how to fix it. The
231
- background process logs to `~/.raytrace/logs/proxy.log`.
243
+ With local sandboxes, run `raytrace uninstall --purge` before removing the
244
+ package: it deletes the local sandbox VM and everything in `~/.raytrace`
245
+ (recorded sessions, archived logs, and the Lima RayTrace downloaded). Without
246
+ `--purge`, remove the VM yourself with `limactl delete --force raytrace`.
247
+
248
+ If you set up local recording with an earlier version, run
249
+ `raytrace uninstall` before removing the package so Claude Code is not left
250
+ with a hook that points at a missing command.
251
+
252
+ ## Troubleshooting
232
253
 
233
- - **Nothing shows up for Claude Code:** check `raytrace status` says
234
- "recording", and that `raytrace` is on your PATH (`which raytrace`). Sessions
235
- appear when the agent finishes a step, not while it is typing.
236
254
  - **`Cannot reach RayTrace at https://api.raytracer.si`:** check your
237
255
  connection. Networks that inspect HTTPS, such as some company Wi-Fi, can
238
256
  block it; try another network.
239
- - **Port 8797 is in use:** set `RAYTACE_PORT=<port>` in `~/.raytrace/config.env`,
240
- then `raytrace stop && raytrace start`.
257
+ - **Sign-in or sandbox creation fails:** run `raytrace auth status`, and
258
+ `raytrace auth login` again if needed. Create the sandbox from inside a Git
259
+ repository.
260
+ - **A local sandbox's Claude Code sessions do not show in the dashboard:**
261
+ RayTrace's proxy may be from before local sandboxes. Restart it:
262
+ `raytrace stop && raytrace start`. `sandbox create --local` warns about this.
263
+ - **The dashboard says this browser is not signed in:** run `raytrace open`.
264
+ Each browser signs in once, for 30 days; a bookmark to the dashboard then
265
+ keeps working.
266
+ - **`sandbox create --local` says the machine is not ready:** each line names
267
+ what is missing and how to fix it; `raytrace doctor` shows the same. Port
268
+ 8798 in use usually means another Lima VM is running (`limactl list`).
269
+ - **The VM fails to start or set up:** the last lines are shown; the whole
270
+ log is in `~/.raytrace/logs/sandbox-vm.log`.
271
+ - **`raytrace connect` asks for a sandbox id:** run `raytrace sandbox list` and
272
+ pass the one you want. The id is optional only when you have one sandbox.
241
273
 
242
274
  ## Developing
243
275
 
package/bin/raytrace.mjs CHANGED
@@ -20,22 +20,42 @@ Cloud sandboxes:
20
20
  optional (same as: raytrace sandbox shell [id])
21
21
  raytrace sandbox list
22
22
  raytrace sandbox start|stop [id]
23
- raytrace sandbox destroy [id] [--yes] delete it; recorded evidence is kept
24
-
25
- Local recording (not needed for cloud sandboxes):
26
- setup set up local recording: Claude Code hook, then start
27
- start start RayTrace in the background (dashboard + recorder)
28
- stop stop it
29
- status is it running, and what is being recorded
30
- open open the local dashboard in your browser
31
- doctor check the install without changing anything
32
- codex [...] run Codex through RayTrace (needs an OpenRouter key)
33
- uninstall remove the Claude Code hook, optionally all recorded data
34
-
35
- Options for setup: --yes --no-claude-code --no-start --openrouter-key <key>
36
- Options for uninstall: --yes --purge (also delete ~/.raytrace)
37
-
38
- Local data and settings live in ~/.raytrace (override with RAYTRACE_HOME).`;
23
+ raytrace sandbox destroy [id] [--yes] [--keep-traces]
24
+ delete it; traces go too unless --keep-traces (paid plans)
25
+
26
+ Local sandboxes (your project stays on this machine):
27
+ raytrace sandbox create --local [--name <name>] [--yes]
28
+ a copy of this Git repository in a gVisor sandbox
29
+ in a Linux VM here; the name defaults to the folder's.
30
+ Offers to download Lima if missing (--yes: no prompt)
31
+ raytrace connect <name> a terminal in it; run claude there
32
+ raytrace sandbox list --local
33
+ raytrace sandbox start|stop <name>
34
+ raytrace sandbox destroy <name> [--delete-logs | --keep-logs]
35
+ asks whether to delete its captured logs too;
36
+ kept logs move to ~/.raytrace/archive
37
+ Recorded commands, files and connections: raytrace open, then Sandbox evidence.
38
+ macOS and Linux; Windows is experimental. raytrace doctor shows what is missing.
39
+
40
+ Upload local evidences to RayTrace cloud (needs sign-in):
41
+ raytrace upload logs [--sandbox <name>] [--dry-run] [--yes]
42
+ gzip and upload a local sandbox's evidences;
43
+ they appear at https://app.raytracer.si
44
+ raytrace upload status your plan's evidences storage
45
+
46
+ Export recorded traces:
47
+ raytrace export <trace-id> view trace details in terminal as Markdown
48
+ raytrace export <trace-id> --format json export trace structured as JSON
49
+ raytrace export <trace-id> --output <file>
50
+ save export to file with owner-only permissions
51
+
52
+ AI features in the dashboard (summaries, recaps, Chain of thought), on your own key:
53
+ raytrace key which keys are set
54
+ raytrace key openrouter add your OpenRouter key (asked for, not echoed)
55
+ raytrace key typesafe optional: Jev ranking and command severity
56
+ raytrace key <name> --remove
57
+
58
+ Your sign-in stays on this machine; raytrace auth logout removes it.`;
39
59
 
40
60
  // node:sqlite, which the recorder stores everything in, needs 22.13.
41
61
  const [major, minor] = process.versions.node.split('.').map(Number);
@@ -75,12 +95,23 @@ if (command === 'auth') {
75
95
 
76
96
  // `raytrace connect <id>`: the sandbox's terminal, by the id the dashboard shows.
77
97
  if (command === 'connect') {
78
- if (rest.length > 1 || rest[0]?.startsWith('-')) { console.error('Usage: raytrace connect [sandbox-id]'); process.exit(2); }
98
+ const flags = { local: rest.includes('--local') };
99
+ const args = rest.filter((arg) => arg !== '--local');
100
+ if (args.length > 1 || args[0]?.startsWith('-')) { console.error('Usage: raytrace connect [sandbox-id or local name] [--local]'); process.exit(2); }
79
101
  const sandbox = await import('../src/sandbox.mjs');
80
- try { await sandbox.shell(rest[0]); process.exit(0); }
102
+ try { await sandbox.shell(args[0], flags); process.exit(0); }
81
103
  catch (error) { console.error(`raytrace connect: ${error.message}`); process.exit(1); }
82
104
  }
83
105
 
106
+ // `raytrace key [openrouter|typesafe] [--remove]`: the keys the dashboard's AI features use.
107
+ if (command === 'key') {
108
+ const args = rest.filter((arg) => arg !== '--remove');
109
+ if (args.length > 1 || args[0]?.startsWith('-')) { console.error('Usage: raytrace key [openrouter|typesafe] [--remove]'); process.exit(2); }
110
+ const { keyCommand } = await import('../src/commands.mjs');
111
+ try { await keyCommand(args[0], { remove: rest.includes('--remove') }); process.exit(0); }
112
+ catch (error) { console.error(`raytrace key: ${error.message}`); process.exit(1); }
113
+ }
114
+
84
115
  if (command === 'sandbox') {
85
116
  const sandbox = await import('../src/sandbox.mjs');
86
117
  let parsed;
@@ -88,15 +119,19 @@ if (command === 'sandbox') {
88
119
  parsed = parseArgs({ args: rest, strict: true, allowPositionals: true, options: {
89
120
  yes: { type: 'boolean', short: 'y' },
90
121
  name: { type: 'string' },
122
+ local: { type: 'boolean' },
123
+ 'delete-logs': { type: 'boolean' },
124
+ 'keep-logs': { type: 'boolean' },
125
+ 'keep-traces': { type: 'boolean' },
91
126
  } });
92
127
  } catch (error) { console.error(`${error.message}\n\nRun \`raytrace help\` for usage.`); process.exit(2); }
93
128
  const [sub, id] = parsed.positionals;
94
129
  const action = {
95
130
  create: () => sandbox.create(parsed.values),
96
- list: () => sandbox.list(),
97
- shell: () => sandbox.shell(id),
98
- start: () => sandbox.start(id),
99
- stop: () => sandbox.stop(id),
131
+ list: () => sandbox.list(parsed.values),
132
+ shell: () => sandbox.shell(id, parsed.values),
133
+ start: () => sandbox.start(id, parsed.values),
134
+ stop: () => sandbox.stop(id, parsed.values),
100
135
  destroy: () => sandbox.destroy(id, parsed.values),
101
136
  }[sub];
102
137
  if (!action) { console.error(`Unknown sandbox command: ${sub ?? '(none)'}\n\n${HELP}`); process.exit(2); }
@@ -104,6 +139,59 @@ if (command === 'sandbox') {
104
139
  catch (error) { console.error(`raytrace sandbox ${sub}: ${error.message}`); process.exit(1); }
105
140
  }
106
141
 
142
+ if (command === 'upload') {
143
+ let parsed;
144
+ try {
145
+ parsed = parseArgs({ args: rest, strict: true, allowPositionals: true, options: {
146
+ yes: { type: 'boolean', short: 'y' },
147
+ sandbox: { type: 'string' },
148
+ 'dry-run': { type: 'boolean' },
149
+ } });
150
+ } catch (error) { console.error(`${error.message}\n\nUsage: raytrace upload logs [--sandbox <name>] [--dry-run] [--yes] | raytrace upload status`); process.exit(2); }
151
+ const [sub, ...extra] = parsed.positionals;
152
+ if (extra.length || (sub !== 'logs' && sub !== 'status')) {
153
+ console.error('Usage: raytrace upload logs [--sandbox <name>] [--dry-run] [--yes] | raytrace upload status');
154
+ process.exit(2);
155
+ }
156
+ const upload = await import('../src/upload.mjs');
157
+ try {
158
+ if (sub === 'status') await upload.uploadStatus();
159
+ else await upload.uploadLogs({ sandbox: parsed.values.sandbox, yes: parsed.values.yes, dryRun: parsed.values['dry-run'] });
160
+ process.exit(0);
161
+ } catch (error) { console.error(`raytrace upload ${sub}: ${error.message}`); process.exit(1); }
162
+ }
163
+
164
+ if (command === 'export') {
165
+ let parsed;
166
+ try {
167
+ parsed = parseArgs({ args: rest, strict: true, allowPositionals: true, options: {
168
+ format: { type: 'string' },
169
+ output: { type: 'string' },
170
+ } });
171
+ } catch (error) {
172
+ console.error(`${error.message}\n\nUsage: raytrace export <trace-id> [--format json|markdown] [--output <file>]`);
173
+ process.exit(2);
174
+ }
175
+ const [traceId, ...extra] = parsed.positionals;
176
+ if (!traceId || extra.length > 0) {
177
+ console.error('Usage: raytrace export <trace-id> [--format json|markdown] [--output <file>]');
178
+ process.exit(2);
179
+ }
180
+ const format = parsed.values.format ?? 'markdown';
181
+ if (format !== 'markdown' && format !== 'json') {
182
+ console.error(`Invalid format: ${format}. Expected 'markdown' or 'json'.`);
183
+ process.exit(2);
184
+ }
185
+ const { exportCommand } = await import('../src/export.mjs');
186
+ try {
187
+ await exportCommand(traceId, { format, output: parsed.values.output });
188
+ process.exit(0);
189
+ } catch (error) {
190
+ console.error(`raytrace export: ${error.message}`);
191
+ process.exit(1);
192
+ }
193
+ }
194
+
107
195
  let flags;
108
196
  try {
109
197
  ({ values: flags } = parseArgs({ args: rest, strict: true, options: {