mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-13 03:13:41 +08:00
buildWikiContext enumerated an agent's bound knowledge-base pages into the system prompt capped only by maxContextChars (default 10000, sized for large cloud models). On a small-context model a large KB therefore consumed a big fixed slice of the window on every turn — the "tool token estimate fills the context" report in #521 (the growth lands in the system-prompt bucket, not the tool-schema bucket; wiki tool schemas are fixed-size and do not scale with file count). Add a budgeted buildWikiContext(agentId, budgetTokens) overload mirroring buildRelevantContext: the page enumeration also stops once the estimated token total exceeds the budget, appending the existing '... and more (use wiki_list_pages)' hint. AgentGraphBuilder passes the same prefix budget it already applies to the memory block; the legacy Integer.MAX_VALUE path keeps chars-only behavior for large models. Tests cover null-budget (all pages), token-budget truncation, and zero-budget skip. |
||
|---|---|---|
| .. | ||
| src | ||
| Dockerfile | ||
| pom.xml | ||
| settings.xml | ||