@raytrace-cli/cli 0.4.0 → 0.5.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 (102) hide show
  1. package/README.md +132 -126
  2. package/bin/raytrace.mjs +41 -20
  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-DtV3UdEB.css +1 -0
  50. package/dist/dashboard/assets/index-jyV5iYHJ.js +38 -0
  51. package/dist/dashboard/index.html +2 -2
  52. package/package.json +3 -1
  53. package/proxy/call-assessment.mjs +385 -0
  54. package/proxy/call-category.mjs +461 -0
  55. package/proxy/capture.mjs +31 -0
  56. package/proxy/claude-code-adapter.mjs +46 -3
  57. package/proxy/evidence-store.mjs +617 -15
  58. package/proxy/exec-narrative.mjs +625 -0
  59. package/proxy/execution-correlation.mjs +185 -0
  60. package/proxy/experiment-engine.mjs +7 -4
  61. package/proxy/failure-signature.mjs +56 -0
  62. package/proxy/gvisor-forwarder.mjs +454 -0
  63. package/proxy/init-evidence-db.mjs +136 -12
  64. package/proxy/local-sandboxes.mjs +94 -0
  65. package/proxy/playground.mjs +411 -0
  66. package/proxy/prompt-context.mjs +12 -7
  67. package/proxy/prompt-traces.mjs +6 -0
  68. package/proxy/raytace-proxy.mjs +460 -176
  69. package/proxy/run-recap.mjs +139 -0
  70. package/proxy/runtime-attribution.mjs +110 -0
  71. package/proxy/sandbox-bridge.mjs +46 -0
  72. package/proxy/schema/EVIDENCE_DATABASE.md +276 -0
  73. package/proxy/schema/auxiliary.sql +48 -1
  74. package/proxy/schema/classification.sql +89 -0
  75. package/proxy/schema/file_context.sql +53 -0
  76. package/proxy/schema/runtime_evidence.sql +201 -0
  77. package/proxy/schema/search.sql +66 -0
  78. package/proxy/search.mjs +418 -0
  79. package/proxy/step-attribution.mjs +380 -0
  80. package/proxy/tool-metadata.mjs +36 -0
  81. package/proxy/trace-view.mjs +276 -0
  82. package/proxy/typesafe.mjs +63 -0
  83. package/src/commands.mjs +73 -4
  84. package/src/lima.mjs +135 -0
  85. package/src/local-sandbox.mjs +324 -0
  86. package/src/proxy-process.mjs +20 -1
  87. package/src/sandbox.mjs +24 -6
  88. package/worker/sandbox/Dockerfile +8 -0
  89. package/worker/sandbox/SYSCALL_CATALOG.md +197 -0
  90. package/worker/sandbox/claude-hook.mjs +331 -0
  91. package/worker/sandbox/collector.py +357 -0
  92. package/worker/sandbox/dns_forwarder.py +255 -0
  93. package/worker/sandbox/engine.py +940 -0
  94. package/worker/sandbox/file_scan.py +491 -0
  95. package/worker/sandbox/lima.yaml +29 -0
  96. package/worker/sandbox/network.py +90 -0
  97. package/worker/sandbox/projects.py +678 -0
  98. package/worker/sandbox/setup.py +159 -0
  99. package/worker/sandbox/syscall_catalog.sql +985 -0
  100. package/worker/sandbox/viewer.py +132 -0
  101. package/dist/dashboard/assets/index-BQ9_JxGq.js +0 -27
  102. 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,99 @@ 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
