graphIndexBlock renders the prompt block: the deterministic MOC card plus the pull hint. Returns "" when disabled or the graph is empty, so quiet setups pay nothing. The card itself is byte-stable between knowledge changes, so it does not bust the prompt cache turn to turn.
()
| 46 | // nothing. The card itself is byte-stable between knowledge changes, so it does |
| 47 | // not bust the prompt cache turn to turn. |
| 48 | func (cli *ChatCLI) graphIndexBlock() string { |
| 49 | if !graphIndexEnabled() { |
| 50 | return "" |
| 51 | } |
| 52 | card := cli.buildKnowledgeGraph().IndexCard(graphIndexMaxHubs) |
| 53 | if card == "" { |
| 54 | return "" |
| 55 | } |
| 56 | return "# Knowledge Graph (index)\n" + card + "\n" + graphRecallHint |
| 57 | } |
| 58 | |
| 59 | // buildKnowledgeGraph assembles the graph from the live stores. Safe to call |
| 60 | // with a nil memory store or persona handler — it simply yields a smaller graph. |
no test coverage detected