synap-git 2.3.0__tar.gz → 2.4.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 (56) hide show
  1. {synap_git-2.3.0 → synap_git-2.4.0}/.gitignore +1 -0
  2. {synap_git-2.3.0 → synap_git-2.4.0}/CHANGELOG.md +35 -1
  3. {synap_git-2.3.0 → synap_git-2.4.0}/PKG-INFO +138 -108
  4. {synap_git-2.3.0 → synap_git-2.4.0}/README.md +136 -106
  5. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/__init__.py +1 -1
  6. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/api/app.py +31 -13
  7. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/cli/main.py +254 -69
  8. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/git/state.py +93 -40
  9. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/indexer/engine.py +54 -36
  10. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/indexer/scanner.py +2 -0
  11. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/mcp/server.py +10 -2
  12. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/provider/factory.py +31 -5
  13. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/provider/ollama.py +15 -6
  14. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/retrieval/engine.py +48 -18
  15. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/storage/sqlite.py +15 -9
  16. {synap_git-2.3.0 → synap_git-2.4.0}/.synap.example/README.md +0 -0
  17. {synap_git-2.3.0 → synap_git-2.4.0}/LICENSE.md +0 -0
  18. {synap_git-2.3.0 → synap_git-2.4.0}/pyproject.toml +0 -0
  19. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/api/__init__.py +0 -0
  20. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/api/static/index.html +0 -0
  21. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/cli/__init__.py +0 -0
  22. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/cli/__main__.py +0 -0
  23. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/cli/checkpoint.py +0 -0
  24. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/cli/lessons.py +0 -0
  25. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/cli/memory.py +0 -0
  26. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/cli/usage.py +0 -0
  27. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/cli/wiki.py +0 -0
  28. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/config.py +0 -0
  29. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/diagnostics/__init__.py +0 -0
  30. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/diagnostics/logger.py +0 -0
  31. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/diagnostics/tracing.py +0 -0
  32. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/embeddings/__init__.py +0 -0
  33. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/git/__init__.py +0 -0
  34. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/indexer/__init__.py +0 -0
  35. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/indexer/daemon.py +0 -0
  36. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/indexer/wiki.py +0 -0
  37. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/mcp/__init__.py +0 -0
  38. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/parser/__init__.py +0 -0
  39. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/parser/registry.py +0 -0
  40. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/provider/__init__.py +0 -0
  41. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/provider/anthropic.py +0 -0
  42. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/provider/base.py +0 -0
  43. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/provider/gemini.py +0 -0
  44. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/provider/openai.py +0 -0
  45. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/provider/openrouter.py +0 -0
  46. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/py.typed +0 -0
  47. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/retrieval/__init__.py +0 -0
  48. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/retrieval/memory.py +0 -0
  49. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/security/__init__.py +0 -0
  50. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/security/redactor.py +0 -0
  51. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/security/sanitizer.py +0 -0
  52. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/security/validator.py +0 -0
  53. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/storage/__init__.py +0 -0
  54. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/utils/__init__.py +0 -0
  55. {synap_git-2.3.0 → synap_git-2.4.0}/src/synap_git/utils/serialization.py +0 -0
  56. {synap_git-2.3.0 → synap_git-2.4.0}/website/README.md +0 -0
@@ -1,6 +1,7 @@
1
1
  .DS_Store
2
2
  Thumbs.db
3
3
  .venv/
4
+ .venv312/
4
5
  __pycache__/
5
6
  *.py[cod]
6
7
  .pytest_cache/
