synapse-pkg 0.1.1__tar.gz → 2.0.0a2__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 (30) hide show
  1. synapse_pkg-2.0.0a2/PKG-INFO +306 -0
  2. synapse_pkg-2.0.0a2/README.md +294 -0
  3. {synapse_pkg-0.1.1 → synapse_pkg-2.0.0a2}/pyproject.toml +8 -4
  4. synapse_pkg-2.0.0a2/synapse/__init__.py +0 -0
  5. synapse_pkg-2.0.0a2/synapse/cli.py +25 -0
  6. synapse_pkg-2.0.0a2/synapse/commands.py +22 -0
  7. synapse_pkg-2.0.0a2/synapse/extractor.py +729 -0
  8. synapse_pkg-2.0.0a2/synapse/git_manager.py +425 -0
  9. synapse_pkg-2.0.0a2/synapse/persistence.py +131 -0
  10. synapse_pkg-2.0.0a2/synapse/processor.py +26 -0
  11. synapse_pkg-2.0.0a2/synapse_pkg.egg-info/PKG-INFO +306 -0
  12. {synapse_pkg-0.1.1 → synapse_pkg-2.0.0a2}/synapse_pkg.egg-info/SOURCES.txt +4 -4
  13. synapse_pkg-2.0.0a2/synapse_pkg.egg-info/entry_points.txt +2 -0
  14. synapse_pkg-2.0.0a2/synapse_pkg.egg-info/requires.txt +2 -0
  15. synapse_pkg-0.1.1/PKG-INFO +0 -222
  16. synapse_pkg-0.1.1/README.md +0 -211
  17. synapse_pkg-0.1.1/synapse/__init__.py +0 -1
  18. synapse_pkg-0.1.1/synapse/extractor.py +0 -63
  19. synapse_pkg-0.1.1/synapse/graph.py +0 -19
  20. synapse_pkg-0.1.1/synapse/persistence.py +0 -22
  21. synapse_pkg-0.1.1/synapse/processor.py +0 -25
  22. synapse_pkg-0.1.1/synapse/query.py +0 -40
  23. synapse_pkg-0.1.1/synapse/synapse.py +0 -37
  24. synapse_pkg-0.1.1/synapse/utils.py +0 -2
  25. synapse_pkg-0.1.1/synapse_pkg.egg-info/PKG-INFO +0 -222
  26. synapse_pkg-0.1.1/synapse_pkg.egg-info/requires.txt +0 -1
  27. {synapse_pkg-0.1.1 → synapse_pkg-2.0.0a2}/LICENSE +0 -0
  28. {synapse_pkg-0.1.1 → synapse_pkg-2.0.0a2}/setup.cfg +0 -0
  29. {synapse_pkg-0.1.1 → synapse_pkg-2.0.0a2}/synapse_pkg.egg-info/dependency_links.txt +0 -0
  30. {synapse_pkg-0.1.1 → synapse_pkg-2.0.0a2}/synapse_pkg.egg-info/top_level.txt +0 -0
