@aliyunrds/ctxdb 1.0.7 → 1.0.8-beta.1

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.
@@ -0,0 +1,59 @@
1
+ # @ali/ctxdb-internal
2
+
3
+ ContextDB 集团内部版 CLI。它通过浏览器或 Device Code 登录选择 Workspace,自动
4
+ 取得当前 Member 的连接凭据,并为 Qoder、QoderWork、QwenWork、Codex、Claude
5
+ Code、OpenCode 和 Hermes 配置 hooks、skills 或插件。
6
+
7
+ ## 安装
8
+
9
+ 推荐使用 ContextDB Web 提供的安装命令。手动安装时执行:
10
+
11
+ ```sh
12
+ npm install -g @ali/ctxdb-internal@latest \
13
+ --registry https://registry.anpm.alibaba-inc.com
14
+ ```
15
+
16
+ ## 登录与配置 Agent
17
+
18
+ 有浏览器的本机终端:
19
+
20
+ ```sh
21
+ ctxdb login --server https://contextdb.alibaba-inc.com --agent codex
22
+ ```
23
+
24
+ SSH、远程或无头终端:
25
+
26
+ ```sh
27
+ ctxdb login --server https://contextdb.alibaba-inc.com \
28
+ --agent codex --device-code
29
+ ```
30
+
31
+ 登录成功后检查当前连接:
32
+
33
+ ```sh
34
+ ctxdb auth status --json
35
+ ```
36
+
37
+ 一个本地安装只保留一条当前连接,一个 API Key 只属于一个 Workspace。切换
38
+ Workspace 时重新执行 `ctxdb login`;新连接完成后会原子替换本地凭据,并尝试
39
+ 吊销由上一次 CLI 登录签发的 Key。
40
+
41
+ ## 本地文件
42
+
43
+ - `~/.ctxdb/credentials.json`:当前连接凭据,仅当前用户可读;
44
+ - `~/.ctxdb/ctxdb.json`:Agent 行为配置,不写入 API Key;
45
+ - `~/.ctxdb/logs/`:运行日志与 recall trace,不记录 API Key。
46
+
47
+ 不要把 `credentials.json`、API Key、授权码或登录回调 URL 复制到聊天、日志或代码
48
+ 仓库。内部版不接受 `ctxdb setup --api-key` 或 `ctxdb setup --base-url`;凭据和
49
+ DATA API 地址均由登录服务提供。
50
+
51
+ ## 退出与升级
52
+
53
+ ```sh
54
+ ctxdb logout
55
+ ctxdb update
56
+ ```
57
+
58
+ `logout` 会吊销当前 CLI 签发的 Key 并删除本地凭据。`update` 会从 Ali NPM 检查
59
+ 并安装 `@ali/ctxdb-internal` 的新版本,然后刷新 Agent 集成。
package/README.md CHANGED
@@ -11,11 +11,55 @@ Unified access layer for RDS ContextDatabase. One `ctxdb` CLI (memory + KB ops),
11
11
  | **claude** | ✅ UserPromptSubmit + Stop + SessionStart | `~/.claude/skills/ctxdb/` | hooks-driven (auto capture/recall) |
12
12
  | **opencode** | Plugin shim (`~/.config/opencode/plugins/ctxdb.ts`) | `~/.config/opencode/skills/` | in-process plugin (auto capture/recall + KB catalog injection) |
13
13
  | **hermes** | ✅ `pre_llm_call` + `post_llm_call` | `~/.hermes/skills/` | shell hooks (auto capture/recall + first-turn warmup) |
14
+ | **workbuddy** | ✅ UserPromptSubmit + Stop + SessionStart | `~/.workbuddy/skills/ctxdb/` | hooks-driven (auto capture/recall); Claude-Code-isomorphic (exec form) |
14
15
 
15
- Config and logs live under `~/.ctxdb/`. `~/.ctxdb/ctxdb.json` is one file, but runtime config is isolated per agent under `agents.qoder`, `agents.qoderwork`, `agents.qwenwork`, `agents.codex`, `agents.claude`, `agents.opencode`, and `agents.hermes`. (Pre-2026-05-23 installs used `~/.ctxdb.json` at the home root; running `ctxdb setup --agent <name>` migrates the file into the selected agent section.)
16
+ Config and logs live under `~/.ctxdb/`. `~/.ctxdb/ctxdb.json` is one file, but runtime config is isolated per agent under `agents.qoder`, `agents.qoderwork`, `agents.qwenwork`, `agents.codex`, `agents.claude`, `agents.opencode`, `agents.hermes`, and `agents.workbuddy`. (Pre-2026-05-23 installs used `~/.ctxdb.json` at the home root; running `ctxdb setup --agent <name>` migrates the file into the selected agent section.)
16
17
 
