@thinkingai/ae-cli 6.1.18 → 6.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/README.md +97 -38
  2. package/README.zh.md +101 -38
  3. package/dist/{auth-ROB2EDYV.js → auth-FUM37MHF.js} +241 -126
  4. package/dist/{capability-DKMYUTLC.js → capability-AXFQW5WM.js} +49 -35
  5. package/dist/{chunk-JHENBQ5B.js → chunk-4P355ZWB.js} +70 -1
  6. package/dist/chunk-6ZIQV5GW.js +26 -0
  7. package/dist/{chunk-TUKQZTMI.js → chunk-7K24F7T2.js} +2 -0
  8. package/dist/{chunk-OO6XR6LK.js → chunk-AMBFK2K3.js} +2 -0
  9. package/dist/chunk-ATSM5XAW.js +623 -0
  10. package/dist/{chunk-4XXOWOTA.js → chunk-BBEFP4SB.js} +31 -38
  11. package/dist/{chunk-BYYS3ANB.js → chunk-CZU3V3DQ.js} +5 -15
  12. package/dist/{chunk-VTWMIC5L.js → chunk-E2JKXMVO.js} +2 -0
  13. package/dist/chunk-ECBLHAZO.js +15 -0
  14. package/dist/{sync-HKIOZXQE.js → chunk-I4WQAEYB.js} +31 -540
  15. package/dist/{chunk-DWO43OIB.js → chunk-JQ3ENZZH.js} +2 -0
  16. package/dist/chunk-LNZBEQXW.js +25216 -0
  17. package/dist/{chunk-ZQ47LWTI.js → chunk-QJQZH5GQ.js} +49 -79
  18. package/dist/{chunk-QZ3AS4KK.js → chunk-RSG4ONOI.js} +9 -8
  19. package/dist/{chunk-4NN5IWVN.js → chunk-T6OSFQZD.js} +2 -0
  20. package/dist/{chunk-Y3LOALAV.js → chunk-TAL6CZH6.js} +8 -7
  21. package/dist/{chunk-3KWQYGYI.js → chunk-TKHSULJT.js} +2 -0
  22. package/dist/chunk-VXNMYUXU.js +202 -0
  23. package/dist/{chunk-3FY3RJ26.js → chunk-WZ6YVQSF.js} +15 -14
  24. package/dist/{chunk-6EIJSNBD.js → chunk-Y74WTIKJ.js} +2 -0
  25. package/dist/{community-report-client-C7WDGET3.js → community-report-client-XXWGSBSD.js} +3 -4
  26. package/dist/{config-BMYZX2UE.js → config-EXUGQN5T.js} +10 -10
  27. package/dist/{data-integration-QEKDWQDY.js → data-integration-4NZ53OMT.js} +920 -97
  28. package/dist/index.js +56 -81
  29. package/dist/{local-data-upload-client-4YYHSYD6.js → local-data-upload-client-KYOKVYZV.js} +3 -4
  30. package/dist/{memory-I2WXDTV2.js → memory-ATNKZNW5.js} +6 -7
  31. package/dist/{metadata-I4C2EWUN.js → metadata-VZVC7YMH.js} +10 -11
  32. package/dist/{model-HLHIEFMU.js → model-E4JMQ4V2.js} +8 -9
  33. package/dist/{personal-semantic-preference-LIPACBDX.js → personal-semantic-preference-7S2SQ3UV.js} +9 -10
  34. package/dist/{project-semantic-RT3R2VQD.js → project-semantic-2SZP2OPO.js} +13 -14
  35. package/dist/sync-YV3E66IF.js +520 -0
  36. package/dist/{te-agent-BR6VDBNX.js → te-agent-JB5T3PO7.js} +396 -92
  37. package/dist/{te-analysis-7VUNUYWZ.js → te-analysis-3YJAAT2D.js} +196 -43
  38. package/dist/{te-community-5DMNKJWY.js → te-community-UDBI672N.js} +12 -34
  39. package/dist/{te-dataops-6P5IKWNJ.js → te-dataops-ZLYOCXZ4.js} +480 -81
  40. package/dist/{te-engage-KZPR5R22.js → te-engage-4XG6OJML.js} +88 -16
  41. package/dist/{te-experiment-6BITX4RD.js → te-experiment-VXUWPINJ.js} +83 -12
  42. package/dist/te-kb-WYQWHFSC.js +1732 -0
  43. package/dist/{te-system-FXITO2JG.js → te-system-7G6F2LJA.js} +569 -35
  44. package/dist/{te-team-ADOC2ROP.js → te-team-E7FBBXMQ.js} +8 -7
  45. package/dist/{update-YCYCKJOO.js → update-D47BUG25.js} +8 -8
  46. package/package.json +22 -10
  47. package/skills/ae-agent/SKILL.md +30 -13
  48. package/skills/ae-agent/references/agent-distribution.md +94 -0
  49. package/skills/ae-agent/references/approval-request.md +4 -0
  50. package/skills/ae-agent/references/command_index.md +9 -2
  51. package/skills/ae-agent/references/create-automation.md +20 -2
  52. package/skills/ae-agent/references/get-agent-context.md +70 -0
  53. package/skills/ae-agent/references/list-automations.md +18 -3
  54. package/skills/ae-agent/references/list-mcp-credentials.md +1 -1
  55. package/skills/ae-agent/references/mcp-token.md +3 -3
  56. package/skills/ae-agent/references/set-mcp-credential.md +0 -1
  57. package/skills/ae-agent/references/update-automation.md +18 -0
  58. package/skills/ae-analysis/SKILL.md +11 -2
  59. package/skills/ae-analysis/references/adhoc_run.md +2 -0
  60. package/skills/ae-analysis/references/ai_models.md +23 -3
  61. package/skills/ae-analysis/references/analysis_gateway_assets.md +3 -3
  62. package/skills/ae-analysis/references/audience_models.md +18 -0
  63. package/skills/ae-analysis/references/command_index.md +9 -9
  64. package/skills/ae-analysis/references/cross_source_config.md +84 -0
  65. package/skills/ae-analysis/references/dashboard_update.md +1 -1
  66. package/skills/ae-analysis/references/project_timezone_update.md +13 -4
  67. package/skills/ae-analysis/references/property_create.md +2 -0
  68. package/skills/ae-analysis/references/super_metadata_batch_create.md +2 -0
  69. package/skills/ae-analysis/references/user_cluster_models.md +2 -0
  70. package/skills/ae-analysis/references/user_cluster_update.md +8 -4
  71. package/skills/ae-analysis/references/user_tag_create.md +30 -2
  72. package/skills/ae-analysis/references/user_tag_models.md +17 -3
  73. package/skills/ae-analysis/references/user_tag_update.md +14 -2
  74. package/skills/ae-data-integration/SKILL.md +3 -1
  75. package/skills/ae-data-integration/references/dimension-routing.md +36 -0
  76. package/skills/ae-data-integration/references/error-handling.md +54 -1
  77. package/skills/ae-data-integration/references/local-analysis.md +2 -0
  78. package/skills/ae-data-integration/references/source-inspect.md +18 -2
  79. package/skills/ae-data-integration/references/tracking-plan.md +1 -1
  80. package/skills/ae-data-integration/references/transform.md +4 -2
  81. package/skills/ae-data-integration/references/ue-mapping.md +5 -2
  82. package/skills/ae-data-integration/references/ue-routing.md +40 -1
  83. package/skills/ae-dataops/SKILL.md +11 -1
  84. package/skills/ae-dataops/references/dataops-backfill.md +135 -0
  85. package/skills/ae-engage/SKILL.md +5 -0
  86. package/skills/ae-engage/references/build-task-save-guide.md +5 -1
  87. package/skills/ae-engage/references/save-flow.md +37 -1
  88. package/skills/ae-engage/references/save-task.md +6 -0
  89. package/skills/ae-experiment/SKILL.md +6 -2
  90. package/skills/ae-experiment/references/save_metric.md +20 -8
  91. package/skills/ae-generate-tracking-plan/SKILL.md +25 -13
  92. package/skills/ae-generate-tracking-plan/references/business-dimension-mapping.md +1 -1
  93. package/skills/ae-kb/SKILL.md +218 -36
  94. package/skills/ae-kb/references/query-workflow.md +59 -29
  95. package/skills/ae-kb/references/versions.md +46 -0
  96. package/skills/ae-system/SKILL.md +29 -31
  97. package/skills/ae-system/references/channel-management.md +303 -0
  98. package/skills/ae-use-agent/SKILL.md +42 -0
  99. package/skills/ae-use-agent/references/local-agent.md +114 -0
  100. package/dist/auth-GBMV6TEJ.js +0 -14
  101. package/dist/capability-HYVVPG25.js +0 -352
  102. package/dist/chunk-EFH4XWYC.js +0 -556
  103. package/dist/chunk-J2DEBMRF.js +0 -313
  104. package/dist/chunk-JRJY5DMJ.js +0 -71
  105. package/dist/chunk-OMPRXM3V.js +0 -349
  106. package/dist/chunk-QNOLN2LJ.js +0 -509
  107. package/dist/chunk-RJDU7NYP.js +0 -1198
  108. package/dist/chunk-RNAALWJK.js +0 -98
  109. package/dist/chunk-SERWF6G5.js +0 -13
  110. package/dist/chunk-UW5UN47B.js +0 -70
  111. package/dist/chunk-ZQKDZXDO.js +0 -317
  112. package/dist/client-L2YDMHQ6.js +0 -203
  113. package/dist/memory-3ORCR7JH.js +0 -893
  114. package/dist/metadata-VUOQJE26.js +0 -339
  115. package/dist/model-UGRDX4MW.js +0 -139
  116. package/dist/personal-semantic-preference-OEISBRHM.js +0 -239
  117. package/dist/project-semantic-FFPWFPIW.js +0 -1114
  118. package/dist/sync-TFHU2UTG.js +0 -10261
  119. package/dist/te-agent-VLYOV7S4.js +0 -3894
  120. package/dist/te-analysis-4YGQL5RC.js +0 -9357
  121. package/dist/te-community-ISDQWJU7.js +0 -1859
  122. package/dist/te-dataops-CVULXNVB.js +0 -2209
  123. package/dist/te-engage-N5WI32H6.js +0 -4898
  124. package/dist/te-experiment-UVR4HLND.js +0 -988
  125. package/dist/te-kb-RCLSSH2Q.js +0 -935
  126. package/dist/te-system-K2GYMCTB.js +0 -2213
  127. package/skills/ae-agent/references/auto-provision-mcp-credentials.md +0 -57
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: ae-kb
3
3
  version: 1.0.0
