ai-advisory-board 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/bin/aab.js +19 -30
- package/dist/bin/aab.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# CHANGELOG — AI Advisory Board CLI
|
|
2
2
|
|
|
3
|
+
## 0.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 80562ca: Fix wiki **Ask** failing with `Query LLM call failed: … "Prompt is too long"` on large wikis.
|
|
8
|
+
|
|
9
|
+
The query prompt inlined the wiki's `catalog.json` (and index). On a wiki with hundreds of pages (e.g. from email/Slack ingestion) that's ~700 KB+ → 170k+ tokens, overflowing the model's context window before the question is even answered. The query agent now **walks the wiki natively with Read/Grep/Glob** — exactly the approach documented in `KNOWLEDGE_WIKI.md` §15.2: `Grep wiki/` for the question's terms, resolve slugs via the compact catalog without reading it whole, and `Read` only the 1–3 relevant pages. Nothing from the wiki is inlined into the prompt, so it stays a fixed small size no matter how large the wiki grows. Answers are unchanged on small wikis; large wikis now work instead of erroring.
|
|
10
|
+
|
|
3
11
|
## 0.12.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/dist/bin/aab.js
CHANGED
|
@@ -9954,6 +9954,7 @@ init_errors();
|
|
|
9954
9954
|
|
|
9955
9955
|
// src/core/prompts/skill-query.ts
|
|
9956
9956
|
function buildQueryPrompt(input) {
|
|
9957
|
+
const dir = input.wikiDir.replace(/\\/g, "/").replace(/\/+$/, "") || "wiki";
|
|
9957
9958
|
const lines = [];
|
|
9958
9959
|
lines.push("You are the wiki query agent for an AI advisory-board CLI.");
|
|
9959
9960
|
lines.push("Your job: answer ONE question using the user's knowledge wiki, citing the pages you used.");
|
|
@@ -9964,34 +9965,21 @@ function buildQueryPrompt(input) {
|
|
|
9964
9965
|
lines.push("## Wiki schema (`wiki/KNOWLEDGE.md`)");
|
|
9965
9966
|
lines.push(input.wikiKnowledgeMd);
|
|
9966
9967
|
lines.push("");
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
} else {
|
|
9976
|
-
lines.push("## Wiki index (`wiki/index.md`, possibly truncated)");
|
|
9977
|
-
lines.push("");
|
|
9978
|
-
lines.push("The `<!-- AAB:SLUG-MAP -->` section is your `[[wikilink]]` resolver. Do NOT re-`Read` the full index.md (it can exceed 256 KB) \u2014 `Grep` it or `Read` with `limit: 150` if you need more.");
|
|
9979
|
-
lines.push("");
|
|
9980
|
-
lines.push(input.wikiIndexMd);
|
|
9981
|
-
}
|
|
9982
|
-
lines.push("");
|
|
9983
|
-
lines.push("## Your procedure");
|
|
9984
|
-
lines.push(`1. From the catalog/index above, identify the most relevant \u2264${input.maxPages} pages \u2014 do NOT read the full index.md.`);
|
|
9985
|
-
lines.push("2. `Grep wiki/` for keywords from the question (target `summary:` and `tags:` first).");
|
|
9986
|
-
lines.push("3. `Read` only the relevant pages. Follow `[[wikilinks]]` only when useful.");
|
|
9987
|
-
lines.push("4. Synthesize a focused answer.");
|
|
9968
|
+
lines.push("## How to retrieve - the wiki lives at `" + dir + "/`; walk it with your tools");
|
|
9969
|
+
lines.push(
|
|
9970
|
+
"The wiki can hold hundreds of pages - do NOT try to read it all, and do NOT expect it inlined here. Retrieve on-demand, within your tool budget:"
|
|
9971
|
+
);
|
|
9972
|
+
lines.push("1. **`Grep " + dir + "/` for the key terms in the question first** (entity names, topics). Target `summary:` and `tags:` frontmatter. Try both English and the user's own language (e.g. Danish) where relevant.");
|
|
9973
|
+
lines.push("2. To resolve a slug to a file path, the compact catalog is at `" + dir + "/.aab/catalog.json` - but it can be large, so `Grep` it for the term rather than `Read`-ing it whole. **Never `Read " + dir + "/index.md` in full** (it can exceed 256 KB) - `Grep` it or `Read` with `limit: 150`.");
|
|
9974
|
+
lines.push("3. `Read` only the " + input.maxPages + " or fewer most relevant pages (usually 1-3). Follow `[[wikilinks]]` only when they help answer the question.");
|
|
9975
|
+
lines.push("4. Synthesize a focused answer grounded in what you actually read. If the wiki has nothing on the topic, say so plainly in `notes`.");
|
|
9988
9976
|
lines.push("5. Mark any claims you inferred (rather than read directly from a page) with `^[inferred]`.");
|
|
9989
|
-
lines.push("6. NEVER fabricate page slugs in citations
|
|
9977
|
+
lines.push("6. NEVER fabricate page slugs in citations - only cite slugs you actually opened.");
|
|
9990
9978
|
lines.push("");
|
|
9991
|
-
lines.push("## Output (return ONLY this raw JSON object
|
|
9979
|
+
lines.push("## Output (return ONLY this raw JSON object - no fences, no commentary)");
|
|
9992
9980
|
lines.push("");
|
|
9993
9981
|
lines.push("{");
|
|
9994
|
-
lines.push(` "answer": "<markdown
|
|
9982
|
+
lines.push(` "answer": "<markdown - the answer to the user's question, terse and grounded in the wiki>",`);
|
|
9995
9983
|
lines.push(' "citations": ["slug-a", "slug-b", ...], // wiki slugs you actually used');
|
|
9996
9984
|
lines.push(' "notes": "Optional 1-line caveat (e.g., \\"wiki contained no info on X\\")."');
|
|
9997
9985
|
lines.push("}");
|
|
@@ -10006,14 +9994,14 @@ async function queryWiki(opts) {
|
|
|
10006
9994
|
}
|
|
10007
9995
|
const maxPages = opts.maxPages ?? opts.settings.knowledgeWiki?.maxAgentPagesPerCall ?? 10;
|
|
10008
9996
|
const model = pickQueryModel(opts.settings, opts.modelOverride);
|
|
10009
|
-
const wikiKnowledgeMd =
|
|
10010
|
-
|
|
10011
|
-
|
|
9997
|
+
const wikiKnowledgeMd = capText(
|
|
9998
|
+
existsSync25(p.wikiKnowledge) ? readFileSync18(p.wikiKnowledge, "utf8") : "",
|
|
9999
|
+
KNOWLEDGE_CHAR_BUDGET
|
|
10000
|
+
);
|
|
10012
10001
|
const prompt2 = buildQueryPrompt({
|
|
10013
10002
|
question: opts.question,
|
|
10014
10003
|
wikiKnowledgeMd,
|
|
10015
|
-
|
|
10016
|
-
wikiCatalogJson,
|
|
10004
|
+
wikiDir: "wiki",
|
|
10017
10005
|
maxPages
|
|
10018
10006
|
});
|
|
10019
10007
|
logger.debug("[query] starting", { question: opts.question.slice(0, 80), model, maxPages });
|
|
@@ -10088,8 +10076,9 @@ function pickQueryModel(settings, override) {
|
|
|
10088
10076
|
}
|
|
10089
10077
|
function capText(text, max) {
|
|
10090
10078
|
if (text.length <= max) return text;
|
|
10091
|
-
return text.slice(0, max) + "\n\u2026[truncated \u2014
|
|
10079
|
+
return text.slice(0, max) + "\n\u2026[truncated \u2014 Grep the wiki instead of reading this in full]";
|
|
10092
10080
|
}
|
|
10081
|
+
var KNOWLEDGE_CHAR_BUDGET = 16e3;
|
|
10093
10082
|
|
|
10094
10083
|
// src/core/knowledge/lint.ts
|
|
10095
10084
|
import {
|