17
18
  ## Install
18
19
 
20
+ ### Internal browser-login distribution
21
+
22
+ The same source also builds `@ali/ctxdb-internal`. That artifact alone
23
+ adds `ctxdb login --server <url>`, `ctxdb login --device-code`, `ctxdb logout`,
24
+ and `ctxdb auth status`. The default login uses a browser loopback callback;
25
+ `--device-code` supports remote or headless terminals. Both methods discover a
26
+ provider-neutral protocol and use PKCE. The selected Workspace is represented
27
+ by the returned API key, so the CLI does not persist a separate Workspace id.
28
+
29
+ Internal login stores its single active connection in owner-only
30
+ `~/.ctxdb/credentials.json`. It then runs the normal Agent setup lifecycle
31
+ without writing an `api_key` field into the Agent or default profile; an
32
+ existing field in either updated profile is removed. At runtime this managed
33
+ credential overrides the API key and DATA URL in the existing v2
34
+ `~/.ctxdb/ctxdb.json`; `CTXDB_API_KEY` and `CTXDB_BASE_URL` remain the highest
35
+ priority overrides. Re-login replaces the active connection and revokes the
36
+ previous key after setup succeeds. The public `@aliyunrds/ctxdb` build does not
37
+ contain or advertise these commands and continues to use `ctxdb setup` and the
38
+ v2 config exactly as before. Build the internal staging package with
39
+ `pnpm build:internal`.
40
+
41
+ The distinction is a compile-time distribution manifest, not a runtime
42
+ environment-variable or file-existence check. The `public` manifest disables
43
+ `interactiveLogin` and `managedCredentials`; the `internal` manifest enables
44
+ both. The CLI hooks and the separately bundled OpenCode plugin receive the
45
+ same manifest, so installing a public build on a machine that happens to have
46
+ `~/.ctxdb/credentials.json` does not make that build consume the file.
47
+
48
+ Internal users install the package from Ali NPM. The internal version is
49
+ managed independently in `internal-release.json`; it does not inherit the
50
+ public package version.
51
+
52
+ ```sh
53
+ npm install -g @ali/ctxdb-internal@latest \
54
+ --registry https://registry.anpm.alibaba-inc.com
55
+ ctxdb login --server https://contextdb.alibaba-inc.com --agent codex
56
+ ctxdb auth status --json
57
+ ```
58
+
59
+ The internal tarball bundles `@aliyunrds/ctxdb-shared`, so users install only
60
+ one ContextDB package. `semver` and `yaml` remain normal registry dependencies.
61
+ Maintainers should follow [`INTERNAL_PUBLISH.md`](./INTERNAL_PUBLISH.md).
62
+
19
63
  ### Recommended: console-generated installer command
20
64
 
21
65
  The customer console supplies the selected Agent and API key to one of two
@@ -110,6 +154,8 @@ ctxdb setup --agent qwenwork --api-key ctxdb-...
110
154
  ctxdb setup --agent codex --api-key ctxdb-...
111
155
  # Claude Code (hooks + skill)
112
156
  ctxdb setup --agent claude --api-key ctxdb-...
157
+ # WorkBuddy (Claude-Code-isomorphic hooks + skill)
158
+ ctxdb setup --agent workbuddy --api-key ctxdb-...
113
159
  # OpenCode (plugin shim + skill)
114
160
  ctxdb setup --agent opencode --api-key ctxdb-...
115
161
  # Hermes (pre_llm_call recall/warmup + post_llm_call capture + skill; macOS/Linux)
@@ -164,9 +210,9 @@ ctxdb setup --agent codex --api-key 'ctxdb-new-...'
164
210
  ctxdb status --agent codex --json
