diff --git a/docs/capabilities/analysis.md b/docs/capabilities/analysis.md index 19fbe4d6..5effc127 100644 --- a/docs/capabilities/analysis.md +++ b/docs/capabilities/analysis.md @@ -46,6 +46,8 @@ async with HaikuRAG("my.lancedb") as client: ## State -When dependencies expose a state dictionary, `AnalysisState` is stored under `"analysis"`. It contains the document filter, code execution log, searches, and citations. Per-run searches and executions reset automatically; the filter and citation index persist. +When dependencies expose a state dictionary, `AnalysisState` is stored under `"analysis"`. It contains the document filter, code execution log, searches, citations, and the `evidence` record of what was retrieved and cited per question. Searches and executions are cleared when a new question starts, and a resumed question keeps them; the filter, citation index and evidence record persist. + +This capability does not alter the message history either. Register the [compaction capability](index.md#multi-turn-conversations) to compact earlier questions. The capability lazily opens both LanceDB and the sandbox only after it is loaded and a tool requires them. Resources close at the end of the agent run. diff --git a/docs/capabilities/rag.md b/docs/capabilities/rag.md index 00a912bb..35c3fbf2 100644 --- a/docs/capabilities/rag.md +++ b/docs/capabilities/rag.md @@ -37,16 +37,19 @@ class RAGState(BaseModel): citation_index: dict[str, Citation] citations: list[str] document_filter: str | None + evidence: CapabilityEvidenceRecord searches: dict[str, list[SearchResult]] ``` -`document_filter` persists between runs. Current citations and searches reset for each run, while the citation index remains available to the host application. +`document_filter`, `citation_index` and `evidence` persist across runs. Citations and searches are cleared when a new question starts; a run that resumes a question keeps the evidence it is still answering from. + +`evidence` records which chunks this capability retrieved and cited, and in which question. `haiku.rag.capabilities.ledger.citation_status(records, question=...)` derives `missing`, `grounded` or `ungrounded` from it, across capabilities. State is ordinary application state; the capability does not depend on AG-UI. An AG-UI application can expose it using Pydantic AI's standard adapter. ## Context management -Large RAG tool results from earlier user turns are replaced with a short marker before model requests. Tool-call pairing and current-turn evidence are retained. This prevents long conversations from repeatedly sending old retrieved content. +This capability does not alter the message history. To stop long conversations resending old retrieved content, register the [compaction capability](index.md#multi-turn-conversations) alongside it. ## Domain context and vision