@@ -5,21 +5,55 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [2.2.0] - 2026-08-03
8
+ ## [2.4.0] - 2026-08-14
9
+
10
+ ### Performance & Latency
11
+ - **MCP Search Sub-10ms Retrieval (780x Speedup)**: Optimized MCP `search` latency from 7,200ms to 9.2ms by replacing slow synchronous LLM router calls with deterministic sub-millisecond intent classification, caching vector deserialization in SQLite, and providing direct context grounding for AI coding agents.
12
+ - **SQLite Vector Search Acceleration**: Added LRU-cached vector parsing and pre-computed norms in `_cosine_similarity`, eliminating repetitive JSON decoding inside SQLite callbacks.
13
+ - **Git State Subprocess Caching**: Added TTL-based caching to `GitRepository.state()` to prevent redundant `git` subprocess executions across concurrent MCP tool calls.
14
+ - **Unthrottled Local LLM / Ollama Indexing**: Removed artificial rate limiter sleeps for local providers (`OllamaProvider`), enabling maximum indexing and embedding throughput.
15
+
16
+ ### Added
17
+ - **`synap index` & `synap sync` Commands**: Added dedicated CLI commands to explicitly map all AST symbols, caller/callee dependencies, and vector embeddings into `.synap/synap.db`.
18
+ - **Live Terminal Watcher (`synap status --watch`)**: Added real-time terminal monitoring with `--watch` (`-w`) option to track file counts, indexed symbols, and wiki status live.
19
+ - **API Health & Status Route Aliases**: Added `/api/status`, `/health`, and `/healthz` endpoints to FastAPI daemon.
20
+
21
+ ### Fixed
22
+ - **Ollama 500 Error Prevention**: Defaulted Ollama embedding requests to `nomic-embed-text` instead of chat models (like `qwen2.5-coder`), preventing Ollama HTTP 500 crashes.
23
+ - **CLI Progress Bar Collisions**: Eliminated terminal line tearing and flickering by removing nested transient Rich progress bars during embedding generation.
24
+ - **Uninitialized Database 500s**: Guarded `/api/v1/usage`, `/api/v1/checkpoints`, and `/api/v1/lessons` with explicit schema initialization to prevent table lookup failures on fresh repos.
25
+
26
+ ### Chore
27
+ - **Bumped package version** to `2.4.0`.
28
+
29
+ ## [2.3.1] - 2026-08-03
30
+
31
+ ### Fixed
32
+
33
+ - **Git state detection**: normalized branch resolution and improved dirty-state detection during runtime bootstrap.
34
+ - **Incremental indexing**: skipped reindex when HEAD commit is already indexed to restore zero-change performance.
35
+
36
+ ### Chore
37
+
38
+ - **Bumped package version** to `2.3.1`.
9
39
 
10
40
  ## [2.3.0] - 2026-08-03
11
41
 
12
42
  ### Added
43
+
13
44
  - **CLI Cost & Usage Command**: Expose `synap cost` (alias `synap usage`) to show aggregated LLM calls, token counts, and estimated USD cost in the terminal.
14
45
  - **Web UI: CLI Cost Integration**: The website CLI playground now surfaces an estimated cost line for sample commands so visitors can see token/cost economics.
15
46
 
16
47
  ### Changed
48
+
17
49
  - **Frontend Defensive Rendering**: Guarded several UI paths against undefined symbol objects to prevent runtime errors in production (fixed `.type` property reads).
18
50
 
19
51
  ### Chore
52
+
20
53
  - **Bumped package version** to `2.3.0`.
21
54
  - **Release automation**: prepared changelog and release tag for GitHub release `v2.3.0`.
22
55
 
56
+ ## [2.2.0] - 2026-08-03
23
57
 
24
58
  ### Added
25
59
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: synap-git
3
- Version: 2.3.0
3
+ Version: 2.4.0
4
4
  Summary: Persistent structural context infrastructure for AI coding agents.
5
5
  Project-URL: Homepage, https://github.com/saahilpal/synapse
6
6
  Project-URL: Repository, https://github.com/saahilpal/synapse
@@ -108,31 +108,32 @@ Synap coordinates local repository scanning, graph storage, wiki rendering, and
108
108
  └──────────────────────────┘
