cognex 0.1.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 (37) hide show
  1. cognex-0.1.0/LICENSE +21 -0
  2. cognex-0.1.0/PKG-INFO +425 -0
  3. cognex-0.1.0/README.md +394 -0
  4. cognex-0.1.0/pyproject.toml +64 -0
  5. cognex-0.1.0/setup.cfg +4 -0
  6. cognex-0.1.0/src/cognex.egg-info/PKG-INFO +425 -0
  7. cognex-0.1.0/src/cognex.egg-info/SOURCES.txt +35 -0
  8. cognex-0.1.0/src/cognex.egg-info/dependency_links.txt +1 -0
  9. cognex-0.1.0/src/cognex.egg-info/entry_points.txt +2 -0
  10. cognex-0.1.0/src/cognex.egg-info/requires.txt +7 -0
  11. cognex-0.1.0/src/cognex.egg-info/top_level.txt +2 -0
  12. cognex-0.1.0/src/substrate/__init__.py +41 -0
  13. cognex-0.1.0/src/substrate/extractor.py +199 -0
  14. cognex-0.1.0/src/substrate/ledger.py +266 -0
  15. cognex-0.1.0/src/substrate/models.py +132 -0
  16. cognex-0.1.0/src/substrate/retriever.py +165 -0
  17. cognex-0.1.0/src/substrate/store.py +300 -0
  18. cognex-0.1.0/src/substrate/substrate.py +199 -0
  19. cognex-0.1.0/src/substrate/swarm.py +230 -0
  20. cognex-0.1.0/src/substrate/teleport.py +293 -0
  21. cognex-0.1.0/src/substrate/trust.py +386 -0
  22. cognex-0.1.0/src/substrate_mcp/__init__.py +11 -0
  23. cognex-0.1.0/src/substrate_mcp/context.py +136 -0
  24. cognex-0.1.0/src/substrate_mcp/server.py +155 -0
  25. cognex-0.1.0/src/substrate_mcp/tools/__init__.py +65 -0
  26. cognex-0.1.0/src/substrate_mcp/tools/core_tools.py +103 -0
  27. cognex-0.1.0/src/substrate_mcp/tools/dispatcher.py +83 -0
  28. cognex-0.1.0/src/substrate_mcp/tools/ledger_tools.py +97 -0
  29. cognex-0.1.0/src/substrate_mcp/tools/memory_tools.py +148 -0
  30. cognex-0.1.0/src/substrate_mcp/tools/registry.py +368 -0
  31. cognex-0.1.0/src/substrate_mcp/tools/swarm_tools.py +39 -0
  32. cognex-0.1.0/src/substrate_mcp/tools/teleport_tools.py +65 -0
  33. cognex-0.1.0/src/substrate_mcp/tools/trust_tools.py +136 -0
  34. cognex-0.1.0/src/substrate_mcp/types.py +141 -0
  35. cognex-0.1.0/tests/test_layers.py +312 -0
  36. cognex-0.1.0/tests/test_mcp_server.py +276 -0
  37. cognex-0.1.0/tests/test_substrate.py +399 -0
