@heyditto/cli 3.24.0 → 3.25.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.
package/README.md CHANGED
@@ -1,1843 +1,215 @@
1
- # Ditto CLI
1
+ # Ditto CLI (`@heyditto/cli`)
2
2
 
3
- ### Personal BYOK Router endpoints and local inference keys
3
+ Command-line interface for [Ditto](https://heyditto.ai): manage your Ditto memory graph, Router inference endpoints, coding-agent launches (`claude`, `codex`), Ditto Review runs (local and GitHub), connected MCP tools, developer apps, and Teleport capsules.
4
4
 
5
- ```sh
6
- heyditto endpoints provider-keys --output json
7
- heyditto endpoints models gm --output json
8
- heyditto endpoints create --name "Infinite Disk" --slug infinite-disk \
9
- --model gm/gpt-6-luna --billing-mode byok --provider-key <saved-key-UUID>
10
- heyditto endpoints set infinite-disk --recall off --record off --record-trace off
11
- heyditto endpoints keys create infinite-disk --key-file /absolute/private/router-key --yes
12
- ```
5
+ - **Package**: `@heyditto/cli` (MIT, Node `22+`, installs the `heyditto` binary — **not** `ditto`, which collides with macOS `/usr/bin/ditto`).
13
6
 
14
- Provider-key discovery returns only your personal vault's selection metadata,
15
- never raw credentials. `--provider-key` is repeatable (or comma-separated),
16
- replaces the selected list, and never accepts an empty list as an implicit
17
- "all keys". `byok` does not fall back to Ditto-funded providers. Endpoints created
18
- without an organization are personal; an existing saved default is unchanged
19
- unless you pass `--default`.
20
-
21
- `--key-file` (also `--store file --secret /absolute/private/router-key`) requires
22
- an existing owner-only 0700 parent directory. It creates a new 0600 file without
23
- overwriting existing files or following symlinks. No plaintext key is printed,
24
- put in argv, or returned in JSON. Delivery failure revokes the newly minted key.
25
- Use an endpoint key in your local app, never your management or provider key.
26
- On Windows use one of the external secret managers instead. Router discovery
27
- requires the matching server capability; an older server fails explicitly.
28
-
29
- `@heyditto/cli` — save, search, fetch, and traverse the [Ditto](https://heyditto.ai) memory graph from the shell.
7
+ ## Install & Updates
30
8
 
31
9
  ```bash
32
10
  npm install -g @heyditto/cli
33
- heyditto init --name "NAME_OF_AGENT" --json # the name is set once, here
34
-
35
- heyditto save "I prefer TypeScript over JS for new projects"
36
- heyditto search "language preferences"
37
- heyditto fetch <id> --memory-format outline
38
- heyditto subjects "memory architecture" --top-k 5
39
- ```
40
-
41
- ## Install
42
-
43
- ```bash
44
- npm install -g @heyditto/cli
45
- # or one-shot via npx
11
+ # or one-shot without global install
46
12
  npx -y --package @heyditto/cli heyditto search "what did I say about X"
47
13
  ```
48
14
 
49
- The package installs the `heyditto` command. On macOS, `ditto` is Apple’s file-copy utility and is not installed by this package. Scripts that used the older `ditto` alias must switch to `heyditto`.
50
-
51
- The published npm package is **`@heyditto/cli`**. Use the installed `heyditto`
52
- binary or the scoped `npx --package` form above; the unscoped `heyditto` npm name
53
- is not our published package.
15
+ Global npm installs run a bounded, SHA512-verified background update check roughly every 6 hours (skipped for `--help`, `--version`, offline commands, `review local --preview`, Homebrew/Nix/CI/`npx`, or `DITTO_CLI_AUTO_UPDATE=0` / `--no-auto-update`):
54
16
 
55
- ### Occasional background updates
56
-
57
- Eligible global npm installations check for a newer CLI about every six hours
58
- when invoked. The check and download run quietly in a finite background worker;
59
- your current command keeps running its selected version. A fully verified update
60
- takes effect on a later invocation. Help, version, offline and review `--preview`
61
- commands do not start a network check. JSON stdout is unchanged.
62
-
63
- ```sh
17
+ ```bash
64
18
  heyditto self-update status --output json
65
- heyditto self-update check # verify and activate for the next invocation
66
- heyditto self-update disable
67
- heyditto self-update enable
68
- heyditto self-update pin # retain the currently selected version
69
- heyditto self-update unpin
70
- DITTO_CLI_AUTO_UPDATE=0 heyditto search "a memory" # suppress this background check
71
- DITTO_CLI_PINNED=1 heyditto --version # run the installed package, bypassing cached updates
19
+ heyditto self-update check # verify and stage for next invocation
20
+ heyditto self-update disable | enable
21
+ heyditto self-update pin | unpin # pin currently selected version (or DITTO_CLI_PINNED=1)
72
22
  ```
73
23
 
74
- `self-update check` uses the same bounded verification path even when automatic
75
- checks are disabled, and explicitly activates the verified update for the next
76
- invocation. A persistent pin still prevents it from installing another
77
- version. `heyditto --no-auto-update <command>` also suppresses a background check;
78
- `DISABLE_AUTOUPDATER=1` is supported. Disabling checks retains a validated version
79
- already selected by an earlier launch (or an explicit manual check). It ignores
80
- new background candidates, including a worker that finishes publishing after
81
- disable has acknowledged. Running commands keep their selected version. A pin
82
- selects its retained version even if a newer update has downloaded concurrently.
83
- All `self-update` controls run the pinned, previously activated or bundled
84
- version; they never adopt a staged candidate before executing the control.
85
- `status` only inspects. `enable` and `unpin` allow a later ordinary launch to
86
- activate a candidate; `check` can activate only after its explicit manual action.
87
- An ordinary launch that already selected a version under an enabled policy may
88
- finish and record that selection after a concurrent disable returns. Disable
89
- does not restart or undo commands already in progress.
90
-
91
- Manual checks return their own worker result in `manualResult`, separately from
92
- shared last-attempt health. If another worker is active, `check` reports `busy`
93
- and exits 75; retry it after that worker finishes. A missing or incomplete worker
94
- result exits nonzero. A concurrent change to shared health cannot turn a blocked
95
- manual request into a successful check.
96
-
97
- Homebrew, Nix and operating-system package locations, project installs, npm
98
- scripts, CI and ephemeral `npx` executions keep their package-manager version;
99
- the updater does not replace their files or override their ownership. Historical
100
- `npm install -g @heyditto/cli@<version>` intent is not recoverable reliably from
101
- installed npm metadata. Use the persistent pin or `DITTO_CLI_PINNED=1` when that
102
- global installation must remain exact. Older CLI versions need one normal npm
103
- upgrade before they have this updater.
104
-
105
- Updates are stored under the CLI config directory's `updates/` folder, with
106
- separate immutable version directories, an atomic candidate pointer and
107
- append-only activation markers for each
108
- OS, CPU architecture and libc target. Enable/disable is one shared user
109
- preference; pins and cached bundles are target-specific. Each control writes its
110
- own atomic preference file, so concurrent pin and disable commands cannot
111
- overwrite each other's intent. Relative
112
- `DITTO_CONFIG_DIR` values are resolved before starting a worker. Every
113
- root and locked dependency archive is restricted to the public npm registry and
114
- checked against SHA512 integrity; archive links, unsafe paths and special files
115
- are rejected. No npm configuration, credentials, project files, install scripts,
116
- daemon, sudo or command restart is used. Compatible prebuilt PTY packages and
117
- ordinary executable bits are retained for coding-agent commands.
118
-
119
- Each attempt is bounded to 60 seconds plus five seconds of worker cleanup,
120
- 128 MiB downloaded, 512 MiB unpacked and
121
- 50,000 files. Cached versions are retained so active commands can still read
122
- them; at 2 GiB per target, the updater pauses for manual cleanup instead of deleting a
123
- potentially active version. Immutable attempt leases also have a metadata cap.
124
- A crashed attempt blocks at most its six-hour window and never steals another
125
- worker's live lease. `self-update status` reports the bundled, selected and
126
- cached versions, eligibility, policy and last result. Invalid selection metadata
127
- falls back before execution; a cached CLI execution failure is quarantined for
128
- the next invocation and **never retries the command**.
129
-
130
- ### macOS command name
131
-
132
- Use `heyditto` for the Ditto CLI. Apple’s `/usr/bin/ditto` is a separate file-copy utility. If an older CLI installation left a `ditto` alias, remove that alias or upgrade the package so it no longer shadows Apple’s command.
133
-
134
- ## Auth
135
-
136
- Humans sign in through the browser:
24
+ ## Authentication
137
25
 
138
26
  ```bash
27
+ # Humans: browser device-code flow (or pass/pipe a ditto_mcp_ key)
139
28
  heyditto login
140
- ```
29
+ heyditto login --stdin < key.txt
141
30
 
142
- This prints a short code, opens `https://heyditto.ai/device` (pre-filled with the
143
- code), and saves the resulting key to your CLI config directory once you approve
144
- it. Pass a key as an argument (`heyditto login ditto_mcp_…`), pipe it with
145
- `--stdin`, or use `--paste` for the older copy-a-key page.
146
-
147
- Agents can self-provision without a browser, email, or OTP:
148
-
149
- ```bash
150
- heyditto init --json
151
- ```
152
-
153
- The command creates a free claimable agent account, stores the key in
154
- your CLI config directory (defaults to `~/.config/heyditto/cli/config.json`;
155
- override with `DITTO_CONFIG_DIR`), and prints a claim URL without printing the
156
- agent key. Humans claim the account later from `claimURL`; agents should share
157
- that link. The claim token is carried in the query string (`?t=...`).
158
-
159
- ### Name the agent at init
160
-
161
- Decide the agent's name **before** you run `init` and pass it with `--name`:
162
-
163
- ```bash
31
+ # Agents: self-provision a claimable account (set --name up front; it labels every saved memory)
164
32
  heyditto init --name "NAME_OF_AGENT" --json
165
- ```
166
-
167
- The caller name is set **once, at account creation**, and it labels everything
168
- the agent saves: after a human claims the account, the agent's memories show up
169
- in the owner's graph as an *external agent thread* titled by this name. If you
170
- init without `--name`, the name defaults to `agent` and every memory is
171
- labeled `agent` — generic and hard to tell apart from other agents.
172
-
173
- So: use the agent's own name, or a name the user has already chosen, and set it
174
- up front. Renaming after init is not yet supported from the CLI, so picking the
175
- right name at init avoids a stuck label.
176
33
 
177
- ### Humans: sign in through the browser
178
-
179
- ```bash
180
- heyditto login
34
+ # Or supply a key via environment
35
+ export DITTO_API_KEY=ditto_mcp_...
181
36
  ```
182
37
 
183
- opens the Ditto web app with a one-time device code (sign in with Google, X, Apple
184
- or GitHub, or create an account), approves it, and hands the key back to the CLI —
185
- nothing to copy. `heyditto claude` / `heyditto codex` run the same flow
186
- automatically on first use, and the web page lets you pick or create the
187
- inference endpoint to launch through, so a fresh machine needs exactly one
188
- command:
38
+ ## Core Commands
189
39
 
190
- ```bash
191
- npx @heyditto/cli@latest claude --yolo --worktree
192
- ```
40
+ Run `heyditto --help` or `heyditto <command> --help` for full flags. Most commands support `--output json` (or `--json`).
193
41
 
194
- You can still paste a key from **https://app.heyditto.ai/mcp/newkey**
195
- (`heyditto login <key>`, `--paste`, or `--stdin`), or set it in the environment:
42
+ ### Memory & Knowledge Graph
196
43
 
197
44
  ```bash
198
- export DITTO_API_KEY=ditto_mcp_…
199
- # add to ~/.zshrc / ~/.bashrc to persist
200
- ```
201
-
202
- ## Commands
203
-
204
- ```
205
- heyditto save <content> [--source <s>] [--source-context <c>]
206
- heyditto search <query>... [--include-public] [--filter-username <u>]
45
+ heyditto save "Project X uses Bun + SolidJS" [--source document --source-context note.md]
46
+ heyditto search "typescript preferences" [--include-public --filter-username <u>]
207
47
  heyditto fetch <id>... [--memory-format full|outline|blocks]
208
- heyditto list [--username <u>] [--limit <n>] [--offset <n>] [--source <s>]
209
- heyditto my-memories [--limit <n>] [--offset <n>] [--source <s>]
210
- heyditto update <id> [--content <text>|--content-file <path>] [--title <t>]
211
- [--source-context <c>] [--edits-json <json>|--edits-file <path>]
212
- [--base-revision <n>]
213
- heyditto publish <id> [--title <t>] [--privacy-mode <mode>]
214
- heyditto unpublish (--memory-id <id>|--share-id <id>|<id>)
48
+ heyditto list [--username <u> --limit <n> --offset <n> --source <s>]
49
+ heyditto my-memories [--limit <n> --source <s>]
50
+ heyditto update <id> [--content <text>|--content-file <path>|--edits-file <path> --base-revision <n>]
51
+ heyditto publish <id> [--title <t> --privacy-mode <mode>]
52
+ heyditto unpublish <id>
215
53
  heyditto delete <memory-id> --confirm
216
54
  heyditto subjects <query> [--top-k <n>]
217
- heyditto subject-edges <subject-id> [--limit <n>] [--min-weight <n>] [--kg <alias>]
55
+ heyditto subject-edges <subject-id> [--limit <n> --min-weight <n> --kg <alias>]
218
56
  heyditto memories <subject-id>... [--query <q>]
219
57
  heyditto network <pair-id> [--limit <n>]
220
58
  heyditto friends
221
- heyditto knowledge-graphs
222
- heyditto graph-sharing (--enable|--disable) [--title <t>] [--description <d>]
223
- heyditto graphs create <name>
224
- heyditto graphs list
225
- heyditto graphs available
226
- heyditto graphs add <@username>
227
- heyditto graphs remove <@username>
228
- heyditto graphs subscribers
229
- heyditto graphs sharing (--enable|--disable) [--title <t>] [--description <d>]
230
- heyditto init [--name <name>] [--subscribe <@graph>]... [<@graph>...] [--json]
231
- heyditto login [<key>] [--paste] [--stdin] [--keys]
232
- heyditto keys list|providers|set|enable|disable|remove|validate [<provider>] [--label <name>]
233
- heyditto endpoints [--set-default <slug>] [--clear-default]
234
- heyditto tools [--endpoint <slug>] [--json]
235
- heyditto tools list [server] [--search <query>] [--json]
236
- heyditto tools describe <server> <tool> [--json]
237
- heyditto tools call <server> <tool> [--json <payload>|--stdin|@file.json] [--arg key=value]... [--download <path-or-dir>]
238
- heyditto apps list [--company <id>]
239
- heyditto apps create <name> [--gh-secret NAME --repo o/r | --gcp-secret NAME | …]
240
- heyditto apps show|update|oidc|icon set|origins verify|secret rotate|consent set …
241
- heyditto apps endpoints list|attach|billing|detach <app> [<endpoint>]
242
- heyditto receipts [--leg ditto|byok|covered] [--app <app_id>] [--days <n>]
243
- heyditto claude [options] [-- <claude args>]
244
- heyditto codex [options] [-- <codex args>]
245
- heyditto codex-app [--endpoint <slug>] [--model <id>] [--unset]
246
- heyditto sessions [--json] [--all]
247
- heyditto sessions rm <id>
248
- heyditto session new [<name>...] [--id <id>]
249
- heyditto session list [--all]
250
- heyditto session use <id>
251
- heyditto session current
252
- heyditto session end
253
- heyditto agents [--space <alias>] [--output <format>]
254
- heyditto agents threads [agent] [--space <alias>]
255
- heyditto agents send <message...> [--agent <id>] [--thread <id>] [--space <alias>] [--wait <seconds>]
256
- heyditto agents message <message-id> [--wait <seconds>]
257
- heyditto logout
258
- heyditto status [--output <format>]
259
- heyditto config
260
- heyditto help [command]
261
- ```
262
-
263
- ### Help
264
-
265
- Use `-h` or `--help` globally or after any command:
266
-
267
- ```bash
268
- heyditto --help
269
- heyditto search --help
270
- heyditto graphs add --help
271
- ```
272
-
273
- ### `feedback`
274
-
275
- Submit a bug report or feature request to the Ditto team. Use a concise report
276
- without memories, private user content, credentials, or raw tool responses.
277
-
278
- ```sh
279
- heyditto feedback "The search tool timed out twice" --title "Search timeouts" --tool search_memories
280
- heyditto feedback --file ./report.txt --title "Missing capability" --include-recent-traces
281
- ```
282
-
283
- Recent request diagnostics are omitted by default. The flag opts in for the
284
- current session; start one with `heyditto session new` to group CLI calls.
285
- The command submits immediately and reports any server-side refusal.
286
-
287
- ### `save`
288
-
289
- Save a document or note to the user's memory base.
290
-
291
- ```bash
292
- heyditto save "Project X uses Bun + SolidJS, deployed to Cloud Run"
293
- heyditto save "$(cat note.md)" --source document --source-context note.md
294
- ```
295
-
296
- ### `search`
297
-
298
- Semantic search across memories. Multiple positional args become an array of queries.
299
- Use `--include-public` to also search public DittoHub memories, optionally scoped
300
- with `--filter-username <u>`.
301
-
302
- ```bash
303
- heyditto search "typescript preferences"
304
- heyditto search "typescript" "language choices"
305
- heyditto search "launch notes" --include-public --filter-username peyton
306
- ```
307
-
308
- ### `review`
309
-
310
- #### Review a working diff before opening a PR
311
-
312
- ```sh
313
- heyditto review local --preview
314
- heyditto review local --staged --profile quick --org omniaura
315
- heyditto review local --base main --context-file .tmp/task.md --output json
316
- heyditto review local-status <run-id> --org omniaura
317
- heyditto review local-cancel <run-id> --org omniaura
318
- ```
319
-
320
- `local` uses your existing login and selected organization, and the current
321
- checkout's GitHub origin identifies its configured Review repository. Override
322
- that mapping with `--repository owner/name`, or the checkout with `--directory`.
323
- The backend must support local Review runs and the repository must be enabled.
324
- The same permissions and spending policy as manual PR reviews apply.
325
-
326
- The default reviews staged, unstaged and eligible untracked changes. `--staged`
327
- reviews the index bytes, including when a file also has unstaged edits.
328
- `--base main` includes branch and working changes since the merge base with
329
- `main`. It cannot be combined with `--staged`. No commit, push, PR or index
330
- mutation is required.
331
-
332
- `--preview` is offline: it shows the selected paths, snapshot digest, file and
333
- byte counts, exclusions and omitted context without logging in or uploading.
334
- Running without `--preview` uploads the selected source changes and bounded
335
- surrounding tracked source to Ditto Review, which uses the existing independent
336
- review and verification engine. The immutable snapshot is limited to 16 MiB of
337
- decoded source and 4096 files per tree. Every eligible changed file must fit;
338
- nearby surrounding files fill the remaining budget. Binary files, symlinks and
339
- submodules are recorded as skipped rather than followed or executed. Unchanged
340
- ones do not make surrounding context incomplete (a reviewer could not read
341
- them anyway); a skipped changed file, or context omitted to fit the limits,
342
- does.
343
- Git paths must be valid UTF-8. Unsupported path encodings abort capture before
344
- upload rather than changing path identity or silently omitting changes.
345
-
346
- Choose `quick` (default), `standard` or `deep`. The service returns the effective
347
- time and budget ceilings; queue and capture time are additional. These profiles
348
- are effort policies, not measured speed guarantees. `--timeout` bounds the
349
- whole CLI operation and requests cancellation when it expires. Ctrl-C also
350
- requests cancellation; use the printed run ID to inspect or cancel a run later.
351
- An uncertain admission is identified by its request ID and is never retried
352
- automatically. Use the printed recovery command with `--request-id <uuid>` to
353
- recover that same admission. The server reuses the original run for identical
354
- input and refuses changes to the source snapshot, profile or context under that
355
- ID, so this recovery does not start another paid attempt.
356
-
357
- Readable and JSON results identify the reviewed snapshot, findings, coverage,
358
- cost receipts and whether the current working tree still matches. Partial
359
- reviews return a nonzero exit code. Bounded surrounding context is stated
360
- explicitly; "no findings in reviewed scope" is not an assertion that the
361
- checkout is bug-free. Results are unpublished local reviews and post nothing
362
- to GitHub. Organization learning-memory and complete hosted repository-policy
363
- parity remain separate capabilities and are not implied by this command.
364
-
365
- Every result carries a `recommendation` (`verdict`: `approve`, `changes` or
366
- `none`; `approved`; `reasons`). It fails closed:
367
-
368
- - `approve` only for a `completed` run whose result is complete and well formed
369
- (findings list present, every changed file fully reviewed on every lens, no
370
- withheld candidate left undecided: only the engine's own decisions such as
371
- `rejected_by_verifier` or `below_confidence` do not block), whose working tree still matches the reviewed
372
- snapshot, with no blocking finding. Bounded surrounding context is listed in
373
- `reasons` but does not block (DITTO-2455).
374
- Findings of severity `low`, `info` or `nit` do not block; any other or
375
- missing severity does.
376
- - `changes` when a completed or partial run has a blocking finding.
377
- - `none` otherwise: failed, partial, cancelled, skipped, superseded, timed-out
378
- or interrupted runs, malformed responses, budget exhaustion, and any reuse
379
- receipt or PR-inheritance claim this CLI cannot verify as resolved. `none` is
380
- never approval. `local-status` always reports `none` for a completed run
381
- because a status read cannot verify the working tree.
382
-
383
- `--gate` turns the recommendation into the exit code: `0` approve, `2` changes
384
- requested, `1` no recommendation (`124` timeout and `130`/`143` interrupt are
385
- unchanged). With `--output json`, a timeout or interrupt still prints a receipt
386
- whose recommendation is `none`. Without `--gate`, exit codes are as before.
387
- A refused admission (HTTP 4xx, such as a CLI/server snapshot-contract mismatch)
388
- names the error code and reference and states that nothing was admitted.
389
-
390
- Manage Ditto Review and follow reviews with `heyditto`.
391
- Commands use your selected organization (`orgs use`) or `--org`; without one,
392
- they use your personal workspace. Repositories must already be set up for
393
- Review. Workspace membership and manager permissions are enforced by the API.
394
-
395
- ```bash
396
- heyditto review repos --org omniaura
397
- heyditto review set ditto-assistant/console --max-minutes 20 --org omniaura
398
- heyditto review pulls ditto-assistant/console --org omniaura
399
- heyditto review start ditto-assistant/console 88 --org omniaura --watch
400
- heyditto review runs ditto-assistant/console --org omniaura --output json
401
- heyditto review status <run-id> --org omniaura --output json
402
- heyditto review watch <run-id> --org omniaura --interval 10 --timeout 3600
403
- heyditto review retry <run-id> --org omniaura
404
- heyditto review cancel <run-id> --org omniaura
405
- ```
406
-
407
- Skip entire PRs from the console's repository settings or a JSON policy file:
408
-
409
- ```sh
410
- heyditto review set owner/repo --skip-rules-file rules.json --org omniaura
411
- heyditto review repos --org omniaura --output json
412
- heyditto review set owner/repo --clear-skip-rules --org omniaura
413
- ```
414
-
415
- The JSON object accepts `headBranches`, `baseBranches`, `titles`, `authors`, and `labels` arrays, plus `bots` (boolean). For example, `{"authors":["dependabot[bot]"],"titles":["chore(i18n):*"],"labels":["skip-review"]}`. Any match excludes the PR. `*` spans any text including slashes; `?` matches one character; brackets and all other characters are literal. Authors and labels ignore case; branches and titles match case. Each list permits 50 patterns of up to 200 UTF-8 bytes. Empty rules skip nothing, and bots are included by default. Rules skip automatic reviews. An explicit `heyditto review start`, console Review now/retry, or authorized `@ditto review` request overrides skip rules for that review, without changing the saved policy. Settings writes preserve the policy and use the repository revision to refuse concurrent edits. This requires a backend that returns `skipRules`; an unsupported backend is reported as a failed save.
416
-
417
- `start` reviews the PR's current head using the repository's saved budget and
418
- settings. Starting a previously completed head requests another paid attempt.
419
- `retry` can reuse a stored result after publication failure; other eligible
420
- retries can spend a new per-run budget. It does not raise any budget or enable
421
- a paused repository. `cancel` requests cancellation; a running review stops
422
- asynchronously, and a review already being published may refuse cancellation.
423
-
424
- `runs` lists the API's recent workspace runs; `status --output json` includes findings and
425
- prior attempts. `watch` polls without starting, retrying, or cancelling the run.
426
- It stops on completion, partial coverage, failure, cancellation, skip, or
427
- supersession. Failed runs and timeouts return a nonzero exit code. A partial
428
- review remains partial even though the command succeeds. A timeout or Ctrl-C
429
- only stops the local watcher; use `cancel` to stop the server review.
430
- `--output json` prints one final JSON document, with watch progress on stderr.
431
-
432
- The lifecycle commands require a backend with CLI-key access to Review run
433
- and PR routes. On an older backend they return an authentication refusal;
434
- upgrading the CLI alone cannot enable those routes.
435
-
436
- ### `fetch`
437
-
438
- Fetch memory content for private pair ids or public share ids. The default
439
- `--memory-format full` returns the full body. Use `outline` to get stable block
440
- ids before a structured `update`, or `blocks` when you need each block body.
441
-
442
- ```bash
443
- heyditto fetch 3a1084ae-235a-433d-9493-2335a0dfeb57
444
- heyditto fetch 3a1084ae-235a-433d-9493-2335a0dfeb57 --memory-format outline --output json
445
- ```
446
-
447
- ### `list`
448
-
449
- List saved memories, or public DittoHub publishes for a username.
450
-
451
- ```bash
452
- heyditto list --limit 10
453
- heyditto list --username peyton --limit 10 --output json
454
- heyditto my-memories --source cli --limit 10 --output json
455
- ```
456
-
457
- `my-memories` calls `list_memories` without a username. It only lists your
458
- saved memories, while `list --username <u>` can switch to public DittoHub
459
- publishes for another user.
460
-
461
- ### `update`
462
-
463
- Edit a saved memory in place. Replace the full body with `--content` or
464
- `--content-file`, or use block edits after fetching `--memory-format outline`.
465
- Block edits require the current revision returned by `save` or a previous
466
- `update`.
467
-
468
- ```bash
469
- heyditto update <memory-id> --content-file revised.md --output json
470
- heyditto fetch <memory-id> --memory-format outline --output json
471
- heyditto update <memory-id> --edits-file edits.json --base-revision 3 --output json
472
- ```
473
-
474
- ### `publish` / `unpublish`
475
-
476
- Publish a saved memory to the user's public DittoHub profile, or disable an
477
- existing share without deleting the private memory.
478
-
479
- ```bash
480
- heyditto publish <memory-id> --title "Launch notes" --privacy-mode scan_and_block --output json
481
- heyditto unpublish --share-id abc123def4 --output json
482
- ```
483
-
484
- ### `delete`
485
-
486
- Permanently delete a saved memory. This is destructive, so the CLI requires
487
- `--confirm`.
488
-
489
- ```bash
490
- heyditto delete <memory-id> --confirm --output json
491
- ```
492
-
493
- ### `subjects`
494
-
495
- Search the subject (topic) graph. Returns subject ids you can pass to `memories` or `network`.
496
-
497
- ```bash
498
- heyditto subjects "memory architecture"
499
- heyditto subjects "performance" --top-k 5
500
- heyditto subject-edges <subject-id> --limit 10 --min-weight 0.5 --output json
501
- ```
502
-
503
- `subject-edges` is the CLI wrapper for `get_subject_edges`.
504
-
505
- ### `memories`
506
-
507
- Fetch memory previews scoped to specific subjects.
508
-
509
- ```bash
510
- heyditto memories <subject-id>
511
- heyditto memories <subject-id> --query "deployment tradeoffs"
512
- ```
513
-
514
- ### `network`
515
-
516
- Traverse a memory's network (related memories via shared subjects).
517
-
518
- ```bash
519
- heyditto network <pair-id> --limit 30
520
- ```
521
-
522
- ### `friends`
523
-
524
- List Ditto friends for commands that need usernames.
525
-
526
- ```bash
527
- heyditto friends --output json
528
- ```
529
-
530
- ### `graphs`
531
-
532
- Manage the public workspaces you're subscribed to. Subscribed workspaces are
533
- folded into your `search`/`fetch` read paths (read-only). Subscriptions only ever
534
- cover **other** users' public workspaces by `@username` — this command can't touch
535
- your own workspace or an app's workspace, since those aren't subscriptions.
536
-
537
- ```bash
538
- heyditto graphs create feedback-triager # create a NEW dedicated workspace you own (mint its CI key in the Ditto UI)
539
- heyditto graphs list # workspaces you're subscribed to
540
- heyditto graphs available # readable workspaces, including main/app workspaces
541
- heyditto graphs add @minos # subscribe to @minos's public workspace
542
- heyditto graphs remove @minos # unsubscribe
543
- heyditto graphs subscribers # who's subscribed to your workspace
544
- heyditto graphs sharing --disable # disable public subscriptions to your workspace
545
- ```
546
-
547
- Top-level aliases are also available:
548
-
549
- ```bash
550
- heyditto knowledge-graphs --output json
551
- heyditto graph-sharing --enable --title "Support Workspace" --description "Public support notes"
552
- ```
553
-
554
- ### `apps` — developer apps ("Sign in with Ditto")
555
-
556
- Everything the developer console (developer.heyditto.ai) does for an app, from the
557
- shell, so an agent can set an app up end to end. The client secret follows the same
558
- rule as endpoint keys: it is **forwarded straight into a secret store** over that
559
- store CLI's stdin and never printed.
560
-
561
- ```bash
562
- heyditto apps create "DittoBench" --gh-secret DITTO_OIDC_CLIENT_SECRET --repo ditto-assistant/ditto-subnet
563
- heyditto apps origins verify dittobench-3f9a https://dittobench.ai # serve the token, then:
564
- heyditto apps origins verify dittobench-3f9a https://dittobench.ai --confirm
565
- heyditto apps consent set dittobench-3f9a credits:spend "Pays for the inference your miner uses."
566
- heyditto apps icon set dittobench-3f9a ./logo.png
567
- heyditto apps oidc dittobench-3f9a --callback https://dittobench.ai/auth/ditto/callback >> .env
568
- heyditto apps endpoints attach dittobench-3f9a screener --billing sponsor
569
- heyditto apps endpoints attach dittobench-3f9a competition --billing user
570
- heyditto endpoints keys create competition --gh-secret DITTO_ROUTER_KEY --repo ditto-assistant/ditto-subnet
571
- ```
572
-
573
- - `create` mints the app and its secret. With a store flag the secret is stored and
574
- never shown; without one it is minted but hidden — rotate it into a store later
575
- with `apps secret rotate` (the previous secret stops working).
576
- - `oidc` prints the non-secret OIDC configuration (`DITTO_OIDC_ISSUER`,
577
- `DITTO_OIDC_CLIENT_ID`, authorization/token/userinfo/JWKS endpoints) as env lines
578
- or `--output json`. `client_id` is the app id; redirect URIs must live on a
579
- verified callback origin.
580
- - `consent set <app> <scope> "<why>"` sets the app's own reason under each requested
581
- permission on the consent screen; `consent show` renders the public consent
582
- profile (`GET /api/v5/consent-profile/<app>`).
583
- - `endpoints attach <app> <endpoint> --billing user|sponsor` makes a Router endpoint
584
- app-owned: the app's users get inference through it (never keys or edits). `user`
585
- bills the consenting user under their `credits:spend` grant to this app
586
- (`X-Ditto-On-Behalf-Of: <ditto uid>` from your server, 402 when not authorized);
587
- `sponsor` bills the endpoint owner and only records the user for attribution.
588
- - `apps` commands use your first-party key against `/api/v5/admin/apps`; pass
589
- `--company <id>` to act on an organization's apps.
590
-
591
- ### `receipts`
592
-
593
- Your receipts for the last 30 days by billing leg (`ditto` = your balance, `byok` =
594
- your own provider keys, no Ditto charge, `covered` = paid by Ditto) and by the app
595
- that spent under your consent; sponsored app calls show up on the sponsor's account.
596
-
597
- ```bash
598
- heyditto receipts
599
- heyditto receipts --leg byok --days 7
600
- heyditto receipts --app dittobench-3f9a --output json
601
- ```
602
-
603
- ### `status`
604
-
605
- Print whether `DITTO_API_KEY` is set and the configured MCP endpoint resolves.
606
-
607
- ### `init`
608
-
609
- Create a free claimable agent account and save its key locally. Use `--json` for
610
- machine-readable output that includes `apiKeyStored`, `userID`, and `claimURL`.
611
- Share `claimURL` with the human owner. The CLI stores the generated key locally
612
- without printing it. The claim URL uses a `?t=...` query parameter.
613
-
614
- Pass `--name <name>` to set the agent's name. This is set once at init,
615
- defaults to `agent`, labels every memory the agent saves, and (after the account
616
- is claimed) becomes the title of the agent's external thread in the owner's
617
- graph. Choose it up front — renaming after init isn't yet supported. See
618
- [Name the agent at init](#name-the-agent-at-init).
619
-
620
- `--agent-caller <name>` is still accepted as a backward-compatible alias.
621
-
622
- ### `config`
623
-
624
- Print a Claude Desktop / Cursor / generic-MCP-client config snippet for the Ditto memory server.
625
-
626
- ### `tools` — connected-app MCP tools from the shell
627
-
628
- Discover, inspect, and invoke connected-app MCP tools (Google Drive, Gmail,
629
- Google Docs, Jira, Backroom, Ditto built-ins, etc.) directly from the shell
630
- without exporting bearer credentials or hand-crafting JSON-RPC requests.
631
-
632
- Each command resolves your active endpoint (via `--endpoint`, `--profile` /
633
- `DITTO_PROFILE`, repository `.ditto`, saved default, or your sole endpoint),
634
- mints a short-lived ephemeral key, performs the Streamable HTTP MCP handshake
635
- internally without ever printing the token, and revokes the key on exit.
636
-
637
- ```bash
638
- # List connected MCP servers on the active endpoint
639
- heyditto tools
640
- heyditto tools --endpoint my-endpoint --json
641
-
642
- # List tools (accepts canonical names like ditto-googledrive or short aliases like googledrive)
643
- heyditto tools list googledrive
644
- heyditto tools list googledrive --search download
645
- heyditto tools list --search gmail --json
646
-
647
- # Inspect a tool's parameters and JSON input schema (alias: schema)
648
- heyditto tools describe googledrive download_file
649
- heyditto tools schema gmail search_messages --json
650
-
651
- # Invoke a tool with --arg, --json, --stdin, or @file.json
652
- heyditto tools call googledrive list_files --arg page_size=10 --output json
653
- heyditto tools call gmail search_messages --json '{"query":"from:alice"}' --output json
654
- echo '{"query":"roadmap"}' | heyditto tools call googledrive search_files --stdin --output json
655
- heyditto tools call jira create_issue @issue.json --output json
656
-
657
- # Stream a returned presigned download payload (e.g. downloaded_file_content.s3url)
658
- # straight to a file or directory without printing presigned URLs or tokens
659
- heyditto tools call googledrive download_file --arg file_id=1abc --download ./downloads/
660
- heyditto tools call googledrive download_file --arg file_id=1abc --download ./report.pdf --output json
661
- ```
662
-
663
- `heyditto mcp` manages organization-owned MCP server connections (`heyditto mcp
664
- list`, `add`, `connect`, `remove`, `enable`, `disable`, `tools [endpoint]`). When
665
- you belong to a single organization, `--org` is selected automatically. `heyditto
666
- mcp tools [endpoint]` accepts an endpoint slug, display name, or UUID.
667
-
668
- ## Coding agents
669
-
670
- `heyditto claude` and `heyditto codex` launch Claude Code or Codex through one of
671
- your Ditto **inference endpoints** (managed at https://developer.heyditto.ai/endpoints;
672
- the Ditto app's Settings → Developer page still works too). Each launch:
673
-
674
- 1. signs you in through the browser if this machine has no key yet, then uses
675
- the endpoint you picked there, `--endpoint`, the saved default, or a picker,
676
- 2. mints a temporary endpoint key (optionally capped with `--budget <tokens>`),
677
- 3. starts the agent with that key and a fresh `X-Ditto-Session-Id`, so the
678
- session becomes its own thread with full traces under the endpoint,
679
- 4. **revokes the key when the agent exits** (Ctrl+C included). The thread and
680
- traces are kept; `--keep-key` opts out, `--expires` sets a server-side
681
- safety expiry (default `1mo`, so a session left open for days keeps
682
- working; the key is still revoked on exit).
683
-
684
- ```bash
685
- npx -y @heyditto/cli login
686
- npx -y @heyditto/cli claude --endpoint my-endpoint
687
-
688
- heyditto endpoints --set-default my-endpoint # skip the picker next time
689
- heyditto claude # interactive Claude Code
690
- heyditto codex --yellow # Codex, auto-accept edits
691
- heyditto claude --yolo --worktree fix-login # bypass prompts in <repo>/.worktrees/fix-login
692
- heyditto codex -p "summarize this repo" --json # headless (codex exec)
693
- heyditto claude -p "list TODOs" --output-format json --max-turns 3
694
- heyditto claude --resume # pick a session (type words to search every project)
695
- heyditto claude --resume "Fix login bug" # resume by title, as `claude --resume` prints it
696
- heyditto claude -- --verbose # anything after -- goes to the agent
697
- ```
698
-
699
- Ditto's flags work in any order, before or after the agent's own: `heyditto
700
- claude --verbose --resume <id> --yolo` uses `--resume` and `--yolo` and
701
- forwards `--verbose`. To pass the agent a flag that Ditto also defines
702
- (`--help`, `-c`, `-p`, `--model`), put it after `--`.
703
-
704
- Options shared by both commands:
705
-
706
- | Flag | Meaning |
707
- | --- | --- |
708
- | `-e, --endpoint <slug>` | endpoint to route through (default: saved default, else a picker) |
709
- | `--budget <tokens>` | spend cap for this session's key, in Ditto tokens |
710
- | `--expires <1h…never>` | server-side key expiry; the key is still revoked on exit unless `--keep-key` |
711
- | `--session <id>` | reuse a Ditto session id so traces land in an existing thread |
712
- | `--resume [id]` / `-c, --continue` | resume a local session (`heyditto sessions`) / the agent's most recent conversation. Claude also takes a Claude session id or title here, including sessions started in Claude Desktop or plain `claude`, and runs in the directory that session ran in; with no value, a terminal gets a searchable picker. Claude's own `-r` / `--resume` / `-c` after `--` do the same. |
713
- | `--yolo` / `--yellow` / `--plan` | bypass permissions / auto-accept edits / plan mode (Claude only) |
714
- | `--mcp` / `--no-mcp` | attach the endpoint's tools to the agent as its own MCP servers, or keep them on the router (default: the endpoint's `<agent>_tool_surface`, e.g. `codex_tool_surface`, else MCP) |
715
- | `--no-hooks` | leave out the Claude Code hooks the repository's `.ditto` profile declares (`claude_hooks`); Claude only |
716
- | `-p, --prompt <text>` | headless run: `claude -p` or `codex exec` |
717
- | `-m, --model <id>` | model to request (default: the agent's own model id passes through and the endpoint routes it) |
718
- | `-w, --worktree [name]` | run inside `<repo>/.worktrees/<name>` on a branch of that name; `.worktrees/` is added to `.gitignore` |
719
- | `--name <label>` | key name shown in the app (default `cli:<agent>:<hostname>`) |
720
- | `--dry-run` | print the command, args and env with the key masked; mints nothing |
721
-
722
- Unknown flags and everything after `--` are forwarded to the agent, so Claude's
723
- and Codex's own options keep working.
724
-
725
- How the wiring works:
726
-
727
- - **Every launch** names its harness and release to the router:
728
- `X-Ditto-Harness: claude|codex` and `X-Ditto-Harness-Version` with the
729
- version `<harness> --version` reports, exactly as printed (a pre-release
730
- stays a pre-release). The router serves that release's own vendored system
731
- prompt and compaction instruction. When the version cannot be read, the
732
- header is left out and the router falls back to the User-Agent; a parent
733
- `heyditto` session's version is never passed on to a child launch.
734
- - **Claude Code** gets `ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN` (a bearer
735
- token, which skips Claude's "use this API key?" prompt) and
736
- `ANTHROPIC_CUSTOM_HEADERS` with the session id. Any inherited
737
- `ANTHROPIC_API_KEY` is removed from the child environment.
738
- With `--no-mcp`, router tools run on the server, so Claude Code's own
739
- permission rules never see them. `permissions.deny` entries for `mcp__ditto__<tool>` (globs allowed;
740
- a bare `mcp__ditto` denies them all) in your user, project or local
741
- `settings.json` are forwarded as `X-Ditto-Tool-Deny`, and the router refuses
742
- those tools for the session. The header can only add denials.
743
- - **Claude Code** gets the endpoint's tools as its own MCP servers by default: `ditto` for Ditto's built-ins, plus one server per
744
- connected app or MCP server (`ditto-github`, `ditto-jira`, …). Claude Code
745
- discovers them with its own ToolSearch and calls them natively. Every call
746
- still runs on Ditto (`/v1/mcp/<server>`) with the credentials Ditto holds and
747
- behind the endpoint's approval gate and deny rules, and the router is told
748
- not to offer the same tools again. The session key reaches the MCP headers
749
- as `${DITTO_ROUTER_MCP_KEY}`, never argv or disk. Who asks before a gated
750
- call is the endpoint's choice:
751
-
752
- | Endpoint | What happens to a gated call |
753
- | --- | --- |
754
- | default | Ditto holds it for approval; Claude Code does not ask a second time |
755
- | `client_approvals = true` | Claude Code asks; `--yolo` runs it without asking. Deny rules still refuse |
756
-
757
- `client_approvals` hands approval to whoever runs the session, so only an
758
- organization's managers can turn it on for an org endpoint. An endpoint
759
- with no tools attaches nothing, and one the MCP surface cannot serve falls
760
- back to the router's tools. `--no-mcp` keeps the tools on the router (Code
761
- Mode or injected tools, as described above) for one session, and
762
- `claude_tool_surface = "router"` in an endpoint profile makes that the
763
- endpoint's default.
764
- - **Codex** speaks the Responses API only, so the endpoint is injected as a
765
- `ditto` model provider via `-c` overrides (nothing is written to
766
- `~/.codex/config.toml`) with the key in `DITTO_INFERENCE_API_KEY`.
767
- - **Codex** gets the same MCP servers as Claude Code by default, the way cmux
768
- attaches its computer-use server: one `-c mcp_servers.<name>={…}` override
769
- per server, read from the same catalog, with `bearer_token_env_var =
770
- "DITTO_ROUTER_MCP_KEY"` so the key stays out of argv and disk. Each override
771
- sets `enabled = true`, because Codex merges it into a server of the same
772
- name in your own config. Approvals map onto Codex's: tools Ditto holds
773
- itself run as `approve`, and under `client_approvals` the gated ones are
774
- `prompt` (`--yolo` runs them unasked). Claude's `permissions.deny` rules are
775
- not applied to Codex. `--no-mcp` or `codex_tool_surface = "router"` keeps
776
- the tools on the router.
777
- - **Grok** gets them as `[mcp_servers."<name>"]` tables in its launch
778
- `GROK_HOME/config.toml` (`bearer_token_env_var = "DITTO_ROUTER_MCP_KEY"`),
779
- plus `[permission]` rules: `allow` each Ditto server (`MCPTool(ditto__*)`)
780
- and, under `client_approvals`, `ask` for each gated tool. Grok defers MCP
781
- schemas behind its own `search_tool` / `use_tool`. The Ditto model entry
782
- sends `X-Ditto-Tool-Surface: mcp`. `--no-mcp` or `grok_tool_surface =
783
- "router"` keeps the router surface.
784
- - **Cursor CLI** (`heyditto cursor`, runs `cursor-agent`) keeps inference on
785
- your own Cursor account; Ditto supplies only the endpoint's tools. Cursor
786
- has no per-launch MCP flag, so they go in a private per-launch plugin
787
- (`--plugin-dir`, a `.cursor-plugin/plugin.json` plus `.mcp.json`) and
788
- nothing is written to `~/.cursor`. The servers show up as
789
- `plugin-ditto-<server>`, and the key is read from
790
- `${env:DITTO_ROUTER_MCP_KEY}`. Cursor asks before each MCP call unless
791
- `--yolo` (`--force`). A `-p` run adds no Cursor-wide flag of its
792
- own: Cursor's `-p` edits and runs commands, but rejects every MCP call it
793
- cannot ask about, so Ditto's tools need `--yolo` there (an explicit choice,
794
- since `--force` also allows any command). An untrusted workspace needs
795
- Cursor's own `--trust`. Remote control and
796
- `--headless` are not available for Cursor yet.
797
- - **OpenCode** (`heyditto opencode`, or `opencode run` for `-p`) gets
798
- everything through `OPENCODE_CONFIG_CONTENT`, which OpenCode merges over
799
- your own config for that run, so nothing is written to disk.
800
- - **Inference:** a `ditto` provider (`@ai-sdk/openai-compatible`) points at
801
- the endpoint. The key is read from `{env:DITTO_INFERENCE_API_KEY}`, and
802
- the model defaults to the endpoint's slug.
803
- - **Tools:** one remote MCP server per catalog source, keyed by
804
- `{env:DITTO_ROUTER_MCP_KEY}`, plus `permission` rules. Tools are named
805
- `<server>_<tool>`, and OpenCode allows any tool no rule names. When
806
- Ditto holds gated calls, or under `--yolo` (`--auto`), each server is
807
- allowed whole. Under `client_approvals`, each server asks by default
808
- (denies in an unattended `opencode run`) and allows only its listed
809
- ungated tools, so a tool the server adds after launch is never covered
810
- by an allow.
811
- - **Not yet:** remote control, `--headless` and `--yellow` are not
812
- available for OpenCode.
813
-
814
- ### `codex-app`
815
-
816
- `heyditto codex-app` wires the **Codex desktop app** (ChatGPT.app) to one of
817
- your inference endpoints, so its models — GLM Flash and friends — work in the
818
- app behind its own **"Sign in with an API key"** screen. Unlike the CLI, the
819
- app cannot be handed environment variables (a Dock-launched app inherits
820
- none), so the wiring is file-based in the `~/.codex` directory the app shares
821
- with the CLI:
822
-
823
- - `openai_base_url` in `~/.codex/config.toml` repoints the built-in `openai`
824
- provider (the Responses wire the gateway speaks) at your endpoint;
825
- - the minted endpoint key lands in `~/.codex/auth.json` as the API-key login,
826
- the same place the app's sign-in screen writes.
827
-
828
- ```bash
829
- heyditto codex-app # sign in, pick an endpoint, wire the app
830
- heyditto codex-app --endpoint my-endpoint # route through a specific endpoint
831
- heyditto codex-app --model glm-5.3-flash # pin the app's model
832
- heyditto codex-app --dry-run # show what would be written
833
- heyditto codex-app --unset # restore the previous wiring, revoke the key
834
- ```
835
-
836
- The command also enables the endpoint's model picker (`--codex-models on`),
837
- so the app's model picker lists the endpoint's models. A previous login
838
- (especially a ChatGPT-plan one) is backed up to `auth.json.pre-ditto` and
839
- confirmed before it is replaced; `--unset` restores it. The key is long-lived
840
- (unlike `heyditto codex`'s per-session keys) and is revoked by `--unset` or
841
- rotated on the next run. Both files are shared with the Codex CLI, so a bare
842
- `codex` run routes through Ditto too; `heyditto codex` is unaffected.
843
-
844
- ### `profile` — named endpoint profiles
845
-
846
- A profile gives an endpoint a local name, so you can keep several (each with
847
- its own MCP tools) and switch which one new sessions use. The active profile is
848
- used whenever `--endpoint` is omitted; `--profile <name>` picks another for one
849
- command and `DITTO_PROFILE=<name>` for one shell. `--endpoint` still wins over
850
- both.
851
-
852
- ```
853
- heyditto profile list (* = active)
854
- heyditto profile create <name> --endpoint <slug> [--inference cliproxy|router] [--use]
855
- heyditto profile use <name> make it active (alias: switch)
856
- heyditto profile set <name> [--endpoint <slug>] [--inference cliproxy|router]
857
- heyditto profile rename <old> <new>
858
- heyditto profile delete <name> not the active one (alias: rm)
59
+ heyditto graphs list | available | create <name> | add <@user> | remove <@user> | subscribers | sharing
859
60
  ```
860
61
 
861
- `--profile` works on `claude`, `codex`, `grok`, `codex-app`, `status`,
862
- `t3 setup` and `endpoints list|create|show|use|pick|open`; `endpoints use
863
- <slug> --profile subnet` re-points only that profile. An install that never
864
- creates a profile behaves exactly as before: its saved default endpoint is the
865
- implicit `default` profile. Creating the first profile saves that default as
866
- profile `default` and keeps it active. The saved `defaultEndpoint` always
867
- mirrors the active profile, so an older CLI on the same machine launches what
868
- the active profile names. Profiles are local and hold no keys; they do not
869
- change an endpoint's routing or policy. (`heyditto profiles`, plural, is an
870
- older alias of `heyditto endpoints`.)
871
-
872
- Two T3 providers, one per profile:
873
-
874
- ```sh
875
- heyditto profile create subnet --endpoint <subnet-endpoint-slug>
876
- heyditto t3 setup --profile subnet --dry-run
877
- # quit T3, then
878
- heyditto t3 setup --profile subnet # adds "Claude Subnet" (claude_ditto_subnet_cliproxy)
879
- heyditto profile use subnet # optional: new terminal sessions use it too
880
- ```
881
-
882
- ### `endpoints`
883
-
884
- Manage the inference endpoints the launchers route through — a CLI mirror of
885
- the developer console at https://developer.heyditto.ai/endpoints (`open` takes
886
- you to an endpoint's page there; set `DITTO_DEVELOPER_BASE` to point elsewhere):
887
-
888
- ```
889
- heyditto endpoints [--set-default <slug>] [--clear-default] list (* = default)
890
- heyditto endpoints list --archived archived endpoints and when they were archived
891
- heyditto endpoints create [--name <n>] [--slug <s>] [--model <id>] [--org <org>] [--default]
892
- heyditto endpoints move <endpoint> (--org <org> | --personal) change who owns and pays for it
893
- heyditto endpoints show <endpoint>
894
- heyditto endpoints use <endpoint> make it the default (of the active profile, or --profile <name>)
895
- heyditto endpoints pick choose the default interactively
896
- heyditto endpoints open [endpoint] open the editor in the Ditto app
897
- heyditto endpoints set <endpoint> [settings flags — see the table below]
898
- heyditto endpoints usage <endpoint> [--window 7d|30d|month] requests, tokens, spend and cap
899
- heyditto endpoints archive <endpoint> [--yes] stop serving; keeps threads, traces, usage, keys (alias: delete)
900
- heyditto endpoints unarchive <endpoint> restore an archived endpoint
901
- heyditto endpoints keys <endpoint> list keys
902
- heyditto endpoints keys create <endpoint> --store <destination> --secret <NAME> [scoping flags]
903
- [--name <label>] [--expires <1h…never>] [--budget <tokens>]
904
- [--spend-period <p>] [--yes]
905
- heyditto endpoints keys stores which destinations this machine can write to
906
- heyditto endpoints keys revoke <endpoint> <keyId> [--yes]
907
- ```
908
-
909
- Endpoints spend your Ditto credits, so archiving one, revoking a key or raising a
910
- spend limit asks you to type the slug back; pass `--yes` in scripts. `--output
911
- json` is available everywhere and includes the gateway base URL.
912
-
913
- Archiving an endpoint (`endpoints delete` is an alias) stops it serving and
914
- frees its slug and plan slot. Its keys stop working while it is archived; its
915
- threads, traces, usage and keys are kept. `heyditto endpoints unarchive <slug>`
916
- brings it back, and keys that were active when it was archived work again
917
- (unless they have since expired or been revoked). If a live endpoint has taken
918
- the slug in the meantime, archive or rename that one first; if you have no free
919
- endpoint slot, archive another endpoint or upgrade your plan.
920
-
921
- #### `endpoints set` — every setting the console has
922
-
923
- `set` is a full mirror of the endpoint editor at
924
- https://developer.heyditto.ai/endpoints: anything the web form can change, this
925
- can change. `heyditto endpoints show <endpoint>` prints all of it back, and
926
- `--output json` gives the raw fields.
927
-
928
- | Flag | What it does |
929
- | --- | --- |
930
- | `--name <name>` / `--model <id>` | display name / default model id |
931
- | `--system-prompt <text>` | prompt prepended to every request |
932
- | `--spend-limit <tokens\|none>` `--spend-period <daily…never>` | spend cap and the window it resets on |
933
- | `--recall on\|off` `--record on\|off` `--memory-depth <0-25>` | memory recall and recording |
934
- | `--record-trace on\|off` `--record-attachments on\|off` | store raw traces / store images sent on the user turn |
935
- | `--trace-retention <days>` | days traces are kept; `0` = forever. Clamped to your plan — the CLI says so when it was |
936
- | `--context-compaction off\|light\|balanced\|aggressive` | how eagerly finished tool results are digested |
937
- | `--result-compression off\|conservative\|grouped` | compress tool results at ingestion |
938
- | `--tool-compression on\|off` | swap harness tool descriptions for stored condensed rewrites |
939
- | `--precompact-at <tokens>` | start a background compaction snapshot at this prompt size; `0` = off |
940
- | `--routing cheap\|fast\|balanced` | how a provider is picked for a model |
941
- | `--failover on\|off` | opt into fallback; off by default, sticky for the session |
942
- | `--failover-model <id\|same>` | use a different, potentially cheaper fallback model, or keep the same model |
943
- | `--failover-max-cost <usd>` | required ceiling for cold-cache input and bounded output across fallback attempts in each request; zero never means unlimited |
944
- | `--model-mode default\|passthrough` | what happens to a request model that is neither alias, route nor provider id |
945
- | `--billing-mode ditto\|byok\|both` | whose provider keys pay for requests |
946
- | `--stream-granularity final\|tool\|full` | how much server-side tool activity the stream shows |
947
- | `--max-tool-rounds <0-32>` | server-side tool loop cap per request |
948
- | `--batch on\|off` `--batch-max-requests <0-50000>` | admit batch submissions, and the per-batch cap |
949
- | `--kind-route <kind=model>` | pin a request archetype to a model: `chat`, `tool_round`, `aside`, `compaction`, `structured_output`, `probe` |
950
- | `--model-route <requested=target>` | map a model id exactly as a harness sends it to a provider model |
951
- | `--alias <name=model>` | name a model on this endpoint |
952
- | `--clear-kind-routes` `--clear-model-routes` `--clear-aliases` | empty a whole map |
953
-
954
- The three map flags are repeatable and **merge** onto what the endpoint already
955
- has, so setting one route never drops the others. An empty value removes a
956
- single entry:
957
-
958
- ```
959
- heyditto endpoints set my-endpoint --kind-route aside=openai/gpt-5.6-nano \
960
- --kind-route probe=openai/gpt-5.6-nano
961
- heyditto endpoints set my-endpoint --kind-route aside= # remove just that one
962
- heyditto endpoints set my-endpoint --clear-kind-routes # remove all of them
963
- ```
964
-
965
- Choices and numeric bounds are checked locally against the gateway's own
966
- enums, so a typo fails instantly instead of costing a round trip.
967
-
968
- #### Put a key straight into a secret manager
969
-
970
- `keys create` mints a long-lived key on an endpoint and stores it in a secret
971
- manager by delegating to that platform's own CLI — **the key is never shown**.
972
- The plaintext goes to the platform CLI over stdin (or through `/dev/stdin`, for
973
- the CLIs that read a file instead), so it does not appear in argv, `ps`, shell
974
- history, logs or the CLI's own output, and nothing is kept locally. If the
975
- platform CLI fails, the freshly minted key is revoked again.
976
-
977
- | Destination | Shorthand | Scoping flags | CLI it delegates to |
978
- | --- | --- | --- | --- |
979
- | GitHub Actions | `--gh-secret NAME` | `--repo` `--env` `--org` | `gh secret set` |
980
- | GitLab CI/CD | `--gitlab-var NAME` | `--project` `--org` `--env` | `glab variable set --masked` |
981
- | AWS Secrets Manager | `--aws-secret NAME` | `--region` | `aws secretsmanager create-secret` (then `put-secret-value`) |
982
- | Google Secret Manager | `--gcp-secret NAME` | `--project` | `gcloud secrets create` (then `versions add`) |
983
- | Azure Key Vault | `--az-secret NAME` | `--key-vault` (required) | `az keyvault secret set --file` |
984
- | 1Password | `--op-item TITLE` | `--op-vault` | `op item create` (JSON template on stdin) |
985
- | HashiCorp Vault | `--vault-secret PATH` | `--mount` `--field` | `vault kv patch` (then `kv put`) |
986
- | Doppler | `--doppler-secret NAME` | `--project` `--doppler-config` | `doppler secrets set` |
987
- | Cloudflare Workers | `--cf-secret NAME` | `--worker` | `wrangler secret put` |
988
- | Vercel | `--vercel-env NAME` | `--vercel-target` | `vercel env add --sensitive` |
989
- | Kubernetes | `--k8s-secret NAME` | `--namespace` `--k8s-key` | `kubectl patch secret` (then `apply`) |
990
- | Fly.io | `--fly-secret NAME` | `--app` | `fly secrets import` |
991
-
992
- Every shorthand is sugar for `--store <id> --secret <NAME>`; use whichever
993
- reads better. `heyditto endpoints keys stores` lists the destinations with the
994
- CLI each one needs and whether it is installed here (`--output json` for
995
- scripts).
62
+ ### Ditto Router Endpoints, BYOK & Keys
996
63
 
997
64
  ```bash
998
- cd my-repo
999
- heyditto endpoints keys create my-endpoint --gh-secret DITTO_KEY # repo from the current directory (like gh)
1000
- heyditto endpoints keys create my-endpoint --gh-secret DITTO_KEY --repo acme/app --budget 5000000
1001
- heyditto endpoints keys create my-endpoint --gh-secret DITTO_KEY --org acme --expires 6mo --output json
1002
- heyditto endpoints keys create my-endpoint --store aws --secret DITTO_KEY --region us-east-1
1003
- heyditto endpoints keys create my-endpoint --gcp-secret ditto-key --project my-gcp-project
1004
- heyditto endpoints keys create my-endpoint --az-secret ditto-key --key-vault my-vault
1005
- heyditto endpoints keys create my-endpoint --op-item "Ditto inference" --op-vault Engineering
1006
- heyditto endpoints keys create my-endpoint --vault-secret ditto/inference --mount secret --field token
1007
- heyditto endpoints keys create my-endpoint --k8s-secret ditto-inference --namespace prod
1008
- ```
1009
-
1010
- Requirements: the platform CLI on `PATH` and signed in — both are checked
1011
- *before* anything is minted, so a missing CLI costs you nothing. Without a
1012
- terminal the command needs `--yes`; interactively it shows what it will do and
1013
- asks you to type the secret name back. Defaults: expiry `1y`, key label
1014
- `<store>:<target>:<NAME>` (GitHub keeps its original `gh:<owner>/<repo>:<NAME>`);
1015
- `--budget` caps the key's spend (`--spend-period` defaults to `monthly`). A
1016
- scoping flag that belongs to another destination is an error rather than being
1017
- ignored. The output shows the key's last four characters, expiry, budget, where
1018
- it was stored, and how to consume it — for GitHub Actions:
1019
-
1020
- ```yaml
1021
- env:
1022
- ANTHROPIC_AUTH_TOKEN: ${{ secrets.DITTO_KEY }}
1023
- ANTHROPIC_BASE_URL: https://api.heyditto.ai
1024
- # OpenAI-compatible clients: OPENAI_API_KEY: ${{ secrets.DITTO_KEY }} with OPENAI_BASE_URL: https://api.heyditto.ai/v1
1025
- ```
1026
-
1027
- Revoke it any time with `heyditto endpoints keys revoke my-endpoint <keyId>`.
1028
-
1029
- **Agent accounts.** An agent set up with `heyditto init` can create and manage
1030
- endpoints too, but an endpoint created by an unclaimed agent starts **inactive**:
1031
- it serves requests once the person the agent works for claims the agent and
1032
- subscribes to Ditto Hero. The CLI prints the server's explanation together with
1033
- an activation link (the agent's claim link plus the endpoint) — hand that link
1034
- to the user.
1035
-
1036
- ### `keys` — your provider keys, kept in Ditto
1037
-
1038
- Ditto is your key manager: save a GM, Engy, Instant, OpenRouter, OpenAI,
1039
- Anthropic or Google key once and every Router endpoint billed to your own keys
1040
- (`--billing-mode byok` or `both`) can use it. Keys go straight to your Ditto
1041
- account and are never shown back; the CLI only ever sees metadata.
1042
-
1043
- ```sh
1044
- heyditto login --keys # sign in and approve key access
1045
- heyditto keys providers # what you can save a key for
1046
- heyditto keys set openrouter # prompts, input hidden
1047
- printf %s "$GM_KEY" | heyditto keys set gm # or pipe it on stdin
1048
- heyditto keys set gm --label work # a second, named gm key
1049
- heyditto keys list
1050
- heyditto keys disable gm # enable | disable | validate | remove
1051
- heyditto keys disable gm --label work # the named one
1052
- heyditto keys remove openrouter --yes
1053
- ```
1054
-
1055
- A provider can hold several keys, each with its own name: `--label` picks one,
1056
- and saving under a name that exists replaces that key. No `--label` means the
1057
- provider's original key. How many keys one provider may hold depends on your
1058
- plan (one on Free); past it, `keys set` fails with `provider_key_limit`.
1059
-
1060
- `keys set` reads the key from stdin or a hidden prompt, never from an argument,
1061
- and checks it with the provider right away: a refused key is still saved, and
1062
- the CLI says why. Saving, turning keys on or off and removing them need a
1063
- sign-in approved for key access: `heyditto login --keys`. A plain login can
1064
- list and check keys, and `keys set` on a terminal offers to sign in again.
1065
- With `--output json`, results print the API's JSON and failures print
1066
- `{"error":{"code","message","status"}}` on stdout with exit code 1 (codes
1067
- include `provider_keys_not_granted`, `provider_not_supported`,
1068
- `provider_key_limit`, `empty_key`, `key_not_found` and `not_logged_in`).
1069
-
1070
- ### `sessions`
1071
-
1072
- List the coding-agent sessions launched from this machine (stored under
1073
- `~/.config/heyditto/cli/sessions/`). `heyditto sessions rm <id>` forgets a local
1074
- record; the Ditto thread and traces are unaffected.
1075
-
1076
- ### `session`
1077
-
1078
- Explicit MCP sessions. Without one, the server groups your saves and searches
1079
- into a time-based *implicit* session (activity within a cooldown, auto-named
1080
- when it goes quiet). `heyditto session new [name]` pins an explicit session:
1081
- every MCP request from then on carries `X-Ditto-Session-Id`, and the name goes
1082
- out once as `X-Ditto-Session-Name` so the thread gets that title. Saves and
1083
- searches land in one thread inside the agent your key is attached to.
1084
-
1085
- ```bash
1086
- heyditto session new "refactor auth module" # prints the id and makes it active
1087
- heyditto save "Decided to keep JWT refresh in the gateway"
1088
- heyditto session current # the active id (exit 1 when none)
1089
- heyditto session list # local history, * marks the active one
1090
- heyditto session end # back to implicit sessions
1091
- heyditto session use 9e9a93c3 # reactivate by id or unique prefix
1092
- ```
1093
-
1094
- `DITTO_SESSION_ID=<id>` pins a session for one shell or script (it overrides the
1095
- saved one and never sends a name). Sessions are tracked locally in
1096
- `~/.config/heyditto/cli/mcp-sessions.json`; the server keeps the threads.
1097
-
1098
- ### `agents`
1099
-
1100
- Thin wrappers over the MCP agent-chat tools (`list_agents`,
1101
- `list_agent_threads`, `send_message_to_agent`, `get_agent_message`).
1102
- `heyditto agents` lists your Ditto agents: your Main Agent and the agents you
1103
- created. Connected chats (Slack, Telegram, WhatsApp DMs), MCP sessions and model
1104
- endpoints are not agents and are not listed. `--space <alias>` uses another
1105
- space you can read instead, such as a company space (`heyditto knowledge-graphs`
1106
- lists the aliases). Reading needs viewer access; sending needs editor access.
1107
-
1108
- ```bash
1109
- heyditto agents --space omniaura/feedback-triager
1110
- heyditto agents send --space omniaura/feedback-triager --agent <id> --wait 300 "which issue has the most reporters?"
1111
- heyditto agents message <message-id> --wait 300 # collect a late answer
65
+ heyditto endpoints [--set-default <slug> | --clear-default]
66
+ heyditto endpoints provider-keys --output json
67
+ heyditto endpoints models gm --output json
68
+ heyditto endpoints create --name "My Endpoint" --slug my-endpoint \
69
+ --model gm/gpt-6-luna --billing-mode byok --provider-key <saved-key-UUID>
70
+ heyditto endpoints set my-endpoint --recall off --record off --record-trace off
71
+ heyditto endpoints keys create my-endpoint --key-file /abs/private/router-key --yes # 0700 dir, 0600 new file, no stdout print
72
+ heyditto keys list | providers | set | enable | disable | remove | validate
73
+ heyditto receipts [--leg ditto|byok|covered --app <app_id> --days <n>]
1112
74
  ```
1113
75
 
1114
- `send` runs as an ordinary turn of that agent, with its instructions, memory and
1115
- connected apps; it appears in the agent's thread in the app and bills as a
1116
- normal message.
1117
-
1118
- ### `review` — Ditto Review from the shell
1119
-
1120
- The developer console's Review pages, as commands. Repository settings:
1121
-
1122
- ```bash
1123
- heyditto review repos --org omniaura # repositories set up for Ditto Review
1124
- heyditto review set ditto-assistant/console --max-minutes 20 --org omniaura
1125
- ```
76
+ `byok` never falls back to Ditto-funded providers; `--key-file` refuses symlinks/existing files and revokes the key on write failure.
1126
77
 
1127
- Findings on a pull request (its newest run), and acting on one. A finding is
1128
- named the way you meet it: by the GitHub review comment's URL
1129
- (`…/pull/12#discussion_r<id>`), by `<run-id>:<finding-id>`, or by a bare
1130
- finding id with `--pr`. Without `--org` the PR's repository is looked up in
1131
- your personal workspace and then in each organization you belong to.
78
+ ### Coding Agents, Profiles & `.ditto/` Config
1132
79
 
1133
80
  ```bash
1134
- heyditto review findings https://github.com/ditto-assistant/backend/pull/3158
1135
- heyditto review findings ditto-assistant/ditto-app#3163 --all --output json # include dismissed
1136
-
1137
- # Managers: dismiss with a reason. Ditto replies on the GitHub thread, resolves
1138
- # it, and keeps the same issue off this PR on later reviews.
1139
- heyditto review dismiss "https://github.com/ditto-assistant/backend/pull/3112#discussion_r4171976544" \
1140
- --reason "Retrying with different arguments is the documented design (trace_test.go:106-115)."
1141
- heyditto review undismiss <run-id>:<finding-id>
1142
-
1143
- # Any member: say whether a finding was useful, wrong or not useful.
1144
- heyditto review feedback "<comment-url>" wrong --note "The retry test covers different arguments."
81
+ heyditto claude [options] [-- <claude args>] # routes Claude Code through a Ditto Router endpoint
82
+ heyditto codex [options] [-- <codex args>] # routes Codex through a Ditto Router endpoint
83
+ heyditto codex-app [--endpoint <slug> --model <id> --unset]
84
+ heyditto profile ... # named endpoint profiles
85
+ heyditto session new|list|use|current|end # explicit MCP session bookkeeping
86
+ heyditto sessions [--json --all] | rm <id>
87
+ heyditto agents [--space <alias>] | threads | send <msg> | message <id>
1145
88
  ```
1146
89
 
1147
- Every action is recorded as the same signal the console records
1148
- (`review_finding_feedback`, `review_finding_dismissals`), so it feeds
1149
- false-positive learning; a plain GitHub reply does not. The key reaches the run
1150
- detail, feedback and dismiss routes only — not cancel, retry, the event stream
1151
- or posting a withheld finding.
90
+ Repositories can commit `.ditto/config.toml`, `.ditto/endpoints/<name>.toml` (schema in `src/dittoconfig/schema.json`) and `.ditto/workflows/<slug>.toml` (see [Workflows](#workflows-workflows-and-dittoworkflows)) to pin default Router endpoints, prompt files, `[review]` defaults, and `claude_hooks`. See [docs/t3-code.md](docs/t3-code.md), [docs/claude-hooks.md](docs/claude-hooks.md), [docs/claude-channel-approval.md](docs/claude-channel-approval.md), and [docs/claude-remote-input.md](docs/claude-remote-input.md).
1152
91
 
1153
- ## Remote Control
1154
-
1155
- Every `heyditto claude` / `heyditto codex` session is reachable from the Ditto
1156
- app by default: open the session's thread on your phone and the chat input
1157
- becomes the terminal's input. Text and attachments you send there are typed
1158
- into the harness on your machine; the harness's own slash commands, skills and
1159
- permission prompts work from the app too.
92
+ ### Workflows (`workflows`) and `.ditto/workflows/`
1160
93
 
1161
94
  ```bash
1162
- heyditto claude # remote-controllable (the default)
1163
- heyditto claude --no-remote-control # local only: never talks to the host bridge
1164
- heyditto codex --headless # no terminal UI; each app prompt runs one turn until Ctrl+C
1165
- heyditto claude --headless -p "start" # run one turn now, then keep taking turns from the app
95
+ heyditto workflows [list] [--space <alias>] # NAME, SCHEDULE, STATE, LAST RUN
96
+ heyditto workflows get|runs|pause|resume <id|name> [--space <alias>]
97
+ heyditto workflows run <id|name> [--input k=v ...] [--inputs-json '{"k":"v"}']
98
+ heyditto workflows apply .ditto/workflows/<slug>.toml [--dry-run]
99
+ heyditto repo apply [--dry-run] [--json] # endpoints, then every workflow
1166
100
  ```
1167
101
 
1168
- How it works:
1169
-
1170
- - The CLI opens one WebSocket to `/api/v5/hosts/ws` (host bridge protocol
1171
- v1.1), announces the session (`session.announce`) and its command catalog
1172
- (`session.commands`), and reconnects with backoff when the backend goes
1173
- away. The host id the backend assigns is kept in the CLI config so a
1174
- machine stays the same device across launches. A backend without the bridge,
1175
- or no network, never blocks the harness: remote control just stays off.
1176
- - **TUI mode** runs the harness in a pseudo-terminal the CLI owns (via the
1177
- optional `@lydell/node-pty` dependency, which ships prebuilt binaries for
1178
- macOS, Linux and Windows on x64/arm64 and runs no install scripts) and
1179
- mirrors it to your terminal. A prompt from the app is pasted into the
1180
- harness's input box (bracketed paste) and submitted; `turn.interrupt` sends
1181
- Esc (Claude Code) or Ctrl+C (Codex). Without a PTY module for your platform,
1182
- or outside a terminal, the launch falls back to a plain spawn and says why
1183
- remote control is off.
1184
- - **Turn boundaries come from the harnesses, not from parsing the screen.**
1185
- Claude Code is launched with `--settings` hooks (`UserPromptSubmit`, `Stop`,
1186
- `Notification`, `PreToolUse` for `AskUserQuestion`); Codex with
1187
- `-c notify=[…]`. Each hook runs `dist/remote/hook.js`, which writes one JSON
1188
- line to a Unix socket the CLI listens on. `Stop` / `agent-turn-complete`
1189
- mark `turn.finished`; if a harness never reports (older builds, builtin
1190
- commands that run no model turn), a quiet-screen fallback ends the turn.
1191
- - **Attachments** are downloaded to `<cwd>/.tmp/ditto/attachments/<turnId>/`
1192
- (size and sha256 verified, mode 0600). `.tmp/` is added to the clone's
1193
- `.git/info/exclude`, never to `.gitignore`. The prompt the harness sees is
1194
- your text followed by `Attached files:` and the relative paths.
1195
- - **Commands** (`turn.deliver {kind: "command"}`): the catalog lists Claude
1196
- Code builtins, `.claude/commands/**` and `~/.claude/commands/**`, skills from
1197
- `.claude/skills` and `~/.claude/skills`, installed plugin skills; Codex
1198
- builtins, `~/.codex/prompts/*.md` (as `/prompts:<name>`) and skills (as
1199
- `$<name>`). It is re-sent when those directories change. TUI mode types the
1200
- command; headless mode runs it through `claude -p "/name args" --resume` or
1201
- `codex exec resume --last`, and answers `turn.finished {unsupported}` for
1202
- TUI-only builtins.
1203
- - **Prompts** (`prompt.request` / `prompt.answer`): a Claude Code permission
1204
- dialog or `AskUserQuestion` is forwarded to the app with its options; the
1205
- answer is typed back as the option's hotkey (or as text). Codex exposes no
1206
- hook for its approval dialogs, so those still need the keyboard.
1207
- - Claude Code terminal hosts advertise prompt delivery modes separately from
1208
- Stop. Normal busy sends remain in the CLI's FIFO; native keyboard activity
1209
- observed through Claude hooks also holds that FIFO until its Stop hook. Explicit `deliveryMode:
1210
- "steer"` bypasses that FIFO and submits the prompt with native Ctrl+Enter;
1211
- queued prompts remain queued. Escape still performs the independent Stop.
1212
- After the first successful steer, Claude Stop hooks remain uncorrelated for
1213
- the rest of that session. Remote receipts and later local keyboard activity
1214
- therefore use the existing quiet fallback (eight seconds by default), which
1215
- can delay completion receipts and queue draining. Physical cancellation and receipt timing are
1216
- separate. Headless and other harnesses reject steering. MCP Channels also
1217
- rejects forced steering and interruption; Claude schedules its notifications,
1218
- which does not establish a host FIFO or immediate-delivery guarantee.
1219
-
1220
- - **Headless mode** runs one `claude -p --resume <id> --output-format
1221
- stream-json` / `codex exec resume --last` per turn, prints a compact progress
1222
- line per event, and reports `turn.finished {exitCode}`. Ctrl+C finishes the
1223
- current turn, announces the session closed and revokes the session key.
1224
- - `checkpoint.request` runs the same push as `heyditto teleport push` and
1225
- answers `checkpoint.done {generation}`.
102
+ Each command is a thin front end over a Ditto MCP tool (`list_workflows`, `get_workflow`, `list_workflow_runs`, `run_workflow`, `set_workflow_paused`, `apply_workflow`); `--output json` prints the tool's result. A repository can declare workflows in `.ditto/workflows/<slug>.toml`. `heyditto repo apply` plans every workflow with `apply_workflow` (`dry_run = true`) before it writes anything, endpoints included, then upserts each one by slug; re-applying an unchanged file writes nothing. `managed = false` files are skipped. `repo validate` checks these files and `repo show` lists them. Workflows are not part of the `.ditto` config digest.
1226
103
 
1227
- ### `fork`
104
+ ```toml
105
+ managed = true # default true; false = skipped by repo apply
106
+ name = "Feedback triage" # required, 1-120 chars
107
+ slug = "feedback-triage" # default: file basename; ^[a-z0-9][a-z0-9-]{0,62}$
108
+ description = "Hourly triage of new feedback"
109
+ space = "omniaura/feedback-triager-51e1d2" # omit for personal; a workflow cannot move spaces
110
+ enabled = true # false = saved but paused
1228
111
 
1229
- Start a new session from a copy of an existing conversation.
112
+ [schedule] # omit the table for a manual-only workflow
113
+ cron = "0 * * * *" # required when [schedule] is present
114
+ timezone = "UTC"
1230
115
 
1231
- ```bash
1232
- heyditto fork <session-id> # copy the transcript under a new session id
1233
- heyditto fork <session-id> --worktree try-b # same, in <repo>/.worktrees/try-b on branch try-b
1234
- heyditto fork <session-id> --cloud # teleport the fork and resume it in Ditto Cloud
116
+ [[steps]] # 1-20 steps, run in order
117
+ key = "triage" # ^[a-z0-9_-]{1,40}$, unique
118
+ name = "Triage pending feedback"
119
+ kind = "agentic" # agentic (default) | script (takes script = "...")
120
+ goal_file = "prompts/feedback-triage.md" # OR goal = "..."; exactly one, <= 32 KiB
121
+ model = "claude-sonnet-5-5"
122
+ allowed_tools = ["feedback_triage_pending", "feedback_triage_resolve"]
123
+ auto_approve_tools = ["feedback_triage_resolve"] # must be a subset of allowed_tools
124
+ timeout_seconds = 1500
125
+ max_tool_calls = 150
126
+ max_turns = 30
127
+ # budget_millicents = 50000
1235
128
  ```
1236
129
 
1237
- Claude Code transcripts are copied to a new uuid (session id fields rewritten,
1238
- and the project directory moved when the fork lives in a new worktree); Codex
1239
- rollouts are copied under a new thread id. The original stays untouched; the
1240
- fork is a normal local session (`heyditto sessions`, `--resume <new-id>`).
1241
-
1242
- ## Teleport
130
+ Unknown keys fail. `goal_file` is relative to `.ditto/` and must resolve (symlinks included) inside it; its contents are sent as the step's `goal`. `auto_approve_tools` in the reviewed file is the consent for unattended runs. Credential-named keys and token-shaped text in goals and scripts are refused.
1243
131
 
1244
- Worktrees, clones, package caches and agent traces pile up until a laptop runs
1245
- out of disk. **Teleport** moves a coding project — one repo or a whole folder of
1246
- repos, plus your Claude Code / Codex session — to Ditto Cloud, so you can resume
1247
- it in the cloud or on another machine, and reclaim the local space. It is a
1248
- Hero-tier ($20) feature.
132
+ ### Ditto Review (`review`)
1249
133
 
1250
- A **capsule** is one teleportable root. Each `push` appends an immutable
1251
- **generation**; only content-addressed chunks (≤ 24 MiB, deduplicated) reach
1252
- storage, and unchanged chunks are never re-uploaded, so re-pushing a mostly
1253
- unchanged tree is cheap. Secrets never travel: `.env*`, key files and package
1254
- caches are excluded by construction.
134
+ #### Local pre-PR review (`review local`)
1255
135
 
1256
136
  ```bash
1257
- heyditto teleport # push the current directory as a capsule
1258
- heyditto teleport --cloud --endpoint work # push, then resume in a Ditto Code cloud job
1259
- heyditto teleport push ~/code/project --mirror all
1260
- heyditto teleport pull project ~/code/project --restore-harness --resume
1261
- heyditto teleport list
1262
- heyditto teleport status project # mirror + verification state
1263
- heyditto teleport generations project # every committed generation
1264
- heyditto teleport targets # mirror targets, quota and capsule limit for your plan
137
+ heyditto review local --preview # offline: changedPaths, byte/file counts, digest
138
+ heyditto review local --base origin/main --profile standard --org omniaura --gate --output json
139
+ heyditto review local --staged --profile quick --org omniaura
140
+ heyditto review local-status <run-id> --org omniaura
141
+ heyditto review local-cancel <run-id> --org omniaura
1265
142
  ```
1266
143
 
1267
- Every teleport command accepts `--json` (or `--output json`). `pull --json`
1268
- prints `{cwd, harnessSessionId, harnessKind, …}`, which is what the Ditto Code
1269
- runner reads when it restores a capsule before starting the harness. Capsules
1270
- can be referred to by name or id everywhere. `--endpoint` for `--cloud` takes an
1271
- endpoint id, slug or name; with a single endpoint it is chosen automatically.
144
+ - Snapshots are bounded to 16 MiB decoded source / 4,096 files per tree, post nothing to GitHub, and never mutate git state.
145
+ - Uncertain admissions print a recovery `--request-id <uuid>`; re-running with the identical snapshot/profile/context reuses the original run without double billing.
146
+ - **`recommendation`** (fail-closed):
147
+ - `approve` only on a `completed` run with a well-formed findings list, every changed file covered on every lens, no undecided withheld candidate, a working tree matching the reviewed snapshot, and no blocking finding (`low`/`info`/`nit` do not block; bounded surrounding context is reported in `reasons` and does not block).
148
+ - `changes` when a completed or partial run has a blocking finding.
149
+ - `none` for failed, partial, cancelled, skipped, superseded, timed-out, interrupted, malformed, budget-exhausted, or unverifiable runs (never approval).
150
+ - `--gate` exit codes: `0` approve, `2` changes, `1` no recommendation (`124` timeout, `130`/`143` interrupt).
1272
151
 
1273
- Under the hood a push negotiates which content-addressed chunks the server
1274
- lacks, uploads only those via presigned URLs, then `commit`s the manifest (the
1275
- server answers `201 Created` with the new generation and its mirror state).
1276
- Every branch's upstream (`branchUpstreams`) and the real remote-tracking shas
1277
- (`upstreamTips`) travel in the manifest, so a pull recreates remotes and
1278
- tracking refs without a network fetch and `offload` sees exactly the unpushed
1279
- commits the source machine saw. A push reports what actually moved, e.g.
1280
- `Pushed generation 2: 1.2 KiB uploaded (2.0 MiB logical, 99.9% reused), 3 chunks
1281
- (1 uploaded, 2 reused)`; `--json` adds `uploadedBytes`, `logicalBytes`,
1282
- `reusedBytes` and `savingsRatio`, and `teleport --cloud --json` prints a single
1283
- `{ push, cloudSession }` document. `--cloud` opens
1284
- the thread URL the backend returns for its linked app (falling back to the
1285
- production app link on older backends). `pull --resume` always resumes the
1286
- harness inside the restored tree (add `--dry-run` to see the launch plan), so
1287
- the next prompt lands in the restored transcript even when the original
1288
- directory still exists on the same machine. Restored Claude transcripts are
1289
- filed under Claude Code's own project slug for the destination path (every
1290
- non-alphanumeric character becomes `-`), so `claude --resume` finds them in
1291
- paths with underscores or dots such as `/opt/workspace_base/capsule`. macOS
1292
- AppleDouble `._*` files and `.DS_Store` never enter the worktree archive. Worktrees compressed with `zstd`
1293
- are decompressed by Node itself when the `zstd` binary is missing; on a Node
1294
- without zstd support the pull fails with a message naming the binary to install.
1295
-
1296
- `push` bundles each repo (thin against the previous generation when possible),
1297
- tars the dirty and untracked files, and captures the harness transcript for the
1298
- session that was working there. `pull` reconstructs the repos from their
1299
- bundles, restores branches, upstreams and the dirty worktree, and places the
1300
- harness transcript under the restored path so `--resume` continues the exact
1301
- session.
1302
-
1303
- ## Offload
1304
-
1305
- `offload` pushes the project, waits until the capsule is verified on redundant
1306
- mirrors, then removes the local copy. On macOS, project files move to Trash.
1307
- Recognized, excluded, untracked `node_modules` directories are deleted from
1308
- that Trash copy by default, so dependency bytes actually leave the disk.
1309
- `--keep-dependencies` retains them in Trash. Other caches remain in Trash until
1310
- their cleanup patterns have been confirmed. If the move to Trash fails, offload
1311
- stops without deleting the project. It refuses when a repo holds commits no
1312
- remote has, unless you pass `--allow-unpushed`.
152
+ #### Hosted PR review management
1313
153
 
1314
154
  ```bash
1315
- heyditto offload ~/code/old-project # verify, confirm, delete
1316
- heyditto offload --yes # skip the confirmation
1317
- heyditto offload --keep-dependencies # preserve node_modules in Trash
1318
- ```
1319
-
1320
- Recover any time with `heyditto teleport pull <capsule> <path>`.
1321
- After pulling, reinstall Node dependencies that were removed during offload;
1322
- `node_modules` is not stored in the capsule.
1323
-
1324
- ## Archive
1325
-
1326
- Coding-agent session history and local recovery data only grow, and they
1327
- usually live on one laptop with no backup. `teleport archive` backs them up to
1328
- an archive capsule. It uses no capsule slot and no Teleport quota, and its bytes
1329
- are billed as storage on your plan.
1330
-
1331
- ```sh
1332
- heyditto teleport archive # ~/.claude/projects, ~/.codex/sessions, infinite-disk recovery data
1333
- heyditto teleport archive --source notes=~/notes --name my-archive
1334
- heyditto teleport archive-restore claude-code ./restored # never overwrites
155
+ heyditto review repos --org omniaura
156
+ heyditto review pulls owner/repo --org omniaura
157
+ heyditto review start owner/repo <pr> --org omniaura --watch
158
+ heyditto review runs owner/repo --org omniaura --output json
159
+ heyditto review status|watch|retry|cancel <run-id> --org omniaura
160
+ heyditto review set owner/repo --max-minutes 20 --skip-rules-file rules.json --org omniaura
1335
161
  ```
1336
162
 
1337
- Each source is one tar stream cut into content-defined chunks, with each chunk
1338
- compressed on its own. Re-running uploads only the chunks that changed, so a
1339
- nightly run after appending to a few sessions sends a few megabytes.
1340
-
1341
- ## Storage mirrors
1342
-
1343
- Ditto stores capsules redundantly on its own storage. You can also bring your
1344
- own S3-compatible bucket (AWS S3, Cloudflare R2, Backblaze B2, MinIO, Hippius)
1345
- and mirror capsules to it — to all buckets or a chosen subset.
163
+ ### Tools, Apps, Teleport, Storage & Feedback
1346
164
 
1347
165
  ```bash
1348
- heyditto storage add --name my-r2 --endpoint https://<acct>.r2.cloudflarestorage.com \
1349
- --region auto --bucket ditto-teleport --access-key … --secret-key …
1350
- heyditto storage list
1351
- heyditto storage test my-r2 # name or id
1352
- heyditto storage remove my-r2
1353
- heyditto storage mirror project all # or: heyditto storage mirror project <id>,<id>
166
+ heyditto tools list [server] [--search <q>] | describe <server> <tool> | call <server> <tool> [--arg k=v] [--download <path>]
167
+ heyditto apps list|create|show|update|oidc|icon|origins|secret|consent|endpoints ...
168
+ heyditto teleport push|list|... | offload ... | archive ... | storage list
169
+ heyditto feedback "<concise report>" --title "<title>" [--tool <name> --include-recent-traces]
170
+ heyditto status | config | logout
1354
171
  ```
1355
172
 
1356
- Buckets are managed through the teleport API (`/api/v5/teleport/buckets`), so the
1357
- saved CLI key is all you need. A bucket added with `storage add` is a teleport
1358
- mirror by default; pass `--no-mirror` to keep it out of mirror policies.
173
+ ## Environment Variables
1359
174
 
1360
- `teleport pull` and `teleport --cloud` need a committed generation: a capsule that
1361
- was created but whose push failed reports `has no generations yet`.
175
+ - `DITTO_API_KEY`: static `ditto_mcp_` API key (overrides config file).
176
+ - `DITTO_API_BASE`: API origin (default `https://api.heyditto.ai`).
177
+ - `DITTO_CONFIG_DIR`: config and `updates/` directory (default `~/.config/heyditto/cli`).
178
+ - `DITTO_CLI_AUTO_UPDATE=0` / `DISABLE_AUTOUPDATER=1`: disable background update checks.
179
+ - `DITTO_CLI_PINNED=1`: bypass cached self-updates and run the installed package.
1362
180
 
1363
- ## Bittensor hotkey (gamma)
181
+ ## Development
1364
182
 
1365
- `heyditto gamma …` uses Ditto Router's paid inference with **only a Bittensor
1366
- hotkey** that has spent SN118 gamma. You do not need a Ditto login, an API key or
1367
- a linked account. This is the client side of the Gamma Integration Standard V1.3
1368
- (§4 and §4a). The hotkey is the account. Your first credited `spend_gamma` at
1369
- Ditto's publisher hotkey creates the account and credits it in USD
1370
- (1 gamma = 1 USD). After that, requests signed with `btauth/1` by that hotkey
1371
- are the only credential the API needs. These commands never read or send
1372
- `DITTO_API_KEY` or the saved login.
183
+ Requires Node `22.23.4+` (see `.nvmrc`). Defined in [package.json](package.json) and [Justfile](Justfile):
1373
184
 
1374
185
  ```bash
1375
- # 1. A hotkey (btcli's default wallet file is the shared source; see below).
1376
- btcli wallet new-hotkey --hotkey ditto_pay
1377
-
1378
- # 2. See your hotkey, Ditto's publisher hotkey and the exact btcli commands.
1379
- heyditto gamma info --hotkey ditto_pay
1380
-
1381
- # 3. Mint gamma into the hotkey's deposit, then spend it at Ditto's publisher hotkey.
1382
- btcli gamma mint --netuid 118 --hotkey ditto_pay --amount-tao 0.01
1383
- btcli gamma spend --netuid 118 --service-hotkey <publisher hotkey from gamma info> --amount-gamma 1 -H ditto_pay
1384
-
1385
- # 4. About 10 finalized blocks later, the credit appears and you can use it.
1386
- heyditto gamma balance --hotkey ditto_pay
1387
- heyditto gamma models --hotkey ditto_pay
1388
- heyditto gamma chat "Explain btauth/1 in two sentences" --hotkey ditto_pay
1389
- heyditto gamma memories search "btauth" --hotkey ditto_pay
186
+ npm install
187
+ npm run check # tsc -p tsconfig.json --noEmit (just check)
188
+ npm run build # compile dist/ + build update lock (just build)
189
+ npm test # node --test (just test)
190
+ npm run verify # check + build + test + npm pack --dry-run (just verify)
191
+ just local-status # smoke against http://localhost:3400
1390
192
  ```
1391
193
 
1392
- | Command | What it does |
194
+ | Path | Purpose |
1393
195
  | --- | --- |
1394
- | `gamma info` | Prints the hotkey SS58 and scheme, the publisher hotkey you sign for, the API base, the balance, OpenAPI, pricing and services URLs, and the btcli mint, spend and show commands. It makes no chain calls. |
1395
- | `gamma balance` | Calls `GET <balance>?hotkey=<ss58>` and prints `credited_usd`, `used_usd` and `remaining_usd`. The call is public. `--hotkey` also accepts a bare SS58. |
1396
- | `gamma models` | Sends `GET /v1/models`, signed. |
1397
- | `gamma chat "<prompt>"` | Sends `POST /v1/chat/completions`, signed, and streams by default (`--no-stream` waits for the whole answer). `--model` defaults to the pricing document's `default_model`. Each turn sends `X-Ditto-Session-Id` (default `heyditto-gamma-cli`, or set `--session <id>` / `--new-session`), so all your turns land in one thread of the hotkey account. A streamed answer is cancelled after 15 minutes in total, or after 2 minutes with no data. Change these limits with `--stream-timeout` and `--idle-timeout` (in seconds), or with `DITTO_GAMMA_STREAM_TIMEOUT_MS` and `DITTO_GAMMA_STREAM_IDLE_MS`. |
1398
- | `gamma memories search "<q>"` | Searches the hotkey account's memories through the Router's native MCP surface (`/v1/mcp/ditto`). It runs the full MCP lifecycle: `initialize`, then `notifications/initialized`, then `tools/list` and `tools/call`. It carries any `Mcp-Session-Id` the server assigns and signs every message. If the server does not offer memory search for hotkey accounts yet, the command says so. |
1399
-
1400
- **Which hotkey.** By default the commands read btcli's wallet hotkey file
1401
- `~/.bittensor/wallets/<wallet>/hotkeys/<hotkey>`. Select it with `--wallet`,
1402
- `--hotkey` and `--wallet-path`, or with `BT_WALLET_NAME`, `BT_WALLET_HOTKEY` and
1403
- `BT_WALLET_PATH`. Each defaults to `default`. btcli writes this file
1404
- unencrypted by default (`secretPhrase`, `secretSeed`, `privateKey`, `cryptoType`).
1405
- An encrypted file is refused. Ditto Desktop can use the same btcli hotkey file,
1406
- so the CLI and Desktop share one account. The SS58 that `gamma info` prints is
1407
- the one Desktop should show.
1408
-
1409
- Other key sources:
1410
-
1411
- - `--hotkey-file <path>`: any btcli hotkey file.
1412
- - `DITTO_HOTKEY_MNEMONIC` or `DITTO_HOTKEY_SEED` (0x plus a 32-byte hex seed).
1413
- - `--hotkey-uri //Alice`: dev keys only, because command-line arguments are
1414
- visible to other local processes.
196
+ | `src/` | CLI entry (`entry.ts`, `cli.ts`), command modules (`commands.ts`, `review-commands.ts`, `org-commands.ts`, `app-commands.ts`), `agents/`, `dittoconfig/`, `gamma/`, `relay/`, `remote/` |
197
+ | `test/` | Node test suites (`*.test.mjs`) |
198
+ | `plugins/ditto-remote/` | Remote-control plugin assets (`npm run plugin:build`) |
199
+ | `scripts/` | Build lock, remote plugin build, and Claude router launcher |
200
+ | `docs/` | T3 Code, Claude hooks, channel approvals, and remote input docs |
201
+ | `.depot/workflows/ci.yml` | Depot CI running `npm run verify` on PRs and `main` |
202
+ | `.github/workflows/publish.yml` | `semantic-release` npm OIDC trusted publish on `main` |
1415
203
 
1416
- `--crypto ed25519` selects ed25519 for these three sources. Hotkey files carry
1417
- their own `cryptoType`. Hashed hotkeys are not supported. Secret material is used
1418
- only in memory to sign requests. It is never printed, logged or written to disk.
204
+ ## Agent Guidance
1419
205
 
1420
- **Discovery.** The commands start from the services document named by Ditto's
1421
- SN118 `set_service`:
1422
- `https://api.heyditto.ai/api/v5/chain-gamma/public/services.json`. To check it,
1423
- run `btcli query services --netuid 118`. To use a different document, pass
1424
- `--services <url>` or set `DITTO_GAMMA_SERVICES_URL`. The CLI has no chain RPC
1425
- client, so it does not read the URL from chain itself.
206
+ Read [AGENTS.md](AGENTS.md) and [CLAUDE.md](CLAUDE.md) before opening a PR. Non-negotiable rules:
1426
207
 
1427
- From that document the CLI takes:
1428
-
1429
- - the publisher hotkeys for `--netuid` (default 118);
1430
- - the gamma payment entry, which must say `"signature": "btauth/1"`, and its
1431
- balance URL;
1432
- - the OpenAPI spec, whose `servers` give the API base;
1433
- - the pricing document.
1434
-
1435
- Requests are signed for the first listed publisher. To sign for another, pass
1436
- `--receiver <ss58>` or set `DITTO_GAMMA_RECEIVER`. A receiver that the document
1437
- does not list is refused before anything is signed. Every discovered URL must be
1438
- `https`.
1439
-
1440
- **Trusted origins.** Requests are signed only for `https://heyditto.ai` and its
1441
- `*.heyditto.ai` subdomains. This applies to the API base from the OpenAPI
1442
- `servers` (which covers the paid routes and `/v1/mcp`) and to the balance URL.
1443
- A services document that points anywhere else is refused before anything is
1444
- signed, because a signed request sent to another host could be replayed to Ditto
1445
- within its 10-second window and charged to your balance. To sign for a host
1446
- you run yourself, such as a local test server, pass `--allow-untrusted-origin`
1447
- or set `DITTO_GAMMA_ALLOW_UNTRUSTED_ORIGIN=1`. The CLI then prints a warning
1448
- that names the host.
1449
-
1450
- **Signing.** Each request carries `X-Bittensor-Version: 1`,
1451
- `X-Bittensor-Hotkey`, `X-Bittensor-Receiver`, `X-Bittensor-Nonce` (unix
1452
- nanoseconds), and `X-Bittensor-Signature`. An ed25519 key also sends
1453
- `X-Bittensor-Crypto: ed25519`. The signature covers eight lines: `btauth/1`,
1454
- the scheme, the method, the percent-encoded path and query exactly as sent,
1455
- the sha256 of the body bytes, the nonce, the sender and the receiver. sr25519
1456
- signs with the `substrate` context and ed25519 is plain RFC 8032. Every attempt
1457
- gets a fresh nonce.
1458
-
1459
- **Empty balance.** A paid call from a hotkey with no credit, including one Ditto
1460
- has never seen, gets HTTP 402 `insufficient_balance`. The CLI then prints the
1461
- btcli mint and spend commands for Ditto's publisher hotkey and exits with
1462
- status **3**. Other errors exit with status 1.
1463
-
1464
- ## Environment
1465
-
1466
- - `DITTO_API_KEY` (optional) — MCP API key override. Agents can instead run `heyditto init --json` for no-human setup.
1467
- - `DITTO_API_BASE` (optional) — API base URL. Defaults to `https://api.heyditto.ai`. Useful for local dev (`http://localhost:3400`).
1468
- - `DITTO_SESSION_ID` (optional) — pin an explicit MCP session id for this shell (see `session`).
1469
- - `DITTO_PROFILE` (optional) — endpoint profile for this shell, overriding the active one (see `profile`).
1470
- - `DITTO_HOTKEY_MNEMONIC`, `DITTO_HOTKEY_SEED`, `DITTO_GAMMA_SERVICES_URL`, `DITTO_GAMMA_RECEIVER`, `DITTO_GAMMA_ALLOW_UNTRUSTED_ORIGIN`, `BT_WALLET_NAME`, `BT_WALLET_HOTKEY`, `BT_WALLET_PATH` (optional) — hotkey and discovery settings for `heyditto gamma` (see [Bittensor hotkey (gamma)](#bittensor-hotkey-gamma)).
1471
- - `DITTO_CONFIG_DIR` (optional) — config directory for the saved key, endpoint profiles and session records. Defaults to `$XDG_CONFIG_HOME/heyditto/cli` or `~/.config/heyditto/cli`.
1472
-
1473
- ## Output
1474
-
1475
- Every data command and `status` accepts `--output <format>`, where `<format>` is one of:
1476
-
1477
- - `json` — guaranteed structured JSON (parses the server text block, re-emits pretty-printed JSON).
1478
- - `text` — the server's text block as-is (the default; for data commands this is already JSON).
1479
- - `markdown` — same as `text`; reserved for future markdown rendering.
1480
- - `raw` — the full MCP response envelope as JSON.
1481
-
1482
- ```bash
1483
- heyditto search "X" --output json | jq '.results[] | {id, similarity, preview: .userPreview}'
1484
- heyditto status --output json | jq '.tools'
1485
- ```
1486
-
1487
- ## Related
1488
-
1489
- - **[`@heyditto/mcp`](https://github.com/ditto-assistant/ditto-mcp)** — local stdio MCP bridge with OAuth (different surface; pair with Claude Desktop / Cursor).
1490
- - **[ditto-clawhub](https://github.com/ditto-assistant/ditto-clawhub)** — the ClawHub / OpenClaw skill that ships alongside this CLI.
1491
- - **Web app:** https://app.heyditto.ai
1492
-
1493
- ## Development
1494
-
1495
- ```bash
1496
- just install
1497
- just check # tsc --noEmit
1498
- just build # tsc to dist/
1499
- just verify # check + build + pack --dry-run
1500
- ```
1501
-
1502
- Releases are automated via [semantic-release](https://github.com/semantic-release/semantic-release) on push to `main`. npm provenance is enabled — every published version is signed by the GitHub Actions OIDC identity. Trusted publishing is configured at the npm registry.
208
+ - **Conventional commits & PR titles are mandatory**: `feat:` (minor), `fix:` (patch), `BREAKING CHANGE:` footer (major — do not rely on `feat!:` alone), `docs:`/`chore:`/`refactor:`/`test:`/`ci:` (no release).
209
+ - **Squash merge only**: PR title becomes the squash commit header consumed by `semantic-release`.
210
+ - **Never edit `package.json` `version`, create tags, or commit `dist/`**: `semantic-release` computes versions and rebuilds via `prepack`.
211
+ - **CI preflight**: run `depot ci run --workflow .depot/workflows/ci.yml --job verify` before pushing code changes.
1503
212
 
1504
213
  ## License
1505
214
 
1506
- MIT — see [LICENSE](LICENSE).
1507
-
1508
- ## Repository configuration (`.ditto/`)
1509
-
1510
- `.ditto/` is the versioned, discoverable contract a repository gives Ditto — endpoint
1511
- bindings, Teleport policy, environment and task settings — validated by the same
1512
- schema in the CLI, backend, web and desktop (vendored as `src/dittoconfig/schema.json`).
1513
-
1514
- ```sh
1515
- heyditto repo init # scaffold .ditto/config.toml + .ditto/mise.toml from detected projects
1516
- heyditto repo validate # exit 1 on any problem, naming the file and key
1517
- heyditto repo show # effective document with the layer each table came from
1518
- heyditto teleport plan [path] # what a push would capture, per project, with byte estimates
1519
- heyditto repo apply [--dry-run] # make your Router endpoints match .ditto/endpoints/*.toml
1520
- ```
1521
-
1522
- ### Router profiles
1523
-
1524
- A `.ditto/endpoints/<name>.toml` is a Router profile checked into the repository:
1525
- model, routing, tools, and the Claude Code or Codex system prompt, which is read
1526
- from a file next to it. `repository.default_endpoint` in `.ditto/config.toml`
1527
- names the profile that `heyditto claude` / `codex` use when no `--endpoint` is
1528
- given, from anywhere inside the repository. `--endpoint` always wins;
1529
- `--fallback-endpoint` (what the default T3 provider passes) applies only
1530
- outside such a repository; profile T3 providers pin their endpoint.
1531
-
1532
- ```toml
1533
- # .ditto/endpoints/dev.toml
1534
- managed = true
1535
- name = "dev"
1536
- slug = "ditto-dev" # the endpoint slug within its owner
1537
- model = "openai/gpt-6.1-sol"
1538
- [settings]
1539
- owner = "@omniaura" # or "personal" (the default)
1540
- model_mode = "passthrough"
1541
- code_mode = true
1542
- kind_routes = { aside = "z-ai/glm-5.3-flash" }
1543
- claude_prompt = { file = "../prompts/claude.md", mode = "replace" }
1544
- ```
1545
-
1546
- `owner = "@<org>"` targets that organization's endpoint, so you must be a member
1547
- who can manage it. `owner = "personal"` creates the endpoint in your own account,
1548
- billed to you, so anyone who clones the repository gets the same setup.
1549
- `heyditto repo apply` creates the endpoint when it is missing and otherwise
1550
- changes only the fields that differ. Settings the file does not name, such as a
1551
- tool list curated in the console, are left alone. An unknown setting is an
1552
- error, not a no-op. Edit the prompt by editing its file and running
1553
- `heyditto repo apply`. `heyditto endpoints set <slug> --claude-prompt @file`
1554
- still works for a one-off change, but the next apply returns the endpoint to
1555
- what the repository says.
1556
-
1557
- Settings: `owner`, `claude_prompt` / `codex_prompt` (`file`, `mode`,
1558
- `autoupdate`), `system_prompt`, `model_mode`, `routing_mode`, `billing_mode`,
1559
- `stream_granularity`, `context_compaction`, `result_compression`,
1560
- `speculative_compaction`, `tool_compression`, `code_mode`,
1561
- `precompact_at_tokens`, `max_tool_rounds`, `memory_depth`, `recall`, `record`,
1562
- `record_trace`, `record_attachments`, `trace_retention_days`, `batch`,
1563
- `batch_max_requests`, `tools`, `tool_approval_mode`, `auto_approve_tools`,
1564
- `tool_deny`, `claude_native_tool_blocks`, `required_connections`, `kind_routes`, `model_routes`,
1565
- `subagent_routes`, `aliases`, `failover`.
1566
-
1567
- Failover is off unless explicitly enabled. For example, a repository profile can
1568
- set `failover = { enabled = true, model = "openai/gpt-5.6-luna", max_cost_usd = 0.25 }`.
1569
- The equivalent command is `heyditto endpoints set <slug> --failover on
1570
- --failover-model openai/gpt-5.6-luna --failover-max-cost 0.25 --yes`.
1571
- It uses only the endpoint's permitted provider keys and billing mode. Switching
1572
- may refill the prompt cache, so the Router checks a conservative cold-cache quote
1573
- before sending the request. Missing pricing, an unbounded cost, or a quote above
1574
- the cap stops fallback. The chosen provider and model stay pinned for normal
1575
- turns and compaction, across backend restarts, until a new session (or seven days
1576
- of inactivity). The cap applies to each request on the fallback, not the session
1577
- total. Endpoint/key spend limits still apply separately. A session identifier is
1578
- required for fallback; Claude Code and Codex supply one automatically.
1579
-
1580
- `tool_deny` lists router tools the endpoint never runs, whatever a client asks:
1581
- tool names, globs such as `"gmail__send_*"`, or a class (`"class:gated"`,
1582
- `"class:write"`). Denied tools are hidden from the model, and a call to one is
1583
- refused. On an organization endpoint, changing it needs endpoint policy
1584
- authority.
1585
-
1586
- `claude_native_tool_blocks = true` writes each router tool call and its result
1587
- into Claude Code's own transcript (`server_tool_use` / `mcp_tool_result`), so
1588
- the router rebuilds earlier turns from the transcript instead of its memory, and
1589
- a deploy no longer loses them. Claude Code does not draw these blocks in its live
1590
- view; they appear in the session file and in tools that read it.
1591
-
1592
- Layers: workspace `.ditto/` (a parent folder of many repos) < repository `.ditto/` <
1593
- ignored `.ditto/local.toml` < flags. Secrets are never literals: use `secret://`
1594
- references. Paths are repository-relative and cannot escape it.
1595
-
1596
- `teleport plan` discovers repositories, worktrees and nested projects under a folder
1597
- (the folder itself need not be a repository), detects project types from a catalog
1598
- adapted from [Kondo](https://github.com/tbillington/kondo) (MIT; detection and exclusion
1599
- knowledge only, never its cleanup), and applies regenerable-artifact exclusions per
1600
- project and path: a directory named `build` is only excluded under a project whose type
1601
- says so. Tracked artifact directories are flagged rather than claimed excluded.
1602
- `heyditto offload` refuses to delete a folder when unrelated files, unknown projects or
1603
- escaping symlinks beneath it would be lost.
1604
-
1605
- ### Ditto Review updates (`[review]`)
1606
-
1607
- By default Ditto Review keeps a progress comment on the pull request, edits it
1608
- as the review runs, and posts each finding as soon as it is verified. Every one
1609
- of those writes reaches anything watching the repository, such as a coding agent
1610
- subscribed to pull request events. To have the review write only once, when it
1611
- is published, set:
1612
-
1613
- ```toml
1614
- # .ditto/config.toml
1615
- version = 1
1616
- [review]
1617
- updates = "final_only" # default: "live"
1618
- ```
1619
-
1620
- With `final_only` there is no progress comment, no edits to it, and no streamed
1621
- findings: the final review carries every finding. A run that ends without a
1622
- review (it failed, or the repository's allowance ran out) still leaves one
1623
- comment saying so.
1624
-
1625
- Ditto Review reads this from the repository's **default branch**, so a pull
1626
- request cannot change how its own review reports; the setting takes effect once
1627
- it is merged. If the file is missing or unreadable, the review uses `live`.
1628
- `heyditto repo validate` checks the value; the table is read by the Ditto
1629
- backend and is not part of the effective config `heyditto repo show` prints.
1630
-
1631
- ### Claude Code hooks (`claude_hooks`)
1632
-
1633
- A profile can attach Ditto's own Claude Code hooks to `heyditto claude`
1634
- sessions in this repository. They apply in every inference mode (Router,
1635
- `--cliproxy`, `--mcp-only`):
1636
-
1637
- ```toml
1638
- # .ditto/endpoints/dev.toml
1639
- [settings]
1640
- claude_hooks = { stop = { checks = ["unpushed"], repos = [".", "workspaces/*/*"] } }
1641
- ```
1642
-
1643
- `stop.checks = ["unpushed"]` is the only hook so far. When Claude finishes a
1644
- turn while a listed repository has uncommitted changes, or commits its remote
1645
- does not have, the hook asks Claude once to push them or to say why they are
1646
- left. `repos` are paths relative to this repository; `*` matches one directory
1647
- name; the default is `["."]`. Remote problems that cannot be confirmed (no
1648
- remote, offline) are not reported.
1649
-
1650
- The setting is read from the checked-in file at launch and is not sent to the
1651
- endpoint by `repo apply`, so a launch outside this repository, or with another
1652
- endpoint, gets none. `--no-hooks` turns them off for one launch. A session with
1653
- hooks is no longer plain Claude Code, so the banner lists them
1654
- (`hooks=Stop (unpushed) (.ditto/endpoints/dev.toml)`). Hooks do not give the
1655
- Router control of inference in CLIProxy or native mode. See
1656
- [docs/claude-hooks.md](docs/claude-hooks.md) for the survey of hook events and
1657
- what comes next.
1658
-
1659
- ### Cloud-assisted CLIProxy inference
1660
-
1661
- To use subscription inference with Router optimizations, cloud session recording
1662
- and remote control, connect a local CLIProxy through an outbound relay. Use a
1663
- dedicated **personal** endpoint and a model exposed by your local proxy:
1664
-
1665
- ```sh
1666
- heyditto endpoints create my-local-models
1667
- heyditto cliproxy relay --endpoint my-local-models --enable --model gpt-6.1-sol
1668
- # In another terminal, while the relay stays running:
1669
- heyditto claude --endpoint my-local-models
1670
- ```
1671
-
1672
- The first `--enable` changes that endpoint to relay-only BYOK inference, enables
1673
- cloud trace recording and selects Router inference instead of a native-account
1674
- default. Later relay starts omit `--enable`. The CLI keeps an outbound
1675
- authenticated connection; your local proxy access key and provider credentials
1676
- stay on your computer. Stopping the relay makes requests fail without switching
1677
- to paid inference. Existing Router optimization/tool resource costs still apply.
1678
-
1679
- The first release supports one relay per personal endpoint and requires the API
1680
- and inference request to reach the same backend process. Organization endpoints
1681
- and routing across multiple backend processes are not supported yet. The local
1682
- model IDs must match the endpoint's routes/aliases; the cloud model list does not
1683
- discover laptop providers. Deploy the matching backend before enabling an endpoint.
1684
-
1685
- For the official T3 Code app, preview a dedicated provider with
1686
- `heyditto t3 setup --inference cliproxy --dry-run`, then quit T3 and rerun
1687
- without `--dry-run`. Without `--endpoint`, setup uses your saved default, your
1688
- only endpoint, or a picker, and offers to create a first endpoint. With
1689
- `--profile <name>` it uses that profile's endpoint and adds a separate provider
1690
- for it (`subnet` → **Claude Subnet**), next to the existing one. This keeps inference on local CLIProxy and
1691
- auto-connects the endpoint's MCP tools. Use `--inference router` for Ditto
1692
- Router inference. See [the T3 setup guide](docs/t3-code.md) for paths, backups,
1693
- limitations, and manual configuration.
1694
-
1695
- ### Direct local CLIProxy inference
1696
-
1697
- Use a locally installed CLIProxy with Claude Code or Codex instead of Ditto Router
1698
- inference:
1699
-
1700
- ```sh
1701
- heyditto claude --cliproxy --endpoint my-tools
1702
- heyditto codex --cliproxy --endpoint my-tools --model gpt-6-luna
1703
- heyditto claude --cliproxy http://127.0.0.1:8317/v1 --dry-run --endpoint my-tools
1704
- ```
1705
-
1706
- `--cliproxy` detects EasyCLIProxyAPI's saved host, port and API access key. It
1707
- reads the GUI configuration from the platform's `com.cpa.gui` application-data
1708
- directory. Set `CLIPROXY_CONFIG` for another EasyCLIProxyAPI TOML file, or use
1709
- `CLIPROXY_BASE_URL` and `CLIPROXY_API_KEY` for a standalone CLIProxy installation.
1710
- The URL must be loopback (`127.0.0.1`, `localhost` or `::1`); discovery does not
1711
- accept LAN/public hosts, URL credentials or redirects. An API key is never
1712
- copied between two different proxy addresses automatically.
1713
-
1714
- Before launching, the CLI authenticates `/v1/models` and selects a Claude/GPT
1715
- model exposed by the proxy, or checks your explicit `--model`. Local failure
1716
- stops the launch without switching to paid Router inference. `--dry-run` checks
1717
- the proxy and prints a plan with credentials masked; it mints no Ditto key.
1718
- Resume remembers the proxy URL and reads its credential again, so `--resume`
1719
- keeps local inference. Use `--no-cliproxy` to return to the normal inference mode.
1720
-
1721
- This mode still uses a Ditto login and endpoint for selected Claude MCP tools
1722
- and remote control. The local API access key stays local; Ditto MCP uses a
1723
- separate temporary endpoint key, which is revoked on exit. `--no-mcp` omits the
1724
- selected Claude MCP tools; `--no-remote-control` omits cloud session registration.
1725
- Those flags do not remove the current launcher's Ditto login/endpoint dependency.
1726
- Local inference bypasses Router compression, routing and inference recording;
1727
- cloud-assisted relay is a separate mode. Cloud MCP calls and remote-control
1728
- activity still reach Ditto when enabled. `--mcp-only` keeps using the native
1729
- Claude account instead; it cannot be combined with `--cliproxy`. `--budget`
1730
- cannot cap subscription inference and is rejected in direct CLIProxy mode.
1731
-
1732
- ### Native Claude inference and remote delivery
1733
-
1734
- `heyditto claude` keeps using Ditto Router for inference. `--mcp` changes
1735
- how tools are attached; it does not change the inference provider.
1736
-
1737
- Use your native Claude Code account while attaching only the endpoint's selected
1738
- MCP tools:
1739
-
1740
- ```sh
1741
- claude auth login
1742
- heyditto claude --mcp-only --endpoint my-tools
1743
- ```
1744
-
1745
- The CLI terminal bridge remains the default remote transport. The launch prints
1746
- a direct Ditto chat link, and live launches are listed by harness in the app's
1747
- Apps view, with Router or MCP-only labels and device presence. MCP-only launches
1748
- are saved under Claude Code in Main Memory; the endpoint supplies tools with its
1749
- existing deny rules and approvals. The endpoint credential is never used for
1750
- native model inference. Missing MCP configuration fails without switching to
1751
- Router inference.
1752
-
1753
- For Claude Code's Channels research preview:
1754
-
1755
- ```sh
1756
- heyditto claude --mcp-only --endpoint my-tools --remote-transport channels
1757
- ```
1758
-
1759
- This attaches a launch-scoped local stdio MCP server declaring `claude/channel`
1760
- and explicitly selects it using Claude's development-channel flag. Claude shows
1761
- its own opt-in prompt; organization policy must also permit Channels. A regular
1762
- MCP tools connection alone does not enable inbound prompts. Keep a supported,
1763
- current Claude Code version and native account signed in.
1764
-
1765
- The adapter pushes `notifications/claude/channel` with a turn ID. A transport
1766
- write is not a model receipt: the session stays awaiting receipt until Claude
1767
- calls `acknowledge`, and finishes only after `reply`. The reply is shown in the
1768
- remote composer. Native local conversation history remains in Claude Code;
1769
- this mode does not proxy model requests or mirror its entire transcript.
1770
-
1771
- Channels supports prompt text and attachments. Use the CLI transport for slash
1772
- commands, remote permission answers, interruption and Teleport checkpoints;
1773
- Channels cannot perform those terminal operations. Senders authenticate through
1774
- the same owned-session host bridge as CLI remote control. Redelivery of a turn
1775
- ID does not inject a second prompt.
1776
-
1777
- Claude Code launch defaults can be saved on an endpoint in the developer console
1778
- or in a repository endpoint profile:
1779
-
1780
- ```toml
1781
- [settings]
1782
- claude_inference = "native" # native Claude account; "router" uses Ditto Router
1783
- claude_remote_transport = "channels" # "cli" uses the terminal bridge
1784
- ```
1785
-
1786
- `heyditto claude` reads the repository's default endpoint profile; `--endpoint`
1787
- selects the cloud profile directly. Repository launch settings override cloud
1788
- settings without requiring `repo apply`; `repo apply` also saves them to the
1789
- cloud. Explicit `--mcp-only`, `--no-mcp-only`, and `--remote-transport` flags
1790
- win for one launch. Resuming retains the previous session's choices. Channels
1791
- requires interactive native Claude Code, an eligible signed-in account and an
1792
- organization that allows Channels. The CLI attaches `ditto-remote` and adds the
1793
- development channel flag in one launch; Claude's experimental-channel
1794
- confirmation still appears. Router inference defaults to the CLI bridge.
1795
-
1796
- Channel distribution and approval: [Claude Code channel approval plan](docs/claude-channel-approval.md).
1797
-
1798
- ### Organization member access
1799
-
1800
- Use explicit organization scope when inspecting or changing access:
1801
-
1802
- ```sh
1803
- heyditto orgs members --org your-team --output json
1804
- heyditto orgs allowance @teammate --org your-team --output json
1805
- heyditto orgs set-role @teammate member --org your-team --expected-role viewer --dry-run
1806
- heyditto orgs set-role @teammate member --org your-team --expected-role viewer
1807
- ```
1808
-
1809
- `allowance` reads your own allowance when the member is omitted. Current org managers can inspect another member by exact id, email or handle. It uses Ditto MCP, exposes no company balance or purchase history, and changes no budget. MCP refusals exit with an error.
1810
-
1811
- `set-role` resolves exactly one member, sends only the role, and reports the previous role. `--expected-role` is a client preflight, not an atomic compare-and-set. Owner/admin authorization and last-owner/last-manager protections are enforced by the backend. Reverting a role uses the same command with the reported previous role and current authorization. Directory listing is capped at 2000 rows and reports possible truncation. Role changes refuse a directory at that cap, since an exact name lookup cannot be guaranteed complete. These commands need a full account CLI key and a backend that admits the member routes; narrowed space/tool/thread keys are refused.
1812
-
1813
-
1814
- Stop also covers a steering command that races its server enqueue. Unknown
1815
- cancellation IDs are retained for 5 minutes (at most 256 entries) in the current
1816
- CLI session and cancel only the matching later steer. They do not cancel normal
1817
- queued prompts or interrupt unrelated current turns. Repeated exact Stop frames
1818
- send one physical interrupt. This intent does not survive a fresh CLI process;
1819
- steering is not automatically replayed offline.
1820
-
1821
- ### SDK MCP configuration
1822
-
1823
- `heyditto mcp-config --session <id>` emits HTTP MCP server JSON for a trusted
1824
- SDK host. Pass `--format antigravity` when targeting Antigravity (`agy`), which
1825
- reads `serverUrl` and `disabled` instead of `type` and `url` and requires
1826
- concrete bearer headers. It selects the repository's `.ditto/` default endpoint, including its
1827
- Backroom tools, before the personal default; `--endpoint` overrides both.
1828
- It requires an existing CLI login and never opens an interactive picker.
1829
- The JSON contains an endpoint key that expires in one hour: pipe it directly
1830
- to the host, never save it in a project or include it in logs. Refresh before
1831
- subsequent turns; a single turn longer than an hour may need to be restarted.
1832
- Each export creates a fresh expiring key. Failed catalog exports revoke it.
1833
-
1834
- With a T3 build that supports the Cursor SDK configuration hook, set this in
1835
- **the T3 server environment**, then restart that service and create a new
1836
- Cursor thread:
1837
-
1838
- ```sh
1839
- T3CODE_CURSOR_MCP_CONFIG_COMMAND='["heyditto","mcp-config"]'
1840
- ```
1841
-
1842
- T3 supplies `T3CODE_THREAD_ID` and runs the command in the thread's directory.
1843
- This hook does not invoke `heyditto cursor` or change Cursor's user settings.
215
+ [MIT](LICENSE)