Files
loki/scripts/test
Mao NakamotoandClaude Opus 4.8 5765603098 feat(loki): harden context — robust fallback, section chunking, retrieval diversity
Push toward "useful even on a modest model": make the harness so good and so
robust that model quality matters less.

- Robustness: askLoki now treats an empty or "couldn't generate a response"
  gateway reply as a failure (not just !ok) and falls back — so a flaky/thinking
  model that emits no final payload never surfaces a broken answer as Loki's.
- Precision: chunkMarkdown splits essays into section-sized passages (h2/h3, then
  paragraph) so retrieval returns the relevant passage, not a truncated 6k blob.
  Reindexer re-chunks essays; deleteKnowledgeByTypes clears owned types first so
  the index is a true mirror (no orphans from id changes / removed docs).
- Coverage: Loki's retrieved-detail now pulls a larger pool and caps chunks per
  source, so a cross-project question gets breadth instead of six chunks of one
  project.

Pure chunker unit-tested (32/32). tsc + lint clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 07:41:53 +02:00
..