-
Notifications
You must be signed in to change notification settings - Fork 0
RAG and Knowledge
Yash Aryan edited this page Aug 8, 2026
·
1 revision
flowchart TB
Refs[Project references] --> Ingest[chunk + embed]
Ingest --> PC[Chroma: anylm_project_context]
Chat[User message] --> EmbedQ[embed query]
EmbedQ --> PC
PC --> Prompt[System prompt chunks + sources]
Threads[Prior turns] --> Mem[anylm_project_memory]
Mem --> Prompt
Org[General/org KB] --> VS[vectorstore collections]
VS --> Prompt
Turns[Completed turns] --> Remember[memory + graph extract]
Remember --> Mem
Remember --> KG[Local knowledge graph]
| Module | Responsibility |
|---|---|
rag.ts |
Chunking, similarity, top-k helpers |
context.ts |
Ingest references; retrieve for prompt |
embed.ts |
Ollama embeddings |
chroma.ts / chroma-server.ts
|
Client + bundled server lifecycle |
memory.ts |
Cross-thread recall / remember |
vectorstore.ts |
General / org knowledge |
graph/ |
Entity/relation store + extract |
- Default model:
nomic-embed-text(overrideANYLM_EMBED_MODEL). - If embeddings unavailable, chat falls back to stored summaries for references.
Startup tries to ensure Chroma (startup-deps.ts). If the server or collections fail:
- Reads return empty
- Writes may be dropped
- Chat still works with weaker context
Never hard-crash the app on vector DB errors when adding features.
Adding a reference (text-like: .txt .md .json .csv .log, plus richer parsers where implemented):
- Read file contents in main
- Chunk
- Embed chunks
- Upsert into project collection (user-scoped)
- Store short summary for UI / fallback
On chat:
- Embed latest user text
- Query top-k chunks with source names
- Inject into system prompt
- Optionally blend memory / org hits
Separate from vectors: structured entities/relations extracted around turns (graph/). Useful for “what do we know” style grounding; inspect store module when extending.
- RAG references are curated project docs.
-
Workspace FS tools operate on a picked folder for coding — different subsystem (
workspace.ts,project-coding/).
- Keep chunk sizes / top-k coherent with context window of local models.
- User-scope collections carefully (multi-account machines).
- Add tests for thin/invalid document rejection (see documents tests).
- When changing collection names, plan migration — silent empty RAG is a common footgun.
| Page | Description |
|---|---|
| Home | Overview and navigation |
| Getting-Started | Local setup |
| Architecture | System design |
| Code-Structure | Directory map |
| Features | Feature inventory |
| Contributing | PR workflow |
| How-to-Change | Common change recipes |
| Gotchas | Footguns |
| Chat-Pipeline | Turn lifecycle |
| IPC-Contract | window.api |
| Auth-and-Firebase | Identity + rules |
| RAG-and-Knowledge | Vectors + graph |
| Agents | Multi-agent |
| Proxy-and-Governance | :3227 + policies |
| Configuration | Env + settings |
| Testing | bun test |
| Build-and-Release | Packaging |
| Skills | Build skills |
| Tools | Build tools |
| MCP-and-Extensions | MCP status + options |