Navegador

navegador / docs / architecture / overview.md
1
# Architecture Overview
2
3
## Design philosophy
4
5
Navegador is built around a single observation: **code structure and business knowledge are both graph-shaped, and they belong in the same graph.**
6
7
Most context tools for AI agents handle one or the other — either they parse code (AST tools, code search) or they surface docs (RAG over wikis, ADR files). Navegador stores both in the same property graph and connects them with typed edges. An agent asking "what does `process_payment` do?" gets back not just the function signature and call graph, but the business rules that govern it and the architectural decision that shaped its design — in a single structured query.
8
9
---
10
11
## Architecture layers
12
13
```
14
┌──────────────────────────────────────────────────────────────────┐
15
│ INTELLIGENCE LAYER │
16
│ LLM providers (Anthropic · OpenAI · Ollama) │
17
│ Semantic search · NLP queries · Doc generation │
18
├──────────────────────────────────────────────────────────────────┤
19
│ ANALYSIS LAYER │
20
│ Impact · Trace · Churn · Deadcode · Cycles · Testmap │
21
│ Diff · Rename · Communities · Blast radius │
22
├──────────────────────────────────────────────────────────────────┤
23
│ KNOWLEDGE LAYER │
24
│ │
25
│ Domain ──BELONGS_TO── Concept ──RELATED_TO── Rule │
26
│ │ │ │ │
27
│ └──BELONGS_TO── Decision GOVERNS │ │
28
│ │ ↓ │
29
│ DECIDED_BY── Person (code nodes) │
30
│ │
31
│ WikiPage ──DOCUMENTS── Concept │
32
│ │
33
├──────────────── ANNOTATES / GOVERNS / IMPLEMENTS ────────────────┤
34
│ │
35
│ CODE LAYER │
36
│ │
37
│ Repository ──CONTAINS── File ──CONTAINS── Class │
38
│ │ │ │
39
│ CONTAINS DEFINES │
40
│ ↓ ↓ │
41
│ Function ──CALLS── Function │
42
│ │ │ │
43
│ DECORATES─Decorator TESTS──TestFn │
44
│ │ │
45
│ IMPORTS── Import │
46
├──────────────────────────────────────────────────────────────────┤
47
│ ENRICHMENT LAYER │
48
│ Framework metadata (Django · FastAPI · React · Rails · Spring) │
49
│ VCS (Git · Fossil) · CODEOWNERS · ADRs · OpenAPI · GraphQL │
50
├──────────────────────────────────────────────────────────────────┤
51
│ STORE LAYER │
52
│ FalkorDB (falkordblite SQLite local / Redis cluster) │
53
└──────────────────────────────────────────────────────────────────┘
54
```
55
56
### Code layer
57
58
Populated automatically by `navegador ingest`. Contains the structural facts extracted from source code across 13 languages: which functions exist, what they call, which classes inherit from which, what decorators are applied. Supports incremental ingestion (content hashing), watch mode, and parallel processing. This layer changes whenever code changes; re-ingest is the refresh mechanism.
59
60
### Knowledge layer
61
62
Populated by humans (via `navegador add`) or semi-automatically (via wiki, Planopticon, ADR, OpenAPI, and PM ingestion). Contains the *why*: business concepts, architectural rules, recorded decisions, domain ownership, and documentation. This layer changes slowly and deliberately.
63
64
### Enrichment layer
65
66
Framework enrichers run after AST parsing to add framework-specific metadata — Django model field types, FastAPI route paths, React component display names, etc. VCS adapters (Git, Fossil) provide blame, history, and churn data. CODEOWNERS files are parsed to populate `Person`→`File` ownership edges.
67
68
### Analysis layer
69
70
Graph analysis commands operate over the populated code and knowledge layers without additional ingestion. They run Cypher traversals for impact analysis, cycle detection, dead code detection, test mapping, and community detection.
71
72
### Intelligence layer
73
74
NLP and LLM commands (`navegador ask`, `navegador semantic-search`, `navegador docs`) use configurable LLM providers (Anthropic, OpenAI, Ollama) to answer natural language queries grounded in graph data.
75
76
### Cross-layer edges
77
78
| Edge | Meaning | Direction |
79
|---|---|---|
80
| `ANNOTATES` | A knowledge node describes a code node | Concept/Rule → Function/Class/File |
81
| `GOVERNS` | A rule applies to a code node | Rule → Function/Class |
82
| `IMPLEMENTS` | A code node implements a concept or interface | Function/Class → Concept/Interface |
83
| `DOCUMENTS` | A wiki page documents a concept or code node | WikiPage → Concept/Function/Class |
84
85
These edges are created explicitly via `navegador annotate` or inferred during wiki/Planopticon ingestion when names match.
86
87
---
88
89
## FalkorDB as the store
90
91
Navegador uses [FalkorDB](https://www.falkordb.com/) — a property graph database with a Cypher query interface.
92
93
| Environment | Backend | Install |
94
|---|---|---|
95
| Local dev | `falkordblite` (SQLite) | Included in `pip install navegador` |
96
| Production / team | FalkorDB on Redis | `pip install "navegador[redis]"` |
97
98
Both backends implement the same `GraphStore` interface. The query path is identical; only the connection setup differs. The SQLite backend uses an embedded engine — no daemon, no port, just a `.db` file.
99
100
---
101
102
## Ingestion pipeline
103
104
```
105
Source code (13 languages via tree-sitter)
106
107
108
tree-sitter parser (per-language grammar)
109
+ incremental parsing (LRU cache, content hashing)
110
+ parallel ingestion (worker pool)
111
112
113
AST visitor (extract nodes + relationships)
114
115
116
Framework enrichers (Django · FastAPI · React · Rails · Spring · Laravel · …)
117
118
119
Graph diffing (only write changed nodes/edges)
120
121
122
GraphStore.merge_node / create_edge
123
124
125
FalkorDB (SQLite or Redis)
126
```
127
128
```
129
Human curation (navegador add)
130
Wiki pages (navegador wiki ingest)
131
Planopticon output (navegador planopticon ingest)
132
ADRs (navegador adr ingest)
133
OpenAPI / GraphQL schemas (navegador api ingest)
134
PM issues (navegador pm ingest --github)
135
External deps (navegador deps ingest)
136
Submodules (navegador submodules ingest)
137
138
139
KnowledgeIngester / WikiIngester / PlanopticonIngester / …
140
141
142
GraphStore.merge_node / create_edge
143
144
145
FalkorDB (same database)
146
```
147
148
All ingesters write to the same graph. There is no separate code database and knowledge database.
149
150
---
151
152
## Query and analysis path
153
154
```
155
User / agent
156
157
▼ CLI command, MCP tool call, or Python SDK
158
navegador context / function / explain / search / impact / trace / ...
159
160
161
ContextLoader / AnalysisEngine (builds Cypher query)
162
163
164
GraphStore.query(cypher) ← MCP: query validation + complexity check
165
166
167
FalkorDB (SQLite or Redis)
168
169
170
ContextBundle / AnalysisResult (structured result)
171
172
173
JSON / Markdown / rich terminal output
174
```
175
176
`ContextLoader` handles context retrieval commands (`function`, `class`, `explain`, etc.). `AnalysisEngine` handles graph analysis commands (`impact`, `trace`, `deadcode`, `cycles`, `churn`, `testmap`). Both construct Cypher queries, fetch results from `GraphStore`, and return structured output. The CLI formats output for the terminal; the MCP server returns JSON; the Python SDK returns typed Python objects.
177
178
---
179
180
## Cluster architecture
181
182
For team and CI environments, navegador supports a cluster mode backed by a shared Redis graph:
183
184
```
185
Multiple agents / CI runners
186
187
188
navegador (each instance)
189
190
191
┌────────────────────────────────────────┐
192
│ Shared Redis │
193
│ ├── FalkorDB graph (shared state) │
194
│ ├── Pub/sub (event broadcast) │
195
│ ├── Task queue (ingest jobs) │
196
│ ├── Sessions (agent state) │
197
│ ├── Checkpoints (long-running tasks) │
198
│ └── Observability (metrics, traces) │
199
└────────────────────────────────────────┘
200
```
201
202
Configure with `[cluster]` in `.navegador/config.toml`. See [Configuration](../getting-started/configuration.md) for details.
203

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button