165
211
  ```
166
212
 
167
- Setup first checks that the target agent home exists (`~/.qoder`, `~/.qoderwork`, `~/.qwenwork`, `~/.codex`, or `~/.claude`; the declared CN variant home also satisfies this check). Setup writes hooks and skills only into homes that already exist, so a CN-only install does not create the international product home, and vice versa. If no home exists, install or start that agent once before running `ctxdb setup --agent <name>`. OpenCode and Hermes are config-dir style: setup creates `~/.config/opencode` / `~/.hermes` when they are missing.
213
+ Setup first checks that the target agent home exists (`~/.qoder`, `~/.qoderwork`, `~/.qwenwork`, `~/.codex`, `~/.claude`, or `~/.workbuddy`; the declared CN variant home also satisfies this check). Setup writes hooks and skills only into homes that already exist, so a CN-only install does not create the international product home, and vice versa. If no home exists, install or start that agent once before running `ctxdb setup --agent <name>`. OpenCode and Hermes are config-dir style: setup creates `~/.config/opencode` / `~/.hermes` when they are missing.
168
214
 
169
- For **qoder**, **qoderwork**, **qwenwork**, **codex**, and **claude**, restart the harness (CLI: just exit + restart; app: Cmd+R or quit/relaunch) so it picks up the new hooks/skill. For **codex**, setup also writes `[features].hooks = true` into `~/.codex/config.toml` (creating the file if missing) — Codex won't fire any hook entries without it. On first use Codex may prompt you to trust the new hook commands. For **opencode**, restart OpenCode so it loads `~/.config/opencode/plugins/ctxdb.ts`. For **hermes**, setup also checks `~/.hermes/shell-hooks-allowlist.json`; it reports setup as incomplete until both ctxdb hook commands are approved.
215
+ For **qoder**, **qoderwork**, **qwenwork**, **codex**, **claude**, and **workbuddy**, restart the harness (CLI: just exit + restart; app: Cmd+R or quit/relaunch) so it picks up the new hooks/skill. For **codex**, setup also writes `[features].hooks = true` into `~/.codex/config.toml` (creating the file if missing) — Codex won't fire any hook entries without it. On first use Codex may prompt you to trust the new hook commands. For **opencode**, restart OpenCode so it loads `~/.config/opencode/plugins/ctxdb.ts`. For **hermes**, setup also checks `~/.hermes/shell-hooks-allowlist.json`; it reports setup as incomplete until both ctxdb hook commands are approved.
170
216
 
171
217
  Hermes owns this security allowlist, so ctxdb only checks it and never writes approvals. Approve the ctxdb `pre_llm_call` and `post_llm_call` hooks with:
172
218
 
@@ -211,7 +257,7 @@ ctxdb setup
211
257
 
212
258
  ## What it does
213
259
 
214
- For **qoder**, **qoderwork**, **qwenwork**, **codex**, and **claude**, hooks fire automatically:
260
+ For **qoder**, **qoderwork**, **qwenwork**, **codex**, **claude**, and **workbuddy**, hooks fire automatically:
215
261
 
216
262
  | Trigger | Hook | What runs |
217
263
  |---|---|---|
@@ -219,7 +265,7 @@ For **qoder**, **qoderwork**, **qwenwork**, **codex**, and **claude**, hooks fir
219
265
  | User submits a prompt | `UserPromptSubmit` | Search `/v3/memories/search/`, format a `<recalled-memories>` block, inject as additional context. **By default only memory is recalled.** Set `recall_knowledge: true` in the selected agent config to also pull KB context into an `<external-knowledge>` block; graph synthesis and document evidence are labeled separately inside that wrapper. Otherwise the recommended path for KB is the agent calling `ctxdb kb search --agent <name>` explicitly when the user asks (see SKILL.md) |
220
266
  | Agent finishes its turn | `Stop` | Read transcript, detect KB create/update turns and skip capture (so document content doesn't bleed into long-term memory), slice the current turn, sanitize the input, POST to memory store |
221
267
 
222
- Implementation note: qoder/Claude consume the JSON `hookSpecificOutput.additionalContext` shape; Codex has been verified on this machine through `~/.codex/hooks.json`, `[features].hooks = true`, and hook audit logs, where non-empty stdout from `UserPromptSubmit`/`SessionStart` is treated as injected context. The same hook core is shared; setup passes `--agent=<name>` so each hook reads its own config section.
268
+ Implementation note: qoder/Claude/WorkBuddy consume the JSON `hookSpecificOutput.additionalContext` shape; Codex has been verified on this machine through `~/.codex/hooks.json`, `[features].hooks = true`, and hook audit logs, where non-empty stdout from `UserPromptSubmit`/`SessionStart` is treated as injected context. The same hook core is shared; setup passes `--agent=<name>` so each hook reads its own config section.
223
269
 
224
270
  For **opencode**, `ctxdb setup --agent opencode` copies the self-contained plugin bundle to `~/.config/opencode/plugins/ctxdb-bundle.js` and writes a re-export shim at `~/.config/opencode/plugins/ctxdb.ts` referencing it via the relative path `./ctxdb-bundle.js` (Bun on Windows can't resolve absolute-path specifiers from a .ts shim). `ctxdb upgrade --agent opencode` re-copies the bundle + refreshes the shim.
225
271
 
@@ -234,8 +280,9 @@ For **hermes**, `ctxdb setup --agent hermes` writes two shell hooks under `~/.he
234
280
  `ctxdb` ships grouped non-interactive commands:
