synap-git 2.4.1__tar.gz → 2.6.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.
- {synap_git-2.4.1 → synap_git-2.6.0}/.gitignore +1 -4
- {synap_git-2.4.1 → synap_git-2.6.0}/CHANGELOG.md +34 -0
- synap_git-2.6.0/PKG-INFO +164 -0
- synap_git-2.6.0/README.md +112 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/pyproject.toml +2 -1
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/__init__.py +1 -1
- synap_git-2.6.0/src/synap_git/api/app.py +351 -0
- synap_git-2.6.0/src/synap_git/api/static/index.html +1590 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/cli/main.py +1709 -311
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/config.py +4 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/git/__init__.py +9 -1
- synap_git-2.6.0/src/synap_git/git/state.py +525 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/indexer/daemon.py +208 -136
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/indexer/engine.py +365 -226
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/indexer/scanner.py +1 -1
- synap_git-2.6.0/src/synap_git/mcp/server.py +1045 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/parser/registry.py +266 -16
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/retrieval/engine.py +219 -37
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/storage/sqlite.py +382 -75
- synap_git-2.4.1/PKG-INFO +0 -527
- synap_git-2.4.1/README.md +0 -476
- synap_git-2.4.1/src/synap_git/api/app.py +0 -162
- synap_git-2.4.1/src/synap_git/api/static/index.html +0 -625
- synap_git-2.4.1/src/synap_git/cli/checkpoint.py +0 -139
- synap_git-2.4.1/src/synap_git/cli/lessons.py +0 -191
- synap_git-2.4.1/src/synap_git/cli/memory.py +0 -171
- synap_git-2.4.1/src/synap_git/cli/usage.py +0 -88
- synap_git-2.4.1/src/synap_git/cli/wiki.py +0 -86
- synap_git-2.4.1/src/synap_git/git/state.py +0 -219
- synap_git-2.4.1/src/synap_git/mcp/server.py +0 -280
- synap_git-2.4.1/src/synap_git/retrieval/memory.py +0 -123
- synap_git-2.4.1/src/synap_git/utils/__init__.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/.synap.example/README.md +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/LICENSE.md +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/api/__init__.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/cli/__init__.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/cli/__main__.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/diagnostics/__init__.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/diagnostics/logger.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/diagnostics/tracing.py +0 -0
- {synap_git-2.4.1/src/synap_git/embeddings → synap_git-2.6.0/src/synap_git/indexer}/__init__.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/indexer/wiki.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/mcp/__init__.py +0 -0
- {synap_git-2.4.1/src/synap_git/indexer → synap_git-2.6.0/src/synap_git/parser}/__init__.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/provider/__init__.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/provider/anthropic.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/provider/base.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/provider/factory.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/provider/gemini.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/provider/ollama.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/provider/openai.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/provider/openrouter.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/py.typed +0 -0
- {synap_git-2.4.1/src/synap_git/parser → synap_git-2.6.0/src/synap_git/retrieval}/__init__.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/security/__init__.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/security/redactor.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/security/sanitizer.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/security/validator.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/storage/__init__.py +0 -0
- {synap_git-2.4.1/src/synap_git/retrieval → synap_git-2.6.0/src/synap_git/utils}/__init__.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/src/synap_git/utils/serialization.py +0 -0
- {synap_git-2.4.1 → synap_git-2.6.0}/website/README.md +0 -0
|
@@ -5,6 +5,40 @@ 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.6.0] - 2026-11-01
|
|
9
|
+
|
|
10
|
+
### Specialist Implementation Sprint & Production-Quality Engineering
|
|
11
|
+
- **Shared Runtime Snapshot Caching & Event Stream Isolation**: Added 2-second TTL caching to `/api/status` and `/api/v1/events` avoiding redundant Git child processes and SQLite queries; added client disconnect detection (`await request.is_disconnected()`) in SSE loop to prevent CPU leaks on closed browser tabs.
|
|
12
|
+
- **Compact FastMCP Session Preamble & Batch Extraction**: Reduced `get_session_preamble()` prompt overhead to <150 tokens preserving negative constraints and branch checkpoints; added `read_symbols(symbols=[...])` for single-roundtrip multi-symbol extraction.
|
|
13
|
+
- **Pipe-Friendly CLI & Machine-Parsable JSON**: Added interactive TTY autodetection in `_print_formatted()` emitting unstyled plain text and pipe-delimited tables when redirected, plus `--json` flags to `synap status`, `synap diff`, `synap blast`, and `synap hubs`.
|
|
14
|
+
- **Merge/Rebase In-Progress Indexing Guards**: Prevented conflict marker corruption (`<<<<<<< HEAD`) by auto-pausing the indexing engine during active `MERGE_HEAD`, `REBASE_HEAD`, or `BISECT_HEAD` operations.
|
|
15
|
+
- **Proportional Context Budgeting & Tokenization**: Replaced fixed 600-token safety margin with dynamic proportional allocation (`12%` budget cap) and added 2-character identifier preservation (`db`, `id`, `ip`, `ui`, `tx`) with camelCase/snake_case sub-tokenization.
|
|
16
|
+
- **Storage Self-Healing Isolation**: Enforced that `recover_if_corrupted()` only resets database files upon explicit `PRAGMA quick_check` B-tree failure, never on transient concurrency lock timeouts.
|
|
17
|
+
- **Background UI Throttling**: Paused dashboard polling and event consumption when browser tab is inactive via Page Visibility API.
|
|
18
|
+
- **Packaging & Version Synchronization**: Unified package version `2.6.0` across `pyproject.toml` and `synap_git/__init__.py`, and pruned legacy unused dependencies.
|
|
19
|
+
|
|
20
|
+
## [2.5.0] - 2026-11-01
|
|
21
|
+
|
|
22
|
+
### Major System Transformation & Performance Acceleration (10-Specialist Mission)
|
|
23
|
+
- **193x Faster Graph Traversal**: Replaced full-table scans in `get_neighborhood()` with `min_distances` CTE pre-aggregation and added composite covering indexes (`idx_edges_src_tgt`, `idx_edges_tgt_src`, `idx_symbols_start_end`).
|
|
24
|
+
- **Personalized PageRank (PPR)**: Pure-Python PPR implementation accelerated 2.36x with integer index arrays, biasing ranking towards active dirty files to identify architectural hubs.
|
|
25
|
+
- **Git-Aware Blast Radius Analysis**: Diff interval mapping (`get_dirty_diff_ranges()`) across untracked, staged, and unstaged modifications, correlating touched lines to AST symbols, callers, and impacted test suites.
|
|
26
|
+
- **Git Worktree & Detached HEAD Resolution**: Safe worktree support resolving `gitdir:` and `commondir:`, robust checkout classification during detached HEAD and rebases, and clean ghost file pruning on branch checkout transitions.
|
|
27
|
+
- **Deterministic AST Code Skeletonization**: Reverse-order byte-slicing across Python, JS/TS, Go, Rust, Java, C/C++ yielding 81%–90% token reduction with nested closure preservation.
|
|
28
|
+
- **Zero-Corruption SQLite Recovery**: Hardened `recover_if_corrupted()` to never wipe database files on transient lock contention or timeouts, and added PRAGMA tuning (`busy_timeout=30000`, `cache_size=-64000`, `temp_store=MEMORY`).
|
|
29
|
+
- **FastMCP Tool Diet**: Upgraded 23 FastMCP tools with clean fallback defaults, directional aliases (`get_callers`, `get_callees`), `read_symbol`, `get_diff`, and `get_test_recommendations`.
|
|
30
|
+
- **New Advanced CLI Commands**: Added `synap blast`, `synap hubs`, `synap outline`, `synap diff`, `synap test`, `synap explain`, `synap pack`, interactive status dashboard on zero arguments, and `--fix` / `--context` support in `synap doctor`.
|
|
31
|
+
- **Web UI Overhaul**: Revamped diagnostic dashboard with zero emojis, dark/light themes, `/` keyboard shortcut search, interactive symbol inspector modal, live blast radius table, PageRank hubs table, and one-click lesson approval/rejection.
|
|
32
|
+
- **Dead Code Pruning**: Purged obsolete `retrieval/memory.py` module, redundant CLI wrappers, and standardized soft-rejection semantics across Web UI and CLI.
|
|
33
|
+
- **10-Specialist Improvement Audit**: Added authoritative audit roadmap (`docs/IMPROVEMENT_AUDIT.md`), architecture specifications (`docs/architecture/system-overview.md`), research literature review (`docs/research/benchmarks-and-literature.md`), and monorepo stress methodology (`docs/benchmarks/monorepo-stress-methodology.md`).
|
|
34
|
+
- **Critical Concurrency & Safety Fixes**:
|
|
35
|
+
- Atomic wiki task dequeuing in SQLite via `UPDATE ... RETURNING *` inside `BEGIN IMMEDIATE`.
|
|
36
|
+
- JSONC comment parsing and `.bak` backups in `_inject_mcp_config` to prevent IDE config wiping.
|
|
37
|
+
- Subdirectory CLI execution automatically resolves repository root via `GitRepository.find_root`.
|
|
38
|
+
- Indexing suspended during active merge conflicts (`MERGE_HEAD`), rebases, and bisects.
|
|
39
|
+
- Proportional token budgeting (`min(500, int(max_tokens * 0.15))`) and preserved $\ge 2$ char tokens in lexical search.
|
|
40
|
+
- Web UI polling throttled when tab is backgrounded via Page Visibility API.
|
|
41
|
+
|
|
8
42
|
## [2.4.1] - 2026-09-11
|
|
9
43
|
|
|
10
44
|
### Security, Protocol & Architecture Hardening (Audit Remediation)
|
synap_git-2.6.0/PKG-INFO
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: synap-git
|
|
3
|
+
Version: 2.6.0
|
|
4
|
+
Summary: Persistent structural context infrastructure for AI coding agents.
|
|
5
|
+
Project-URL: Homepage, https://github.com/saahilpal/synapse
|
|
6
|
+
Project-URL: Repository, https://github.com/saahilpal/synapse
|
|
7
|
+
Project-URL: Issues, https://github.com/saahilpal/synapse/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/saahilpal/synapse/blob/main/CHANGELOG.md
|
|
9
|
+
Author: Synap contributors
|
|
10
|
+
License: Apache-2.0
|
|
11
|
+
License-File: LICENSE.md
|
|
12
|
+
Keywords: ai,context,developer-tools,git,mcp,repository-indexing
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Requires-Dist: click==8.1.8
|
|
23
|
+
Requires-Dist: fastapi==0.115.11
|
|
24
|
+
Requires-Dist: gitpython==3.1.44
|
|
25
|
+
Requires-Dist: httpx==0.28.1
|
|
26
|
+
Requires-Dist: keyring==25.6.0
|
|
27
|
+
Requires-Dist: mcp==1.3.0
|
|
28
|
+
Requires-Dist: msgpack==1.1.0
|
|
29
|
+
Requires-Dist: packaging>=24.0
|
|
30
|
+
Requires-Dist: prompt-toolkit<3.0.44
|
|
31
|
+
Requires-Dist: pydantic-settings==2.8.1
|
|
32
|
+
Requires-Dist: pydantic==2.10.6
|
|
33
|
+
Requires-Dist: questionary==2.1.0
|
|
34
|
+
Requires-Dist: rich>=13.7.0
|
|
35
|
+
Requires-Dist: structlog==25.1.0
|
|
36
|
+
Requires-Dist: tiktoken==0.9.0
|
|
37
|
+
Requires-Dist: tree-sitter-languages==1.10.2
|
|
38
|
+
Requires-Dist: tree-sitter==0.20.4
|
|
39
|
+
Requires-Dist: typer==0.15.1
|
|
40
|
+
Requires-Dist: uvicorn==0.34.0
|
|
41
|
+
Requires-Dist: watchdog>=6.0.0
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Requires-Dist: bandit==1.8.3; extra == 'dev'
|
|
44
|
+
Requires-Dist: mypy==1.15.0; extra == 'dev'
|
|
45
|
+
Requires-Dist: pre-commit==4.1.0; extra == 'dev'
|
|
46
|
+
Requires-Dist: pytest-asyncio==0.25.3; extra == 'dev'
|
|
47
|
+
Requires-Dist: pytest-cov==6.0.0; extra == 'dev'
|
|
48
|
+
Requires-Dist: pytest-timeout==2.3.1; extra == 'dev'
|
|
49
|
+
Requires-Dist: pytest==8.3.4; extra == 'dev'
|
|
50
|
+
Requires-Dist: ruff==0.9.9; extra == 'dev'
|
|
51
|
+
Description-Content-Type: text/markdown
|
|
52
|
+
|
|
53
|
+
# Synapse
|
|
54
|
+
|
|
55
|
+
> Fast, local, zero-cost structural context engine for AI coding agents.
|
|
56
|
+
|
|
57
|
+
[](https://github.com/saahilpal/synapse/actions)
|
|
58
|
+
[](https://pypi.org/project/synap-git/)
|
|
59
|
+
[](https://pypi.org/project/synap-git/)
|
|
60
|
+
[](LICENSE.md)
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## ⚡ 5-Second Quickstart
|
|
65
|
+
|
|
66
|
+
Install Synapse and automatically configure your IDE (Cursor, Claude Code, Cline, Windsurf):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install synap-git
|
|
70
|
+
synap install
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Done. Synapse indexes your repository with Tree-sitter, installs zero-daemon Git hooks for automatic reindexing, and registers MCP server endpoints.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Why Synapse?
|
|
78
|
+
|
|
79
|
+
| Feature | Synapse | Repomix | Aider | Cursor / Cline Default |
|
|
80
|
+
| :--- | :---: | :---: | :---: | :---: |
|
|
81
|
+
| **API Cost** | **100% Free (Zero)** | 100% Free | Burns Tokens | Cloud Token Usage |
|
|
82
|
+
| **Graph Intelligence** | **AST Symbol & Edge Graph** | None (Flat Dump) | Repo Map (CTags) | Vector Embeddings |
|
|
83
|
+
| **Code Skeletonization** | **85% Token Reduction** | None (Raw Code) | Line Truncation | Chunk Slicing |
|
|
84
|
+
| **Git Blast Radius** | **Instant Callers & Tests** | None | Diff Only | None |
|
|
85
|
+
| **Architectural Hubs** | **Personalized PageRank** | None | Static Frequency | None |
|
|
86
|
+
| **Working Memory** | **Persistent Checkpoints** | None | Ephemeral Chat | Ephemeral Session |
|
|
87
|
+
| **Runtime Footprint** | **Zero-Daemon Hook Mode** | CLI Only | CLI Process | Background Indexer |
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Architecture
|
|
92
|
+
|
|
93
|
+
```mermaid
|
|
94
|
+
flowchart TD
|
|
95
|
+
A[AI Coding Agent / IDE<br>Cursor · Claude Code · Cline · Aider] -->|MCP stdio / CLI| B[Synapse Engine]
|
|
96
|
+
B --> C[AST Skeletonizer<br>85% Token Reduction]
|
|
97
|
+
B --> D[Git State & Blast Radius<br>Diff Line -> Callers -> Tests]
|
|
98
|
+
B --> E[Graph Engine & PageRank<br>Architectural Hubs]
|
|
99
|
+
B --> F[Working Memory & Lessons<br>Checkpoints & Anti-Regressions]
|
|
100
|
+
C & D & E & F --> G[(Local SQLite WAL DB<br>.synap/synap.db)]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
For database schemas and CTE traversal queries, see [Architecture Internals](docs/architecture.md).
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Essential CLI Commands
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Print token-bounded startup context (< 750 tokens)
|
|
111
|
+
synap context
|
|
112
|
+
|
|
113
|
+
# Check modified symbols, direct callers, and impacted tests
|
|
114
|
+
synap blast
|
|
115
|
+
|
|
116
|
+
# Run only tests impacted by dirty git blast radius
|
|
117
|
+
synap test
|
|
118
|
+
|
|
119
|
+
# Deep structural symbol inspection (callers, dependencies, tests)
|
|
120
|
+
synap explain my_function
|
|
121
|
+
|
|
122
|
+
# Export token-budgeted prompt pack with AST skeletons (< 8k tokens)
|
|
123
|
+
synap pack
|
|
124
|
+
|
|
125
|
+
# Inspect structural AST skeleton of any file (strips bodies, keeps types/docstrings)
|
|
126
|
+
synap skeleton src/my_module.py
|
|
127
|
+
|
|
128
|
+
# Discover top architectural hubs via PageRank
|
|
129
|
+
synap hubs
|
|
130
|
+
|
|
131
|
+
# Search repository with hybrid structural ranking
|
|
132
|
+
synap search "authentication flow"
|
|
133
|
+
|
|
134
|
+
# Verify environment and system health
|
|
135
|
+
synap doctor
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Shorthand aliases supported: `synap ctx`, `synap blast`, `synap t`, `synap ex <sym>`, `synap sk <file>`, `synap hubs`, `synap doc`.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## MCP Tools for AI Agents
|
|
143
|
+
|
|
144
|
+
When registered via `synap install`, AI agents gain direct access to these MCP tools:
|
|
145
|
+
|
|
146
|
+
| MCP Tool | Purpose |
|
|
147
|
+
| :--- | :--- |
|
|
148
|
+
| `get_session_preamble()` | Token-optimized session startup context (< 750 tokens: active branch, dirty files, blast radius, hubs, lessons). |
|
|
149
|
+
| `get_skeleton(file_path)` | Extracts function signatures, types, and docstrings without function bodies (85% token savings). |
|
|
150
|
+
| `get_blast_radius()` | Computes impact radius of uncommitted git changes down to callers and test files. |
|
|
151
|
+
| `get_callers(symbol)` | Finds all functions and modules that call or depend upon a symbol. |
|
|
152
|
+
| `get_callees(symbol)` | Finds all functions and symbols called by a given symbol. |
|
|
153
|
+
| `read_symbol(symbol)` | Reads exact lines and code of a specific function or class without reading the entire file. |
|
|
154
|
+
| `get_diff()` | Unified git diff of uncommitted or staged changes. |
|
|
155
|
+
| `get_test_recommendations()` | Discovers impacted test suites and provides recommended `pytest` commands. |
|
|
156
|
+
| `create_checkpoint(doing)` | Saves thought process and dirty working state before complex refactors. |
|
|
157
|
+
| `restore_checkpoint(id)` | Restores past checkpoint context after agent context compaction or memory wipes. |
|
|
158
|
+
| `remember(key, content)` | Stores operational observations and environment facts in persistent memory. |
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## License
|
|
163
|
+
|
|
164
|
+
MIT © Saahil Pal
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Synapse
|
|
2
|
+
|
|
3
|
+
> Fast, local, zero-cost structural context engine for AI coding agents.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/saahilpal/synapse/actions)
|
|
6
|
+
[](https://pypi.org/project/synap-git/)
|
|
7
|
+
[](https://pypi.org/project/synap-git/)
|
|
8
|
+
[](LICENSE.md)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## ⚡ 5-Second Quickstart
|
|
13
|
+
|
|
14
|
+
Install Synapse and automatically configure your IDE (Cursor, Claude Code, Cline, Windsurf):
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install synap-git
|
|
18
|
+
synap install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Done. Synapse indexes your repository with Tree-sitter, installs zero-daemon Git hooks for automatic reindexing, and registers MCP server endpoints.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Why Synapse?
|
|
26
|
+
|
|
27
|
+
| Feature | Synapse | Repomix | Aider | Cursor / Cline Default |
|
|
28
|
+
| :--- | :---: | :---: | :---: | :---: |
|
|
29
|
+
| **API Cost** | **100% Free (Zero)** | 100% Free | Burns Tokens | Cloud Token Usage |
|
|
30
|
+
| **Graph Intelligence** | **AST Symbol & Edge Graph** | None (Flat Dump) | Repo Map (CTags) | Vector Embeddings |
|
|
31
|
+
| **Code Skeletonization** | **85% Token Reduction** | None (Raw Code) | Line Truncation | Chunk Slicing |
|
|
32
|
+
| **Git Blast Radius** | **Instant Callers & Tests** | None | Diff Only | None |
|
|
33
|
+
| **Architectural Hubs** | **Personalized PageRank** | None | Static Frequency | None |
|
|
34
|
+
| **Working Memory** | **Persistent Checkpoints** | None | Ephemeral Chat | Ephemeral Session |
|
|
35
|
+
| **Runtime Footprint** | **Zero-Daemon Hook Mode** | CLI Only | CLI Process | Background Indexer |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Architecture
|
|
40
|
+
|
|
41
|
+
```mermaid
|
|
42
|
+
flowchart TD
|
|
43
|
+
A[AI Coding Agent / IDE<br>Cursor · Claude Code · Cline · Aider] -->|MCP stdio / CLI| B[Synapse Engine]
|
|
44
|
+
B --> C[AST Skeletonizer<br>85% Token Reduction]
|
|
45
|
+
B --> D[Git State & Blast Radius<br>Diff Line -> Callers -> Tests]
|
|
46
|
+
B --> E[Graph Engine & PageRank<br>Architectural Hubs]
|
|
47
|
+
B --> F[Working Memory & Lessons<br>Checkpoints & Anti-Regressions]
|
|
48
|
+
C & D & E & F --> G[(Local SQLite WAL DB<br>.synap/synap.db)]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
For database schemas and CTE traversal queries, see [Architecture Internals](docs/architecture.md).
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Essential CLI Commands
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Print token-bounded startup context (< 750 tokens)
|
|
59
|
+
synap context
|
|
60
|
+
|
|
61
|
+
# Check modified symbols, direct callers, and impacted tests
|
|
62
|
+
synap blast
|
|
63
|
+
|
|
64
|
+
# Run only tests impacted by dirty git blast radius
|
|
65
|
+
synap test
|
|
66
|
+
|
|
67
|
+
# Deep structural symbol inspection (callers, dependencies, tests)
|
|
68
|
+
synap explain my_function
|
|
69
|
+
|
|
70
|
+
# Export token-budgeted prompt pack with AST skeletons (< 8k tokens)
|
|
71
|
+
synap pack
|
|
72
|
+
|
|
73
|
+
# Inspect structural AST skeleton of any file (strips bodies, keeps types/docstrings)
|
|
74
|
+
synap skeleton src/my_module.py
|
|
75
|
+
|
|
76
|
+
# Discover top architectural hubs via PageRank
|
|
77
|
+
synap hubs
|
|
78
|
+
|
|
79
|
+
# Search repository with hybrid structural ranking
|
|
80
|
+
synap search "authentication flow"
|
|
81
|
+
|
|
82
|
+
# Verify environment and system health
|
|
83
|
+
synap doctor
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Shorthand aliases supported: `synap ctx`, `synap blast`, `synap t`, `synap ex <sym>`, `synap sk <file>`, `synap hubs`, `synap doc`.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## MCP Tools for AI Agents
|
|
91
|
+
|
|
92
|
+
When registered via `synap install`, AI agents gain direct access to these MCP tools:
|
|
93
|
+
|
|
94
|
+
| MCP Tool | Purpose |
|
|
95
|
+
| :--- | :--- |
|
|
96
|
+
| `get_session_preamble()` | Token-optimized session startup context (< 750 tokens: active branch, dirty files, blast radius, hubs, lessons). |
|
|
97
|
+
| `get_skeleton(file_path)` | Extracts function signatures, types, and docstrings without function bodies (85% token savings). |
|
|
98
|
+
| `get_blast_radius()` | Computes impact radius of uncommitted git changes down to callers and test files. |
|
|
99
|
+
| `get_callers(symbol)` | Finds all functions and modules that call or depend upon a symbol. |
|
|
100
|
+
| `get_callees(symbol)` | Finds all functions and symbols called by a given symbol. |
|
|
101
|
+
| `read_symbol(symbol)` | Reads exact lines and code of a specific function or class without reading the entire file. |
|
|
102
|
+
| `get_diff()` | Unified git diff of uncommitted or staged changes. |
|
|
103
|
+
| `get_test_recommendations()` | Discovers impacted test suites and provides recommended `pytest` commands. |
|
|
104
|
+
| `create_checkpoint(doing)` | Saves thought process and dirty working state before complex refactors. |
|
|
105
|
+
| `restore_checkpoint(id)` | Restores past checkpoint context after agent context compaction or memory wipes. |
|
|
106
|
+
| `remember(key, content)` | Stores operational observations and environment facts in persistent memory. |
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
MIT © Saahil Pal
|
|
@@ -24,13 +24,14 @@ dependencies = [
|
|
|
24
24
|
"gitpython==3.1.44",
|
|
25
25
|
"httpx==0.28.1",
|
|
26
26
|
"keyring==25.6.0",
|
|
27
|
-
"markdown-it-py==3.0.0",
|
|
28
27
|
"mcp==1.3.0",
|
|
29
28
|
"msgpack==1.1.0",
|
|
29
|
+
"packaging>=24.0",
|
|
30
30
|
"prompt-toolkit<3.0.44",
|
|
31
31
|
"pydantic==2.10.6",
|
|
32
32
|
"pydantic-settings==2.8.1",
|
|
33
33
|
"questionary==2.1.0",
|
|
34
|
+
"rich>=13.7.0",
|
|
34
35
|
"structlog==25.1.0",
|
|
35
36
|
"tiktoken==0.9.0",
|
|
36
37
|
"tree-sitter==0.20.4",
|