feat: add rag evidence postprocess blocks

This commit is contained in:
aruo
2026-07-05 03:03:18 +08:00
parent 4a94c14feb
commit 5197712719
12 changed files with 497 additions and 1 deletions
@@ -0,0 +1,26 @@
## 1. Evidence Model
- [x] 1.1 Add an `EvidenceBlock` DTO.
- [x] 1.2 Add evidence block list and postprocess count fields to `LookupResult`.
## 2. Evidence Postprocess
- [x] 2.1 Build evidence blocks from L0 matches and L1 candidates in `LookupKnowledgeTool`.
- [x] 2.2 Deduplicate evidence by stable source key.
- [x] 2.3 Preserve existing primary/supplement compatibility behavior.
## 3. Trace Recording
- [x] 3.1 Extend `ToolInvocationRecorder.LookupKnowledgeRecord` with evidence block summaries and postprocess counts.
- [x] 3.2 Persist evidence block summaries in `retrieval_details`.
## 4. Tests
- [x] 4.1 Add or update tests for evidence block creation and deduplication.
- [x] 4.2 Add or update tests for persisted evidence block summaries.
- [x] 4.3 Run targeted tests and the RAG retrieval baseline evaluator.
## 5. Validation
- [x] 5.1 Run OpenSpec validation for the change.
- [x] 5.2 Review git diff to confirm only expected code/spec/test files changed.