235
281
 
236
282
  - **Top-level**: `setup` / `status` / `ping` / `debug` / `uninstall` / `update` (`upgrade` alias)
237
- - **Memory**: `memory add|search|list|get|update|delete`
238
- - **KB**: `kb upload-text|upload-file|update-text|update-file|list|documents-list|document-get|search`
283
+ - **Memory**: `memory add|search|list|get|update|delete`, plus the `memory promotion` subgroup (记忆成文): `memory promotion generate|list|get|approve|reject|batch-action|batch-delete|resolve-doubts` and the `memory promotion template list|create|get|update|delete|set-default|clear-default` / `memory promotion settings get|update` sub-subgroups
284
+ - **KB**: `kb upload-text|upload-file|update-text|update-file|list|documents-list|document-get|search`, plus the `kb review` subgroup: `kb review list|get|action|resolve-conflicts|batch-action|batch-delete|delete`, `kb review template list|create|update|delete|get|set-default|clear-default`, `kb review settings get|update`
285
+
239
286
 
240
287
  See `ctxdb --help`.
241
288
 
@@ -267,7 +314,7 @@ restores it. `ctxdb status` reports `debug` (effective), `debug_configured`,
267
314
  `debug_forced`, and `debug_reason` (`non_production_base_url` when forced).
268
315
 
269
316
  Effective debug writes full-fidelity recall records for qoder, qoderwork,
270
- qwenwork, codex, claude, opencode, and hermes to
317
+ qwenwork, codex, claude, opencode, hermes, and workbuddy to
271
318
  `~/.ctxdb/logs/recall-trace.jsonl`. The trace contains the complete query,
272
319
  complete returned memory/KB candidates, local selected/excluded outcome, and
273
320
  the exact context injected into the model. **This can contain sensitive project
@@ -286,13 +333,68 @@ not be interpreted as a completed `timeout`. Disabling debug stops future
286
333
  writes but leaves existing trace files available for replay; `ctxdb uninstall
287
334
  --purge-logs` removes them.
288
335
 
289
- `setup` without `--agent` writes `agents.default` in `~/.ctxdb/ctxdb.json` (CLI-only, no hooks or skills); with `--agent <qoder|qoderwork|qwenwork|codex|claude|opencode|hermes>` it writes agent config and installs hooks/plugins + skills for that harness. Rerunning it repairs integration artifacts and may replace the selected Agent's API key. Memory and KB commands also accept `--agent <name>` so agents use their own config section; when omitted, `CTXDB_AGENT` env wins, otherwise `agents.default` is used. `uninstall` without `--agent` loops every supported agent; with `--agent <name>` it targets just that one. `teardown` is an alias for `uninstall`.
336
+ `setup` without `--agent` writes `agents.default` in `~/.ctxdb/ctxdb.json` (CLI-only, no hooks or skills); with `--agent <qoder|qoderwork|qwenwork|codex|claude|opencode|hermes|workbuddy>` it writes agent config and installs hooks/plugins + skills for that harness. Rerunning it repairs integration artifacts and may replace the selected Agent's API key. Memory and KB commands also accept `--agent <name>` so agents use their own config section; when omitted, `CTXDB_AGENT` env wins, otherwise `agents.default` is used. `uninstall` without `--agent` loops every supported agent; with `--agent <name>` it targets just that one. `teardown` is an alias for `uninstall`.
290
337
 
