Engineering/AI documentation
Knowledge Memory
The Memory knowledge tab manages project knowledge artifacts and retrieval material.
Concepts: rag
Implementation Summary
The Memory knowledge tab manages project knowledge artifacts and retrieval material for the active project.
Frontend Surface
frontend/src/components/memory/MemoryView.tsxfrontend/src/lib/memoryApi.tsbackend/app/api/routes/memory.py
State, API, And Backend Contracts
Stores
- None recorded.
API And Backend
backend/app/api/routes/memory.py
Ingestion, Chunking And Measured Retrieval (2026-09-25)
- **One writer per uploaded file.** The upload route owns an upload's ingestion (Document, evidence
units, both indices) and creates its research tasks from the plaintext before encryption. The
file watcher, which also watches every project's upload directory, skips managed uploads: indexing
them too raced the route and left two copies of each chunk in the vector store (2,134 rows for
1,097 spans on the Harbor Ledger corpus). Reprocess cleans existing duplicates.
- **Uploads are classified by the researcher's file name.** An upload is stored as
<uuid>.<ext>,
so the task rules keyed on the name (interview, survey, usability, field notes, diary, competitor)
never matched it; the route now passes the original name for classification and task titles. An
upload does not raise the watcher's sticky "new research file" suggestion (the upload has its own
confirmation; stacked suggestions covered the Memory tabs at 375 px). Files dropped into a watched
folder still raise it.
- **Chunking parameters mean what they say.**
chunk_overlap=0is zero (it used to become the
default 180), a chunk size must be positive, and the splitter always advances, so a large overlap
can no longer loop forever.
- **Measured retrieval.**
python -m app.evals.retrieval_eval evaluate|ablate|budgetmeasures
nDCG@10, Recall@10 and MRR@10 with bootstrap intervals on span-graded qrels over the Harbor Ledger
corpus, with paired randomization tests (Holm) for ablations and budget recall per context
window. Results with the local nomic-embed-text embedder are in
docs/build-stream/2026-09-25-spine-findings-evidence.md (measurements 1-3); the five-embedder
comparison behind the BGE-M3 default (DEC-15) is in the same file.
Architecture Notes
- The feature is mounted through
frontend/src/components/memory/MemoryView.tsxand the UI navigation path recorded in the inventory. backend/app/api/routes/memory.pyvalidates project visibility before opening vector or keyword memory storage, so unknown or unauthorized project ids cannot create or inspect memory indexes.frontend/src/components/memory/MemoryView.tsxremounts project-backed memory tabs when the active project changes so local chunks, search results, notes, and health state do not linger across projects.- Memory source rows, health breakdowns, filters, search results, and chunks resolve uploaded document metadata to a human-readable title (with the filename as a disambiguator); the canonical source path remains in the DOM title and is still used for filtering and deletion.
- If document metadata cannot be loaded, the UI safely falls back to the source basename without blocking memory browsing.
- Search results render their hybrid rank (
data-testid=memory-result-rank) rather than the reciprocal-rank-fusion sum, which ranges about 0.005-0.02 and read as "1.6%" for the best match.KeywordIndex.searchruns the exact-phrase query first and fills top-k from the all-terms query, keeping two-character tokens;VectorStore.delete_file_sourcedeletes both the full-path and basename spellings of a source, so reprocess is idempotent. Pinned bytests/test_retrieval_correctness_fixes.pyand simulation scenario85-retrieval-correctness. - The frontmatter and manifest entries are the durable contract for agents updating this page after code changes.
- When the referenced component, store, route, agent, skill, or test behavior changes, regenerate and validate the feature documentation.
Agents, Skills, LLM, MCP, And Permissions
- RAG-related behavior depends on project context, documents, memory, or retrieval material referenced by the cited stores and routes.
Tests And Verification
tests/test_memory.py
Related Features
Related Concepts
Compass Evidence
- Spec/task: CF-SPEC-60 / CF-757
- Inventory source:
docs/features/inventory.json
When To Update
- Update this page whenever the listed UI components, stores, routes, model behavior, permissions, or tests change.
- Regenerate the site and machine manifests with
python scripts/feature_docs.py --seed-missing --generate-site --check.