4
- description: "AE/TE knowledge base CLI manual for creating, querying, LLM-powered ask, listing accessible knowledge bases, deterministic index/grep/read retrieval, checking status, uploading, compiling, schema generation, URL sources, source deletion, and knowledge base deletion. Use when the user asks to manage TE/AE/ThinkingEngine knowledge bases, upload documents or URLs to a knowledge base, query knowledge, ask knowledge bases with an LLM, list accessible knowledge bases, inspect knowledge base indexes, search knowledge base pages, read a specific knowledge base page, check knowledge base status, generate schemas, compile knowledge, remove sources, or delete a knowledge base. To choose which knowledge base is worth searching, use the ae-kb-discovery skill first; this skill runs the retrieval once a target is chosen. Must use ae-cli kb commands and must not guess knowledge base names, scopes, page paths, source display names, JSON payload shapes, or URL formats."
4
+ description: 'AE/TE knowledge base CLI manual for creating, importing read-only compiled snapshots, querying, LLM-powered ask, listing accessible knowledge bases and their sources, deterministic index/grep/read retrieval, checking status, ZIP source upload and directory management, raw child-file reading, revision-checked child updates and deletion, compiling, schema generation, URL sources, source deletion, and knowledge base deletion. Use when the user asks to manage TE/AE/ThinkingEngine knowledge bases, import a compiled Markdown ZIP snapshot, upload documents or URLs to a knowledge base, query knowledge, ask knowledge bases with an LLM, list accessible knowledge bases or source metadata, inspect knowledge base indexes, search knowledge base pages, read a specific knowledge base page, check knowledge base status, generate schemas, compile knowledge, remove sources, or delete a knowledge base. To choose which knowledge base is worth searching, use the ae-kb-discovery skill first; this skill runs the retrieval once a target is chosen. Must use ae-cli kb commands and must not guess knowledge base names, scopes, page paths, source IDs, source display names, JSON payload shapes, or URL formats.'
5
5
  ---
6
6
 
7
7
  # ae-kb
@@ -14,11 +14,11 @@ ae-cli kb +<command> [options]
14
14
 
15
15
  ## Global Rules
16
16
 