cognex-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gaurav Singh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
cognex-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,425 @@
1
+ Metadata-Version: 2.4
2
+ Name: cognex
3
+ Version: 0.1.0
4
+ Summary: Persistent memory layer for AI agents โ€” survives sessions, learns patterns, enables continuity
5
+ Author: Cognex Contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/YOUR_USERNAME/cognex
8
+ Project-URL: Repository, https://github.com/YOUR_USERNAME/cognex
9
+ Project-URL: Issues, https://github.com/YOUR_USERNAME/cognex/issues
10
+ Project-URL: Changelog, https://github.com/YOUR_USERNAME/cognex/blob/main/CHANGELOG.md
11
+ Keywords: mcp,memory,ai-agents,persistent-memory,claude,llm,model-context-protocol
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: mcp>=1.0.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == "dev"
27
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
28
+ Requires-Dist: build>=0.10; extra == "dev"
29
+ Requires-Dist: twine>=4.0; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # ๐Ÿง  Cognex
33
+
34
+ **Persistent memory layer for AI agents โ€” survives sessions, learns patterns, enables continuity.**
35
+
36
+ Give your AI coding assistant long-term memory, decision tracking, and trust management.
37
+
38
+ ![Python](https://img.shields.io/badge/python-3.10%2B-blue)
39
+ ![MCP](https://img.shields.io/badge/MCP-1.0%2B-purple)
40
+ ![Tests](https://img.shields.io/badge/tests-79%2F84%20passing-brightgreen)
41
+
42
+ ---
43
+
44
+ ## Why Use It?
45
+
46
+ ```
47
+ You: "Remember I prefer pytest over unittest"
48
+
49
+ Next session:
50
+ AI: "Got it โ€” I'll use pytest for your tests instead."
51
+ ```
52
+
53
+ Your AI forgets everything between sessions. **Cognex** fixes that.
54
+
55
+ ### Features
56
+
57
+ | Feature | What It Does |
58
+ |---------|-------------|
59
+ | ๐Ÿง  **Persistent Memory** | Remembers preferences, facts, patterns across sessions |
60
+ | ๐Ÿ“ **Decision Ledger** | Tracks choices made and their outcomes |
61
+ | ๐Ÿ›ก๏ธ **Trust Engine** | Learns which tools you approve vs deny |
62
+ | ๐Ÿ”„ **Teleportation** | Export your brain, load it on another machine |
63
+ | ๐Ÿ **Swarm Mode** | Turn natural language into multi-agent plans |
64
+
65
+ ---
66
+
67
+ ## Supported AI Tools
68
+
69
+ | Tool | Works? |
70
+ |------|--------|
71
+ | Claude Code | โœ… |
72
+ | Claude Desktop | โœ… |
73
+ | OpenCode | โœ… |
74
+ | Cursor | โœ… |
75
+ | Codex | โœ… |
76
+ | Any MCP-compatible tool | โœ… |
77
+
78
+ ---
79
+
80
+ ## Installation (Choose One)
81
+
82
+ ### Option 1: uvx (Recommended โ€” no install needed)
83
+
84
+ ```bash
85
+ uvx cognex
86
+ ```
87
+
88
+ ### Option 2: pipx (isolated environment)
89
+
90
+ ```bash
91
+ pipx install cognex
92
+ ```
93
+
94
+ ### Option 3: pip (system-wide install)
95
+
96
+ ```bash
97
+ pip install cognex
98
+ ```
99
+
100
+ ### Option 4: Install from this folder (development)
101
+
102
+ ```bash
103
+ cd D:\COGNITIVE\cognitive-substrate
104
+ pip install -e .
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Configuration by CLI Tool
110
+
111
+ ### OpenCode
112
+
113
+ **Config location:** `%USERPROFILE%\.config\opencode\opencode.json`
114
+
115
+ **With uvx (no install):**
116
+ ```json
117
+ {
118
+ "$schema": "https://opencode.ai/config.json",
119
+ "mcp": {
120
+ "cognex": {
121
+ "type": "local",
122
+ "command": ["uvx", "cognex"],
123
+ "enabled": true
124
+ }
125
+ }
126
+ }
127
+ ```
128
+
129
+ **With pipx:**
130
+ ```json
131
+ {
132
+ "$schema": "https://opencode.ai/config.json",
133
+ "mcp": {
134
+ "cognex": {
135
+ "type": "local",
136
+ "command": ["pipx", "run", "cognex"],
137
+ "enabled": true
138
+ }
139
+ }
140
+ }
141
+ ```
142
+
143
+ **With pip (simplest):**
144
+ ```json
145
+ {
146
+ "$schema": "https://opencode.ai/config.json",
147
+ "mcp": {
148
+ "cognex": {
149
+ "type": "local",
150
+ "command": ["cognex"],
151
+ "enabled": true
152
+ }
153
+ }
154
+ }
155
+ ```
156
+
157
+ ---
158
+
159
+ ### Claude Code / Claude Desktop
160
+
161
+ **Config location (Windows):** `%APPDATA%\Claude\claude_desktop_config.json`
162
+
163
+ **Config location (Mac):** `~/Library/Application Support/Claude/claude_desktop_config.json`
164
+
165
+ **With pip:**
166
+ ```json
167
+ {
168
+ "mcpServers": {
169
+ "cognex": {
170
+ "command": "cognex"
171
+ }
172
+ }
173
+ }
174
+ ```
175
+
176
+ **With uvx:**
177
+ ```json
178
+ {
179
+ "mcpServers": {
180
+ "cognex": {
181
+ "command": "uvx",
182
+ "args": ["cognex"]
183
+ }
184
+ }
185
+ }
186
+ ```
187
+
188
+ ---
189
+
190
+ ### Cursor
191
+
192
+ **Config location (Windows):** `%USERPROFILE%\.cursor\mcp.json`
193
+
194
+ **Config location (Mac):** `~/.cursor/mcp.json`
195
+
196
+ **With pip:**
197
+ ```json
198
+ {
199
+ "mcpServers": {
200
+ "cognex": {
201
+ "command": "cognex"
202
+ }
203
+ }
204
+ }
205
+ ```
206
+
207
+ ---
208
+
209
+ ### VS Code (with MCP extension)
210
+
211
+ Create `.vscode/mcp.json` in your project:
212
+
213
+ ```json
214
+ {
215
+ "servers": {
216
+ "cognex": {
217
+ "command": "uvx",
218
+ "args": ["cognex"]
219
+ }
220
+ }
221
+ }
222
+ ```
223
+
224
+ ---
225
+
226
+ ### Codex
227
+
228
+ Add to your Codex config (`~/.codex/config.json`):
229
+
230
+ ```json
231
+ {
232
+ "mcpServers": {
233
+ "cognex": {
234
+ "command": "cognex"
235
+ }
236
+ }
237
+ }
238
+ ```
239
+
240
+ ---
241
+
242
+ ## Restart Your AI Tool
243
+
244
+ After adding the config, **completely close and reopen** your AI tool. You should see 18 new tools available.
245
+
246
+ ---
247
+
248
+ ## The 18 Tools
249
+
250
+ ### ๐Ÿ—“๏ธ Session Management
251
+ | Tool | Description |
252
+ |------|-------------|
253
+ | `substrate_start_session` | Start a new work session |
254
+ | `substrate_end_session` | End session with summary/metrics |
255
+ | `substrate_process_transcript` | Extract memories from conversation |
256
+ | `substrate_report` | Get memory health report |
257
+
258
+ ### ๐Ÿ’พ Memory
259
+ | Tool | Description |
260
+ |------|-------------|
261
+ | `memory_add` | Add a memory (fact, preference, decision, pattern) |
262
+ | `memory_search` | Search memories with filters |
263
+ | `memory_get_context` | Get relevant context for current work |
264
+ | `memory_decay` | Age memories (auto-cleanup old ones) |
265
+
266
+ ### ๐Ÿ›ก๏ธ Trust Engine
267
+ | Tool | Description |
268
+ |------|-------------|
269
+ | `trust_check` | Check if tool needs approval |
270
+ | `trust_record` | Record approval/denial/violation |
271
+ | `trust_get` | Get trust score for a tool |
272
+ | `trust_summary` | Get trust overview |
273
+
274
+ ### ๐Ÿ“– Decision Ledger
275
+ | Tool | Description |
276
+ |------|-------------|
277
+ | `ledger_record` | Record a decision made |
278
+ | `ledger_outcome` | Record what happened after |
279
+ | `ledger_find_similar` | Find similar past decisions |
280
+
281
+ ### ๐Ÿš€ Teleportation
282
+ | Tool | Description |
283
+ |------|-------------|
284
+ | `teleport_create_bundle` | Export your brain to JSON |
285
+ | `teleport_rehydrate` | Import brain from another machine |
286
+
287
+ ### ๐Ÿ Swarm
288
+ | Tool | Description |
289
+ |------|-------------|
290
+ | `swarm_compile_intent` | Turn "build me an API" into a multi-agent plan |
291
+
292
+ ---
293
+
294
+ ## Example Usage
295
+
296
+ ### Remember a Preference
297
+ ```
298
+ You: "I prefer using type hints everywhere"
299
+ AI: (calls memory_add)
300
+ โ†’ Saved to your memory bank
301
+ ```
302
+
303
+ ### Get Context Next Session
304
+ ```
305
+ You: (start new session)
306
+ AI: (calls memory_get_context with "coding style")
307
+ โ†’ Returns: "I prefer using type hints everywhere"
308
+ AI: "Got it โ€” I'll add type hints throughout."
309
+ ```
310
+
311
+ ### Track a Decision
312
+ ```
313
+ You: "FastAPI or Flask?"
314
+ AI: "FastAPI has better type safety."
315
+ AI: (calls ledger_record)
316
+
317
+ Later...
318
+ You: "Did that work out?"
319
+ AI: (calls ledger_outcome with success: true)
320
+ ```
321
+
322
+ ### Tool Trust Check
323
+ ```
324
+ AI wants to run: rm -rf /
325
+ AI: (calls trust_check)
326
+ โ†’ {requires_approval: true, trust_level: 0.2}
327
+ AI asks: "Can I delete everything?"
328
+ ```
329
+
330
+ ---
331
+
332
+ ## Where Data is Stored
333
+
334
+ All data stays local on your machine in SQLite:
335
+
336
+ ```
337
+ %USERPROFILE%\.cognex\
338
+ โ””โ”€โ”€ cognex.db
339
+ โ”œโ”€โ”€ memories (your persistent memories)
340
+ โ”œโ”€โ”€ sessions (session history)
341
+ โ”œโ”€โ”€ trust_records (tool approval history)
342
+ โ””โ”€โ”€ decisions (decision ledger)
343
+ ```
344
+
345
+ ---
346
+
347
+ ## Troubleshooting
348
+
349
+ ### "command not found" or "cognex" not recognized
350
+
351
+ **Fix:** Make sure you installed it:
352
+ ```bash
353
+ pip install cognex
354
+ ```
355
+ Or use uvx in your config:
356
+ ```json
357
+ "command": ["uvx", "cognex"]
358
+ ```
359
+
360
+ ### Tools not appearing
361
+
362
+ 1. Check the AI tool's developer console for errors
363
+ 2. Try restarting the AI tool completely
364
+ 3. Verify your JSON config is valid (use a JSON validator)
365
+
366
+ ---
367
+
368
+ ## Development
369
+
370
+ ```bash
371
+ # Run tests
372
+ cd D:\COGNITIVE\cognitive-substrate
373
+ python tests/test_mcp_server.py
374
+
375
+ # Run pytest
376
+ python -m pytest tests/ -v -k "not mcp_server"
377
+
378
+ # Run demo
379
+ python demo/run_demo.py
380
+ ```
381
+
382
+ ---
383
+
384
+ ## File Structure
385
+
386
+ ```
387
+ D:\COGNITIVE\cognitive-substrate\
388
+ โ”œโ”€โ”€ README.md โ† You are here!
389
+ โ”œโ”€โ”€ mcp.json โ† MCP config ready to copy
390
+ โ”œโ”€โ”€ pyproject.toml โ† Package config (name: cognex)
391
+ โ”œโ”€โ”€ demo/
392
+ โ”‚ โ”œโ”€โ”€ run_demo.py โ† Simple demo
393
+ โ”‚ โ””โ”€โ”€ run_full_demo.py โ† Full workflow demo
394
+ โ”œโ”€โ”€ src/
395
+ โ”‚ โ”œโ”€โ”€ substrate/ โ† Core memory system
396
+ โ”‚ โ”‚ โ”œโ”€โ”€ substrate.py โ† Main orchestrator
397
+ โ”‚ โ”‚ โ”œโ”€โ”€ store.py โ† SQLite storage
398
+ โ”‚ โ”‚ โ”œโ”€โ”€ extractor.py โ† Memory extraction
399
+ โ”‚ โ”‚ โ”œโ”€โ”€ retriever.py โ† Memory retrieval
400
+ โ”‚ โ”‚ โ”œโ”€โ”€ ledger.py โ† Decision tracking
401
+ โ”‚ โ”‚ โ”œโ”€โ”€ trust.py โ† Trust engine
402
+ โ”‚ โ”‚ โ”œโ”€โ”€ teleport.py โ† State export/import
403
+ โ”‚ โ”‚ โ””โ”€โ”€ swarm.py โ† Multi-agent planning
404
+ โ”‚ โ””โ”€โ”€ substrate_mcp/ โ† MCP server
405
+ โ”‚ โ”œโ”€โ”€ server.py โ† MCP server entry
406
+ โ”‚ โ””โ”€โ”€ tools/ โ† 18 tool implementations
407
+ โ””โ”€โ”€ tests/
408
+ โ”œโ”€โ”€ test_substrate.py โ† Core tests
409
+ โ”œโ”€โ”€ test_layers.py โ† Layer tests
410
+ โ””โ”€โ”€ test_mcp_server.py โ† Tool tests
411
+ ```
412
+
413
+ ---
414
+
415
+ ## License
416
+
417
+ MIT โ€” free to use, modify, and distribute.
418
+
419
+ ---
420
+
421
+ ## Need Help?
422
+
423
+ - ๐Ÿ“‚ Source code: `D:\COGNITIVE\cognitive-substrate\src\`
424
+ - ๐Ÿงช Run tests: `python tests/test_mcp_server.py`
425
+ - ๐Ÿ”ง Tool implementations: `src\substrate_mcp\tools\`