WeKnora/internal/agent
adawang 1c735ebb9e feat(wiki): front-load static rules in chunk-citation prompt for prefix cache
WikiChunkCitationPrompt placed the per-batch <chunks> block before the
static rules, output schema and the per-document-stable <candidate_slugs>.
Within one document only ChunksXML changes between batches, so the stable
content trailing the chunks could not form a long common prefix and
providers re-billed the static rules on every citation batch (issue #1687
measured ~6.4% prefix-cache hit rate on wiki synthesis).

Reorder to [rules | output schema | candidate_slugs | chunks] so every
batch after the first shares the long [rules | candidate_slugs] prefix.
No instruction text was dropped; only block order and the inline
above/below directional references changed. Verified the cacheable prefix
grows from 281 to 2366 bytes and is byte-identical across batches.

Addresses #1687

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 16:58:12 +08:00
..
approval fix(agent): enhance user authorization and concurrency handling in tool approval 2026-05-10 22:57:12 +08:00
memory feat(agent): enhance message consolidation and context management 2026-03-25 22:08:29 +08:00
skills feat: adapt preloaded skills to smart-reasoning agent 2026-02-04 20:08:49 +08:00
token feat(agent): enhance message consolidation and context management 2026-03-25 22:08:29 +08:00
tools feat(agent): add tool result persistence trimming for large outputs 2026-06-16 01:09:23 +08:00
act.go fix(chat): preserve provider tool-call metadata 2026-06-09 20:55:20 +08:00
const.go feat: Implement wiki_config updates in knowledge base management 2026-04-22 21:17:21 +08:00
engine.go refactor(agent): remove final_answer tool references and update related logic 2026-06-04 15:48:04 +08:00
engine_image_test.go feat: auto-describe MCP tool result images via VLM 2026-03-25 21:38:15 +08:00
engine_test.go feat(agent): enhance event routing for reasoning and answers in streaming 2026-06-04 15:48:04 +08:00
finalize.go fix(agent): 修复WeKnora对话完前端未显示结束标记问题 2026-05-07 16:34:20 +08:00
langfuse_test.go feat(observability): instrument agent ReAct loop and tool calls in Langfuse 2026-04-24 19:58:08 +08:00
observe.go fix(chat): preserve provider tool-call metadata 2026-06-09 20:55:20 +08:00
observe_test.go fix(chat): preserve provider tool-call metadata 2026-06-09 20:55:20 +08:00
prompts.go feat: Update agent type presets and prompt templates for improved knowledge base handling 2026-04-22 21:18:34 +08:00
prompts_wiki.go feat(wiki): front-load static rules in chunk-citation prompt for prefix cache 2026-06-16 16:58:12 +08:00
prompts_wiki_test.go feat(wiki): front-load static rules in chunk-citation prompt for prefix cache 2026-06-16 16:58:12 +08:00
think.go refactor(agent): remove final_answer tool references and update related logic 2026-06-04 15:48:04 +08:00