synaptiq 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. synaptiq-0.3.0/PKG-INFO +588 -0
  2. synaptiq-0.3.0/README.md +545 -0
  3. synaptiq-0.3.0/pyproject.toml +73 -0
  4. synaptiq-0.3.0/src/synaptiq/__init__.py +3 -0
  5. synaptiq-0.3.0/src/synaptiq/cli/__init__.py +1 -0
  6. synaptiq-0.3.0/src/synaptiq/cli/main.py +475 -0
  7. synaptiq-0.3.0/src/synaptiq/config/__init__.py +13 -0
  8. synaptiq-0.3.0/src/synaptiq/config/ignore.py +135 -0
  9. synaptiq-0.3.0/src/synaptiq/config/languages.py +27 -0
  10. synaptiq-0.3.0/src/synaptiq/core/__init__.py +1 -0
  11. synaptiq-0.3.0/src/synaptiq/core/daemon/__init__.py +1 -0
  12. synaptiq-0.3.0/src/synaptiq/core/daemon/lock.py +152 -0
  13. synaptiq-0.3.0/src/synaptiq/core/daemon/socket_client.py +110 -0
  14. synaptiq-0.3.0/src/synaptiq/core/daemon/socket_server.py +124 -0
  15. synaptiq-0.3.0/src/synaptiq/core/diff.py +246 -0
  16. synaptiq-0.3.0/src/synaptiq/core/embeddings/__init__.py +1 -0
  17. synaptiq-0.3.0/src/synaptiq/core/embeddings/embedder.py +87 -0
  18. synaptiq-0.3.0/src/synaptiq/core/embeddings/text.py +206 -0
  19. synaptiq-0.3.0/src/synaptiq/core/graph/__init__.py +1 -0
  20. synaptiq-0.3.0/src/synaptiq/core/graph/graph.py +175 -0
  21. synaptiq-0.3.0/src/synaptiq/core/graph/model.py +97 -0
  22. synaptiq-0.3.0/src/synaptiq/core/ingestion/__init__.py +1 -0
  23. synaptiq-0.3.0/src/synaptiq/core/ingestion/calls.py +360 -0
  24. synaptiq-0.3.0/src/synaptiq/core/ingestion/community.py +193 -0
  25. synaptiq-0.3.0/src/synaptiq/core/ingestion/coupling.py +224 -0
  26. synaptiq-0.3.0/src/synaptiq/core/ingestion/dead_code.py +345 -0
  27. synaptiq-0.3.0/src/synaptiq/core/ingestion/heritage.py +141 -0
  28. synaptiq-0.3.0/src/synaptiq/core/ingestion/imports.py +256 -0
  29. synaptiq-0.3.0/src/synaptiq/core/ingestion/parser_phase.py +216 -0
  30. synaptiq-0.3.0/src/synaptiq/core/ingestion/pipeline.py +214 -0
  31. synaptiq-0.3.0/src/synaptiq/core/ingestion/processes.py +315 -0
  32. synaptiq-0.3.0/src/synaptiq/core/ingestion/structure.py +110 -0
  33. synaptiq-0.3.0/src/synaptiq/core/ingestion/symbol_lookup.py +139 -0
  34. synaptiq-0.3.0/src/synaptiq/core/ingestion/types.py +139 -0
  35. synaptiq-0.3.0/src/synaptiq/core/ingestion/walker.py +123 -0
  36. synaptiq-0.3.0/src/synaptiq/core/ingestion/watcher.py +153 -0
  37. synaptiq-0.3.0/src/synaptiq/core/parsers/__init__.py +1 -0
  38. synaptiq-0.3.0/src/synaptiq/core/parsers/base.py +70 -0
  39. synaptiq-0.3.0/src/synaptiq/core/parsers/python_lang.py +589 -0
  40. synaptiq-0.3.0/src/synaptiq/core/parsers/typescript.py +656 -0
  41. synaptiq-0.3.0/src/synaptiq/core/search/__init__.py +1 -0
  42. synaptiq-0.3.0/src/synaptiq/core/search/hybrid.py +102 -0
  43. synaptiq-0.3.0/src/synaptiq/core/storage/__init__.py +1 -0
  44. synaptiq-0.3.0/src/synaptiq/core/storage/base.py +122 -0
  45. synaptiq-0.3.0/src/synaptiq/core/storage/kuzu_backend.py +843 -0
  46. synaptiq-0.3.0/src/synaptiq/mcp/__init__.py +1 -0
  47. synaptiq-0.3.0/src/synaptiq/mcp/resources.py +150 -0
  48. synaptiq-0.3.0/src/synaptiq/mcp/server.py +297 -0
  49. synaptiq-0.3.0/src/synaptiq/mcp/tools.py +336 -0
  50. synaptiq-0.3.0/src/synaptiq/py.typed +0 -0