+ ```
96
+
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 http://localhost:8798.
109
+ Nothing leaves your machine.
110
+ - **Changes:** the sandbox's Claude Code hook snapshots the project after
111
+ every edit, so **Changes** shows what each prompt left different, file by
112
+ file, with a patch to take home.
113
+ - **Playground:** rerun a session from any step with part of it changed (a
114
+ tool result, a file, the model, the message) and compare where it ends up,
115
+ optionally with a check command such as `npm test` as pass or fail. Each
116
+ rerun is a fork: a sandbox of its own in the VM, started from the snapshot
117
+ just before that step, running Claude Code on the sign-in you made in the
118
+ sandbox (so it uses your Claude account). The newest fork is kept, stopped,
119
+ for a day; destroying a sandbox destroys its forks.
120
+ - **Signing in to your agent:** run `claude` inside the sandbox and sign in.
121
+ RayTrace passes no key in. The sign-in stays in the sandbox until you destroy it.
122
+ - **Destroying it:** `raytrace sandbox destroy <name>` deletes the sandbox and
123
+ asks whether to delete the logs captured in it as well. Yes deletes them
124
+ everywhere, dashboard included, Playground forks too. No moves them to
125
+ `~/.raytrace/archive/<name>-<time>/` (Claude Code transcripts, its forks'
126
+ under `forks/`, and the recorded commands, files and connections as JSON
127
+ lines), and its sessions stay in your dashboard. `--delete-logs` or `--keep-logs` answers without
128
+ asking.
129
+ - **What you need:** nothing to install on macOS 13.5 or later. RayTrace
130
+ uses [Lima](https://lima-vm.io) for the VM: yours if you have Lima 2.0 or
131
+ later, otherwise it offers to download Lima's own release into
132
+ `~/.raytrace/lima` (no admin rights; checked against a pinned checksum).
133
+ Docker, gVisor and the agents are installed inside the VM, not on your
134
+ machine. On Linux, also QEMU and access to `/dev/kvm`. On macOS before
135
+ 13.5, QEMU (`brew install qemu`). `raytrace doctor` shows what is missing,
136
+ and `create --local` says so before it starts. First run downloads about
137
+ 1 GB (Lima, Ubuntu, packages); the VM uses 4 GiB of memory while it runs.
138
+ - **Platforms:** macOS and Linux. Windows is experimental: Lima's Windows
139
+ support is itself experimental, and RayTrace does not download Lima there.
140
+ - **The VM:** `limactl stop raytrace` frees its memory; `limactl delete
141
+ raytrace` removes it.
142
+
143
+ ## AI features, on your own key
144
+
145
+ The dashboard records and shows everything above without any key. A few
146
+ views can also ask a model to explain a run; locally they use **your own
147
+ OpenRouter key**, and the calls are billed to your OpenRouter account.
148
+
149
+ ```sh
150
+ raytrace key openrouter # paste your key from https://openrouter.ai/keys (not echoed)
151
+ raytrace key # which keys are set
152
+ ```
153
153
 
154
- Cloud sandboxes:
154
+ | Feature | Where | Model (default) |
155
+ |---|---|---|
156
+ | Run recap: what the agent did and why, in a few lines | Story, Chain of thought | `anthropic/claude-sonnet-5.5` |
157
+ | Chain of thought: the likely reasons for each tool call | Chain of thought | `qwen/qwen3-coder` |
158
+ | Step summaries, and plain-English lines for commands no rule describes | Tool calls, Sandbox evidence | `openai/gpt-oss-120b` |
159
+
160
+ - **Without a key** those parts say so and everything else works: Story's key
161
+ moments, Chain of thought's unranked reasons and the rule-based command
162
+ descriptions need no model.
163
+ - **Cost:** each answer is kept, so opening the same prompt again costs
164
+ nothing. Nothing is sent until you open a view that needs it.
165
+ - **What is sent:** to OpenRouter, the parts of the recorded run the feature
166
+ reads (the prompt, tool calls and their results, commands). Nothing goes to
167
+ RayTrace.
168
+ - **Other models:** set `RAYTACE_OBSERVER_MODEL` (recap),
169
+ `RAYTACE_ATTRIBUTION_MODEL` (Chain of thought) or `RAYTACE_SUMMARY_MODEL`
170
+ (summaries) in `~/.raytrace/config.env`, then `raytrace stop && raytrace start`.
171
+ - **Optional, Jev ranking:** `raytrace key typesafe` adds a
172
+ [TypeSafe](https://typesafe.ai) key, which ranks Chain of thought's reasons
173
+ and rates how severe each command was. Without it the reasons are listed
174
+ unranked and severity comes from rules.
175
+ - `raytrace key openrouter --remove` removes a key.
176
+
177
+ ## Commands
155
178
 
156
179
  | Command | What it does |
157
180
  |---|---|
@@ -161,52 +184,16 @@ Cloud sandboxes:
161
184
  | `raytrace sandbox start\|stop [id]` | start or stop a sandbox; stopping keeps its files |
162
185
  | `raytrace sandbox destroy [id]` | delete a sandbox; its recorded sessions are kept |
163
186
  | `raytrace auth login` | sign in to RayTrace; `status`, `logout` |
164
-
165
- Local recording:
166
-
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.
187
+ | `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) |
188
+ | `raytrace sandbox list --local` | your local sandboxes; their names work with `connect`, `start`, `stop` and `destroy` |
189
+ | `raytrace sandbox destroy <name> [--delete-logs \| --keep-logs]` | delete a local sandbox; asks whether its captured logs go too, or move to `~/.raytrace/archive` |
190
+ | `raytrace doctor` | what this machine has and lacks, local sandboxes included |
191
+ | `raytrace key [openrouter\|typesafe] [--remove]` | your keys for the dashboard's AI features; asked for, never taken as an argument |
190
192
 
