@thinkingai/ae-cli 6.0.44 → 6.0.45
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 +5 -2
- package/README.zh.md +5 -2
- package/dist/{data-integration-2MYMANJI.js → data-integration-XQYB4X4F.js} +141 -21
- package/dist/index.js +2 -2
- package/dist/{te-kb-APXBWBDY.js → te-kb-SQCLHG6X.js} +245 -121
- package/package.json +2 -1
- package/skills/ae-data-integration/references/source-inspect.md +14 -1
- package/skills/ae-kb/SKILL.md +55 -50
- package/skills/ae-kb/references/query-workflow.md +112 -0
- package/skills/ae-kb-discovery/SKILL.md +105 -0
package/skills/ae-kb/SKILL.md
CHANGED
|
@@ -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. 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, 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."
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# ae-kb
|
|
@@ -15,25 +15,27 @@ ae-cli kb +<command> [options]
|
|
|
15
15
|
## Global Rules
|
|
16
16
|
|
|
17
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.
|
|
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.**
|
|
18
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.
|
|
19
20
|
- Prefer `--dry-run` before destructive or broad writes when the user has not already validated the target.
|
|
20
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.
|
|
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.
|
|
21
23
|
- JSON flags must be valid JSON strings, usually wrapped in single quotes in shell commands.
|
|
22
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`.
|
|
23
25
|
- `--host <url>` overrides the active AE host. It is available on every command and may be placed after the subcommand, e.g. `ae-cli kb +<command> --host <url>`.
|
|
24
26
|
- **CRITICAL — Host compat (do this first):** After each `ae-cli` run, check stderr and `_notice.host_compat`. If either is present, open the user reply with a short ⚠️ version warning and **quote the `npm i -g` / `npx skills add` (or update-cluster) lines verbatim**, then present the business result. Soft tip; `ok: true` can still carry the notice.
|
|
25
|
-
-
|
|
27
|
+
- Retrieval (`+index` / `+grep` / `+read`) is deterministic and server-side LLM-free; use it for simple factual lookups. Use `+ask` when the question requires synthesizing across multiple pages or multi-hop reasoning.
|
|
26
28
|
|
|
27
29
|
## Commands
|
|
28
30
|
|
|
29
31
|
| Command | Risk | Purpose |
|
|
30
32
|
|---|---:|---|
|
|
31
|
-
| `+
|
|
32
|
-
| `+ask` | read |
|
|
33
|
+
| `+ask` | read | LLM-powered Q&A over knowledge bases; for multi-page synthesis or multi-hop questions. |
|
|
34
|
+
| `+ask-status` | read | Query the current status of an ask execution by `--execution-id` without polling. |
|
|
33
35
|
| `+list` | read | List accessible knowledge bases filtered by buildStatus (default: compiled). |
|
|
34
36
|
| `+index` | read | List accessible knowledge bases and their `index.md` navigation maps. |
|
|
35
37
|
| `+grep` | read | Keyword-search knowledge base pages and return matched lines with context. |
|
|
36
|
-
| `+read` | read | Read a full knowledge base page
|
|
38
|
+
| `+read` | read | Read a full knowledge base page, a line window, or (with `--outline`) only the page heading tree. |
|
|
37
39
|
| `+new` | write | Create a new personal or company knowledge base. |
|
|
38
40
|
| `+add` | write | Upload local files, a non-recursive directory, or HTTP(S) pages converted to markdown. |
|
|
39
41
|
| `+url` | write | Upload a URL source directly with optional display name and parsing instruction. |
|
|
@@ -123,34 +125,26 @@ Use `+status` to inspect the current status of a knowledge base.
|
|
|
123
125
|
ae-cli kb +status --name engineering-handbook
|
|
124
126
|
```
|
|
125
127
|
|
|
126
|
-
### Query Knowledge
|
|
127
|
-
|
|
128
|
-
Use `+query` with a natural-language question. Optionally scope to specific knowledge bases or tune result count and locale.
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
ae-cli kb +query \
|
|
132
|
-
--query "How do we release a dashboard?" \
|
|
133
|
-
--sources '[{"scope":"company","name":"engineering-handbook"}]' \
|
|
134
|
-
--top-k 10 \
|
|
135
|
-
--locale zh
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
When `--sources` is provided, each entry requires:
|
|
139
|
-
|
|
140
|
-
- `scope`: knowledge base scope such as `personal` or `company`.
|
|
141
|
-
- `name`: knowledge base name.
|
|
142
|
-
|
|
143
128
|
### Ask Knowledge (LLM)
|
|
144
129
|
|
|
145
|
-
Use `+ask` when the
|
|
130
|
+
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
|
+
|
|
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.
|
|
146
133
|
|
|
147
134
|
```bash
|
|
135
|
+
# Default: submit and poll for completion
|
|
148
136
|
ae-cli kb +ask \
|
|
149
137
|
--question "How do we troubleshoot payment alerts?" \
|
|
150
138
|
--sources '[{"scope":"company","name":"engineering-handbook"}]' \
|
|
151
139
|
--model-id claude-sonnet-4-6 \
|
|
152
140
|
--max-turns 50 \
|
|
153
141
|
--locale zh
|
|
142
|
+
|
|
143
|
+
# Submit only, return executionId immediately (for batch processing)
|
|
144
|
+
ae-cli kb +ask --question "..." --no-wait
|
|
145
|
+
|
|
146
|
+
# Query execution status later
|
|
147
|
+
ae-cli kb +ask-status --execution-id <id>
|
|
154
148
|
```
|
|
155
149
|
|
|
156
150
|
- `--question`, alias `-q`: required natural-language question (1-2000 characters).
|
|
@@ -158,10 +152,12 @@ ae-cli kb +ask \
|
|
|
158
152
|
- `--model-id`: optional LLM model ID. Omit to use the platform default.
|
|
159
153
|
- `--max-turns`: optional agent turn limit (1-100, server default 50).
|
|
160
154
|
- `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
|
|
155
|
+
- `--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.
|
|
161
157
|
|
|
162
158
|
### List Accessible Knowledge Bases
|
|
163
159
|
|
|
164
|
-
Use `+list` when you only need accessible knowledge base metadata without loading `index.md` navigation maps.
|
|
160
|
+
Use `+list` when you only need accessible knowledge base metadata without loading `index.md` navigation maps. Omit `--build-status` to default to `compiled`; pass `idle` / `pending` / `compiling` / `compiled` / `failed` to filter by a specific status (system knowledge bases are always listed regardless of status):
|
|
165
161
|
|
|
166
162
|
```bash
|
|
167
163
|
ae-cli kb +list
|
|
@@ -173,6 +169,8 @@ ae-cli kb +list --build-status compiled
|
|
|
173
169
|
|
|
174
170
|
Use the deterministic retrieval primitives when an agent needs to explore knowledge base content like a code repository. These endpoints do not call an LLM on the server side.
|
|
175
171
|
|
|
172
|
+
**Before running a real query, read [`references/query-workflow.md`](references/query-workflow.md)** — it is the step-by-step procedure for turning a question into an answer without crawling. It covers candidate indexing, copied-path grep, same-page read windows, linked-page re-grep, outline-derived ranges, and coverage assessment. This section below is the per-command reference the workflow draws on.
|
|
173
|
+
|
|
176
174
|
Start with `+list` or `+index` to discover accessible knowledge bases. Use `+index` when you also need navigation maps:
|
|
177
175
|
|
|
178
176
|
```bash
|
|
@@ -190,26 +188,30 @@ Then use `+grep` to locate likely pages and line numbers:
|
|
|
190
188
|
ae-cli kb +grep \
|
|
191
189
|
--query "sandbox configuration" \
|
|
192
190
|
--sources '[{"scope":"company","name":"engineering-handbook"}]' \
|
|
191
|
+
--paths '["wiki/sandbox.md"]' \
|
|
193
192
|
--top-k 10
|
|
194
193
|
```
|
|
195
194
|
|
|
196
|
-
|
|
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.
|
|
196
|
+
|
|
197
|
+
Use `+read --outline` when the current target page has no reliable grep range and headings are needed to choose a section:
|
|
197
198
|
|
|
198
199
|
```bash
|
|
199
200
|
ae-cli kb +read \
|
|
200
201
|
--source '{"scope":"company","name":"engineering-handbook"}' \
|
|
201
202
|
--path "wiki/sandbox.md" \
|
|
202
|
-
--
|
|
203
|
-
--limit 200
|
|
203
|
+
--outline
|
|
204
204
|
```
|
|
205
205
|
|
|
206
|
-
|
|
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:
|
|
207
207
|
|
|
208
|
-
|
|
209
|
-
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
208
|
+
```bash
|
|
209
|
+
ae-cli kb +read \
|
|
210
|
+
--source '{"scope":"company","name":"engineering-handbook"}' \
|
|
211
|
+
--path "wiki/sandbox.md" \
|
|
212
|
+
--offset 42 \
|
|
213
|
+
--limit 60
|
|
214
|
+
```
|
|
213
215
|
|
|
214
216
|
### Remove One Source
|
|
215
217
|
|
|
@@ -233,29 +235,29 @@ ae-cli kb +remove --name engineering-handbook
|
|
|
233
235
|
|
|
234
236
|
## Command Reference
|
|
235
237
|
|
|
236
|
-
### `+
|
|
238
|
+
### `+ask`
|
|
237
239
|
|
|
238
240
|
```bash
|
|
239
|
-
ae-cli kb +
|
|
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]
|
|
240
242
|
```
|
|
241
243
|
|
|
242
|
-
- `--
|
|
244
|
+
- `--question`, alias `-q`: required natural-language question (1-2000 characters).
|
|
243
245
|
- `--sources`: optional JSON array of knowledge base refs. Omit to search all accessible knowledge bases.
|
|
244
|
-
- `--
|
|
246
|
+
- `--model-id`: optional LLM model ID. Omit to use the platform default.
|
|
247
|
+
- `--max-turns`: optional agent turn limit (1-100, server default 50).
|
|
245
248
|
- `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
|
|
249
|
+
- `--no-wait`: optional. Return immediately with `{executionId, status}` instead of polling.
|
|
250
|
+
- 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]`).
|
|
246
252
|
|
|
247
|
-
### `+ask`
|
|
253
|
+
### `+ask-status`
|
|
248
254
|
|
|
249
255
|
```bash
|
|
250
|
-
ae-cli kb +ask
|
|
256
|
+
ae-cli kb +ask-status --execution-id <id>
|
|
251
257
|
```
|
|
252
258
|
|
|
253
|
-
- `--
|
|
254
|
-
-
|
|
255
|
-
- `--model-id`: optional LLM model ID. Omit to use the platform default.
|
|
256
|
-
- `--max-turns`: optional agent turn limit (1-100, server default 50).
|
|
257
|
-
- `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
|
|
258
|
-
- **Token cost**: this command invokes an LLM on the server and consumes platform tokens. Prefer `+index` -> `+grep` -> `+read` for token-free deterministic retrieval.
|
|
259
|
+
- `--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.
|
|
259
261
|
|
|
260
262
|
### `+list`
|
|
261
263
|
|
|
@@ -263,7 +265,7 @@ ae-cli kb +ask --question "<question>" [--sources '[{"scope":"company","name":"k
|
|
|
263
265
|
ae-cli kb +list [--build-status compiled] [--locale zh|en|ja|ko]
|
|
264
266
|
```
|
|
265
267
|
|
|
266
|
-
- `--build-status`: optional
|
|
268
|
+
- `--build-status`: optional; one of `idle` / `pending` / `compiling` / `compiled` / `failed`. Omit to default to `compiled` (system knowledge bases are always listed regardless of status).
|
|
267
269
|
- `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
|
|
268
270
|
- Response items include `buildStatus`.
|
|
269
271
|
|
|
@@ -279,24 +281,27 @@ ae-cli kb +index [--sources '[{"scope":"company","name":"kb-name"}]'] [--locale
|
|
|
279
281
|
### `+grep`
|
|
280
282
|
|
|
281
283
|
```bash
|
|
282
|
-
ae-cli kb +grep --query "<keywords>"
|
|
284
|
+
ae-cli kb +grep --query "<keywords>" --sources '[{"scope":"company","name":"kb-name"}]' --paths '["wiki/page.md"]' [--top-k 10] [--locale zh|en|ja|ko]
|
|
283
285
|
```
|
|
284
286
|
|
|
285
|
-
- `--query`, alias `-q`: required keywords to search
|
|
286
|
-
- `--sources`:
|
|
287
|
+
- `--query`, alias `-q`: required keywords to search.
|
|
288
|
+
- `--sources`: required JSON array of knowledge base refs.
|
|
289
|
+
- `--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).
|
|
287
290
|
- `--top-k`: optional max number of hits, 1-50, default 10.
|
|
288
291
|
- `--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.
|
|
289
293
|
|
|
290
294
|
### `+read`
|
|
291
295
|
|
|
292
296
|
```bash
|
|
293
|
-
ae-cli kb +read --source '{"scope":"company","name":"kb-name"}' --path "index.md" [--offset 1] [--limit 200] [--locale zh|en|ja|ko]
|
|
297
|
+
ae-cli kb +read --source '{"scope":"company","name":"kb-name"}' --path "index.md" [--offset 1] [--limit 200] [--outline] [--locale zh|en|ja|ko]
|
|
294
298
|
```
|
|
295
299
|
|
|
296
300
|
- `--source`: required JSON object pointing to exactly one knowledge base.
|
|
297
301
|
- `--path`: required page path relative to the knowledge base root, such as `index.md` or `wiki/concepts/data-model.md`.
|
|
298
302
|
- `--offset`: optional 1-based start line.
|
|
299
303
|
- `--limit`: optional max line count, 1-10000.
|
|
304
|
+
- `--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.
|
|
300
305
|
- `--locale`: optional locale: `zh`, `en`, `ja`, or `ko`.
|
|
301
306
|
|
|
302
307
|
### `+new`
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# ae-kb deterministic query workflow
|
|
2
|
+
|
|
3
|
+
How to answer a knowledge question with the deterministic retrieval primitives
|
|
4
|
+
(`+list` / `+index` / `+grep` / `+read`) instead of `+ask`. Follow this order;
|
|
5
|
+
it is designed to reach the right section in a few calls and to avoid crawling a
|
|
6
|
+
page line by line.
|
|
7
|
+
|
|
8
|
+
Use `+ask` when the question requires synthesizing across multiple pages or
|
|
9
|
+
multi-hop reasoning; simple factual lookups are served by the steps below.
|
|
10
|
+
Everything below is server-side LLM-free.
|
|
11
|
+
|
|
12
|
+
## The loop
|
|
13
|
+
|
|
14
|
+
This picks up **after** `ae-kb-discovery` has listed accessible knowledge bases
|
|
15
|
+
and ranked candidates. Start here with a chosen candidate; scope every `+index`
|
|
16
|
+
/ `+grep` / `+read` call to it with `--sources` / `--source`. If the candidate
|
|
17
|
+
turns out not to cover the question, go back to `ae-kb-discovery` for the next
|
|
18
|
+
candidate rather than searching everything blindly.
|
|
19
|
+
|
|
20
|
+
1. **Index the candidate.** Call `+index --sources` with the discovery pick.
|
|
21
|
+
Use `index.md` for navigation, a fit check, and **query wording** — the real
|
|
22
|
+
terms in the index (product names, API identifiers, section titles) become
|
|
23
|
+
your `+grep` keywords.
|
|
24
|
+
|
|
25
|
+
**Done when:** you have the candidate's `index.md`, and a list of `wiki/...`
|
|
26
|
+
links you can **copy** (0 items still counts as done).
|
|
27
|
+
|
|
28
|
+
2. **Grep copied paths.** Copy 1–3 `wiki/...` entries from the index (a page
|
|
29
|
+
such as `wiki/sandbox.md`, or a subdirectory such as `wiki/guides`). Call
|
|
30
|
+
`+grep` with the candidate `--sources` and the copied list as `--paths`. Search
|
|
31
|
+
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.
|
|
34
|
+
|
|
35
|
+
**Done when:** you have hits, or you have rewritten once, or step 1 copied
|
|
36
|
+
0 paths. Copied 0 paths → skip grep and `+read --outline` the likeliest
|
|
37
|
+
title page, or go back to discovery for the next candidate.
|
|
38
|
+
|
|
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.
|
|
46
|
+
- `+read --offset` / `--limit` are the actual read window. Choose the
|
|
47
|
+
smallest reliable window that preserves the needed evidence; do not
|
|
48
|
+
shell-truncate with `| head`.
|
|
49
|
+
|
|
50
|
+
3. **Choose the section locator.** Pick one locator for the current target
|
|
51
|
+
page:
|
|
52
|
+
|
|
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
|
|
58
|
+
`--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.
|
|
62
|
+
- **Linked or related page:** if you follow a catalog/detail/related link to
|
|
63
|
+
a different page, the old grep range no longer applies. If you have
|
|
64
|
+
concrete terms for that new page, run `+grep --paths '["<new-page>"]'`
|
|
65
|
+
scoped to that page and use the new hit range.
|
|
66
|
+
- **No reliable range:** if the new page has no concrete grep terms, its
|
|
67
|
+
grep misses, or headings are needed to choose the right section, call
|
|
68
|
+
`+read --outline` for that page. It returns only the heading tree
|
|
69
|
+
(`{level, heading, line}`), independent of any offset/limit window, with
|
|
70
|
+
empty content.
|
|
71
|
+
|
|
72
|
+
A bare `+read` without `--offset` / `--limit` is only acceptable after the
|
|
73
|
+
response proves the whole page was returned (`startLine: 1`,
|
|
74
|
+
`endLine: totalLines`, and `truncated: false`).
|
|
75
|
+
|
|
76
|
+
**Done when:** you have a reliable range from the same-page grep hit, a new
|
|
77
|
+
page grep hit, an outline-derived heading range, or a complete untruncated
|
|
78
|
+
page response.
|
|
79
|
+
|
|
80
|
+
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.
|
|
85
|
+
|
|
86
|
+
**Done when:** the needed evidence is in context without shell truncation,
|
|
87
|
+
or the page response is complete and untruncated.
|
|
88
|
+
|
|
89
|
+
5. **Assess coverage, then answer or iterate.** Map the user's question into
|
|
90
|
+
subquestions and check each one against the sections you actually read. If a
|
|
91
|
+
subquestion is covered, answer with citations (knowledge base + page path +
|
|
92
|
+
section). If a gap remains, go back to step 2 with another set of `--paths`
|
|
93
|
+
**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.
|
|
96
|
+
|
|
97
|
+
**Done when:** every answered subquestion is supported by read sections, or
|
|
98
|
+
the remaining gaps are explicitly reported as missing evidence.
|
|
99
|
+
|
|
100
|
+
## Anti-pattern: same-page offset crawling
|
|
101
|
+
|
|
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.
|
|
107
|
+
|
|
108
|
+
## Related
|
|
109
|
+
|
|
110
|
+
- Command flags and JSON shapes: see the `+grep` / `+read` sections in
|
|
111
|
+
[`../SKILL.md`](../SKILL.md).
|
|
112
|
+
- Use `+ask` for multi-page synthesis or multi-hop questions. Default `+ask` submits then polls until the answer is ready; `--no-wait` and `+ask-status` are for batch submit/retrieve. See the `+ask` section in [`../SKILL.md`](../SKILL.md).
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ae-kb-discovery
|
|
3
|
+
description: >
|
|
4
|
+
Discover which AE/TE/ThinkingEngine knowledge bases accessible to the current user are worth searching, and decide whether to search at all, through read-only operations. Use when the user explicitly asks to search knowledge bases, internal documentation, or company materials. Also use when a task requires internal facts or business context, including product design and rules, events, campaign or operations calendars, release and iteration records, workflows, policies, and terminology; use it as well when this context is needed to explain data analysis results, anomalies, or trends and form evidence-backed conclusions. Do not use if the user explicitly asks not to access knowledge bases. This skill covers discovery and candidate selection; run the actual `+index` / `+grep` / `+read` / `+ask` retrieval with the `ae-kb` skill.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Knowledge Base Discovery
|
|
8
|
+
|
|
9
|
+
Treat knowledge bases as an optional source of internal facts and business context. Keep the user's original goal unchanged; knowledge base retrieval is a supporting workflow, not the task itself.
|
|
10
|
+
|
|
11
|
+
This skill decides **whether** to use a knowledge base and **which** knowledge base is worth searching. The retrieval procedure itself — inspecting the index, grep, reading sections, and optional LLM synthesis — lives in the `ae-kb` skill (`references/query-workflow.md`). Discover here, then hand off to `ae-kb` to execute.
|
|
12
|
+
|
|
13
|
+
## Decide Whether to Use This Skill
|
|
14
|
+
|
|
15
|
+
Use this skill when:
|
|
16
|
+
|
|
17
|
+
- The user explicitly asks to search a knowledge base, internal documentation, or company materials.
|
|
18
|
+
- The task requires organization-specific facts or context, such as product design and rules, events, campaign or operations calendars, release and iteration records, workflows, policies, or terminology.
|
|
19
|
+
- Internal context is needed to explain data analysis results, anomalies, or trends and form evidence-backed conclusions.
|
|
20
|
+
- The knowledge base context currently available does not cover the question, and discovering other accessible sources has clear value.
|
|
21
|
+
|
|
22
|
+
Do not use this skill when:
|
|
23
|
+
|
|
24
|
+
- The user explicitly asks not to use knowledge bases.
|
|
25
|
+
- The task only requires querying real-time state or performing an operation and does not need document context.
|
|
26
|
+
- General knowledge is sufficient for a reliable answer and internal evidence would not materially improve it.
|
|
27
|
+
|
|
28
|
+
## Discovery Workflow
|
|
29
|
+
|
|
30
|
+
### 1. Get the List of Accessible Knowledge Bases
|
|
31
|
+
|
|
32
|
+
First, get the lightweight list of knowledge bases accessible to the current user:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
ae-cli kb +list
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Use the exact `scope` and knowledge base name returned by the command, together with available metadata such as description, tags, language, and `bindings`. A binding identifies an associated context through `targetType`, `targetId`, and optional `targetName`. Do not guess a name, scope, or binding. Treat metadata returned by `+list` only as input for candidate selection, not as evidence from knowledge base content.
|
|
39
|
+
|
|
40
|
+
If `+list` is unavailable or fails, do not guess which knowledge bases exist. If the user explicitly requested a knowledge base search, explain that discovery cannot currently be completed. Otherwise, return to the original task and reassess the capabilities currently available.
|
|
41
|
+
|
|
42
|
+
### 2. Rank Candidate Knowledge Bases
|
|
43
|
+
|
|
44
|
+
Rank candidates in this order:
|
|
45
|
+
|
|
46
|
+
1. Prefer a knowledge base explicitly named by the user. Use the exact name and scope returned by `+list`, regardless of whether it has a matching binding.
|
|
47
|
+
2. Prefer candidates whose bindings exactly match the current session context. Match `targetType: project` against the current analysis project ID, `targetType: space` against the current community space ID, and `targetType: dwSpace` against the current digital workspace code.
|
|
48
|
+
3. For the remaining candidates, compare the user's request with the knowledge base name, description, and tags. Use language only as a preference between candidates with similar relevance; language alone does not establish relevance.
|
|
49
|
+
|
|
50
|
+
Compare `targetId` with the corresponding current ID or code first. Use `targetName` only as a secondary signal when an ID or code is unavailable; do not replace a conflicting ID match with a name match. A candidate with no bindings or no current-context match remains eligible for semantic ranking. A binding to another project or space lowers implicit priority but does not exclude the candidate, and an explicit user choice still takes precedence.
|
|
51
|
+
|
|
52
|
+
Select one preferred knowledge base by default. When several candidates are highly relevant, retain no more than three and try them one at a time in priority order. Do not read the indexes of all candidates in advance. A binding, name, description, tag, or language match only indicates that a knowledge base is worth searching; it does not prove a content match, grant access, or count as knowledge base evidence.
|
|
53
|
+
|
|
54
|
+
### 3. Hand Off to Retrieval
|
|
55
|
+
|
|
56
|
+
Once a preferred knowledge base is selected, hand off to the `ae-kb` skill and follow its `references/query-workflow.md` for the entire retrieval procedure — including when `+ask` is appropriate.
|
|
57
|
+
|
|
58
|
+
## Assess Coverage
|
|
59
|
+
|
|
60
|
+
- Full coverage: The page content read supports the key conclusions required for the information request or analysis.
|
|
61
|
+
- Partial coverage: The page content read provides only background, definitions, or partially relevant facts and cannot independently support the required conclusions.
|
|
62
|
+
- No coverage: No suitable candidate knowledge base exists, or `+grep` and `+read` return no content that can support the conclusions.
|
|
63
|
+
|
|
64
|
+
A candidate returned by `+list`, navigation returned by `+index`, a successful command, a tool call, or a metadata match does not count as a knowledge base hit. Only relevant page content that has actually been read can serve as knowledge base evidence.
|
|
65
|
+
|
|
66
|
+
## Use Knowledge Base Evidence in Analysis
|
|
67
|
+
|
|
68
|
+
When using internal context to explain data analysis results, anomalies, or trends:
|
|
69
|
+
|
|
70
|
+
1. First state what the analysis itself demonstrates, including the metric change, time range, affected entity, and magnitude.
|
|
71
|
+
2. Search using the affected entity, metric, time range, campaign or event name, product area, and release or version name.
|
|
72
|
+
3. Verify that the retrieved evidence:
|
|
73
|
+
- Applies to the same entity, product area, or business scope.
|
|
74
|
+
- Overlaps with the time range covered by the analysis.
|
|
75
|
+
- Records an event, rule, release, or change that actually took effect.
|
|
76
|
+
- Uses a version and effective date that remained valid during the analysis period.
|
|
77
|
+
4. Distinguish planned activities from completed events. A calendar or roadmap does not prove that an activity or release occurred unless the retrieved content confirms execution.
|
|
78
|
+
5. Combine analytical facts with retrieved internal evidence and state directly what the evidence supports. Do not list possible causes that lack evidence.
|
|
79
|
+
6. Use causal language such as "caused" or "led to" only when the available evidence establishes causality. Otherwise, say that the evidence supports a factor as a key explanation or that the factor is consistent with the observed change.
|
|
80
|
+
7. If the evidence is insufficient, state clearly that the cause cannot be determined from the available evidence. Do not fill evidence gaps with speculation.
|
|
81
|
+
8. When appropriate, organize the final answer in this order:
|
|
82
|
+
- Conclusion.
|
|
83
|
+
- Analytical evidence.
|
|
84
|
+
- Knowledge base evidence and relevant page paths.
|
|
85
|
+
- Necessary limitations of the evidence.
|
|
86
|
+
|
|
87
|
+
## Handle Partial or No Coverage
|
|
88
|
+
|
|
89
|
+
When knowledge base evidence provides only partial coverage, is entirely absent, or retrieval fails:
|
|
90
|
+
|
|
91
|
+
1. Stop repeating searches against the same candidate knowledge base.
|
|
92
|
+
2. If ranked candidates remain, switch to the next candidate. Search no more than three knowledge bases in one task.
|
|
93
|
+
3. When all candidates provide no coverage, return to the user's original request instead of remaining in the knowledge base retrieval subtask.
|
|
94
|
+
4. Reassess the capabilities currently available and choose the next path that best serves the original task. Do not hard-code a fixed fallback.
|
|
95
|
+
5. Retain verified background evidence when useful, but never attribute conclusions drawn from other sources to a knowledge base.
|
|
96
|
+
6. Do not report an unsuccessful knowledge base search unless the retrieval failure itself affects the user's decision.
|
|
97
|
+
|
|
98
|
+
Knowledge base information must not replace required business operations. If the original task also requires real-time data or an action, complete that part through the appropriate available capability.
|
|
99
|
+
|
|
100
|
+
## Safety Boundaries
|
|
101
|
+
|
|
102
|
+
- Limit knowledge base access to the read-only retrieval primitives (`+list`, `+index`, `+grep`, `+read`, and `+ask` when the question requires multi-page synthesis or multi-hop reasoning). Do not create, upload, compile, or delete knowledge bases.
|
|
103
|
+
- Respect existing scope, tenant, and membership permissions. Do not attempt to bypass an inaccessible knowledge base.
|
|
104
|
+
- Do not expose internal root paths, access tokens, or raw permission metadata.
|
|
105
|
+
- For protected knowledge bases, provide only summaries and synthesized conclusions allowed by the current permissions. Do not export complete source text or extensive verbatim excerpts.
|