109
109
  ```
110
110
 
111
- * **synap_git.cli** — Mounts Typer subcommands for configuration, database repair, logs tailing, and service management.
112
- * **synap_git.indexer.daemon** — Runs the background loop tracking commit shifts and processes asynchronous documentation tasks.
113
- * **synap_git.api.app** — Serves REST endpoints for system metrics, LLM call logging, and diagnostic event streams.
114
- * **synap_git.git.state** — Extracts Git commit OIDs, untracked changes status, and branch indicators.
115
- * **synap_git.indexer.engine** — Orchestrates parallel file parsing, AST traversal, and database serialization.
116
- * **synap_git.parser.registry** — Parses language-specific grammar using Tree-sitter.
117
- * **synap_git.storage.sqlite** — Controls SQLite databases, Write-Ahead Logging (WAL), and FTS5 search indexing.
118
- * **synap_git.indexer.wiki** — Generates file, module, and project markdown documentation summaries.
119
- * **synap_git.retrieval.engine** — Controls lexical, structural, and semantic search queries with token budgeting.
120
- * **synap_git.mcp.server** — Serves Model Context Protocol commands via stdio.
111
+ - **synap_git.cli** — Mounts Typer subcommands for configuration, database repair, logs tailing, and service management.
112
+ - **synap_git.indexer.daemon** — Runs the background loop tracking commit shifts and processes asynchronous documentation tasks.
113
+ - **synap_git.api.app** — Serves REST endpoints for system metrics, LLM call logging, and diagnostic event streams.
114
+ - **synap_git.git.state** — Extracts Git commit OIDs, untracked changes status, and branch indicators.
115
+ - **synap_git.indexer.engine** — Orchestrates parallel file parsing, AST traversal, and database serialization.
116
+ - **synap_git.parser.registry** — Parses language-specific grammar using Tree-sitter.
117
+ - **synap_git.storage.sqlite** — Controls SQLite databases, Write-Ahead Logging (WAL), and FTS5 search indexing.
118
+ - **synap_git.indexer.wiki** — Generates file, module, and project markdown documentation summaries.
119
+ - **synap_git.retrieval.engine** — Controls lexical, structural, and semantic search queries with token budgeting.
120
+ - **synap_git.mcp.server** — Serves Model Context Protocol commands via stdio.
121
121
 
122
122
  ### The Layer Model
123
123
 
124
124
  Synap isolates structural truth from non-deterministic summaries through three defined layers:
125
125
 
126
- * **L1 (Structural Graph):** Tree-sitter parsers convert code files to AST symbols and import dependencies. Imports map caller-callee relations in a database graph, fully regeneratable from HEAD.
127
- * **L2 (Semantic Wiki):** Asynchronous background prompts construct markdown summaries of files and modules. Missing pages are resolved on-demand through lazy loading.
128
- * **L3 (Behavioral Memory):** Stored checkpoints, technical decisions, and lessons persist through branch swaps and index rollbacks.
126
+ - **L1 (Structural Graph):** Tree-sitter parsers convert code files to AST symbols and import dependencies. Imports map caller-callee relations in a database graph, fully regeneratable from HEAD.
127
+ - **L2 (Semantic Wiki):** Asynchronous background prompts construct markdown summaries of files and modules. Missing pages are resolved on-demand through lazy loading.
128
+ - **L3 (Behavioral Memory):** Stored checkpoints, technical decisions, and lessons persist through branch swaps and index rollbacks.
129
129
 
130
130
  ### Runtime Topology
131
131
 
132
132
  On daemon execution, Synap hosts all services in a single process using the asyncio event loop:
133
- * **Git Watcher Loop:** Polls repository state every 2 seconds. Identifies branch switches, commit additions, merges, and reverts.
134
- * **Uvicorn Server:** Hosts the REST API and HTML dashboard on port 9876.
135
- * **Wiki Worker Task:** Listens to `wiki_queue` changes, generating summaries using LLM calls.
133
+
134
+ - **Git Watcher Loop:** Polls repository state every 2 seconds. Identifies branch switches, commit additions, merges, and reverts.
135
+ - **Uvicorn Server:** Hosts the REST API and HTML dashboard on port 9876.
136
+ - **Wiki Worker Task:** Listens to `wiki_queue` changes, generating summaries using LLM calls.
136
137
 
137
138
  ### Data Flow
138
139
 
@@ -243,11 +244,13 @@ llm_calls
243
244
  file_path TEXT associated file path if applicable
244
245
  created_at INTEGER unix epoch timestamp
245
246
  ```
246
- *Note: Schema versioning is managed via `user_version` pragmas (currently version 3).*
247
+
248
+ _Note: Schema versioning is managed via `user_version` pragmas (currently version 3)._
247
249
 
248
250
  ### Indexing Pipeline
249
251
 
250
252
  Indexing translates source trees to SQLite relations:
253
+
251
254
  1. **Bootstrap Check:** Compares HEAD commit hash with database records. Passes execution to first-run indexing if blank, or incremental indexing if commit history matches.
252
255
  2. **First-run Indexing:** Parses all files. Files are split into chunks of 500. `ProcessPoolExecutor` uses all available CPU cores to execute AST parsing in parallel.