291
338
  `memory add … --no-infer` stores the text verbatim (skips server-side LLM
292
339
  fact-extraction). Use it when the user explicitly asks for a verbatim
293
340
  memory ("记住 / 请记忆 / 原文记下"); without `--no-infer` the server may
294
341
  rewrite, merge, or skip details.
295
342
 
343
+ ### Memory promotion (记忆成文)
344
+
345
+ The promotion commands live under the Memory group (`ctxdb memory promotion ...`) and cover the server's memory promotion pipeline: turn
346
+ accumulated memories into reviewed knowledge-base documents.
347
+
348
+ ```sh
349
+ # Task lifecycle
350
+ ctxdb memory promotion generate "<topic>" [--knowledge-base-id=<kb-id>]
351
+ ctxdb memory promotion list [--status=pending_review] [--page=N] [--page-size=N] \
352
+ [--sort-by=quality_score] [--sort-order=asc|desc]
353
+ ctxdb memory promotion get <promotion-id>
354
+ ctxdb memory promotion approve --promotion-id=<id> --knowledge-base-id=<kb-id>
355
+ ctxdb memory promotion reject --promotion-id=<id> [--reason=<text>]
356
+ ctxdb memory promotion batch-action --action=<approve|reject> --ids=<id1,id2,...> \
357
+ [--knowledge-base-id=<kb-id>] [--reason=<text>]
358
+ ctxdb memory promotion batch-delete --ids=<id1,id2,...> # rejected tasks only
359
+ ctxdb memory promotion resolve-doubts --promotion-id=<id> \
360
+ --resolutions-json='[{"index":0,"choice":"<label>","comment":"..."}]' \
361
+ [--title=<title>] [--content=<markdown>]
362
+
363
+ # Document templates (up to 5 per member)
364
+ ctxdb memory promotion template list
365
+ ctxdb memory promotion template create --name=<name> \
366
+ --sections-json='[{"title":"...","guidance":"...","level":1}]' [--is-default]
367
+ ctxdb memory promotion template get|update|delete|set-default <template-id>
368
+ ctxdb memory promotion template clear-default
369
+
370
+ # Auto-ingest settings (current Member in the current Workspace)
371
+ ctxdb memory promotion settings get
372
+ ctxdb memory promotion settings update [--auto-ingest-enabled=<true|false>] \
373
+ [--auto-ingest-threshold=<0..1>] [--default-kb-id=<kb-id> | --clear-default-kb]
374
+ ```
375
+
376
+ Notes:
377
+
378
+ - Routes, methods, and parameter names mirror `openapi/data-api.yaml`
379
+ (`/v1/memory_promotions/**`). Batch requests accept at most 50 ids.
380
+ - `approve` and `batch-action --action=approve` require an explicit
381
+ `--knowledge-base-id`; rejecting does not require a target KB.
382
+ - Batch commands print every result and exit 1 if any item failed.
383
+ - `--clear-default-kb` sends an empty `default_kb_id` string, which the
384
+ server interprets as clearing the target (null means unchanged). If
385
+ auto-ingest is enabled, also pass `--auto-ingest-enabled=false` to clear it.
386
+ - Write commands validate required identifiers (promotion/template id,
387
+ batch ids, action) locally and exit 2 without sending a request when
388
+ arguments are missing or invalid.
389
+ - Default output is a compact agent-friendly view (`list` keeps
390
+ decision-relevant row fields; `template list` drops rendered markdown
391
+ and guidance text). `--raw` returns successful server envelopes verbatim
392
+ but still rejects business errors, including string error codes;
393
+ `--json` pretty-prints whichever view is active.
394
+ - `template` / `settings` are second-level subgroups: running
395
+ `ctxdb memory promotion` or `ctxdb memory promotion template` without a subcommand
396
+ lists the available subcommands and exits 2.
397
+
296
398
  ### KB create/update completion mode
297
399
 
298
400
  `kb upload-text`, `kb upload-file`, `kb update-text`, and `kb update-file`
@@ -343,6 +445,54 @@ Every successful update returns the canonical `document.id` and
343
445
  same-content updates may reuse it. Callers must retain the returned ID for the
344
446
  next update; `--wait` also polls the returned ID/KB pair rather than caller input.
345
447
 
