feat(kb): add per-doc summaries to get_knowledge_base response#85
Merged
mhersson merged 1 commit intoMay 12, 2026
Merged
Conversation
- Add extractSummary parser to service_knowledge.go: scans for first ## Summary heading, collects content until next ## heading or EOF, returns empty string when section is absent - Add Summaries map[string]string to KnowledgeBaseRead and getKnowledgeBaseOutput; non-nil guaranteed in all code paths - Populate Summaries in ReadKnowledgeBase for each loaded doc - Nil-check Summaries alongside Docs in the MCP handler - Add ## Summary placeholder as first level-2 heading in all four refresh-knowledge doc templates (5.1–5.4) with 150–300 token spec - Add surgical 2-3 sentence triage guidance to KB-loading step in create-plan, run-autonomous, brainstorming, systematic-debugging skills - Document summaries field and agent usage pattern in docs/agent-workflow.md - 6 new unit tests: TestExtractSummary (4 cases), PopulatesSummaries, SummariesNonNilWhenEmpty
2cac0a4 to
e1ec788
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
summariesfield to theget_knowledge_baseMCP tool response:{doc_name → string}, populated by parsing the first## Summarysection from each KB doc (empty string when absent, never null)refresh-knowledge.mdtemplates to require## Summaryas the first level-2 heading on every generated doc (150–300 tokens)create-plan,run-autonomous,brainstorming, andsystematic-debuggingskillsdocs/agent-workflow.mdTest plan
go test ./internal/...— 17 packages pass, including 6 new tests:TestExtractSummary(4 table-driven cases),TestReadKnowledgeBase_PopulatesSummaries,TestReadKnowledgeBase_SummariesNonNilWhenEmptygo build ./...— clean buildget_knowledge_baseMCP response includessummariesfield after arefresh_knowledge_baserun## Summarysections return empty strings (backward-compatible)