253
256
  3. **AST Symbol Extraction:** Tree-sitter parsers process code bytes. Traversal scripts register functions and classes.
@@ -258,6 +261,7 @@ Indexing translates source trees to SQLite relations:
258
261
  ### Retrieval Design
259
262
 
260
263
  Retrieval uses a four-stage hybrid query execution loop:
264
+
261
265
  1. **Temporal Selection:** Filters data based on active branch state.
262
266
  2. **Lexical Searching:** Queries terms using `symbols_fts` MATCH indexing, starting candidate scores at `1.0`.
263
267
  3. **Structural Expansion:** Traverses neighbors up to 2 hops away using SQLite recursive CTEs. Neighbors receive a starting score of `0.8^distance`.
@@ -267,34 +271,41 @@ Retrieval uses a four-stage hybrid query execution loop:
267
271
 
268
272
  MCP server communicates via stdio, packaging database actions under a JSON envelope.
269
273
 
270
- * **`get_status`** — Returns indexing counts, branch details, and HEAD commit hashes.
271
- * **`search`** (inputs: `query` string, `max_tokens` integer) — Returns ranked context blocks and latency timelines.
272
- * **`create_checkpoint`** (inputs: `doing` string, `changed_files` list, `next_step` string, `blockers` string) — Registers new thought snapshot.
273
- * **`restore_checkpoint`** — Returns the latest checkpoint detail for the active branch.
274
- * **`log_decision`** (inputs: `content` string, `context_info` string) — Logs architectural decisions.
275
- * **`verify_system`** — Performs SQLite quick checks.
276
- * **`submit_lesson_analysis`** (inputs: `lesson_id` string, `why_failed` string) — Saves lesson details under pending status.
277
- * **`get_approved_memory`** — Returns active approved memory lessons.
278
- * **`get_pending_memory`** — Returns pending lessons awaiting approval.
279
- * **`signal_low_context`** (inputs: `token_count` integer, `capacity` integer) — Asserts window usage thresholds, recommending checkpoints if needed.
274
+ - **`get_status`** — Returns indexing counts, branch details, and HEAD commit hashes.
275
+ - **`search`** (inputs: `query` string, `max_tokens` integer) — Returns ranked context blocks and latency timelines.
276
+ - **`create_checkpoint`** (inputs: `doing` string, `changed_files` list, `next_step` string, `blockers` string) — Registers new thought snapshot.
277
+ - **`restore_checkpoint`** — Returns the latest checkpoint detail for the active branch.
278
+ - **`log_decision`** (inputs: `content` string, `context_info` string) — Logs architectural decisions.
279
+ - **`verify_system`** — Performs SQLite quick checks.
280
+ - **`submit_lesson_analysis`** (inputs: `lesson_id` string, `why_failed` string) — Saves lesson details under pending status.
281
+ - **`get_approved_memory`** — Returns active approved memory lessons.
282
+ - **`get_pending_memory`** — Returns pending lessons awaiting approval.
283
+ - **`signal_low_context`** (inputs: `token_count` integer, `capacity` integer) — Asserts window usage thresholds, recommending checkpoints if needed.
280
284
 
281
285
  ### Key Algorithms
282
286
 
283
287
  #### Revert Detection
288
+
284
289
  When the daemon watcher registers a checkout transition, it runs:
290
+
285
291
  ```bash
286
292
  git log -n 1 --pretty=format:%s
287
293
  ```
294
+
288
295
  If the commit message starts with `"Revert "`, Synap parses the commit message to extract the reverted commit hash. It runs `git show --name-only` to identify affected paths and inserts a pending lesson row.
289
296
 
290
297
  #### Context Packing
298
+
291
299
  Context is packed using `tiktoken`'s `cl100k_base` tokenizer.
292
- * Enforces limit of `max_tokens - 600` (reserves 600 tokens for instructions).
293
- * Appends active approved memory lessons under `# APPROVED SYSTEM MEMORY`.
294
- * Formats code blocks sequentially. Candidate elements exceeding the remaining budget are truncated.
300
+
301
+ - Enforces limit of `max_tokens - 600` (reserves 600 tokens for instructions).
302
+ - Appends active approved memory lessons under `# APPROVED SYSTEM MEMORY`.
303
+ - Formats code blocks sequentially. Candidate elements exceeding the remaining budget are truncated.
295
304
 
