{"_id":"@aliyunrds/ctxdb-qoder","name":"@aliyunrds/ctxdb-qoder","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@aliyunrds/ctxdb-qoder","version":"0.0.1","type":"module","description":"Qoder access layer for RDS ContextDatabase: hooks (UserPromptSubmit autoRecall + Stop autoCapture), `ctxdb-qoder` CLI (memory + KB ops), one-shot `setup` installer, and SKILL.md.","license":"Apache-2.0","keywords":["qoder","rds-context-database","ctxdb","memory","knowledge-base","hooks"],"main":"./dist/cli/main.js","bin":{"ctxdb-qoder":"dist/cli/main.js"},"author":{"name":"kuahai"},"engines":{"node":">=22"},"dependencies":{"@aliyunrds/ctxdb-shared":"~0.0.1"},"devDependencies":{"@types/node":"^22.15.0","@vitest/coverage-v8":"^4.0.18","tsup":"^8.5.0","typescript":"^5.8.3","vitest":"^4.0.18"},"scripts":{"build":"tsup && mkdir -p dist/setup && cp -r src/setup/skills dist/setup/ && chmod +x dist/hooks/*.js dist/cli/main.js","postinstall":"chmod +x dist/hooks/*.js dist/cli/main.js 2>/dev/null || true","test":"vitest run"},"_id":"@aliyunrds/ctxdb-qoder@0.0.1","_integrity":"sha512-e9D1hI0K4VFHcW1FivB1kbfmMfqJzz/PnKosF/Dq6YipD/nP8eoAH/Kyj/lPQBQGo3jXR0kLYPkKyleSVW7Srw==","_resolved":"/private/var/folders/n_/qzytbr3157nc2rs8l79v_7900000gp/T/3b5b765941c2b9acf989eb7faca9c2ab/aliyunrds-ctxdb-qoder-0.0.1.tgz","_from":"file:aliyunrds-ctxdb-qoder-0.0.1.tgz","_nodeVersion":"25.8.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-e9D1hI0K4VFHcW1FivB1kbfmMfqJzz/PnKosF/Dq6YipD/nP8eoAH/Kyj/lPQBQGo3jXR0kLYPkKyleSVW7Srw==","shasum":"8b3ea1dba2035aa0246bcd2b0e8075b79d934598","tarball":"https://registry.npmjs.org/@aliyunrds/ctxdb-qoder/-/ctxdb-qoder-0.0.1.tgz","fileCount":12,"unpackedSize":75604,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBxTRl5o+dR3HIyNseuHdqmcE+yUR1qB6Ra4zenhfORLAiBj82pwXhA2T5cXnzVbu/pbXUKpgrEnShntsX8RTE2cOA=="}]},"_npmUser":{"name":"kuahai","email":"wangyueyang.aliyun@gmail.com"},"directories":{},"maintainers":[{"name":"kuahai","email":"wangyueyang.aliyun@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ctxdb-qoder_0.0.1_1779452390582_0.5699110623289301"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-22T12:19:50.375Z","0.0.1":"2026-05-22T12:19:50.777Z","modified":"2026-05-22T12:19:50.963Z"},"maintainers":[{"name":"kuahai","email":"wangyueyang.aliyun@gmail.com"}],"description":"Qoder access layer for RDS ContextDatabase: hooks (UserPromptSubmit autoRecall + Stop autoCapture), `ctxdb-qoder` CLI (memory + KB ops), one-shot `setup` installer, and SKILL.md.","keywords":["qoder","rds-context-database","ctxdb","memory","knowledge-base","hooks"],"author":{"name":"kuahai"},"license":"Apache-2.0","readme":"# @aliyunrds/ctxdb-qoder\n\nQoder access layer for RDS ContextDatabase: hooks (UserPromptSubmit autoRecall + Stop autoCapture), `ctxdb-qoder` CLI (memory + KB ops), one-shot `setup` installer, and a Qoder-agent SKILL.md.\n\n## Install\n\n```sh\nnpm install -g @aliyunrds/ctxdb-qoder\n\n# One-shot install: writes ~/.qoder/ctxdb.json + idempotent settings.json\n# hooks + chmod +x + skill copy + ping validation\nctxdb-qoder setup \\\n  --base-url https://context-database.aliyuncs.com \\\n  --api-key  ctxdb-... \\\n  --user-id  qoder-tester\n\n# Verify\nctxdb-qoder status --json\n```\n\nRestart Qoder (CLI: just exit + restart; app: Cmd+R or quit/relaunch) so it picks up the new hooks.\n\n## What it does\n\n| Trigger | Hook | What runs |\n|---|---|---|\n| User submits a prompt | `UserPromptSubmit` | Search `/v3/memories/search/`, format a `<recalled-memories>` block, inject as `additionalContext`. **By default only memory is recalled.** Set `recall_knowledge: true` in the config to also pull KB chunks into a `<external-knowledge>` block; otherwise the recommended path for KB is the agent calling `ctxdb-qoder kb search` explicitly when the user asks (see SKILL.md) |\n| Agent finishes its turn | `Stop` | Read transcript, detect KB-upload turns and skip capture (so uploaded content doesn't bleed into long-term memory), slice the current turn, sanitize the input, POST to memory store |\n\n## CLI\n\n`ctxdb-qoder` ships 18 subcommands:\n\n- **Top-level**: `init` / `status` / `ping` / `setup`\n- **Memory**: `memory add|search|list|get|update|delete`\n- **KB**: `kb upload-text|upload-file|list|documents-list|document-get|search`\n\nSee `ctxdb-qoder --help`.\n\n`memory add … --no-infer` stores the text verbatim (skips server-side LLM\nfact-extraction). Use it when the user explicitly asks for a verbatim\nmemory (\"记住 / 请记忆 / 原文记下\"); without `--no-infer` the server may\nrewrite, merge, or skip details.\n\n`kb search <query> [--kb=name1,name2] [--top-k=N] [--threshold=F]` is the\nagent-driven KB recall path — calls `POST /v1/knowledge/query` directly\n(distinct from `memory search --knowledge`, which is a memory + KB hybrid\nsearch). The SKILL points the agent here when the user explicitly asks for\nKB lookup (\"结合知识库查询\" / \"从知识库召回\"). `--kb` is comma-separated;\nomit it to search across all KBs.\n\n## Configuration\n\nLives at `~/.qoder/ctxdb.json`. Schema:\n\n```json\n{\n  \"api_key\": \"ctxdb-...\",\n  \"base_url\": \"https://context-database.aliyuncs.com\",\n  \"user_id\": \"qoder-tester\",\n  \"auto_capture\": true,\n  \"auto_recall\": true,\n  \"recall_knowledge\": false,\n  \"top_k\": 10,\n  \"threshold\": 0.4,\n  \"knowledge_top_k\": 6,\n  \"debug\": false\n}\n```\n\nField reference:\n\n| Key | Type | Default | Meaning |\n|---|---|---|---|\n| `auto_capture` | bool | `true` | Stop hook captures each turn into long-term memory |\n| `auto_recall` | bool | `true` | UserPromptSubmit hook recalls memory on each user prompt |\n| `recall_knowledge` | bool | `false` | When `auto_recall` is on, also pull KB chunks alongside memory. Default is **off** — the recommended KB-recall path is the agent calling `kb search` explicitly when the user asks |\n| `top_k` / `threshold` | int / float | `10` / `0.4` | Memory recall pagination + similarity floor |\n| `knowledge_top_k` | int | `6` | KB chunks pulled per recall (only effective when `recall_knowledge: true`) |\n| `debug` | bool | `false` | Verbose hook logging |\n\nEnv-var overrides (env wins): `CTXDB_API_KEY` / `CTXDB_BASE_URL` / `CTXDB_USER_ID`.\n\n## Architecture\n\n```\n@aliyunrds/ctxdb-qoder      ← this package (hooks + CLI + setup)\n       │\n       └─ depends on @aliyunrds/ctxdb-shared  ← input sanitation,\n                                          prompt-injection defenses,\n                                          memory/KB types, recall pipeline\n                                          (also consumed by openclaw_memory_rds_ctxdb)\n```\n\n## Uninstall\n\n```sh\nctxdb-qoder setup --remove   # unwires hooks from ~/.qoder/settings.json\nnpm uninstall -g @aliyunrds/ctxdb-qoder\n```\n\n## Remote SSH (Qoder IDE)\n\nWhen you connect to a remote host via Qoder IDE's SSH session, `ctxdb-qoder` does **not** travel with the Qoder server. Qoder syncs its own server bits to the remote machine, but `~/.qoder/{settings.json, ctxdb.json, skills/}` are per-host — your local hooks, config, and skill are not propagated.\n\nTo enable autoCapture / autoRecall in the remote session, run the same install on the remote machine:\n\n```sh\n# on the remote host\nnpm install -g @aliyunrds/ctxdb-qoder\nctxdb-qoder setup \\\n  --base-url <your-ctxdb-server-url> \\\n  --api-key  ctxdb-... \\\n  --user-id  <id>\n```\n\nEach remote host needs its own one-time setup. If you want memories to be shared across machines, reuse the same `user-id`; if you want per-host bucketing, give each remote a distinct one.\n\n## Developer docs\n\nMaintainer-facing docs (source layout, dev/test workflows, server-config archives) live in the project's internal notebooks and are not packaged with this release. npm consumers can ignore this section.\n\n## License\n\nApache-2.0\n","readmeFilename":"README.md","_rev":"1-d3250ad7341cb5fb59a1579c43654f76"}