Improve context retention, tool routing, memory retrieval and stream metrics #71

Merged
ryan merged 1 commits from feat/context-quality into main 2026-10-12 20:19:51 -04:00
Owner

Long tool turns repeatedly carry full results and every tool schema into the model. Select relevant tool groups on each call, bind the same subset on primary and fallback models, and offer discovery to enable additional groups. Saved memories rank query relevance ahead of recency.

Compact supported tool artifacts as structured JSON while preserving totals, dates, filters, source identities and explicit omission counts. Focused Obsidian reads retain their requested range; heading indexes support subsequent reads. Original checkpoint messages and artifacts remain unchanged by compaction.

Persist bounded historical evidence in a transactional SQLite sidecar, keyed by authenticated user and conversation. Integrate it into streaming and non-streaming requests and delete it with the conversation. Optional historical evidence yields to the current request. The sidecar defaults beside the checkpoint database and supports an explicit path override.

Correct stream measurements: distinguish backend token usage from emitted content chunks, report partial usage and per-call model identity, and count persistence failures and cancellations once. Add offline scenarios that validate exact context facts, source identities, estimated budgets and local compaction latency.

Validation: all 356 unit tests pass; 3 frontend renderer tests, TypeScript checking, frontend build, Ruff and formatting hooks pass. Every result received two reviews, with independent fix verification for the findings.

Limits: routing and memory ranking are lexical; persisted summaries are bounded extractive evidence, not semantic model-generated summaries. Token estimates remain approximate. Offline evaluations measure context retention, not generated-answer accuracy. SQLite workers must share the durable checkpoint volume. See docs/context-management.md.

Long tool turns repeatedly carry full results and every tool schema into the model. Select relevant tool groups on each call, bind the same subset on primary and fallback models, and offer discovery to enable additional groups. Saved memories rank query relevance ahead of recency. Compact supported tool artifacts as structured JSON while preserving totals, dates, filters, source identities and explicit omission counts. Focused Obsidian reads retain their requested range; heading indexes support subsequent reads. Original checkpoint messages and artifacts remain unchanged by compaction. Persist bounded historical evidence in a transactional SQLite sidecar, keyed by authenticated user and conversation. Integrate it into streaming and non-streaming requests and delete it with the conversation. Optional historical evidence yields to the current request. The sidecar defaults beside the checkpoint database and supports an explicit path override. Correct stream measurements: distinguish backend token usage from emitted content chunks, report partial usage and per-call model identity, and count persistence failures and cancellations once. Add offline scenarios that validate exact context facts, source identities, estimated budgets and local compaction latency. Validation: all 356 unit tests pass; 3 frontend renderer tests, TypeScript checking, frontend build, Ruff and formatting hooks pass. Every result received two reviews, with independent fix verification for the findings. Limits: routing and memory ranking are lexical; persisted summaries are bounded extractive evidence, not semantic model-generated summaries. Token estimates remain approximate. Offline evaluations measure context retention, not generated-answer accuracy. SQLite workers must share the durable checkpoint volume. See docs/context-management.md.
ryan added 1 commit 2026-10-12 20:19:43 -04:00
ryan merged commit 3ab7faf139 into main 2026-10-12 20:19:51 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ryan/simbarag#71