296
305
  #### Graph CTE Traversal
306
+
297
307
  Recursively traverses dependencies using SQLite SQL CTEs:
308
+
298
309
  ```sql
299
310
  WITH RECURSIVE neighborhood(id, d) AS (
300
311
  SELECT ? as id, 0 as d
@@ -315,39 +326,49 @@ ORDER BY n.d ASC
315
326
  ## Install
316
327
 
317
328
  Install the python package:
329
+
318
330
  ```bash
319
331
  pip install synap-git
320
332
  ```
321
333
 
322
334
  ### System Requirements
323
- * Python >= 3.11
324
- * Git Command Line Tool
325
- * SQLite (compiled with FTS5 virtual table support)
335
+
336
+ - Python >= 3.11
337
+ - Git Command Line Tool
338
+ - SQLite (compiled with FTS5 virtual table support)
326
339
 
327
340
  ---
328
341
 
329
342
  ## Quick Start
330
343
 
331
344
  ### 1. Setup LLM Credentials
345
+
332
346
  Run interactive configuration to configure your model:
347
+
333
348
  ```bash
334
349
  synap setup .
335
350
  ```
336
351
 
337
352
  ### 2. Run Ingestion
353
+
338
354
  Initialize the local SQLite database index:
355
+
339
356
  ```bash
340
357
  synap init .
341
358
  ```
342
359
 
343
360
  ### 3. Connect IDE / Start MCP
361
+
344
362
  Launch the unified background daemon and MCP stdio server:
363
+
345
364
  ```bash
346
365
  synap start .
347
366
  ```
348
367
 
349
368
  ### 4. Connect IDE
369
+
350
370
  Generate configuration settings:
371
+
351
372
  ```bash
352
373
  synap mcp config .