448
+ ### Knowledge review commands
449
+
450
+ `kb review` covers the Knowledge Review DATA APIs: review-queue handling
451
+ (single/batch actions, conflict resolution, deletion), review-rewrite
452
+ templates, and per-knowledge-base review settings. Every command accepts `--agent`
453
+ (`CTXDB_AGENT`) and `--json`; list/detail commands follow the three-tier
454
+ projection (`kb search` discipline): default prints a minimal agent view,
455
+ `--verbose` adds sourcing/audit fields, `--raw` ships the server envelope
456
+ verbatim. Missing or illegal arguments print usage and exit 2 before any
457
+ request is sent.
458
+
459
+ ```sh
460
+ # Review queue (filters are optional; sort by quality score)
461
+ ctxdb kb review list --knowledge-base-id=<kb-id> --review-status=pending --sort-by=confidence_score
462
+ ctxdb kb review get <review-id> [--content-page=N] [--verbose|--raw]
463
+
464
+ # Human actions: confirm | force_accept | accept_rewrite | reject | reject_reupload
465
+ ctxdb kb review action <review-id> --action=confirm
466
+ ctxdb kb review action <review-id> --action=accept_rewrite --edited-content=<text>
467
+ ctxdb kb review resolve-conflicts <review-id> \
468
+ --resolutions='[{"conflict_id":"<id>","resolution":"use_new|keep_old|merge|annotate_divergence"}]'
469
+
470
+ # Batch (up to 50 ids per request; batch-action supports confirm|reject)
471
+ ctxdb kb review batch-action --action=confirm --ids=<id1>,<id2>
472
+ ctxdb kb review batch-delete --ids=<id1>,<id2>
473
+ ctxdb kb review delete <review-id>
474
+
475
+ # Review-rewrite templates (per knowledge base, max 5 per KB)
476
+ ctxdb kb review template list <kb-id>
477
+ ctxdb kb review template create <kb-id> --name=<name> --sections-file=sections.json [--default]
478
+ ctxdb kb review template update <kb-id> <template-id> [--name=<name>] [--sections=<json>] [--default|--no-default]
479
+ ctxdb kb review template get <kb-id> <template-id> [--verbose|--raw]
480
+ ctxdb kb review template set-default <kb-id> <template-id>
481
+ ctxdb kb review template clear-default <kb-id>
482
+ ctxdb kb review template delete <kb-id> <template-id>
483
+
484
+ # Review settings for one knowledge base
485
+ ctxdb kb review settings get <kb-id>
486
+ ctxdb kb review settings update <kb-id> --review-enabled --high-threshold=0.85 --rewrite-enabled --max-rewrite-iterations=3
487
+ ```
488
+
489
+ `--sections` / `--sections-file` take a JSON array
490
+ (`[{"level": 1, "title": "...", "guidance": "..."}]`, `level` optional 1-3,
491
+ max 15 sections). `accept_rewrite` falls back to the server-rendered rewrite
492
+ when `--edited-content` is omitted. `kb review template get` on a missing
493
+ template reports `{"found": false}` instead of erroring, matching the server
494
+ contract.
495
+
346
496
  ### KB file upload policy and large files
347
497
 
348
498
  `kb upload-file` and `kb update-file` do not maintain a client-side format allowlist or file-size
@@ -436,7 +586,7 @@ Lives at `~/.ctxdb/ctxdb.json` (co-located with logs at `~/.ctxdb/logs/`). Schem
436
586
  }
