|
18 | 18 |
|
19 | 19 | <p align="center"> |
20 | 20 | <a href="./README_ZH.md">简体中文</a> · |
21 | | - <a href="./docs/README.md">Docs Index</a> · |
| 21 | + <a href="./docs/README.md">Docs</a> · |
22 | 22 | <a href="./docs/guides/first-use.md">First Use</a> · |
23 | | - <a href="./docs/changelog/2026-04-09.md">2026-04-09 Update</a> · |
24 | | - <a href="./docs/archive/deliveries/2026-04-09-index-and-memory/delivery-bundle.md">2026-04-09 Delivery</a> · |
25 | 23 | <a href="./docs/guides/deployment.md">Deployment</a> · |
26 | 24 | <a href="./docs/reference/cli.md">CLI</a> · |
27 | 25 | <a href="./docs/reference/mcp.md">MCP</a> |
|
44 | 42 |
|
45 | 43 | - [Why ContextAtlas](#why-contextatlas) |
46 | 44 | - [Where it fits](#where-it-fits) |
47 | | -- [Core capabilities](#core-capabilities) |
48 | | -- [Quick highlights](#quick-highlights) |
49 | | -- [Positioning](#positioning) |
50 | | -- [Tech stack](#tech-stack) |
| 45 | +- [Core Capabilities](#core-capabilities) |
| 46 | +- [Tech Stack](#tech-stack) |
51 | 47 | - [Installation](#installation) |
52 | 48 | - [Configuration](#configuration) |
53 | | -- [Quick start](#quick-start) |
54 | | -- [Integration modes](#integration-modes) |
55 | | -- [Usage flow](#usage-flow) |
56 | | -- [Common commands](#common-commands) |
57 | | -- [Architecture overview](#architecture-overview) |
58 | | -- [Project structure](#project-structure) |
59 | | -- [Notes](#notes) |
60 | | -- [Current limitations](#current-limitations) |
61 | | -- [Documentation map](#documentation-map) |
62 | | -- [Contributing](#contributing) |
63 | | -- [Development](#development) |
64 | | -- [Friendly links](#friendly-links) |
| 49 | +- [Quick Start](#quick-start) |
| 50 | +- [Integration Modes](#integration-modes) |
| 51 | +- [Architecture Overview](#architecture-overview) |
| 52 | +- [Documentation](#documentation-map) |
| 53 | +- [Friendly Links](#friendly-links) |
65 | 54 | - [License](#license) |
66 | 55 |
|
67 | 56 | ContextAtlas is not just a code search tool. It addresses a more practical engineering problem: |
@@ -108,62 +97,7 @@ ContextAtlas turns this into a composable set of capabilities: |
108 | 97 | | **Async Indexing** | SQLite queue + daemon consumer + atomic snapshot switch | |
109 | 98 | | **Observability** | Retrieval monitor, usage report, index health, memory health, and alert evaluation | |
110 | 99 |
|
111 | | -## Quick highlights |
112 | | - |
113 | | -### 1. It does more than search code |
114 | | - |
115 | | -ContextAtlas does not aim to return “the most similar snippet.” It assembles a usable context pack through: |
116 | | - |
117 | | -- vector recall |
118 | | -- FTS recall |
119 | | -- RRF fusion |
120 | | -- rerank |
121 | | -- graph expansion |
122 | | -- token-aware packing |
123 | | - |
124 | | -### 2. Repository understanding can be persisted |
125 | | - |
126 | | -In addition to retrieval, ContextAtlas supports: |
127 | | - |
128 | | -- Feature Memory: module responsibilities, files, dependencies, and data flow |
129 | | -- Decision Record: architecture decisions and rationale |
130 | | -- Project Profile: tech stack, structure, and conventions |
131 | | -- Long-term Memory: preferences, rules, and external references |
132 | | - |
133 | | -### 3. The retrieval system itself is observable |
134 | | - |
135 | | -You can inspect more than just search results: |
136 | | - |
137 | | -- whether the index is healthy |
138 | | -- whether retrieval quality is degrading |
139 | | -- whether long-term memories are stale or expired |
140 | | -- whether usage patterns suggest a rebuild or incremental indexing |
141 | | - |
142 | | -### 4. It works both as CLI and MCP Server |
143 | | - |
144 | | -The same capabilities can be used: |
145 | | - |
146 | | -- directly from local shell commands, scripts, and skills |
147 | | -- through MCP tools in Claude Desktop or other MCP clients |
148 | | - |
149 | | -## Positioning |
150 | | - |
151 | | -**ContextAtlas is a context infrastructure layer for AI agents.** |
152 | | - |
153 | | -It answers this question: |
154 | | - |
155 | | -> When an upstream agent starts working, how can it reliably get high-value, low-noise, reusable code context and repository knowledge? |
156 | | -
|
157 | | -It does **not** handle: |
158 | | - |
159 | | -- agent reasoning itself |
160 | | -- workflow orchestration / planning |
161 | | -- full verification harness responsibilities |
162 | | -- browser, terminal, or business API actions |
163 | | - |
164 | | -In short, ContextAtlas decides **what context to provide**, not **how the task should be executed**. |
165 | | - |
166 | | -For a fuller architecture explanation, see [ContextAtlas engineering positioning](./docs/architecture/harness-engineering.md). |
| 100 | +ContextAtlas decides **what context to provide**, not **how the task should be executed**. It does not handle agent reasoning, workflow orchestration, or business API actions. |
167 | 101 |
|
168 | 102 | ## Tech stack |
169 | 103 |
|
@@ -328,183 +262,15 @@ ContextAtlas MCP tools cover: |
328 | 262 | - cross-project hub operations |
329 | 263 | - auto-recording and memory suggestion flows |
330 | 264 |
|
331 | | -## Usage flow |
332 | | - |
333 | | -```text |
334 | | -1. init |
335 | | - ↓ |
336 | | -2. index |
337 | | - ↓ |
338 | | -3. search / MCP retrieval |
339 | | - ↓ |
340 | | -4. understand code and dependencies |
341 | | - ↓ |
342 | | -5. record project memory / long-term memory (optional) |
343 | | - ↓ |
344 | | -6. continuously observe health / monitor / usage signals |
345 | | -``` |
346 | | - |
347 | | -A typical workflow looks like this: |
348 | | - |
349 | | -1. run `contextatlas init` |
350 | | -2. run `contextatlas index /path/to/repo` |
351 | | -3. use `contextatlas search` or MCP tools to retrieve code and memory |
352 | | -4. record stable module knowledge, decisions, or long-term memory after the task |
353 | | -5. periodically run `health:full`, `monitor:retrieval`, `usage:index-report`, and `memory:health` |
354 | | - |
355 | | -### Recommended CLAUDE.md startup rules |
356 | | - |
357 | | -If you use ContextAtlas inside Claude Code or other session-based agent workflows, add a rule like this to `CLAUDE.md`: |
358 | | - |
359 | | -```md |
360 | | -At the beginning of every conversation: |
361 | | -1. Query project memory first (for example via `project-memory-hub` / `memory-load` / `find_memory`) |
362 | | -2. Immediately run repository indexing (`contextatlas index /path/to/repo`) |
363 | | -3. Only then start retrieval, analysis, and implementation |
364 | | -``` |
365 | | - |
366 | | -Why this helps: |
367 | | - |
368 | | -- it loads existing project knowledge before broad exploration |
369 | | -- it reduces the chance of working against stale retrieval data after repository changes |
370 | | -- it makes later planning and implementation depend on fresher context |
371 | | - |
372 | | -## Common commands |
373 | | - |
374 | | -### Retrieval and indexing |
375 | | - |
376 | | -```bash |
377 | | -contextatlas start /path/to/repo |
378 | | -contextatlas index /path/to/repo |
379 | | -contextatlas index --force |
380 | | -contextatlas index:plan /path/to/repo --json |
381 | | -contextatlas index:diagnose --json |
382 | | -contextatlas daemon start |
383 | | -contextatlas search --repo-path /path/to/repo --information-request "Where is the database connection logic?" |
384 | | -``` |
385 | | - |
386 | | -### Project memory and long-term memory |
387 | | - |
388 | | -```bash |
389 | | -contextatlas memory:find "auth" |
390 | | -contextatlas memory:record "Auth Module" --desc "User authentication module" --dir "src/auth" |
391 | | -contextatlas memory:record-long-term --type reference --title "Grafana Dashboard" --summary "Dashboard URL https://grafana.example.com/d/abc123" |
392 | | -contextatlas memory:list |
393 | | -contextatlas memory:prune-long-term --include-stale |
394 | | -contextatlas decision:list |
395 | | -contextatlas profile:show |
396 | | -``` |
397 | | - |
398 | | -`contextatlas start` now gives the default loop directly: `Connect Repo → Check Index Status → Ask → Review Result → Give Feedback / Save Memory`. Retrieval result cards also surface source hierarchy, freshness/conflict/confidence signals, and concrete follow-up commands. |
399 | | - |
400 | | -Index health checks now also show the latest successful indexing time and the latest execution mode for each project, so it is clearer whether a repository is staying healthy through incremental updates or falling back to rebuild-heavy recovery. |
401 | | - |
402 | | -### Cross-project hub |
403 | | - |
404 | | -```bash |
405 | | -contextatlas hub:list-projects |
406 | | -contextatlas hub:search --category search |
407 | | -contextatlas hub:deps <projectId> <moduleName> |
408 | | -``` |
409 | | - |
410 | | -### Observability and operations |
411 | | - |
412 | | -```bash |
413 | | -contextatlas monitor:retrieval --days 7 |
414 | | -contextatlas usage:index-report --days 7 |
415 | | -contextatlas ops:summary |
416 | | -contextatlas ops:metrics --days 7 --stale-days 30 |
417 | | -contextatlas health:check |
418 | | -contextatlas index:plan /path/to/repo |
419 | | -contextatlas index:diagnose |
420 | | -contextatlas alert:eval --stale-days 30 |
421 | | -``` |
422 | | - |
423 | 265 | ## Architecture overview |
424 | 266 |
|
425 | | -### Retrieval path |
426 | | - |
427 | 267 | ```text |
428 | | -User question |
429 | | - → vector recall |
430 | | - → FTS lexical recall |
431 | | - → RRF fusion |
432 | | - → rerank |
433 | | - → graph expansion |
434 | | - → token-aware packing |
435 | | - → structured context output |
| 268 | +Indexing: Crawler / Scanner → Chunking → Indexing → Vector / SQLite Storage |
| 269 | +Retrieval: Vector + FTS Recall → RRF → Rerank → Graph Expansion → Context Packing |
| 270 | +Memory: Project Memory / Long-term Memory / Hub → CLI / MCP Tools |
436 | 271 | ``` |
437 | 272 |
|
438 | | -In the current implementation, `SearchService` is mostly an orchestration facade instead of a single all-in-one engine: |
439 | | - |
440 | | -- `HybridRecallEngine` handles vector + lexical recall, FTS fallback, and RRF fusion |
441 | | -- `RerankPolicy` owns rerank pool selection and Smart TopK cutoff |
442 | | -- `SnippetExtractor` builds rerank text and hit-centered snippets |
443 | | -- `GraphExpander` and `ContextPacker` still own expansion and packing |
444 | | - |
445 | | -### Indexing path |
446 | | - |
447 | | -```text |
448 | | -File changes |
449 | | - → scanner/ detects changes |
450 | | - → chunking/ semantic chunking |
451 | | - → indexer/ embedding + vector store write |
452 | | - → storage/ atomic snapshot switch |
453 | | - → indexing/ queue state update |
454 | | -``` |
455 | | - |
456 | | -### Memory path |
457 | | - |
458 | | -```text |
459 | | -Feature / Decision / Profile / Long-term write |
460 | | - → MemoryStore facade |
461 | | - → bootstrap project initialization and compatibility import |
462 | | - → focused sub-stores persist and sync data |
463 | | - → Memory Hub / Router / retrieval tools read it back |
464 | | -``` |
465 | | - |
466 | | -The current `memory/` boundaries are: |
467 | | - |
468 | | -- `MemoryStore` stays as the stable facade for CLI, MCP, and monitoring |
469 | | -- `MemoryStoreBootstrap` handles read-only/writable initialization, project registration, and compatibility import |
470 | | -- `ProjectMetaStore` owns checkpoints, catalog, profile, and global memory |
471 | | -- `FeatureMemoryRepository` and `FeatureMemoryCatalogCoordinator` own feature memory persistence and catalog sync |
472 | | -- `DecisionStore` owns decision-record mapping and persistence |
473 | | -- `LongTermMemoryService` owns append/find/status/prune logic for long-term memory |
474 | | - |
475 | | -## Project structure |
476 | | - |
477 | | -```text |
478 | | -src/ |
479 | | -├── api/ # Embedding / Rerank / Unicode handling |
480 | | -├── chunking/ # Tree-sitter semantic chunking |
481 | | -├── db/ # SQLite + FTS + file metadata |
482 | | -├── indexer/ # Vector indexing orchestration |
483 | | -├── indexing/ # Index queue and daemon |
484 | | -├── mcp/ # MCP server and tool definitions |
485 | | -├── memory/ # MemoryStore facade + bootstrap + sub-stores + cross-project hub |
486 | | -├── monitoring/ # Retrieval monitoring / health / alerts |
487 | | -├── scanner/ # File discovery and incremental scanning |
488 | | -├── search/ # SearchService facade + recall / rerank / snippet / expand / pack submodules |
489 | | -├── storage/ # Snapshot layout and atomic switching |
490 | | -├── usage/ # Usage tracking and optimization analysis |
491 | | -└── vectorStore/ # LanceDB vector storage |
492 | | -``` |
493 | | - |
494 | | -## Notes |
495 | | - |
496 | | -- **The first full index may take time**: index once, then keep incremental updates warm with the daemon |
497 | | -- **Do not store code-derivable facts in long-term memory**: use it for rules, preferences, external references, and non-code state |
498 | | -- **MCP and CLI are complementary**: MCP is better for tool integration, CLI is better for scripts, skills, and manual debugging |
499 | | -- **Make health checks routine**: when results get worse, check index, memory, and retrieval metrics before blaming the model |
500 | | - |
501 | | -## Current limitations |
502 | | - |
503 | | -- no multi-tenant or permission isolation yet |
504 | | -- memory write quality still depends on upstream workflow discipline |
505 | | -- no conflict detection in the cross-project hub yet |
506 | | -- automatic incremental indexing still relies on the daemon or external scheduling |
507 | | -- no unified confidence score interface for retrieval results yet |
| 273 | +ContextAtlas focuses on **what context to provide**, not how the task should be executed. For a fuller architecture explanation, see [repository positioning](./docs/architecture/repository-positioning.md) and [engineering positioning](./docs/architecture/harness-engineering.md). |
508 | 274 |
|
509 | 275 | ## Documentation map |
510 | 276 |
|
|
0 commit comments