353
374
  ```
@@ -358,36 +379,41 @@ synap mcp config .
358
379
 
359
380
  All commands support target path arguments:
360
381
 
361
- * `synap setup [PATH]` — Runs provider configuration wizard.
362
- * `synap init [PATH]` — Performs initial structural indexing. Supports `--skip-llm`, `--skip-wiki`.
363
- * `synap wipe [PATH]` — Purges SQLite index.
364
- * `synap start [PATH]` — Launches background daemon.
365
- * `synap stop [PATH]` — Terminate background daemon.
366
- * `synap restart [PATH]` — Restarts background daemon.
367
- * `synap status [PATH]` — Prints active indexing parameters. Supports `--json`.
368
- * `synap logs` — Views system logs. Supports `-t`, `-n`, `-d`.
369
- * `synap update` — Upgrades Synap installation.
370
- * `synap version` — Prints version.
371
- * `synap rollback [PATH]` — Restores index state to previous commit. Supports `-c`, `-y`.
372
- * `synap repair [PATH]` — Wipes index and rebuilds from HEAD. Supports `-y`.
373
- * `synap doctor [PATH]` — Verifies database integrity and parsers.
374
- * `synap run [PATH]` — Runs daemon in foreground.
375
- * `synap ui [PATH]` — Launches HTML dashboard.
376
- * `synap mcp config [PATH]` — Outputs Cursor connection blocks.
377
- * `synap mcp verify [PATH]` — Asserts MCP server stability.
378
- * `synap memory status [PATH]` — Lists lesson counts.
379
- * `synap memory prune [PATH]` — Evaluates and deletes expired lessons.
380
- * `synap memory verify [PATH]` — Checks lessons for missing files. Supports `--json`.
381
- * `synap lessons approve <ID> [PATH]` — Approves a pending lesson.
382
- * `synap lessons reject <ID> [PATH]` — Rejects a lesson.
383
- * `synap lessons review [PATH]` — Launches interactive lesson review console.
384
- * `synap checkpoint create [PATH]` — Logs progress snapshot. Supports `--doing`, `--files`, `--next-step`, `--blockers`.
385
- * `synap checkpoint list [PATH]` — Renders checkpoint tables.
386
- * `synap checkpoint restore <ID> [PATH]` — Displays checkpoint records.
387
- * `synap usage show [PATH]` — Renders token metrics.
388
- * `synap usage clear [PATH]` — Clears LLM call logs.
389
- * `synap wiki list [PATH]` — Lists generated docs.
390
- * `synap wiki show <FILE> [PATH]` — Renders wiki files.
382
+ - `synap setup [PATH]` — Runs interactive provider and embedding configuration wizard.
383
+ - `synap init [PATH]` — Performs initial structural indexing. Supports `--skip-llm`, `--skip-wiki`.
384
+ - `synap index [PATH]` — Explicitly indexes all AST symbols, dependencies, and vector embeddings into SQLite. Supports `--force` (`-f`), `--skip-llm`, `--quiet` (`-q`), `--json`.
385
+ - `synap sync [PATH]` — Incrementally synchronizes SQLite database with recent Git commits.
386
+ - `synap search <QUERY> [PATH]` — Performs hybrid lexical, structural, and semantic code search with optional LLM answer synthesis.
387
+ - `synap wipe [PATH]` — Purges SQLite index.
388
+ - `synap start [PATH]` — Launches background daemon.
389
+ - `synap stop [PATH]` — Terminates background daemon.
390
+ - `synap restart [PATH]` — Restarts background daemon.
391
+ - `synap status [PATH]` — Prints active indexing parameters. Supports `--watch` (`-w`) for real-time live monitoring and `--json`.
392
+ - `synap logs` — Views system logs. Supports `-t`, `-n`, `-d`.
393
+ - `synap update` — Upgrades Synap installation.
394
+ - `synap version` — Prints version.
395
+ - `synap rollback [PATH]` — Restores index state to previous commit. Supports `-c`, `-y`.
396
+ - `synap repair [PATH]` — Wipes index and rebuilds from HEAD. Supports `-y`.
397
+ - `synap doctor [PATH]` — Verifies database integrity, port binding, and REST API health.
398
+ - `synap run [PATH]` — Runs daemon in foreground.
399
+ - `synap ui [PATH]` — Launches HTML dashboard.
400
+ - `synap mcp config [PATH]` — Outputs Cursor / IDE connection blocks.
401
+ - `synap mcp verify [PATH]` — Asserts MCP server stability and benchmarks tool latencies.
402
+ - `synap memory status [PATH]` — Lists lesson counts.
403
+ - `synap memory prune [PATH]` — Evaluates and deletes expired lessons.
404
+ - `synap memory verify [PATH]` — Checks lessons for missing files. Supports `--json`.
405
+ - `synap lessons approve <ID> [PATH]` — Approves a pending lesson.
406
+ - `synap lessons reject <ID> [PATH]` — Rejects a lesson.
407
+ - `synap lessons review [PATH]` — Launches interactive lesson review console.
408
+ - `synap checkpoint create [PATH]` — Logs progress snapshot. Supports `--doing`, `--files`, `--next-step`, `--blockers`.
409
+ - `synap checkpoint list [PATH]` — Renders checkpoint tables.
410
+ - `synap checkpoint restore <ID> [PATH]` — Displays checkpoint records.
411
+ - `synap usage show [PATH]` — Renders token metrics.
412
+ - `synap usage clear [PATH]` — Clears LLM call logs.
413
+ - `synap cost [PATH]` — Shows aggregated LLM calls, token counts, and estimated USD cost (alias for `synap usage show`).
414
+ - `synap wiki list [PATH]` — Lists generated docs.
415
+ - `synap wiki show <FILE> [PATH]` — Renders wiki files.
416
+ - `synap wiki retry [PATH]` — Retries generation of failed or stale wiki documentation pages.
391
417
 
392
418
  ---
393
419
 
@@ -395,46 +421,48 @@ All commands support target path arguments:
395
421
 
396
422
  Configuration values are parsed from `~/.config/synap/config.toml`.
397
423
 
398
- | Field Name | Type | Default | Description |
399
- | :--- | :--- | :--- | :--- |
400
- | `profile` | `string` | `"dev"` | Active environment configuration profile. |
401
- | `mode` | `string` | `"active"` | Watcher polling mode selector. |
402
- | `repository_path` | `string` | `"."` | Repository root directory. |
403
- | `state_path` | `string` | `".synap"` | Root storage path. |
404
- | `sqlite_path` | `string` | `".synap/synap.db"` | Database file location. |
405
- | `object_path` | `string` | `".synap/objects"` | Directory for serialized artifacts. |
406
- | `log_path` | `string` | `".synap/logs"` | Directory for logs. |
407
- | `logging_mode` | `string` | `"human"` | Log output format type. |
408
- | `log_level` | `string` | `"INFO"` | Minimum logging level threshold. |
409
- | `max_file_bytes` | `integer` | `1000000` | Size threshold for parsed files. |
410
- | `checkpoint_threshold` | `float` | `0.60` | Threshold ratio for memory warnings. |
411
- | `lesson_expiry_days` | `integer` | `7` | Days before memory lessons expire. |
412
- | `llm_provider` | `string` | `null` | Generative provider: `openai`, `gemini`, `anthropic`, `ollama`, `openrouter`. |
413
- | `llm_model` | `string` | `null` | Named model used for prompts. |
414
- | `ollama_url` | `string` | `"http://127.0.0.1:11434"` | Endpoint URL for Ollama connectivity. |
415
- | `mcp_host` | `string` | `"127.0.0.1"` | Bind host for local networking. |
416
- | `mcp_port` | `integer` | `9876` | Server listener port. |
417
- | `daemon_poll_interval_seconds` | `float` | `2.0` | Git state polling frequency. |
418
- | `shutdown_timeout_seconds` | `float` | `5.0` | Timeout threshold for shutting down. |
424
+ | Field Name | Type | Default | Description |
425
+ | :----------------------------- | :-------- | :------------------------- | :---------------------------------------------------------------------------- |
426
+ | `profile` | `string` | `"dev"` | Active environment configuration profile. |
427
+ | `mode` | `string` | `"active"` | Watcher polling mode selector. |
428
+ | `repository_path` | `string` | `"."` | Repository root directory. |
429
+ | `state_path` | `string` | `".synap"` | Root storage path. |
430
+ | `sqlite_path` | `string` | `".synap/synap.db"` | Database file location. |
431
+ | `object_path` | `string` | `".synap/objects"` | Directory for serialized artifacts. |
432
+ | `log_path` | `string` | `".synap/logs"` | Directory for logs. |
433
+ | `logging_mode` | `string` | `"human"` | Log output format type. |
434
+ | `log_level` | `string` | `"INFO"` | Minimum logging level threshold. |
435
+ | `max_file_bytes` | `integer` | `1000000` | Size threshold for parsed files. |
436
+ | `checkpoint_threshold` | `float` | `0.60` | Threshold ratio for memory warnings. |
437
+ | `lesson_expiry_days` | `integer` | `7` | Days before memory lessons expire. |
438
+ | `llm_provider` | `string` | `null` | Generative provider: `openai`, `gemini`, `anthropic`, `ollama`, `openrouter`. |
439
+ | `llm_model` | `string` | `null` | Named model used for prompts. |
440
+ | `ollama_url` | `string` | `"http://127.0.0.1:11434"` | Endpoint URL for Ollama connectivity. |
441
+ | `mcp_host` | `string` | `"127.0.0.1"` | Bind host for local networking. |
442
+ | `mcp_port` | `integer` | `9876` | Server listener port. |
443
+ | `daemon_poll_interval_seconds` | `float` | `2.0` | Git state polling frequency. |
444
+ | `shutdown_timeout_seconds` | `float` | `5.0` | Timeout threshold for shutting down. |
419
445
 
420
446
  ---
421
447
 
422
448
  ## MCP Integration
423
449
 
424
450
  Verify configurations using:
451
+
425
452
  ```bash