17
- - Use this skill for TE/AE knowledge base tasks: create, query, ask with LLM, list accessible knowledge bases, inspect indexes, grep pages, read pages, check status, upload sources, add URL sources, generate schema, compile, remove source files, and delete knowledge bases.
17
+ - Use this skill for TE/AE knowledge base tasks: create, import a compiled snapshot, query, ask with LLM, list accessible knowledge bases and their sources, inspect indexes, grep pages, read pages, check status, upload sources, add URL sources, generate schema, compile, remove source files, and delete knowledge bases.
18
18
  - **Searching a knowledge base for an answer is the most common task. If that is what you are doing, go straight to [Explore Knowledge Base Pages](#explore-knowledge-base-pages) and read [`references/query-workflow.md`](references/query-workflow.md) first — it is the retrieval procedure. The other commands below are for managing knowledge bases, not answering from them.**
19
19
  - Read operations can run directly after required inputs are known. Write operations require explicit user intent and normally keep the confirmation prompt unless the user asks to bypass it.
20
20
  - Prefer `--dry-run` before destructive or broad writes when the user has not already validated the target.
21
- - Do not invent knowledge base names, scopes, source display names, or JSON payloads. Ask the user or query known context when values are missing.
21
+ - Do not invent knowledge base names, scopes, source IDs, source display names, or JSON payloads. Ask the user or query known context when values are missing.
22
22
  - When building a `--sources` ref (or `+read --source`), copy the exact `scope` and `name` from `+list` output — run `ae-cli kb +list` first when the scope of a named knowledge base is unknown.
23
23
  - JSON flags must be valid JSON strings, usually wrapped in single quotes in shell commands.
24
24
  - Successful commands return JSON by default. Use `--format table` only when a table is easier for a human to scan. Envelope may include optional `_notice.host_compat`.
@@ -33,18 +33,82 @@ ae-cli kb +<command> [options]
33
33
  | `+ask` | read | LLM-powered Q&A over knowledge bases; for multi-page synthesis or multi-hop questions. |
34
34
  | `+ask-status` | read | Query the current status of an ask execution by `--execution-id` without polling. |
35
35
  | `+list` | read | List accessible knowledge bases filtered by buildStatus (default: compiled). |
36
+ | `+list-sources` | read | List source metadata for one knowledge base so exact source identifiers can be discovered safely. |
36
37
  | `+index` | read | List accessible knowledge bases and their `index.md` navigation maps. |
37
- | `+grep` | read | Keyword-search knowledge base pages and return matched lines with context. |
38
+ | `+grep` | read | Keyword-search knowledge base pages; returns a page-level results array (hitCount / pageKind / sections previews). |
38
39
  | `+read` | read | Read a full knowledge base page, a line window, or (with `--outline`) only the page heading tree. |
39
40
  | `+new` | write | Create a new personal or company knowledge base. |
40
- | `+add` | write | Upload local files, a non-recursive directory, or HTTP(S) pages converted to markdown. |
41
+ | `+import` | write | Import a compiled Markdown ZIP as a personal or company read-only snapshot; `--scope` defaults to `personal`. |
42
+ | `+import-status` | read | Query one snapshot import task by `--request-id` without polling; output includes the persisted `scope`. |
43
+ | `+add` | write | Upload local files (including ZIP directory sources), a non-recursive directory, or HTTP(S) pages converted to markdown. |
41
44
  | `+url` | write | Upload a URL source directly with optional display name and parsing instruction. |
42
45
  | `+schema` | write | Generate the compile schema for a knowledge base. |
43
46
  | `+compile` | write | Compile a knowledge base in incremental or full mode. |
44
47
  | `+status` | read | Query the current status of a knowledge base. |
45
- | `+rm-source` | write | Delete one source file from a knowledge base by display name. |
48
+ | `+rm-source` | high-risk-write | Delete one source from a knowledge base by stable ID; exact display name is legacy compatibility only. |
46
49
  | `+remove` | write | Delete an entire knowledge base. |
47
50
 
51
+ ## Published Version History
52
+
53
+ Use the nine version commands described in [`references/versions.md`](references/versions.md) to inspect immutable published history, compare source changes, and explicitly roll back an earlier version as a new publication. These commands manage history; `+index/+grep/+read/+ask` continue to use current published content.
54
+
55
+ | Command | Risk | Purpose |
56
+ | --- | --- | --- |
57
+ | `+versions` | read | List published versions and latestVersionId. |
58
+ | `+version-show` | read | Show one version summary. |
59
+ | `+version-sources` | read | Discover historical source IDs. |
60
+ | `+version-diff` | read | Compare two versions. |
61
+ | `+version-tree` | read | List a historical ZIP/URL source directory. |
62
+ | `+version-read` | read | Preview a historical directory child file. |
63
+ | `+version-download` | read | Save one ordinary historical file source; no directory download. |
64
+ | `+rollback` | high-risk-write | Restore an earlier version and create a new version. |
65
+ | `+rollback-status` | read | Query a persisted rollback Operation without polling. |
66
+
67
+ ## ZIP Directory Sources
68
+
69
+ Use `+add --files '["./sources.zip"]'` to upload one ZIP as one editable parent source, preserving its internal hierarchy. Archive validation and limits are enforced by the server. This is different from `+import`, which creates a read-only compiled snapshot. Passing a local directory to `+add` still uploads only its immediate supported files; it does not recursively package that directory.
70
+
71
+ Discover the exact parent ID with `+list-sources`. ZIP rows include `fileCount`, `sizeBytes`, `contentRevision`, and `updateStatus`.
72
+
73
+ | Command | Risk | Purpose |
74
+ | --- | --- | --- |
75
+ | `+source-ls` | read | List one directory page with revision, current children and deleted paths relative to the successful baseline. |
76
+ | `+source-read` | read | Read a child source file as UTF-8/base64, or save original bytes. |
77
+ | `+source-put` | write | Add one local file or explicitly replace the exact ZIP-relative path. |
78
+ | `+source-rm` | high-risk-write | Delete one child file or recursively delete a child directory. |
79
+
80
+ ```bash
81
+ ae-cli kb +source-ls --name handbook --id <source-id> --path "" --limit 100
82
+ ae-cli kb +source-ls --name handbook --id <source-id> --path "guides" --cursor <nextCursor>
83
+ ae-cli kb +source-read --name handbook --id <source-id> --path "guides/intro.md"
84
+ ae-cli kb +source-read --name handbook --id <source-id> --path "images/chart.png" --output ./chart.png
85
+ ae-cli kb +source-read --name handbook --id <source-id> --path "images/chart.png" --encoding base64
86
+ ae-cli kb +source-put --name handbook --id <source-id> --path "guides/new.md" --file ./new.md --action add --expected-revision 7 --dry-run
87
+ ae-cli kb +source-put --name handbook --id <source-id> --path "guides/new.md" --file ./new.md --action add --expected-revision 7
88
+ ae-cli kb +source-put --name handbook --id <source-id> --path "guides/new.md" --file ./revised.md --action replace --expected-revision 8
89
+ ae-cli kb +source-rm --name handbook --id <source-id> --path "guides/new.md" --expected-revision 9
90
+ ae-cli kb +source-rm --name handbook --id <source-id> --path "guides/obsolete" --recursive --expected-revision 10
91
+ ae-cli kb +compile --name handbook --mode incremental
92
+ ```
93
+
94
+ - Copy the source ID, paths and revision from current discovery. Names resolve personal then company, following the existing External API; no scope override is available on these commands.
95
+ - `--path` is relative to the ZIP root, not a local filesystem or `raw/zip/...` path. Root listing uses an empty path. Nonempty paths cannot be absolute or contain empty, dot, parent or backslash segments.
96
+ - Listing returns one page; continue using `nextCursor` and the same path. On a revision change, restart discovery before writing.
97
+ - `+source-read` reads source bytes; `+read` reads compiled Wiki pages. Default UTF-8 output fails on invalid UTF-8. Base64 preserves binary data. `--output` creates a new local file and refuses to overwrite an existing file.
98
+ - `+source-put` accepts one file up to 50 MB. Default `--action add` rejects an existing path; `--action replace` explicitly authorizes overwriting an existing child. There is no silent upsert. Dry-run shows metadata and redacts file content.
99
+ - `--expected-revision` is mandatory for writes. A 409 conflict is returned with its server error code; the command never refreshes and retries the write automatically.
100
+ - `+source-rm` keeps the parent source. Nonempty directory removal requires `--recursive`; deletion follows the CLI confirmation gate. Use `--yes` only when automated deletion of the exact target is already authorized. `+rm-source --id` deletes the entire parent.
101
+ - A mutation marks the parent changed but does not start compilation or regenerate Schema. Run incremental compilation explicitly; wait for successful publication before the next test stage.
102
+ - `+status` is the existing aggregate status query; it is not a per-run event or ZIP Diff reader. Do not interpret its compilation submission response as successful publication.
103
+ - No Gateway equivalent is registered in the current KB implementation. These commands reuse the typed External source APIs.
104
+
105
+ Transition status: transitional
106
+ Owning module: te-claude External Knowledge Base Sources API
107
+ Current transport: authenticated External REST via `kbApi` and multipart `kbUpload`.
108
+ Gateway target: TBD (ZIP source directory and raw-file capabilities)
109
+ Review after: 2026-12-06
110
+ Exit condition: migrate when equivalent typed Gateway file, directory and revision-aware mutation capabilities exist; retain CLI file handling and explicit mutation semantics.
111
+
48
112
  ## Common Workflows
49
113
 
50
114
  ### Create a Knowledge Base
@@ -67,6 +131,36 @@ Optional fields:
67
131
  - `--project-id`: optional project ID to bind.
68
132
  - `--project-name`: optional project display name.
69
133
 
134
+ ### Import a Compiled Snapshot
135
+
136
+ Use `+import` only for a ZIP whose root contains `index.md` and at least one
137
+ `wiki/**/*.md` page. The server validates all archive paths, limits, UTF-8 text, and Wiki links.
138
+
139
+ ```bash
140
+ ae-cli kb +import \
141
+ --file ./knowledge-base.zip \
142
+ --name "Imported handbook" \
143
+ --description "Compiled documentation snapshot" \
144
+ --tags '["docs","handbook"]'
145
+
146
+ # The submission returns requestId + queued. Query one snapshot later:
147
+ ae-cli kb +import-status --request-id <requestId>
148
+ ```
149
+
150
+ - The result is always a `personal` read-only snapshot; there is no `--scope`, `--force`, or replace option.
151
+ - Imported snapshots support list, Index/Wiki reading, grep/read, Ask, and deletion. They do not expose source, Schema, usage, compile, member, settings, ownership-transfer, or company-publish operations.
152
+ - The ZIP is limited to 50 MB and supports Markdown text only. Local images, attachments, other binaries, broken Wiki links, and ambiguous Wiki links are rejected by the server.
153
+ - Submission returns `{requestId, status: "queued"}` immediately. It does not wait for ZIP validation or publication.
154
+ - `+import-status` returns one of `queued`, `running`, `succeeded`, or `failed`; success includes `knowledgeBaseId`, and failure includes a stable error code/message.
155
+ - If a `requestId` was returned, query it before retrying. If no request ID was received, run `ae-cli kb +list` before retrying the same name. A repeated same-name import is rejected.
156
+
157
+ - Transition status: transitional
158
+ - Owning module: te-claude External Knowledge Base Import API
159
+ - Current transport: authenticated KB external REST through `kbUpload` for submission and `kbApi` for status lookup.
160
+ - Gateway target: TBD (`kb.snapshot.import` proposed)
161
+ - Review after: 2026-12-01
162
+ - Exit condition: migrate to a typed Gateway capability when the equivalent multipart import capability is available, or remove this command if dynamic Gateway execution provides the same file-handling and output contract.
163
+
70
164
  ### Upload Files or Directories
71
165
 
72
166
  Use `+add` when sources are local files, local directories, or pages that should be fetched and converted to markdown before upload.
@@ -74,6 +168,7 @@ Use `+add` when sources are local files, local directories, or pages that should
74
168
  ```bash
75
169
  ae-cli kb +add \
76
170
  --name engineering-handbook \
171
+ --scope company \
77
172
  --files '["./README.md","./docs","https://example.com/guide"]'
78
173
  ```
79
174
 
@@ -92,6 +187,7 @@ Use `+url` when adding one URL source and optionally passing a display name or p
92
187
  ```bash
93
188
  ae-cli kb +url \
94
189
  --name engineering-handbook \
190
+ --scope company \
95
191
  --url https://example.com/guide \
96
192
  --display-name guide \
97
193
  --parse-instruction "Keep headings and code blocks"
@@ -104,15 +200,29 @@ ae-cli kb +url \
104
200
  Generate the schema first when the knowledge base needs a compile schema.
105
201
 
106
202
  ```bash
107
- ae-cli kb +schema --name engineering-handbook
203
+ ae-cli kb +schema --name engineering-handbook --scope company
108
204
  ```
109
205
 
110
- Use `--force` only to recover a stuck `generating` status. Use `--model` only when the user provides the model display name.
206
+ Use `--force` only when `+status` reports `schema_generating` and the user explicitly wants to replace the current generation attempt. The replacement may consume additional tokens.
207
+
208
+ Schema and Compile accept the same optional model reference. Prefer the model record `id` returned by `ae-cli agent +list-models` (`Model.id`). Historical `modelId` and the unambiguous `modelId::scope` form remain compatible. A model `displayName` is presentation text, not a stable reference.
209
+
210
+ To add one-time guidance for this generation without changing stored knowledge base metadata, pass `--custom-instructions`. The server trims the value, treats whitespace-only input as absent, and accepts up to 10,000 Unicode characters. Do not include secrets or credentials.
211
+
212
+ ```bash
213
+ ae-cli kb +schema \
214
+ --name engineering-handbook \
215
+ --scope company \
216
+ --model <model-ref> \
217
+ --custom-instructions "Prioritize troubleshooting workflows and preserve command examples"
218
+ ```
219
+
220
+ Use `--dry-run` to inspect the request body before sending it. While generation is running, a request without `--force` is idempotent only when it supplies no new model or effective custom instructions; otherwise it fails with `KB_SCHEMA_GENERATION_IN_PROGRESS`. With `--force`, the selected model and custom instructions apply to the replacement attempt. Invalid text fails with `KB_SCHEMA_CUSTOM_INSTRUCTIONS_INVALID`.
111
221
 
112
222
  Compile after sources and schema are ready:
113
223
 
114
224
  ```bash
115
- ae-cli kb +compile --name engineering-handbook --mode incremental
225
+ ae-cli kb +compile --name engineering-handbook --scope company --mode incremental --model <model-ref>
116
226
  ```
117
227
 
118
228
  Valid compile modes are `incremental` and `full`; default is `incremental`.
@@ -122,14 +232,14 @@ Valid compile modes are `incremental` and `full`; default is `incremental`.
122
232
  Use `+status` to inspect the current status of a knowledge base.
123
233
 
124
234
  ```bash
125
- ae-cli kb +status --name engineering-handbook
235
+ ae-cli kb +status --name engineering-handbook --scope company
126
236
  ```
127
237
 
128
238
  ### Ask Knowledge (LLM)
129
239
 
130
240
  Use `+ask` when the question requires synthesizing across multiple pages or multi-hop reasoning — a server-side agent runs the full retrieval loop and returns a synthesized answer with its source paths. Prefer `+index` -> `+grep` -> `+read` when deterministic retrieval is enough.
131
241
 
132
- The `+ask` command uses asynchronous submit/poll: by default, it automatically polls for completion (every 5s, up to 10 minutes) and prints the final answer. The output JSON is isomorphic to the previous synchronous response, so consumers require no changes.
242
+ The `+ask` command uses asynchronous submit/poll: by default, it automatically polls for completion (every 5s, up to 10 minutes) and prints the final answer with its execution ID, sources, model usage, tool call count, and model ID.
133
243
 
134
244
  ```bash
135
245
  # Default: submit and poll for completion
@@ -137,7 +247,6 @@ ae-cli kb +ask \
137
247
  --question "How do we troubleshoot payment alerts?" \
138
248
  --sources '[{"scope":"company","name":"engineering-handbook"}]' \
139
249
  --model-id claude-sonnet-4-6 \
140
- --max-turns 50 \
141
250
  --locale zh
142
251
 
143
252
  # Submit only, return executionId immediately (for batch processing)
@@ -150,10 +259,9 @@ ae-cli kb +ask-status --execution-id <id>
150
259
  - `--question`, alias `-q`: required natural-language question (1-2000 characters).
151
260
  - `--sources`: optional JSON array of knowledge base refs. Omit to search all accessible knowledge bases.
152
261
  - `--model-id`: optional LLM model ID. Omit to use the platform default.
153
- - `--max-turns`: optional agent turn limit (1-100, server default 50).
154
262
  - `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
155
263
  - `--no-wait`: optional boolean flag. Return immediately after submission with `{executionId, status}`, without polling.
156
- - **Failure handling**: If execution fails, the command exits non-zero and prints an error message on stderr prefixed with the typed error code, e.g. `[timeout] ...` / `[model_error] ...` / `[invalid_sources] ...` (followed by the executionId). Treat the bracketed code as the machine-readable failure type.
264
+ - **Failure handling**: If execution fails, the command exits non-zero and prints the unified JSON error envelope on stderr: `{"ok":false,"error":{"type":"api","code":"<server-code>","message":"..."}}`. Stable server codes are `model_unavailable`, `sandbox_unavailable`, `agent_skill_unavailable`, `dispatch_auth_unavailable`, `provider_failed`, `retrieval_error`, `timeout`, and `process_restart`.
157
265
 
158
266
  ### List Accessible Knowledge Bases
159
267
 
@@ -182,7 +290,7 @@ ae-cli kb +index \
182
290
  --sources '[{"scope":"company","name":"engineering-handbook"}]'
183
291
  ```
184
292
 
185
- Then use `+grep` to locate likely pages and line numbers:
293
+ Then use `+grep` to locate likely pages:
186
294
 
187
295
  ```bash
188
296
  ae-cli kb +grep \
@@ -192,7 +300,7 @@ ae-cli kb +grep \
192
300
  --top-k 10
193
301
  ```
194
302
 
195
- Each grep hit carries `path`, `line`, `breadcrumb`, a context snippet, and the section range of the matched line (`sectionStartLine` / `sectionEndLine`). `line` is the hit anchor; `sectionStartLine` / `sectionEndLine` are the enclosing heading-section boundaries. Choose the smallest reliable `--offset` / `--limit` window that preserves the needed evidence; use the section range when the answer needs whole-section context.
303
+ The response is a page-level `results` array: each entry is one page with its full `hitCount`, a `pageKind` (`content` or `catalog`), up to 4 `sections` previews (breadcrumb, `sectionStartLine`/`sectionEndLine`, text preview), and `moreSections`. Use `hitCount` and the previews to decide which pages to read; `pageKind: "catalog"` marks a module directory page — treat its entries as detail-page navigation, not as an answer source. Read the section range with `--offset sectionStartLine` / `--limit sectionEndLine - sectionStartLine + 1`; when `moreSections > 0` and the answer is not in the previews, re-grep that single page to see all its hits.
196
304
 
197
305
  Use `+read --outline` when the current target page has no reliable grep range and headings are needed to choose a section:
198
306
 
@@ -203,19 +311,46 @@ ae-cli kb +read \
203
311
  --outline
204
312
  ```
205
313
 
206
- Then use `+read` to open the selected window, using the hit anchor, a section boundary from same-page or linked-page grep, or two adjacent outline headings:
314
+ Then use `+read` to open the selected window, using a page-group section boundary or two adjacent outline headings:
207
315
 
208
316
  ```bash
209
317
  ae-cli kb +read \
210
318
  --source '{"scope":"company","name":"engineering-handbook"}' \
211
319
  --path "wiki/sandbox.md" \
212
320
  --offset 42 \
213
- --limit 60
321
+ --limit 60 \
322
+ --expand block
214
323
  ```
215
324
 
325
+ ### List Sources
326
+
327
+ List sources first to discover the stable identifier for the intended source:
328
+
329
+ ```bash
330
+ ae-cli kb +list-sources --name engineering-handbook --scope company
331
+ ```
332
+
333
+ Copy the exact `id` from the response into `+rm-source`. Do not guess a source ID from a local filename, URL, display name, or an older upload response.
334
+
335
+ - Transition status: transitional
336
+ - Owning module: te-claude External Knowledge Base Sources API
337
+ - Current transport: authenticated KB external REST through `kbApi`.
338
+ - Gateway target: TBD (`kb.source.list` proposed)
339
+ - Review after: 2026-12-03
340
+ - Exit condition: migrate to a typed Gateway capability when an equivalent source-list capability is available, or remove this command if dynamic Gateway execution provides the same discoverability and safe output contract.
341
+
216
342
  ### Remove One Source
217
343
 
218
- Use `+rm-source` only when the source display name is known exactly.
344
+ Use `+rm-source --id` with the exact ID returned by the current `+list-sources` response. This is a `high-risk-write`; keep the interactive confirmation unless the user has explicitly authorized `--yes`.
345
+
346
+ ```bash
347
+ ae-cli kb +rm-source \
348
+ --name engineering-handbook \
349
+ --scope company \
350
+ --id cm-source-id
351
+ ```
352
+
353
+ `--display-name` is retained for legacy compatibility only when a stable source ID is unavailable:
219
354
 
220
355
  ```bash
221
356
  ae-cli kb +rm-source \
@@ -223,14 +358,14 @@ ae-cli kb +rm-source \
223
358
  --display-name kb-1780046712-guide.md
224
359
  ```
225
360
 
226
- If the user only gives a loose source name, do not guess. Ask for the exact uploaded display name.
361
+ If the user only gives a loose source name, do not guess a source ID. Run `+list-sources`, identify the intended row from returned metadata, and ask only when multiple rows remain ambiguous.
227
362
 
228
363
  ### Delete a Knowledge Base
229
364
 
230
365
  Use `+remove` for deleting the entire knowledge base. Confirm the target name with the user if there is any ambiguity.
231
366
 
232
367
  ```bash
233
- ae-cli kb +remove --name engineering-handbook
368
+ ae-cli kb +remove --name engineering-handbook --scope company
234
369
  ```
235
370
 
236
371
  ## Command Reference
@@ -238,17 +373,16 @@ ae-cli kb +remove --name engineering-handbook
238
373
  ### `+ask`
239
374
 
240
375
  ```bash
241
- ae-cli kb +ask --question "<question>" [--sources '[{"scope":"company","name":"kb-name"}]'] [--model-id claude-sonnet-4-6] [--max-turns 50] [--locale zh|en|ja|ko] [--no-wait]
376
+ ae-cli kb +ask --question "<question>" [--sources '[{"scope":"company","name":"kb-name"}]'] [--model-id claude-sonnet-4-6] [--locale zh|en|ja|ko] [--no-wait]
242
377
  ```
243
378
 
244
379
  - `--question`, alias `-q`: required natural-language question (1-2000 characters).
245
380
  - `--sources`: optional JSON array of knowledge base refs. Omit to search all accessible knowledge bases.
246
381
  - `--model-id`: optional LLM model ID. Omit to use the platform default.
247
- - `--max-turns`: optional agent turn limit (1-100, server default 50).
248
382
  - `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
249
383
  - `--no-wait`: optional. Return immediately with `{executionId, status}` instead of polling.
250
384
  - When to use: multi-page synthesis or multi-hop questions. For simple factual lookups, prefer `+index` / `+grep` / `+read`.
251
- - Output: By default, polls and returns `{executionId, answer, sources, modelUsage, toolCallCount, maxTurns, modelId}` (same fields as the previous synchronous response, plus `executionId`). With `--no-wait`, returns `{executionId, status}` immediately. On failure, exits non-zero with a stderr message prefixed by the typed error code (`[timeout]`, `[model_error]`, `[invalid_sources]`, `[process_restart]`).
385
+ - Output: By default, polls and returns `{executionId, answer, sources, modelUsage, toolCallCount, modelId}`. With `--no-wait`, returns `{executionId, status}` immediately. On failure, exits non-zero with the unified stderr envelope containing `error.type="api"`, the server `error.code` (`model_unavailable`, `sandbox_unavailable`, `agent_skill_unavailable`, `dispatch_auth_unavailable`, `provider_failed`, `retrieval_error`, `timeout`, or `process_restart`), and `error.message`.
252
386
 
253
387
  ### `+ask-status`
254
388
 
@@ -257,7 +391,7 @@ ae-cli kb +ask-status --execution-id <id>
257
391
  ```
258
392
 
259
393
  - `--execution-id`: required. The execution ID returned by `+ask` submission.
260
- - Output: Returns the current execution state: `{executionId, status, elapsedMs?, answer?, sources?, modelUsage?, toolCallCount?, error?}`. Does not poll; returns a single snapshot.
394
+ - Output: Returns one successful CLI envelope snapshot. For a failed execution, the stable server code remains at `data.error.code`: `{"ok":true,"data":{"executionId":"...","status":"failed","error":{"code":"retrieval_error","message":"..."}}}`. Does not poll.
261
395
 
262
396
  ### `+list`
263
397
 
@@ -289,18 +423,19 @@ ae-cli kb +grep --query "<keywords>" --sources '[{"scope":"company","name":"kb-n
289
423
  - `--paths`: required JSON array of wiki pages or subdirectories **copied** from `+index`. A single page is still an array, e.g. `["wiki/sandbox.md"]`. Distinct from `+read --path` (one string).
290
424
  - `--top-k`: optional max number of hits, 1-50, default 10.
291
425
  - `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
292
- - Each hit includes `sectionStartLine` / `sectionEndLine`: the line range of the section (bounded by the nearest headings) containing the matched line. Use it as the `+read` window.
426
+ - Each page entry in results carries `hitCount` (full match count), `pageKind`, and `sections` previews with `sectionStartLine` / `sectionEndLine` — use the section range as the `+read` window.
293
427
 
294
428
  ### `+read`
295
429
 
296
430
  ```bash
297
- ae-cli kb +read --source '{"scope":"company","name":"kb-name"}' --path "index.md" [--offset 1] [--limit 200] [--outline] [--locale zh|en|ja|ko]
431
+ ae-cli kb +read --source '{"scope":"company","name":"kb-name"}' --path "index.md" [--offset 1] [--limit 200] [--expand block|none] [--outline] [--locale zh|en|ja|ko]
298
432
  ```
299
433
 
300
434
  - `--source`: required JSON object pointing to exactly one knowledge base.
301
435
  - `--path`: required page path relative to the knowledge base root, such as `index.md` or `wiki/concepts/data-model.md`.
302
- - `--offset`: optional 1-based start line.
303
- - `--limit`: optional max line count, 1-10000.
436
+ - `--offset`: optional 1-based integer start line.
437
+ - `--limit`: optional max line count, 1-2000.
438
+ - `--expand`: optional Markdown block expansion mode. `block` lets the server include a complete Markdown block outside the requested line window; `none` keeps the exact offset/limit window. Omit it to use the server default, `block`.
304
439
  - `--outline`: optional. Return only the whole-page heading tree (`{level, heading, line}`) with empty content, independent of `--offset` / `--limit`. Use it on long pages to choose which section to read.
305
440
  - `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
306
441
 
@@ -313,41 +448,88 @@ ae-cli kb +new --name "<name>" [--scope personal|company] [--description "..."]
313
448
  ### `+add`
314
449
 
315
450
  ```bash
316
- ae-cli kb +add --name "<name>" --files '["./a.md","./docs","https://example.com/page"]'
451
+ ae-cli kb +add --name "<name>" --files '["./a.md","./docs","https://example.com/page"]' [--scope personal|company]
452
+ ```
453
+
454
+ ### `+import`
455
+
456
+ ```bash
457
+ ae-cli kb +import --file "./knowledge-base.zip" --name "<name>" [--description "..."] [--tags '["t1","t2"]'] [--project-id "..."]
458
+ ```
459
+
460
+ - `--file`: required local `.zip` file.
461
+ - `--name`: required personal knowledge-base name, up to 30 characters.
462
+ - `--description`: optional, up to 200 characters.
463
+ - `--tags`: optional JSON array, max 2 unique tags, each up to 15 characters.
464
+ - `--project-id`: optional project binding.
465
+ - Scope and terminal build state are generated by the server and cannot be supplied by the client.
466
+ - Output: `{requestId, status: "queued"}`. Use `+import-status`; the command does not poll.
467
+
468
+ ### `+import-status`
469
+
470
+ ```bash
471
+ ae-cli kb +import-status --request-id <requestId>
317
472
  ```
318
473
 
474
+ - `--request-id`: required ID returned by `+import`.
475
+ - Output: `{requestId, status, knowledgeBaseId?, errorCode?, errorMessage?}`.
476
+ - Returns a single snapshot and does not poll. A failed import is returned as `status: "failed"` with its stable error code/message; an unknown or inaccessible request exits non-zero.
477
+
319
478
  ### `+url`
320
479
 
321
480
  ```bash
322
- ae-cli kb +url --name "<name>" --url "https://example.com/page" [--display-name "..."] [--parse-instruction "..."]
481
+ ae-cli kb +url --name "<name>" --url "https://example.com/page" [--scope personal|company] [--display-name "..."] [--parse-instruction "..."]
323
482
  ```
324
483
 
325
484
  ### `+schema`
326
485
 
327
486
  ```bash
328
- ae-cli kb +schema --name "<name>" [--force] [--model "<model displayName>"]
487
+ ae-cli kb +schema --name "<name>" [--scope personal|company] [--force] [--model <model-ref>] [--custom-instructions "<one-time guidance>"]
329
488
  ```
330
489
 
490
+ - `--custom-instructions`: Optional per-run schema-generation guidance. It is not persisted; whitespace-only input is omitted. The server allows at most 10,000 Unicode characters and rejects disallowed control characters. Do not include secrets or credentials.
491
+ - `--force`: Replace the current attempt only when schema generation is already running and the user explicitly requests the replacement. The selected model and custom instructions apply to the new attempt, which may consume additional tokens.
492
+ - `--dry-run`: Shows the same `customInstructions` request field that execution will send.
493
+ - `--model`: Optional stable model reference. Prefer `Model.id` from `ae-cli agent +list-models`; historical `modelId` and `modelId::scope` remain compatible.
494
+ - `--scope`: Optional exact knowledge-base scope. Omit it to retain the legacy personal-to-company lookup order.
495
+ - Errors: `KB_SCHEMA_CUSTOM_INSTRUCTIONS_INVALID` means the field failed validation. `KB_SCHEMA_GENERATION_IN_PROGRESS` means generation is active and a request without `--force` supplied a new model or effective custom instructions.
496
+
331
497
  ### `+compile`
332
498
 
333
499
  ```bash
334
- ae-cli kb +compile --name "<name>" [--mode incremental|full]
500
+ ae-cli kb +compile --name "<name>" [--scope personal|company] [--mode incremental|full] [--model <model-ref>]
335
501
  ```
336
502
 
337
503
  ### `+status`
338
504
 
339
505
  ```bash
340
- ae-cli kb +status --name "<name>"
506
+ ae-cli kb +status --name "<name>" [--scope personal|company]
341
507
  ```
342
508
 
509
+ ### `+list-sources`
510
+
511
+ ```bash
512
+ ae-cli kb +list-sources --name "<name>" [--scope personal|company]
513
+ ```
514
+
515
+ - `--name`: required knowledge base name.
516
+ - Output: `items` contains effective sources with stable `id`. `pendingDeletions` contains soft-deleted sources still included in the current successful version. `deletionMaintenance` is separate and may report already-published deletions awaiting cleanup. Paths, hashes, credentials, and source content are not returned.
517
+ - Check `deletionProjection.state` and its `baseline` before interpreting deletion lists. `ready` with `pendingDeletions: []` means no pending deletion at that baseline. `changing`, `review_required`, or `unavailable` with `pendingDeletions: null` means undetermined; display the `reasonCode`, never turn null into an empty list. Legacy libraries without a verifiable complete publication manifest return unavailable until a real version is published.
518
+ - A rollback creates a new current version. An older deletion receipt cannot override membership in that version. A later source deletion needs publication again.
519
+ - Copy the exact `id` from the current response before deleting a source; never guess it.
520
+
343
521
  ### `+rm-source`
344
522
 
345
523
  ```bash
346
- ae-cli kb +rm-source --name "<name>" --display-name "<uploaded source display name>"
524
+ ae-cli kb +rm-source --name "<name>" --id "<source-id>" [--scope personal|company]
347
525
  ```
348
526
 
527
+ - `--id`: preferred stable source identifier copied from `+list-sources`.
528
+ - `--display-name`: legacy compatibility selector used only when an ID is unavailable.
529
+ - If both are supplied, `--id` wins. The command removes one source only.
530
+
349
531
  ### `+remove`
350
532
 
351
533
  ```bash
352
- ae-cli kb +remove --name "<name>"
534
+ ae-cli kb +remove --name "<name>" [--scope personal|company]
353
535
  ```
@@ -20,7 +20,12 @@ candidate rather than searching everything blindly.
20
20
  1. **Index the candidate.** Call `+index --sources` with the discovery pick.
21
21
  Use `index.md` for navigation, a fit check, and **query wording** — the real
22
22
  terms in the index (product names, API identifiers, section titles) become
23
- your `+grep` keywords.
23
+ your `+grep` keywords. The root index routes at module level only; when a
24
+ module is too coarse for your question (it has many detail pages), read that
25
+ module's catalog page (`wiki/modules/<module>/catalog.md`) — it groups
26
+ detail pages by topic with one-line summaries. **Copy** detail-page paths
27
+ from the catalog as additional `--paths` candidates; the catalog itself is
28
+ navigation, not an answer source.
24
29
 
25
30
  **Done when:** you have the candidate's `index.md`, and a list of `wiki/...`
26
31
  links you can **copy** (0 items still counts as done).
@@ -29,36 +34,52 @@ candidate rather than searching everything blindly.
29
34
  such as `wiki/sandbox.md`, or a subdirectory such as `wiki/guides`). Call
30
35
  `+grep` with the candidate `--sources` and the copied list as `--paths`. Search
31
36
  with the index terms. If the first grep misses, rewrite the query **once**
32
- using different index terms — still with this same `--paths` — then stop
33
- rewriting.
37
+ using different index terms **only** — never paraphrase the user's wording
38
+ from memory — still with this same `--paths`. If the rewrite also misses,
39
+ stop grepping entirely: `+read --outline` the index page whose title or
40
+ section name relates to the question and read the matching heading range
41
+ from it. A third rewrite of the same idea produces no new recall.
34
42
 
35
43
  **Done when:** you have hits, or you have rewritten once, or step 1 copied
36
44
  0 paths. Copied 0 paths → skip grep and `+read --outline` the likeliest
37
45
  title page, or go back to discovery for the next candidate.
38
46
 
39
- A grep hit gives both a hit anchor and its enclosing section range:
40
-
41
- - `line` is the exact matched line. Use it as the anchor when the evidence
42
- is local.
43
- - `sectionStartLine` / `sectionEndLine` are the enclosing heading-section
44
- boundaries. Use them when the answer needs the whole section context, or
45
- as the maximum boundary when choosing a smaller window.
47
+ **Reading the result — the page-level `results` view.** The response is a page-level
48
+ `results` array: each entry is one page with its full `hitCount`, a
49
+ `pageKind`, and up to 4 `sections` previews (each with its breadcrumb,
50
+ `sectionStartLine`/`sectionEndLine`, and a text preview). Read the top
51
+ relevant pages until every subquestion of the question is backed by
52
+ sections you have actually read. `hitCount` tells you how dense the matches
53
+ are on a page; `pageKind: "catalog"` marks a module directory page — its
54
+ previews are detail-page entries, so treat them as navigation: add the
55
+ detail-page paths you see there to your read list instead of reading the
56
+ catalog as an answer source. When a page has `moreSections > 0` and the
57
+ answer is not in the previews, re-grep that single page to see all its
58
+ hits.
59
+
60
+ Each page-group section preview carries its enclosing heading-section
61
+ boundaries:
62
+
63
+ - `sectionStartLine` / `sectionEndLine` are the section boundaries. Use
64
+ them as the read window (or as the maximum boundary when choosing a
65
+ smaller window under them).
46
66
  - `+read --offset` / `--limit` are the actual read window. Choose the
47
67
  smallest reliable window that preserves the needed evidence; do not
48
68
  shell-truncate with `| head`.
69
+ - `+read --expand block` may include the rest of a Markdown block just
70
+ outside the requested window. Use `+read --expand none` when the line
71
+ window must be exact. Omit the flag to keep the server default, `block`.
49
72
 
50
73
  3. **Choose the section locator.** Pick one locator for the current target
51
74
  page:
52
75
 
53
- - **Same-page grep hit:** choose a read window from the hit. For narrow
54
- fact/table/code evidence, read a bounded window anchored at `line`; stay
55
- within `sectionStartLine`–`sectionEndLine`. For section-level meaning,
56
- field definitions, caveats, or rows that depend on the heading context,
57
- read the section range with
76
+ - **Section preview of a page group:** read the section range with
58
77
  `--offset sectionStartLine` and
59
- `--limit sectionEndLine - sectionStartLine + 1`. If the first window is
60
- too small, widen once up to the section range. Do not crawl by shifting
61
- offsets line by line.
78
+ `--limit sectionEndLine - sectionStartLine + 1`. For narrow
79
+ fact/table/code evidence, narrow the window under the section boundary
80
+ once you see the preview text. If the window turns out too small, widen
81
+ once up to the section range. Do not crawl by shifting offsets line by
82
+ line.
62
83
  - **Linked or related page:** if you follow a catalog/detail/related link to
63
84
  a different page, the old grep range no longer applies. If you have
64
85
  concrete terms for that new page, run `+grep --paths '["<new-page>"]'`
@@ -78,32 +99,41 @@ candidate rather than searching everything blindly.
78
99
  page response.
79
100
 
80
101
  4. **Read the selected window.** Read the selected window in one call. Windows
81
- come from the hit anchor, the grep hit's section boundaries, or two adjacent
82
- outline headings (`heading.line` of the target section to `heading.line - 1`
83
- of the next). If a window turns out too small, widen to the section boundary
84
- in one more call.
102
+ come from a page-group section preview's boundaries or two adjacent outline
103
+ headings (`heading.line` of the target section to `heading.line - 1` of the
104
+ next). If a window turns out too small, widen to the section boundary in one
105
+ more call.
85
106
 
86
107
  **Done when:** the needed evidence is in context without shell truncation,
87
108
  or the page response is complete and untruncated.
88
109
 
110
+ **Read coverage:** read the relevant candidate pages from the page results
111
+ until every subquestion of the user's question is backed by sections you
112
+ have actually read — not until a page "looks like the answer". Do not stop
113
+ to compose the answer while any subquestion still has no read evidence
114
+ behind it, and do not pick a single page by surface similarity between the
115
+ question wording and the page/module name or hit line.
116
+
89
117
  5. **Assess coverage, then answer or iterate.** Map the user's question into
90
118
  subquestions and check each one against the sections you actually read. If a
91
119
  subquestion is covered, answer with citations (knowledge base + page path +
92
120
  section). If a gap remains, go back to step 2 with another set of `--paths`
93
121
  **copied** from the index, or return to discovery for the next candidate.
94
- If the evidence is missing after the allowed search, say which subquestion is
95
- not covered instead of filling it from memory.
122
+ If the evidence is missing after the allowed search, the only acceptable
123
+ output for that subquestion is "not covered by the knowledge base" — do not
124
+ attach a confident value from general knowledge, not even with a disclaimer
125
+ or a self-declared boundary.
96
126
 
97
127
  **Done when:** every answered subquestion is supported by read sections, or
98
128
  the remaining gaps are explicitly reported as missing evidence.
99
129
 
100
130
  ## Anti-pattern: same-page offset crawling
101
131
 
102
- The failure this workflow prevents: grep returns a line number, you `+read` a
103
- tiny window around it, it is cut mid-evidence, so you nudge the window one line
104
- at a time. That wastes calls and never shows page structure. Instead: use the
105
- hit anchor, widen once up to the section boundary, or open `--outline` and read
106
- the selected heading range.
132
+ The failure this workflow prevents: reading a tiny window, finding it cut
133
+ mid-evidence, and nudging the window one line at a time. That wastes calls and
134
+ never shows page structure. Instead: read the page-group section range, widen
135
+ once up to the section boundary, or open `--outline` and read the selected
136
+ heading range.
107
137
 
108
138
  ## Related
109
139