@@ -0,0 +1,306 @@
1
+ Metadata-Version: 2.4
2
+ Name: synapse-pkg
3
+ Version: 2.0.0a2
4
+ Summary: Knowledge graph extraction library powered by LLMs
5
+ Author: Piyush Garg
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: GitPython>=3.1.40
10
+ Requires-Dist: ollama>=0.5.0
11
+ Dynamic: license-file
12
+
13
+
14
+ # Synapse V2
15
+
16
+ > **Incremental Repository Memory for AI Systems**
17
+
18
+ Modern AI coding assistants can reason about code, but they repeatedly forget the repository they are working on.
19
+
20
+ Every new conversation often starts from scratch, requiring the model to rediscover architecture, features, design decisions, and project evolution from thousands of lines of code.
21
+
22
+ **Synapse V2** treats a Git repository as a continuously evolving source of knowledge rather than a static snapshot.
23
+
24
+ Instead of reprocessing an entire repository every time, Synapse incrementally builds and maintains a **Repository Memory** that can be reused across conversations, tools, and AI systems.
25
+
26
+ ---
27
+
28
+ # Why Synapse?
29
+
30
+ Large software repositories contain years of engineering knowledge spread across:
31
+
32
+ - Source code
33
+ - Commit history
34
+ - Architectural evolution
35
+ - Engineering decisions
36
+ - Feature additions
37
+ - Documentation
38
+
39
+ Traditional repository summarization tools typically analyze only the latest state of a repository.
40
+
41
+ As repositories grow, repeatedly asking an LLM to understand the repository becomes increasingly expensive and inefficient.
42
+
43
+ The repository already contains its own history.
44
+
45
+ The challenge is transforming that history into a compact, durable memory representation.
46
+
47
+ ---
48
+
49
+ # Repository Memory Pipeline
50
+
51
+ ```text
52
+ Git Repository
53
+ │
54
+ ▼
55
+ Repository Changes
56
+ │
57
+ ▼
58
+ Knowledge Extraction
59
+ │
60
+ ▼
61
+ Repository Memory
62
+ │
63
+ ▼
64
+ Future Incremental Updates
65
+ ```
66
+
67
+ Rather than producing a one-time summary, Synapse continuously maintains a semantic memory of the repository.
68
+
69
+ ---
70
+
71
+ # What Synapse Extracts
72
+
73
+ Synapse attempts to preserve long-term repository knowledge including:
74
+
75
+ - Repository purpose
76
+ - Architecture
77
+ - Engineering decisions
78
+ - Design principles
79
+ - User-facing features
80
+ - Current capabilities
81
+ - Architectural evolution
82
+
83
+ The objective is not to summarize every commit, but to construct a stable repository ontology that evolves alongside the project.
84
+
85
+ ---
86
+
87
+ # Installation
88
+
89
+ ## Requirements
90
+
91
+ - Python 3.10+
92
+ - Git
93
+ - Ollama
94
+
95
+ Install the required model (recommended):
96
+
97
+ ```bash
98
+ ollama pull qwen3:14b-q4_K_M
99
+ ```
100
+
101
+ Install Synapse:
102
+
103
+ ```bash
104
+ pip install synapse-pkg
105
+ ```
106
+
107
+ ---
108
+
109
+ # Usage
110
+
111
+ Initialize Synapse inside any Git repository:
112
+
113
+ ```bash
114
+ synapse init
115
+ ```
116
+
117
+ This creates the `.synapse/` directory containing:
118
+
119
+ ```text
120
+ .synapse/
121
+ ├── metadata.json
122
+ ├── context.json
123
+ ├── compressed_context.json
124
+ └── config.json
125
+ ```
126
+
127
+ Build the initial Repository Context and Repository Memory:
128
+
129
+ ```bash
130
+ synapse knowledge
131
+ ```
132
+
133
+ On the first execution, Synapse processes the repository history.
134
+
135
+ Future executions process only commits that have not previously been analyzed, automatically updating the Repository Memory.
136
+
137
+ ---
138
+
139
+ # Incremental Processing
140
+
141
+ The first execution processes the repository history.
142
+
143
+ Subsequent executions process **only commits that have not previously been analyzed**.
144
+
145
+ ```text
146
+ First Run
147
+ ─────────
148
+ Entire Repository
149
+ │
150
+ ▼
151
+ Repository Memory
152
+
153
+ Future Runs
154
+ ───────────
155
+ New Commits
156
+ │
157
+ ▼
158
+ Updated Repository Memory
159
+ ```
160
+
161
+ Repository metadata stores the last processed commit, allowing future executions to continue from where the previous run ended.
162
+
163
+ ---
164
+
165
+ # Adaptive Processing Strategy
166
+
167
+ Different repositories require different processing strategies.
168
+
169
+ Synapse automatically selects one of three strategies.
170
+
171
+ ## Log Strategy
172
+
173
+ Used for repositories with a relatively small amount of new history.
174
+
175
+ Each commit is processed individually, preserving architectural evolution with the highest fidelity.
176
+
177
+ ---
178
+
179
+ ## Evolution Diff Strategy
180
+
181
+ For larger repositories, Synapse periodically compares snapshots of repository evolution instead of processing every individual commit.
182
+
183
+ This significantly reduces processing cost while preserving long-term architectural changes.
184
+
185
+ ---
186
+
187
+ ## Full Repository Diff
188
+
189
+ For extremely large repositories (currently **more than 100,000 commits**), Synapse processes a single diff between the **last processed commit** and the current `HEAD`.
190
+
191
+ This provides a scalable fallback that allows Synapse to continue operating efficiently even on repositories with extremely large histories.
192
+
193
+ ---
194
+
195
+ # Repository Context
196
+
197
+ Synapse maintains two persistent representations.
198
+
199
+ ## Repository Context
200
+
201
+ A structured historical representation containing processed repository changes.
202
+
203
+ This serves as the historical source of truth during repository processing.
204
+
205
+ ## Repository Memory
206
+
207
+ A continuously evolving semantic representation optimized for LLM consumption.
208
+
209
+ The memory is intentionally compact while preserving durable architectural understanding.
210
+
211
+ ---
212
+
213
+ # Why This Matters
214
+
215
+ Without persistent repository memory:
216
+
217
+ ```text
218
+ Repository
219
+ │
220
+ ▼
221
+ Language Model
222
+ │
223
+ ▼
224
+ Forget
225
+ ```
226
+
227
+ With Synapse:
228
+
229
+ ```text
230
+ Repository
231
+ │
232
+ ▼
233
+ Repository Memory
234
+ │
235
+ ▼
236
+ Any Language Model
237
+ ```
238
+
239
+ Repository understanding becomes reusable instead of being reconstructed every conversation.
240
+
241
+ ---
242
+
243
+ # Current Features
244
+
245
+ - Git repository initialization
246
+ - Automatic repository processing
247
+ - Incremental repository updates
248
+ - Adaptive processing strategy selection
249
+ - Repository Context generation
250
+ - Repository Memory generation
251
+ - Large commit splitting
252
+ - Automatic metadata tracking
253
+ - Persistent repository memory
254
+
255
+ ---
256
+
257
+ # Testing
258
+
259
+ Synapse V2 is currently in **alpha** and is undergoing testing on repositories of varying sizes and commit histories.
260
+
261
+ Current testing focuses on:
262
+
263
+ - Repository memory quality
264
+ - Incremental update correctness
265
+ - Processing strategy selection
266
+ - Large commit handling
267
+ - Repository scalability
268
+ - LLM extraction consistency
269
+ - Memory compression quality
270
+
271
+ Performance benchmarks will be published after testing has been completed across multiple repositories and hardware configurations.
272
+
273
+ ---
274
+
275
+ # Current Status
276
+
277
+ Synapse V2 is currently in **alpha**.
278
+
279
+ The repository ingestion pipeline is complete, and the current focus is improving repository memory quality, ontology consistency, and extraction accuracy through real-world testing.
280
+
281
+ ---
282
+
283
+ # Future Work
284
+
285
+ Repository Memory is intended to become the foundation for additional capabilities built on persistent repository understanding.
286
+
287
+ The exact direction of future versions is still evolving, with the immediate focus remaining on improving the quality, scalability, and usefulness of Repository Memory.
288
+
289
+ ---
290
+
291
+ # Vision
292
+
293
+ Language models provide reasoning.
294
+
295
+ Repositories contain knowledge.
296
+
297
+ Synapse aims to separate **repository memory** from the language model itself.
298
+
299
+ The long-term goal is to create a reusable, incremental, portable memory layer that evolves alongside software projects and can be shared across different AI systems without repeatedly reconstructing repository understanding.
300
+
301
+ ---
302
+
303
+ # License
304
+
305
+ MIT License
306
+
@@ -0,0 +1,294 @@
1
+
2
+ # Synapse V2
3
+
4
+ > **Incremental Repository Memory for AI Systems**
5
+
6
+ Modern AI coding assistants can reason about code, but they repeatedly forget the repository they are working on.
7
+
8
+ Every new conversation often starts from scratch, requiring the model to rediscover architecture, features, design decisions, and project evolution from thousands of lines of code.
9
+
10
+ **Synapse V2** treats a Git repository as a continuously evolving source of knowledge rather than a static snapshot.
11
+
12
+ Instead of reprocessing an entire repository every time, Synapse incrementally builds and maintains a **Repository Memory** that can be reused across conversations, tools, and AI systems.
13
+
14
+ ---
15
+
16
+ # Why Synapse?
17
+
18
+ Large software repositories contain years of engineering knowledge spread across:
19
+
20
+ - Source code
21
+ - Commit history
22
+ - Architectural evolution
23
+ - Engineering decisions
24
+ - Feature additions
25
+ - Documentation
26
+
27
+ Traditional repository summarization tools typically analyze only the latest state of a repository.
28
+
29
+ As repositories grow, repeatedly asking an LLM to understand the repository becomes increasingly expensive and inefficient.
30
+
31
+ The repository already contains its own history.
32
+
33
+ The challenge is transforming that history into a compact, durable memory representation.
34
+
35
+ ---
36
+
37
+ # Repository Memory Pipeline
38
+
39
+ ```text
40
+ Git Repository
41
+ │
42
+ ▼
43
+ Repository Changes
44
+ │
45
+ ▼
46
+ Knowledge Extraction
47
+ │
48
+ ▼
49
+ Repository Memory
50
+ │
51
+ ▼
52
+ Future Incremental Updates
53
+ ```
54
+
55
+ Rather than producing a one-time summary, Synapse continuously maintains a semantic memory of the repository.
56
+
57
+ ---
58
+
59
+ # What Synapse Extracts
60
+
61
+ Synapse attempts to preserve long-term repository knowledge including:
62
+
63
+ - Repository purpose
64
+ - Architecture
65
+ - Engineering decisions
66
+ - Design principles
67
+ - User-facing features
68
+ - Current capabilities
69
+ - Architectural evolution
70
+
71
+ The objective is not to summarize every commit, but to construct a stable repository ontology that evolves alongside the project.
72
+
73
+ ---
74
+
75
+ # Installation
76
+
77
+ ## Requirements
78
+
79
+ - Python 3.10+
80
+ - Git
81
+ - Ollama
82
+
83
+ Install the required model (recommended):
84
+
85
+ ```bash
86
+ ollama pull qwen3:14b-q4_K_M
87
+ ```
88
+
89
+ Install Synapse:
90
+
91
+ ```bash
92
+ pip install synapse-pkg
93
+ ```
94
+
95
+ ---
96
+
97
+ # Usage
98
+
99
+ Initialize Synapse inside any Git repository:
100
+
101
+ ```bash
102
+ synapse init
103
+ ```
104
+
105
+ This creates the `.synapse/` directory containing:
106
+
107
+ ```text
108
+ .synapse/
109
+ ├── metadata.json
110
+ ├── context.json
111
+ ├── compressed_context.json
112
+ └── config.json
113
+ ```
114
+
115
+ Build the initial Repository Context and Repository Memory:
116
+
117
+ ```bash
118
+ synapse knowledge
119
+ ```
120
+
121
+ On the first execution, Synapse processes the repository history.
122
+
123
+ Future executions process only commits that have not previously been analyzed, automatically updating the Repository Memory.
124
+
125
+ ---
126
+
127
+ # Incremental Processing
128
+
129
+ The first execution processes the repository history.
130
+
131
+ Subsequent executions process **only commits that have not previously been analyzed**.
132
+
133
+ ```text
134
+ First Run
135
+ ─────────
136
+ Entire Repository
137
+ │
138
+ ▼
139
+ Repository Memory
140
+
141
+ Future Runs
142
+ ───────────
143
+ New Commits
144
+ │
145
+ ▼
146
+ Updated Repository Memory
147
+ ```
148
+
149
+ Repository metadata stores the last processed commit, allowing future executions to continue from where the previous run ended.
150
+
151
+ ---
152
+
153
+ # Adaptive Processing Strategy
154
+
155
+ Different repositories require different processing strategies.
156
+
157
+ Synapse automatically selects one of three strategies.
158
+
159
+ ## Log Strategy
160
+
161
+ Used for repositories with a relatively small amount of new history.
162
+
163
+ Each commit is processed individually, preserving architectural evolution with the highest fidelity.
164
+
165
+ ---
166
+
167
+ ## Evolution Diff Strategy
168
+
169
+ For larger repositories, Synapse periodically compares snapshots of repository evolution instead of processing every individual commit.
170
+
171
+ This significantly reduces processing cost while preserving long-term architectural changes.
172
+
173
+ ---
174
+
175
+ ## Full Repository Diff
176
+
177
+ For extremely large repositories (currently **more than 100,000 commits**), Synapse processes a single diff between the **last processed commit** and the current `HEAD`.
178
+
179
+ This provides a scalable fallback that allows Synapse to continue operating efficiently even on repositories with extremely large histories.
180
+
181
+ ---
182
+
183
+ # Repository Context
184
+
185
+ Synapse maintains two persistent representations.
186
+
187
+ ## Repository Context
188
+
189
+ A structured historical representation containing processed repository changes.
190
+
191
+ This serves as the historical source of truth during repository processing.
192
+
193
+ ## Repository Memory
194
+
195
+ A continuously evolving semantic representation optimized for LLM consumption.
196
+
197
+ The memory is intentionally compact while preserving durable architectural understanding.
198
+
199
+ ---
200
+
201
+ # Why This Matters
202
+
203
+ Without persistent repository memory:
204
+
205
+ ```text
206
+ Repository
207
+ │
208
+ ▼
209
+ Language Model
210
+ │
211
+ ▼
212
+ Forget
213
+ ```
214
+
215
+ With Synapse:
216
+
217
+ ```text
218
+ Repository
219
+ │
220
+ ▼
221
+ Repository Memory
222
+ │
223
+ ▼
224
+ Any Language Model
225
+ ```
226
+
227
+ Repository understanding becomes reusable instead of being reconstructed every conversation.
228
+
229
+ ---
230
+
231
+ # Current Features
232
+
233
+ - Git repository initialization
234
+ - Automatic repository processing
235
+ - Incremental repository updates
236
+ - Adaptive processing strategy selection
237
+ - Repository Context generation
238
+ - Repository Memory generation
239
+ - Large commit splitting
240
+ - Automatic metadata tracking
241
+ - Persistent repository memory
242
+
243
+ ---
244
+
245
+ # Testing
246
+
247
+ Synapse V2 is currently in **alpha** and is undergoing testing on repositories of varying sizes and commit histories.
248
+
249
+ Current testing focuses on:
250
+
251
+ - Repository memory quality
252
+ - Incremental update correctness
253
+ - Processing strategy selection
254
+ - Large commit handling
255
+ - Repository scalability
256
+ - LLM extraction consistency
257
+ - Memory compression quality
258
+
259
+ Performance benchmarks will be published after testing has been completed across multiple repositories and hardware configurations.
260
+
261
+ ---
262
+
263
+ # Current Status
264
+
265
+ Synapse V2 is currently in **alpha**.
266
+
267
+ The repository ingestion pipeline is complete, and the current focus is improving repository memory quality, ontology consistency, and extraction accuracy through real-world testing.
268
+
269
+ ---
270
+
271
+ # Future Work
272
+
273
+ Repository Memory is intended to become the foundation for additional capabilities built on persistent repository understanding.
274
+
275
+ The exact direction of future versions is still evolving, with the immediate focus remaining on improving the quality, scalability, and usefulness of Repository Memory.
276
+
277
+ ---
278
+
279
+ # Vision
280
+
281
+ Language models provide reasoning.
282
+
283
+ Repositories contain knowledge.
284
+
285
+ Synapse aims to separate **repository memory** from the language model itself.
286
+
287
+ The long-term goal is to create a reusable, incremental, portable memory layer that evolves alongside software projects and can be shared across different AI systems without repeatedly reconstructing repository understanding.
288
+
289
+ ---
290
+
291
+ # License
292
+
293
+ MIT License
294
+
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "synapse-pkg"
7
- version = "0.1.1"
7
+ version = "2.0.0a2"
8
8
  description = "Knowledge graph extraction library powered by LLMs"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -13,6 +13,10 @@ authors = [
13
13
  { name = "Piyush Garg" }
14
14
  ]