426
453
  synap mcp config .
427
454
  ```
428
455
 
429
456
  ### Server Configuration Block
457
+
430
458
  ```json
431
459
  {
432
- "mcpServers": {
433
- "synap": {
434
- "command": "/usr/local/bin/python",
435
- "args": ["-m", "synap_git.cli", "start", "/Users/username/repo"]
460
+ "mcpServers": {
461
+ "synap": {
462
+ "command": "/usr/local/bin/python",
463
+ "args": ["-m", "synap_git.cli", "start", "/Users/username/repo"]
464
+ }
436
465
  }
437
- }
438
466
  }
439
467
  ```
440
468
 
@@ -444,15 +472,15 @@ synap mcp config .
444
472
 
445
473
  Synap now processes syntax dynamically for **over 50 programming languages** via `tree-sitter-languages`, including:
446
474
 
447
- * **Python** (`.py`)
448
- * **JavaScript / TypeScript** (`.js`, `.jsx`, `.ts`, `.tsx`)
449
- * **C / C++ / C#** (`.c`, `.cpp`, `.h`, `.hpp`, `.cs`)
450
- * **Java / Kotlin / Scala** (`.java`, `.kt`, `.kts`, `.scala`)
451
- * **Go / Rust / Swift** (`.go`, `.rs`, `.swift`)
452
- * **Ruby / PHP / Perl** (`.rb`, `.php`, `.pl`)
453
- * **Shell Scripts** (`.sh`, `.bash`, or via `#!` shebang detection)
454
- * **Data / Config** (`.sql`, `.json`, `.yaml`, `.toml`, `.xml`)
455
- * **Web** (`.html`, `.css`, `.scss`)
475
+ - **Python** (`.py`)
476
+ - **JavaScript / TypeScript** (`.js`, `.jsx`, `.ts`, `.tsx`)
477
+ - **C / C++ / C#** (`.c`, `.cpp`, `.h`, `.hpp`, `.cs`)
478
+ - **Java / Kotlin / Scala** (`.java`, `.kt`, `.kts`, `.scala`)
479
+ - **Go / Rust / Swift** (`.go`, `.rs`, `.swift`)
480
+ - **Ruby / PHP / Perl** (`.rb`, `.php`, `.pl`)
481
+ - **Shell Scripts** (`.sh`, `.bash`, or via `#!` shebang detection)
482
+ - **Data / Config** (`.sql`, `.json`, `.yaml`, `.toml`, `.xml`)
483
+ - **Web** (`.html`, `.css`, `.scss`)
456
484
 
457
485
  Even extensionless scripts are gracefully detected via shebang parsing. Missing grammars automatically degrade gracefully to plaintext indexing.
458
486
 
@@ -460,30 +488,32 @@ Even extensionless scripts are gracefully detected via shebang parsing. Missing
460
488
 
461
489
  ## Supported Providers
462
490
 
463
- * **Ollama** — Local model integration.
464
- * **OpenAI** — Cloud GPT models. (Environment Variable: `SYNAP_OPENAI_API_KEY`)
465
- * **Anthropic** — Cloud Claude models. (Environment Variable: `SYNAP_ANTHROPIC_API_KEY`)
466
- * **Gemini** — Cloud Gemini models. (Environment Variable: `SYNAP_GEMINI_API_KEY`)
467
- * **OpenRouter** — Unified cloud model routing. (Environment Variable: `SYNAP_OPENROUTER_API_KEY`)
491
+ - **Ollama** — Local model integration.
492
+ - **OpenAI** — Cloud GPT models. (Environment Variable: `SYNAP_OPENAI_API_KEY`)
493
+ - **Anthropic** — Cloud Claude models. (Environment Variable: `SYNAP_ANTHROPIC_API_KEY`)
494
+ - **Gemini** — Cloud Gemini models. (Environment Variable: `SYNAP_GEMINI_API_KEY`)
495
+ - **OpenRouter** — Unified cloud model routing. (Environment Variable: `SYNAP_OPENROUTER_API_KEY`)
468
496
 
469
497
  ---
470
498
 
471
499
  ## Limitations
472
500
 
473
- * **Git workspace dependency:** Indexes and tracks metadata solely inside valid Git repositories.
474
- * **Structural-only mode:** Runs without wiki generation or contextual LLM generation if `llm_provider` is unset.
475
- * **Size exclusions:** Skips binary files and files larger than `max_file_bytes` (default 1MB).
501
+ - **Git workspace dependency:** Indexes and tracks metadata solely inside valid Git repositories.
502
+ - **Structural-only mode:** Runs without wiki generation or contextual LLM generation if `llm_provider` is unset.
503
+ - **Size exclusions:** Skips binary files and files larger than `max_file_bytes` (default 1MB).
476
504
 
477
505
  ---
478
506
 
479
507
  ## Contributing
480
508
 
481
509
  Execute unit tests:
510
+
482
511
  ```bash
483
512
  SYNAP_SKIP_STRESS=1 uv run pytest tests/ -x --tb=short
484
513
  ```
485
514
 
486
515
  Format code and check types:
516
+
487
517
  ```bash
488
518
  uv run ruff format src/
489
519
  uv run ruff check src/