437
587
  ```
438
588
 
439
- Agent selection is driven by `--agent <qoder|qoderwork|qwenwork|codex|claude|opencode|hermes|default>` on every CLI invocation, falling back to `CTXDB_AGENT` env, then to `default`. There is no `default_agent` field — older installs that have one written get it dropped on the next save.
589
+ Agent selection is driven by `--agent <qoder|qoderwork|qwenwork|codex|claude|opencode|hermes|workbuddy|default>` on every CLI invocation, falling back to `CTXDB_AGENT` env, then to `default`. There is no `default_agent` field — older installs that have one written get it dropped on the next save.
440
590
 
441
591
  Field reference:
442
592
 
@@ -453,7 +603,7 @@ Field reference:
453
603
  | `knowledge_top_k` | int | `6` | KB chunks pulled per recall (only effective when `recall_knowledge: true`) |
454
604
  | `debug` | bool | `false` | Configured preference for verbose hook logging and full recall tracing. Effective debug is forced on for every final `base_url` outside the exact official-production allowlist; see “Debug control and recall replay”. General logs go to `~/.ctxdb/logs/ctxdb.log`, structured full-content recall records to `~/.ctxdb/logs/recall-trace.jsonl` |
455
605
 
456
- Env-var overrides apply to the selected agent config (env wins): `CTXDB_AGENT` / `CTXDB_API_KEY` / `CTXDB_BASE_URL` / `CTXDB_USER_ID` / `CTXDB_AGENT_ID` / `CTXDB_APP_ID`. The last two default to unset — the request body omits `agent_id`/`app_id` entirely; set them only when you want per-agent / per-app scope isolation on the server.
606
+ Env-var overrides apply to the selected agent config (env wins): `CTXDB_AGENT` / `CTXDB_API_KEY` / `CTXDB_BASE_URL` / `CTXDB_USER_ID` / `CTXDB_AGENT_ID` / `CTXDB_APP_ID`. The internal login command additionally reads `CTXDB_LOGIN_SERVER` as its provider-neutral login endpoint. The last two default to unset — the request body omits `agent_id`/`app_id` entirely; set them only when you want per-agent / per-app scope isolation on the server.
457
607
 
458
608
  Hook/plugin escape hatch: set `CTXDB_SKIP_HOOKS=TRUE` on the agent process to make all ctxdb hook entrypoints exit immediately before reading config or calling the API. Direct `ctxdb memory` / `ctxdb kb` / `ctxdb setup` CLI commands are unchanged.
459
609
 
@@ -514,7 +664,7 @@ ctxdb uninstall --purge-logs # also deletes ~/.ctxdb/logs/
514
664
 
515
665
  ### What uninstall does (and doesn't) touch
516
666
 
517
- - **Hook entries in `~/.qoder/settings.json`, `~/.qoderwork/settings.json`, `~/.qwenwork/settings.json`, `~/.codex/hooks.json`, `~/.claude/settings.json`, and `~/.hermes/config.yaml`**: stripped precisely by marker (`_ctxdb = @aliyunrds/ctxdb`, plus legacy keys `_ctxdbQoder` / `_ctxdbPackage` and the legacy `@aliyunrds/ctxdb-qoder` value for installs predating the unified marker). Any hooks you added yourself stay. A timestamped `*.bak-ctxdb-<TS>` is written before each modification (rotation keeps the 5 most recent).
667
+ - **Hook entries in `~/.qoder/settings.json`, `~/.qoderwork/settings.json`, `~/.qwenwork/settings.json`, `~/.codex/hooks.json`, `~/.claude/settings.json`, `~/.workbuddy/settings.json`, and `~/.hermes/config.yaml`**: stripped precisely by marker (`_ctxdb = @aliyunrds/ctxdb`, plus legacy keys `_ctxdbQoder` / `_ctxdbPackage` and the legacy `@aliyunrds/ctxdb-qoder` value for installs predating the unified marker). Any hooks you added yourself stay. A timestamped `*.bak-ctxdb-<TS>` is written before each modification (rotation keeps the 5 most recent).
518
668
  - **Skill directories**: `~/.<agent>/skills/ctxdb/` for each set-up agent, plus legacy dirs (`ctxdb-qoder`, `rds-ctxdb-qoder`, `qoder-ctxdb`) under `~/.qoder/skills/` from older package names.
519
669
  - **`~/.ctxdb/` state**: only with `--purge-config` / `--purge-logs` / `--purge-all`. Defensive: `--purge-all` removes the `~/.ctxdb/` root only if it's empty after the named files are deleted (won't blanket-rm an unknown directory).
520
670
  - **`~/.codex/config.toml` `[features].hooks`**: **NOT** reverted. Setup adds `hooks = true` so Codex will fire ctxdb's hook entries; uninstall leaves the flag alone because (a) the user may have wanted it on for non-ctxdb hooks, and (b) it's harmless when `~/.codex/hooks.json` is empty. If you want it off, edit the file by hand.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  configDir
4
- } from "./chunk-S5W4FQ7M.js";
4
+ } from "./chunk-KYW76CL7.js";
5
5
 
6
6
  // src/lib/circuit.ts
7
7
  import { statSync, writeFileSync, unlinkSync, mkdirSync, readdirSync, readFileSync } from "fs";