15
15
 
16
- dependencies = [
17
- "google-generativeai",
18
- ]
16
+ dependencies = [
17
+ "GitPython>=3.1.40",
18
+ "ollama>=0.5.0"
19
+ ]
20
+
21
+ [project.scripts]
22
+ synapse = "synapse.cli:main"
File without changes
@@ -0,0 +1,25 @@
1
+ import sys
2
+
3
+ from . import commands
4
+
5
+
6
+ def main():
7
+
8
+ if len(sys.argv) < 2:
9
+ print("Usage: synapse <command>")
10
+ print()
11
+ print("Available commands:")
12
+ print(" init")
13
+ print(" knowledge")
14
+ return
15
+
16
+ command = sys.argv[1].lower()
17
+
18
+ if command == "init":
19
+ commands.init()
20
+
21
+ elif command == "knowledge":
22
+ commands.knowledge()
23
+
24
+ else:
25
+ print(f"Unknown command: {command}")
@@ -0,0 +1,22 @@
1
+ from .persistence import initialize_synapse
2
+ from .processor import build_repository_context
3
+ from .extractor import build_compressed_context
4
+
5
+
6
+ def init():
7
+ initialize_synapse()
8
+
9
+
10
+ def knowledge():
11
+ print("Initializing repository context...")
12
+
13
+ build_repository_context()
14
+
15
+ print(
16
+ "Repository context initialized.\n"
17
+ "Building compressed repository context..."
18
+ )
19
+
20
+ build_compressed_context()
21
+
22
+ print("Successfully initialized compressed repository context.")