@@ -0,0 +1,588 @@
1
+ Metadata-Version: 2.4
2
+ Name: synaptiq
3
+ Version: 0.3.0
4
+ Summary: Graph-powered code intelligence engine — indexes codebases into a knowledge graph, exposed via MCP tools for AI agents and a CLI for developers.
5
+ Keywords: code-intelligence,knowledge-graph,mcp,tree-sitter,static-analysis,dead-code,claude-code
6
+ Author: Stevica Canadi
7
+ Author-email: Stevica Canadi <stevica.canadi@gmail.com>
8
+ License-Expression: MIT
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Software Development :: Quality Assurance
17
+ Classifier: Topic :: Software Development :: Code Generators
18
+ Requires-Dist: typer>=0.15.0
19
+ Requires-Dist: rich>=13.0.0
20
+ Requires-Dist: tree-sitter>=0.25.0
21
+ Requires-Dist: tree-sitter-python>=0.23.0
22
+ Requires-Dist: tree-sitter-javascript>=0.23.0
23
+ Requires-Dist: tree-sitter-typescript>=0.23.0
24
+ Requires-Dist: kuzu>=0.11.0
25
+ Requires-Dist: igraph>=1.0.0
26
+ Requires-Dist: leidenalg>=0.11.0
27
+ Requires-Dist: fastembed>=0.7.0
28
+ Requires-Dist: mcp>=1.0.0
29
+ Requires-Dist: watchfiles>=1.0.0
30
+ Requires-Dist: pathspec>=1.0.4
31
+ Requires-Dist: pytest>=8.0.0 ; extra == 'dev'
32
+ Requires-Dist: pytest-asyncio>=0.24.0 ; extra == 'dev'
33
+ Requires-Dist: pytest-cov>=6.0.0 ; extra == 'dev'
34
+ Requires-Dist: ruff>=0.9.0 ; extra == 'dev'
35
+ Requires-Dist: neo4j>=5.0.0 ; extra == 'neo4j'
36
+ Requires-Python: >=3.11
37
+ Project-URL: Homepage, https://github.com/scanadi/synaptiq
38
+ Project-URL: Repository, https://github.com/scanadi/synaptiq
39
+ Project-URL: Issues, https://github.com/scanadi/synaptiq/issues
40
+ Provides-Extra: dev
41
+ Provides-Extra: neo4j
42
+ Description-Content-Type: text/markdown
43
+
44
+ # Synaptiq
45
+
46
+ **Graph-powered code intelligence engine** — indexes your codebase into a knowledge graph and exposes it via MCP tools for AI agents and a CLI for developers.
47
+
48
+ ```
49
+ synaptiq analyze .
50
+
51
+ Phase 1: Walking files... 142 files found
52
+ Phase 3: Parsing code... 142/142
53
+ Phase 5: Tracing calls... 847 calls resolved
54
+ Phase 7: Analyzing types... 234 type relationships
55
+ Phase 8: Detecting communities... 8 clusters found
56
+ Phase 9: Detecting execution flows... 34 processes found
57
+ Phase 10: Finding dead code... 12 unreachable symbols
58
+ Phase 11: Analyzing git history... 18 coupled file pairs
59
+
60
+ Done in 4.2s — 623 symbols, 1,847 edges, 8 clusters, 34 flows
61
+ ```
62
+
63
+ Most code intelligence tools treat your codebase as flat text. Synaptiq builds a **structural graph** — every function, class, import, call, type reference, and execution flow becomes a node or edge in a queryable knowledge graph. AI agents using Synaptiq don't just search for keywords; they understand how your code is connected.
64
+
65
+ ---
66
+
67
+ ## Why Synaptiq?
68
+
69
+ **For AI agents (Claude Code, Cursor):**
70
+ - "What breaks if I change this function?" → blast radius via call graph + type references + git coupling
71
+ - "What code is never called?" → dead code detection with framework-aware exemptions
72
+ - "Show me the login flow end-to-end" → execution flow tracing from entry points through the call graph
73
+ - "Which files always change together?" → git history change coupling analysis
74
+
75
+ **For developers:**
76
+ - Instant answers to architectural questions without grepping through files
77
+ - Find dead code, tightly coupled files, and execution flows automatically
78
+ - Raw Cypher queries against your codebase's knowledge graph
79
+ - Watch mode that re-indexes on every save
80
+
81
+ **Zero cloud dependencies.** Everything runs locally — parsing, graph storage, embeddings, search. No API keys, no data leaving your machine.
82
+
83
+ ---
84
+
85
+ ## Features
86
+
87
+ ### 11-Phase Analysis Pipeline
88
+
89
+ Synaptiq doesn't just parse your code — it builds a deep structural understanding through 11 sequential analysis phases:
90
+
91
+ | Phase | What It Does |
92
+ |-------|-------------|
93
+ | **File Walking** | Walks repo respecting `.gitignore`, filters by supported languages |
94
+ | **Structure** | Creates File/Folder hierarchy with CONTAINS relationships |
95
+ | **Parsing** | tree-sitter AST extraction — functions, classes, methods, interfaces, enums, type aliases |
96
+ | **Import Resolution** | Resolves import statements to actual files (relative, absolute, bare specifiers) |
97
+ | **Call Tracing** | Maps function calls with confidence scores (1.0 = exact match, 0.5 = fuzzy) |
98
+ | **Heritage** | Tracks class inheritance (EXTENDS) and interface implementation (IMPLEMENTS) |
99
+ | **Type Analysis** | Extracts type references from parameters, return types, and variable annotations |
100
+ | **Community Detection** | Leiden algorithm clusters related symbols into functional communities |
101
+ | **Process Detection** | Framework-aware entry point detection + BFS flow tracing |
102
+ | **Dead Code Detection** | Multi-pass analysis with override, protocol, and decorator awareness |
103
+ | **Change Coupling** | Git history analysis — finds files that always change together |
104
+
105
+ ### Hybrid Search (BM25 + Vector + RRF)
106
+
107
+ Three search strategies fused with Reciprocal Rank Fusion:
108
+
109
+ - **BM25 full-text search** — fast exact name and keyword matching via KuzuDB FTS
110
+ - **Semantic vector search** — conceptual queries via 384-dim embeddings (BAAI/bge-small-en-v1.5)
111
+ - **Fuzzy name search** — Levenshtein fallback for typos and partial matches
112
+
113
+ Test files are automatically down-ranked (0.5x), source-level functions/classes boosted (1.2x).
114
+
115
+ ### Dead Code Detection
116
+
117
+ Finds unreachable symbols with intelligence — not just "zero callers" but a multi-pass analysis:
118
+
119
+ 1. **Initial scan** — flags functions/methods/classes with no incoming calls
120
+ 2. **Exemptions** — entry points, exports, constructors, test code, dunder methods, `__init__.py` public symbols, decorated functions, `@property` methods
121
+ 3. **Override pass** — un-flags methods that override non-dead base class methods (handles dynamic dispatch)
122
+ 4. **Protocol conformance** — un-flags methods on classes conforming to Protocol interfaces
123
+ 5. **Protocol stubs** — un-flags all methods on Protocol classes (interface contracts)
124
+
125
+ ### Impact Analysis (Blast Radius)
126
+
127
+ When you're about to change a symbol, Synaptiq traces upstream through:
128
+ - **Call graph** — every function that calls this one, recursively
129
+ - **Type references** — every function that takes, returns, or stores this type
130
+ - **Git coupling** — files that historically change alongside this one
131
+
132
+ ### Community Detection
133
+
134
+ Uses the [Leiden algorithm](https://www.nature.com/articles/s41598-019-41695-z) (igraph + leidenalg) to automatically discover functional clusters in your codebase. Each community gets a cohesion score and auto-generated label based on member file paths.
135
+
136
+ ### Execution Flow Tracing
137
+
138
+ Detects entry points using framework-aware patterns:
139
+ - **Python**: `@app.route`, `@router.get`, `@click.command`, `test_*` functions, `__main__` blocks
140
+ - **JavaScript/TypeScript**: Express handlers, exported functions, `handler`/`middleware` patterns
141
+
142
+ Then traces BFS execution flows from each entry point through the call graph, classifying flows as intra-community or cross-community.
143
+
144
+ ### Change Coupling (Git History)
145
+
146
+ Analyzes 6 months of git history to find hidden dependencies that static analysis misses:
147
+
148
+ ```
149
+ coupling(A, B) = co_changes(A, B) / max(changes(A), changes(B))
150
+ ```
151
+
152
+ Files with coupling strength ≥ 0.3 and 3+ co-changes get linked. Surfaces coupled files in impact analysis.
153
+
154
+ ### Watch Mode
155
+
156
+ Live re-indexing powered by a Rust-based file watcher (watchfiles):
157
+
158
+ ```bash
159
+ $ synaptiq watch
160
+ Watching /Users/you/project for changes...
161
+
162
+ [10:32:15] src/auth/validate.py modified → re-indexed (0.3s)
163
+ [10:33:02] 2 files modified → re-indexed (0.5s)
164
+ ```
165
+
166
+ - File-local phases (parse, imports, calls, types) run immediately on change
167
+ - Global phases (communities, processes, dead code) batch every 30 seconds
168
+
169
+ ### Multi-Instance Concurrency
170
+
171
+ Synaptiq supports multiple concurrent MCP sessions (e.g., swarm sub-agents) through a primary/proxy daemon architecture:
172
+
173
+ - **Primary process**: Owns the database, watcher, and socket server
174
+ - **Proxy processes**: Forward queries over Unix socket to primary
175
+ - **Automatic role detection**: Each instance self-detects its role at startup
176
+
177
+ ### Branch Comparison
178
+
179
+ Structural diff between branches using git worktrees (no stashing required):
180
+
181
+ ```bash
182
+ $ synaptiq diff main..feature
183
+
184
+ Symbols added (4):
185
+ + process_payment (Function) -- src/payments/stripe.py
186
+ + PaymentIntent (Class) -- src/payments/models.py
187
+
188
+ Symbols modified (2):
189
+ ~ checkout_handler (Function) -- src/routes/checkout.py
190
+
191
+ Symbols removed (1):
192
+ - old_charge (Function) -- src/payments/legacy.py
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Supported Languages
198
+
199
+ | Language | Extensions | Parser |
200
+ |----------|-----------|--------|
201
+ | Python | `.py` | tree-sitter-python |
202
+ | TypeScript | `.ts`, `.tsx` | tree-sitter-typescript |
203
+ | JavaScript | `.js`, `.jsx`, `.mjs`, `.cjs` | tree-sitter-javascript |
204
+
205
+ ---
206
+
207
+ ## Installation
208
+
209
+ ```bash
210
+ # With pip
211
+ pip install synaptiq
212
+
213
+ # With uv (recommended)
214
+ uv add synaptiq
215
+
216
+ # With Neo4j backend support
217
+ pip install synaptiq[neo4j]
218
+ ```
219
+
220
+ Requires **Python 3.11+**.
221
+
222
+ ### From Source
223
+
224
+ ```bash
225
+ git clone https://github.com/scanadi/synaptiq.git
226
+ cd synaptiq
227
+ uv sync --all-extras
228
+ uv run synaptiq --help
229
+ ```
230
+
231
+ ---
232
+
233
+ ## Quick Start
234
+
235
+ ### 1. Index Your Codebase
236
+
237
+ ```bash
238
+ cd your-project
239
+ synaptiq analyze .
240
+ ```
241
+
242
+ ### 2. Query It
243
+
244
+ ```bash
245
+ # Search for symbols
246
+ synaptiq query "authentication handler"
247
+
248
+ # Get full context on a symbol
249
+ synaptiq context validate_user
250
+
251
+ # Check blast radius before changing something
252
+ synaptiq impact UserModel --depth 3
253
+
254
+ # Find dead code
255
+ synaptiq dead-code
256
+
257
+ # Run a raw Cypher query
258
+ synaptiq cypher "MATCH (n:Function) WHERE n.is_dead = true RETURN n.name, n.file_path"
259
+ ```
260
+
261
+ ### 3. Keep It Updated
262
+
263
+ ```bash
264
+ # Watch mode — re-indexes on every save
265
+ synaptiq watch
266
+
267
+ # Or re-analyze manually
268
+ synaptiq analyze .
269
+ ```
270
+
271
+ ---
272
+
273
+ ## CLI Reference
274
+
275
+ ```
276
+ synaptiq analyze [PATH] Index a repository (default: current directory)
277
+ --full Force full rebuild (skip incremental)
278
+
279
+ synaptiq status Show index status for current repo
280
+ synaptiq list List all indexed repositories
281
+ synaptiq clean Delete index for current repo
282
+ --force / -f Skip confirmation prompt
283
+
284
+ synaptiq query QUERY Hybrid search the knowledge graph
285
+ --limit / -n N Max results (default: 20)
286
+
287
+ synaptiq context SYMBOL 360-degree view of a symbol
288
+ synaptiq impact SYMBOL Blast radius analysis
289
+ --depth / -d N BFS traversal depth (default: 3)
290
+
291
+ synaptiq dead-code List all detected dead code
292
+ synaptiq cypher QUERY Execute a raw Cypher query (read-only)
293
+
294
+ synaptiq watch Watch mode — live re-indexing on file changes
295
+ synaptiq diff BASE..HEAD Structural branch comparison
296
+
297
+ synaptiq setup Print MCP configuration JSON
298
+ --claude For Claude Code
299
+ --cursor For Cursor
300
+
301
+ synaptiq mcp Start the MCP server (stdio transport)
302
+ synaptiq serve Start the MCP server (same as synaptiq mcp)
303
+ --watch, -w Enable live file watching with auto-reindex
304
+ synaptiq --version Print version
305
+ ```
306
+
307
+ ---
308
+
309
+ ## MCP Integration
310
+
311
+ Synaptiq exposes its full intelligence as an MCP server, giving AI agents like Claude Code and Cursor deep structural understanding of your codebase.
312
+
313
+ ### Setup for Claude Code
314
+
315
+ Add to your `.claude/settings.json` or project `.mcp.json`:
316
+
317
+ ```json
318
+ {
319
+ "mcpServers": {
320
+ "synaptiq": {
321
+ "command": "synaptiq",
322
+ "args": ["serve", "--watch"]
323
+ }
324
+ }
325
+ }
326
+ ```
327
+
328
+ This starts the MCP server **with live file watching** — the knowledge graph updates automatically as you edit code. To run without watching, use `"args": ["mcp"]` instead.
329
+
330
+ Or run the setup helper:
331
+
332
+ ```bash
333
+ synaptiq setup --claude
334
+ ```
335
+
336
+ ### Setup for Cursor
337
+
338
+ Add to your Cursor MCP settings:
339
+
340
+ ```json
341
+ {
342
+ "synaptiq": {
343
+ "command": "synaptiq",
344
+ "args": ["serve", "--watch"]
345
+ }
346
+ }
347
+ ```
348
+
349
+ Or run:
350
+
351
+ ```bash
352
+ synaptiq setup --cursor
353
+ ```
354
+
355
+ ### MCP Tools
356
+
357
+ Once connected, your AI agent gets access to these tools:
358
+
359
+ | Tool | Description |
360
+ |------|-------------|
361
+ | `synaptiq_list_repos` | List all indexed repositories with stats |
362
+ | `synaptiq_query` | Hybrid search (BM25 + vector + fuzzy) across all symbols |
363
+ | `synaptiq_context` | 360-degree view — callers, callees, type refs, community, processes |
364
+ | `synaptiq_impact` | Blast radius — all symbols affected by changing the target |
365
+ | `synaptiq_dead_code` | List all unreachable symbols grouped by file |
366
+ | `synaptiq_detect_changes` | Map a `git diff` to affected symbols in the graph |
367
+ | `synaptiq_cypher` | Execute read-only Cypher queries against the knowledge graph |
368
+
369
+ Every tool response includes a **next-step hint** guiding the agent through a natural investigation workflow:
370
+
371
+ ```
372
+ query → "Next: Use context() on a specific symbol for the full picture."
373
+ context → "Next: Use impact() if planning changes to this symbol."
374
+ impact → "Tip: Review each affected symbol before making changes."
375
+ ```
376
+
377
+ ### MCP Resources
378
+
379
+ | Resource URI | Description |
380
+ |-------------|-------------|
381
+ | `synaptiq://overview` | Node and relationship counts by type |
382
+ | `synaptiq://dead-code` | Full dead code report |
383
+ | `synaptiq://schema` | Graph schema reference for writing Cypher queries |
384
+
385
+ ---
386
+
387
+ ## Knowledge Graph Model
388
+
389
+ ### Nodes
390
+
391
+ | Label | Description |
392
+ |-------|-------------|
393
+ | `File` | Source file |
394
+ | `Folder` | Directory |
395
+ | `Function` | Top-level function |
396
+ | `Class` | Class definition |
397
+ | `Method` | Method within a class |
398
+ | `Interface` | Interface / Protocol definition |
399
+ | `TypeAlias` | Type alias |
400
+ | `Enum` | Enumeration |
401
+ | `Community` | Auto-detected functional cluster |
402
+ | `Process` | Detected execution flow |
403
+
404
+ ### Relationships
405
+
406
+ | Type | Description | Key Properties |
407
+ |------|-------------|----------------|
408
+ | `CONTAINS` | Folder → File/Symbol hierarchy | — |
409
+ | `DEFINES` | File → Symbol it defines | — |
410
+ | `CALLS` | Symbol → Symbol it calls | `confidence` (0.0–1.0) |
411
+ | `IMPORTS` | File → File it imports from | `symbols` (names list) |
412
+ | `EXTENDS` | Class → Class it extends | — |
413
+ | `IMPLEMENTS` | Class → Interface it implements | — |
414
+ | `USES_TYPE` | Symbol → Type it references | `role` (param/return/variable) |
415
+ | `EXPORTS` | File → Symbol it exports | — |
416
+ | `MEMBER_OF` | Symbol → Community it belongs to | — |
417
+ | `STEP_IN_PROCESS` | Symbol → Process it participates in | `step_number` |
418
+ | `COUPLED_WITH` | File → File that co-changes with it | `strength`, `co_changes` |
419
+
420
+ ### Node ID Format
421
+
422
+ ```
423
+ {label}:{relative_path}:{symbol_name}
424
+
425
+ Examples:
426
+ function:src/auth/validate.py:validate_user
427
+ class:src/models/user.py:User
428
+ method:src/models/user.py:User.save
429
+ ```
430
+
431
+ ---
432
+
433
+ ## Architecture
434
+
435
+ ```
436
+ Source Code (.py, .ts, .js, .tsx, .jsx)
437
+
438
+
439
+ ┌──────────────────────────────────────────────┐
440
+ │ Ingestion Pipeline (11 phases) │
441
+ │ │
442
+ │ walk → structure → parse → imports → calls │
443
+ │ → heritage → types → communities → processes │
444
+ │ → dead_code → coupling │
445
+ └──────────────────────┬───────────────────────┘
446
+
447
+
448
+ ┌─────────────────┐
449
+ │ KnowledgeGraph │ (in-memory during build)
450
+ └────────┬────────┘
451
+
452
+ ┌────────────┼────────────┐
453
+ ▼ ▼ ▼
454
+ ┌─────────┐ ┌─────────┐ ┌─────────┐
455
+ │ KuzuDB │ │ FTS │ │ Vector │
456
+ │ (graph) │ │ (BM25) │ │ (HNSW) │
457
+ └────┬────┘ └────┬────┘ └────┬────┘
458
+ └────────────┼────────────┘
459
+
460
+ StorageBackend Protocol
461
+
462
+ ┌────────┴────────┐
463
+ ▼ ▼
464
+ ┌──────────┐ ┌──────────┐
465
+ │ MCP │ │ CLI │
466
+ │ Server │ │ (Typer) │
467
+ │ (stdio) │ │ │
468
+ └────┬─────┘ └────┬─────┘
469
+ │ │
470
+ Claude Code Terminal
471
+ / Cursor (developer)
472
+ ```
473
+
474
+ ### Tech Stack
475
+
476
+ | Layer | Technology | Purpose |
477
+ |-------|-----------|---------|
478
+ | Parsing | tree-sitter | Language-agnostic AST extraction |
479
+ | Graph Storage | KuzuDB | Embedded graph database with Cypher, FTS, and vector support |
480
+ | Graph Algorithms | igraph + leidenalg | Leiden community detection |
481
+ | Embeddings | fastembed | ONNX-based 384-dim vectors (~100MB, no PyTorch) |
482
+ | MCP Protocol | mcp SDK (FastMCP) | AI agent communication via stdio |
483
+ | CLI | Typer + Rich | Terminal interface with progress bars |
484
+ | File Watching | watchfiles | Rust-based file system watcher |
485
+ | Gitignore | pathspec | Full `.gitignore` pattern matching |
486
+
487
+ ### Storage
488
+
489
+ Everything lives locally in your repo:
490
+
491
+ ```
492
+ your-project/
493
+ └── .synaptiq/
494
+ ├── kuzu/ # KuzuDB graph database (graph + FTS + vectors)
495
+ └── meta.json # Index metadata and stats
496
+ ```
497
+
498
+ Add `.synaptiq/` to your `.gitignore`.
499
+
500
+ The storage layer is abstracted behind a `StorageBackend` Protocol — KuzuDB is the default, with an optional Neo4j backend available via `pip install synaptiq[neo4j]`.
501
+
502
+ ---
503
+
504
+ ## Example Workflows
505
+
506
+ ### "I need to refactor the User class — what breaks?"
507
+
508
+ ```bash
509
+ # See everything connected to User
510
+ synaptiq context User
511
+
512
+ # Check blast radius
513
+ synaptiq impact User --depth 3
514
+
515
+ # Find which files always change with user.py
516
+ synaptiq cypher "MATCH (a:File)-[r:CodeRelation]->(b:File) WHERE a.name = 'user.py' AND r.rel_type = 'coupled_with' RETURN b.name, r.strength ORDER BY r.strength DESC"
517
+ ```
518
+
519
+ ### "Is there dead code we should clean up?"
520
+
521
+ ```bash
522
+ synaptiq dead-code
523
+ ```
524
+
525
+ ### "What are the main execution flows in our app?"
526
+
527
+ ```bash
528
+ synaptiq cypher "MATCH (p:Process) RETURN p.name, p.properties ORDER BY p.name"
529
+ ```
530
+
531
+ ### "Which parts of the codebase are most tightly coupled?"
532
+
533
+ ```bash
534
+ synaptiq cypher "MATCH (a:File)-[r:CodeRelation]->(b:File) WHERE r.rel_type = 'coupled_with' RETURN a.name, b.name, r.strength ORDER BY r.strength DESC LIMIT 20"
535
+ ```
536
+
537
+ ---
538
+
539
+ ## How It Compares
540
+
541
+ | Capability | grep/ripgrep | LSP | Synaptiq |
542
+ |-----------|-------------|-----|----------|
543
+ | Text search | Yes | No | Yes (hybrid BM25 + vector) |
544
+ | Go to definition | No | Yes | Yes (graph traversal) |
545
+ | Find all callers | No | Partial | Yes (full call graph with confidence) |
546
+ | Type relationships | No | Yes | Yes (param/return/variable roles) |
547
+ | Dead code detection | No | No | Yes (multi-pass, framework-aware) |
548
+ | Execution flow tracing | No | No | Yes (entry point → flow) |
549
+ | Community detection | No | No | Yes (Leiden algorithm) |
550
+ | Change coupling (git) | No | No | Yes (6-month co-change analysis) |
551
+ | Impact analysis | No | No | Yes (calls + types + git coupling) |
552
+ | AI agent integration | No | Partial | Yes (full MCP server) |
553
+ | Structural branch diff | No | No | Yes (node/edge level) |
554
+ | Watch mode | No | Yes | Yes (Rust-based, 500ms debounce) |
555
+ | Works offline | Yes | Yes | Yes |
556
+
557
+ ---
558
+
559
+ ## Development
560
+
561
+ ```bash
562
+ git clone https://github.com/scanadi/synaptiq.git
563
+ cd synaptiq
564
+ uv sync --all-extras
565
+
566
+ # Run tests
567
+ uv run pytest
568
+
569
+ # Lint
570
+ uv run ruff check src/
571
+
572
+ # Run from source
573
+ uv run synaptiq --help
574
+ ```
575
+
576
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed contribution guidelines.
577
+
578
+ ---
579
+
580
+ ## Acknowledgments
581
+
582
+ Synaptiq was originally inspired by and built upon [axon](https://github.com/harshkedia177/axon) by [@harshkedia177](https://github.com/harshkedia177). This project has since evolved into an independent codebase with its own architecture, features, and direction.
583
+
584
+ ---
585
+
586
+ ## License
587
+
588
+ MIT — see [LICENSE](LICENSE).