191
193
  ## Privacy
192
194
 
193
- Local recording stays on your machine.
194
-
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.
208
-
209
- Cloud sandboxes are different by design: they run on RayTrace's servers.
195
+ Local sandboxes keep everything on your machine. Cloud sandboxes run on
196
+ RayTrace's servers.
210
197
 
211
198
  - `raytrace sandbox create` uploads your project (see
212
199
  [what is uploaded](#cloud-sandboxes-preview)) to RayTrace.
@@ -221,23 +208,42 @@ Cloud sandboxes are different by design: they run on RayTrace's servers.
221
208
  ## Uninstall
222
209
 
223
210
  ```sh
224
- raytrace uninstall --purge # removes the hook and ~/.raytrace
211
+ raytrace sandbox destroy <sandbox-id> # any sandboxes you no longer need
212
+ raytrace auth logout
225
213
  npm uninstall -g @raytrace-cli/cli
226
214
  ```
227
215
 
228
- ## Troubleshooting
216
+ Upgrading from 0.4 or earlier: the first start of the new version upgrades
217
+ `~/.raytrace/evidence.db` in place (your recorded sessions are kept), and older
218
+ versions cannot open it afterwards.
229
219
 
230
- Run `raytrace doctor` first; it lists anything wrong and how to fix it. The
231
- background process logs to `~/.raytrace/logs/proxy.log`.
220
+ With local sandboxes, run `raytrace uninstall --purge` before removing the
221
+ package: it deletes the local sandbox VM and everything in `~/.raytrace`
222
+ (recorded sessions, archived logs, and the Lima RayTrace downloaded). Without
223
+ `--purge`, remove the VM yourself with `limactl delete --force raytrace`.
224
+
225
+ If you set up local recording with an earlier version, run
226
+ `raytrace uninstall` before removing the package so Claude Code is not left
227
+ with a hook that points at a missing command.
228
+
229
+ ## Troubleshooting
232
230
 
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
231
  - **`Cannot reach RayTrace at https://api.raytracer.si`:** check your
237
232
  connection. Networks that inspect HTTPS, such as some company Wi-Fi, can
238
233
  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`.
234
+ - **Sign-in or sandbox creation fails:** run `raytrace auth status`, and
235
+ `raytrace auth login` again if needed. Create the sandbox from inside a Git
236
+ repository.
237
+ - **A local sandbox's Claude Code sessions do not show in the dashboard:**
238
+ RayTrace's proxy may be from before local sandboxes. Restart it:
239
+ `raytrace stop && raytrace start`. `sandbox create --local` warns about this.
240
+ - **`sandbox create --local` says the machine is not ready:** each line names
241
+ what is missing and how to fix it; `raytrace doctor` shows the same. Port
242
+ 8798 in use usually means another Lima VM is running (`limactl list`).
243
+ - **The VM fails to start or set up:** the last lines are shown; the whole
244
+ log is in `~/.raytrace/logs/sandbox-vm.log`.
245
+ - **`raytrace connect` asks for a sandbox id:** run `raytrace sandbox list` and
246
+ pass the one you want. The id is optional only when you have one sandbox.
241
247
 
242
248
  ## Developing
243
249
 
package/bin/raytrace.mjs CHANGED
@@ -22,20 +22,27 @@ Cloud sandboxes:
22
22
  raytrace sandbox start|stop [id]
23
23
  raytrace sandbox destroy [id] [--yes] delete it; recorded evidence is kept
24
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).`;
25
+ Local sandboxes (your project stays on this machine):
26
+ raytrace sandbox create --local [--name <name>] [--yes]
27
+ a copy of this Git repository in a gVisor sandbox
28
+ in a Linux VM here; the name defaults to the folder's.
29
+ Offers to download Lima if missing (--yes: no prompt)
30
+ raytrace connect <name> a terminal in it; run claude there
31
+ raytrace sandbox list --local
32
+ raytrace sandbox start|stop <name>
33
+ raytrace sandbox destroy <name> [--delete-logs | --keep-logs]
34
+ asks whether to delete its captured logs too;
35
+ kept logs move to ~/.raytrace/archive
36
+ Recorded commands, files and connections: http://localhost:8798.
37
+ macOS and Linux; Windows is experimental. raytrace doctor shows what is missing.
38
+
39
+ AI features in the dashboard (summaries, recaps, Chain of thought), on your own key:
40
+ raytrace key which keys are set
41
+ raytrace key openrouter add your OpenRouter key (asked for, not echoed)
42
+ raytrace key typesafe optional: Jev ranking and command severity
43
+ raytrace key <name> --remove
44
+
45
+ Your sign-in stays on this machine; raytrace auth logout removes it.`;
39
46
 
40
47
  // node:sqlite, which the recorder stores everything in, needs 22.13.
41
48
  const [major, minor] = process.versions.node.split('.').map(Number);
@@ -75,12 +82,23 @@ if (command === 'auth') {
75
82
 
76
83
  // `raytrace connect <id>`: the sandbox's terminal, by the id the dashboard shows.
77
84
  if (command === 'connect') {
78
- if (rest.length > 1 || rest[0]?.startsWith('-')) { console.error('Usage: raytrace connect [sandbox-id]'); process.exit(2); }
85
+ const flags = { local: rest.includes('--local') };
86
+ const args = rest.filter((arg) => arg !== '--local');
87
+ if (args.length > 1 || args[0]?.startsWith('-')) { console.error('Usage: raytrace connect [sandbox-id or local name] [--local]'); process.exit(2); }
79
88
  const sandbox = await import('../src/sandbox.mjs');
80
- try { await sandbox.shell(rest[0]); process.exit(0); }
89
+ try { await sandbox.shell(args[0], flags); process.exit(0); }
81
90
  catch (error) { console.error(`raytrace connect: ${error.message}`); process.exit(1); }
82
91
  }
83
92
 
93
+ // `raytrace key [openrouter|typesafe] [--remove]`: the keys the dashboard's AI features use.
94
+ if (command === 'key') {
95
+ const args = rest.filter((arg) => arg !== '--remove');
96
+ if (args.length > 1 || args[0]?.startsWith('-')) { console.error('Usage: raytrace key [openrouter|typesafe] [--remove]'); process.exit(2); }
97
+ const { keyCommand } = await import('../src/commands.mjs');
98
+ try { await keyCommand(args[0], { remove: rest.includes('--remove') }); process.exit(0); }
99
+ catch (error) { console.error(`raytrace key: ${error.message}`); process.exit(1); }
100
+ }
101
+
84
102
  if (command === 'sandbox') {
85
103
  const sandbox = await import('../src/sandbox.mjs');
86
104
  let parsed;
@@ -88,15 +106,18 @@ if (command === 'sandbox') {
88
106
  parsed = parseArgs({ args: rest, strict: true, allowPositionals: true, options: {
89
107
  yes: { type: 'boolean', short: 'y' },
90
108
  name: { type: 'string' },
109
+ local: { type: 'boolean' },
110
+ 'delete-logs': { type: 'boolean' },
111
+ 'keep-logs': { type: 'boolean' },
91
112
  } });
92
113
  } catch (error) { console.error(`${error.message}\n\nRun \`raytrace help\` for usage.`); process.exit(2); }
93
114
  const [sub, id] = parsed.positionals;
94
115
  const action = {
95
116
  create: () => sandbox.create(parsed.values),
96
- list: () => sandbox.list(),
97
- shell: () => sandbox.shell(id),
98
- start: () => sandbox.start(id),
99
- stop: () => sandbox.stop(id),
117
+ list: () => sandbox.list(parsed.values),
118
+ shell: () => sandbox.shell(id, parsed.values),
119
+ start: () => sandbox.start(id, parsed.values),
120
+ stop: () => sandbox.stop(id, parsed.values),
100
121
  destroy: () => sandbox.destroy(id, parsed.values),
101
122
  }[sub];
102
123
  if (!action) { console.error(`Unknown sandbox command: ${sub ?? '(none)'}\n\n${HELP}`); process.exit(2); }