cortex-identity 1.0.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 (67) hide show
  1. cortex_identity-1.0.0/LICENSE +21 -0
  2. cortex_identity-1.0.0/MANIFEST.in +3 -0
  3. cortex_identity-1.0.0/PKG-INFO +542 -0
  4. cortex_identity-1.0.0/README.md +511 -0
  5. cortex_identity-1.0.0/cortex/__init__.py +3 -0
  6. cortex_identity-1.0.0/cortex/__main__.py +4 -0
  7. cortex_identity-1.0.0/cortex/_hook.py +25 -0
  8. cortex_identity-1.0.0/cortex/adapters.py +281 -0
  9. cortex_identity-1.0.0/cortex/centrality.py +158 -0
  10. cortex_identity-1.0.0/cortex/cli.py +1633 -0
  11. cortex_identity-1.0.0/cortex/coding.py +868 -0
  12. cortex_identity-1.0.0/cortex/compat.py +255 -0
  13. cortex_identity-1.0.0/cortex/context.py +302 -0
  14. cortex_identity-1.0.0/cortex/continuous.py +384 -0
  15. cortex_identity-1.0.0/cortex/contradictions.py +243 -0
  16. cortex_identity-1.0.0/cortex/cooccurrence.py +238 -0
  17. cortex_identity-1.0.0/cortex/dashboard/__init__.py +1 -0
  18. cortex_identity-1.0.0/cortex/dashboard/server.py +328 -0
  19. cortex_identity-1.0.0/cortex/dedup.py +145 -0
  20. cortex_identity-1.0.0/cortex/edge_extraction.py +221 -0
  21. cortex_identity-1.0.0/cortex/extract_memory.py +1438 -0
  22. cortex_identity-1.0.0/cortex/graph.py +569 -0
  23. cortex_identity-1.0.0/cortex/hooks.py +397 -0
  24. cortex_identity-1.0.0/cortex/import_memory.py +1006 -0
  25. cortex_identity-1.0.0/cortex/intelligence.py +238 -0
  26. cortex_identity-1.0.0/cortex/query.py +328 -0
  27. cortex_identity-1.0.0/cortex/sync/__init__.py +1 -0
  28. cortex_identity-1.0.0/cortex/sync/monitor.py +206 -0
  29. cortex_identity-1.0.0/cortex/sync/scheduler.py +185 -0
  30. cortex_identity-1.0.0/cortex/temporal.py +183 -0
  31. cortex_identity-1.0.0/cortex/timeline.py +192 -0
  32. cortex_identity-1.0.0/cortex/upai/__init__.py +5 -0
  33. cortex_identity-1.0.0/cortex/upai/disclosure.py +149 -0
  34. cortex_identity-1.0.0/cortex/upai/identity.py +256 -0
  35. cortex_identity-1.0.0/cortex/upai/versioning.py +222 -0
  36. cortex_identity-1.0.0/cortex/viz/__init__.py +1 -0
  37. cortex_identity-1.0.0/cortex/viz/layout.py +284 -0
  38. cortex_identity-1.0.0/cortex/viz/renderer.py +326 -0
  39. cortex_identity-1.0.0/cortex_identity.egg-info/PKG-INFO +542 -0
  40. cortex_identity-1.0.0/cortex_identity.egg-info/SOURCES.txt +65 -0
  41. cortex_identity-1.0.0/cortex_identity.egg-info/dependency_links.txt +1 -0
  42. cortex_identity-1.0.0/cortex_identity.egg-info/entry_points.txt +3 -0
  43. cortex_identity-1.0.0/cortex_identity.egg-info/requires.txt +13 -0
  44. cortex_identity-1.0.0/cortex_identity.egg-info/top_level.txt +1 -0
  45. cortex_identity-1.0.0/pyproject.toml +44 -0
  46. cortex_identity-1.0.0/setup.cfg +4 -0
  47. cortex_identity-1.0.0/tests/test_adapters.py +198 -0
  48. cortex_identity-1.0.0/tests/test_coding.py +849 -0
  49. cortex_identity-1.0.0/tests/test_context.py +493 -0
  50. cortex_identity-1.0.0/tests/test_continuous.py +755 -0
  51. cortex_identity-1.0.0/tests/test_contradictions.py +343 -0
  52. cortex_identity-1.0.0/tests/test_cooccurrence.py +224 -0
  53. cortex_identity-1.0.0/tests/test_dashboard.py +145 -0
  54. cortex_identity-1.0.0/tests/test_dedup.py +219 -0
  55. cortex_identity-1.0.0/tests/test_edge_extraction.py +395 -0
  56. cortex_identity-1.0.0/tests/test_features.py +774 -0
  57. cortex_identity-1.0.0/tests/test_graph.py +879 -0
  58. cortex_identity-1.0.0/tests/test_hooks.py +451 -0
  59. cortex_identity-1.0.0/tests/test_intelligence.py +327 -0
  60. cortex_identity-1.0.0/tests/test_monitor.py +174 -0
  61. cortex_identity-1.0.0/tests/test_query.py +411 -0
  62. cortex_identity-1.0.0/tests/test_scheduler.py +190 -0
  63. cortex_identity-1.0.0/tests/test_temporal.py +375 -0
  64. cortex_identity-1.0.0/tests/test_timeline.py +274 -0
  65. cortex_identity-1.0.0/tests/test_upai.py +274 -0
  66. cortex_identity-1.0.0/tests/test_versioning.py +213 -0
  67. cortex_identity-1.0.0/tests/test_viz.py +335 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Junebugg1214
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.
@@ -0,0 +1,3 @@
1
+ include LICENSE
2
+ include README.md
3
+ recursive-include cortex *.py
@@ -0,0 +1,542 @@
1
+ Metadata-Version: 2.4
2
+ Name: cortex-identity
3
+ Version: 1.0.0
4
+ Summary: Own your AI memory. Take it everywhere.
5
+ Author: Junebugg1214
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Junebugg1214/Cortex-AI
8
+ Project-URL: Repository, https://github.com/Junebugg1214/Cortex-AI
9
+ Project-URL: Issues, https://github.com/Junebugg1214/Cortex-AI/issues
10
+ Keywords: ai-identity,knowledge-graph,chatgpt,claude,memory,portable
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Provides-Extra: crypto
22
+ Requires-Dist: pynacl>=1.5.0; extra == "crypto"
23
+ Provides-Extra: fast
24
+ Requires-Dist: numpy>=1.24.0; extra == "fast"
25
+ Provides-Extra: full
26
+ Requires-Dist: pynacl>=1.5.0; extra == "full"
27
+ Requires-Dist: numpy>=1.24.0; extra == "full"
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7.0; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ <h1 align="center">Cortex</h1>
33
+ <p align="center"><strong>Own your AI memory. Take it everywhere.</strong></p>
34
+
35
+ <p align="center">
36
+ <a href="https://pypi.org/project/cortex-identity/"><img src="https://img.shields.io/pypi/v/cortex-identity?color=blue&label=PyPI" alt="PyPI"></a>
37
+ <a href="https://pypi.org/project/cortex-identity/"><img src="https://img.shields.io/pypi/pyversions/cortex-identity" alt="Python"></a>
38
+ <a href="https://github.com/Junebugg1214/Cortex-AI/blob/main/LICENSE"><img src="https://img.shields.io/github/license/Junebugg1214/Cortex-AI" alt="License"></a>
39
+ <a href="https://github.com/Junebugg1214/Cortex-AI/stargazers"><img src="https://img.shields.io/github/stars/Junebugg1214/Cortex-AI?style=social" alt="Stars"></a>
40
+ </p>
41
+
42
+ <p align="center">
43
+ <img src="assets/demo.svg" alt="Cortex demo" width="800">
44
+ </p>
45
+
46
+ ---
47
+
48
+ **Your ChatGPT knows you. Now Claude does too.**
49
+
50
+ Cortex extracts your context from ChatGPT, Claude, Gemini, Perplexity, and coding tools (Claude Code, Cursor, Copilot) — builds a portable knowledge graph you own — and pushes it to any platform. Cryptographically signed. Version controlled. Zero dependencies.
51
+
52
+ ## Quick Start
53
+
54
+ ```bash
55
+ pip install cortex-identity
56
+
57
+ # Migrate ChatGPT → Claude in one command
58
+ cortex chatgpt-export.zip --to claude -o ./output
59
+
60
+ # See what it extracted
61
+ cortex stats output/context.json
62
+
63
+ # Visualize your knowledge graph
64
+ cortex viz output/context.json --output graph.html
65
+ ```
66
+
67
+ ## What Makes This Different
68
+
69
+ | | Cortex | Mem0 | Letta | ChatGPT Memory | Claude Memory |
70
+ |---|:-:|:-:|:-:|:-:|:-:|
71
+ | **You own it** | Yes | No | No | No | No |
72
+ | **Portable** | Yes | No | No | No | No |
73
+ | **Knowledge graph** | Yes | Partial | No | No | No |
74
+ | **Temporal tracking** | Yes | No | No | No | No |
75
+ | **Works offline** | Yes | No | No | No | No |
76
+ | **Zero dependencies** | Yes | No | No | N/A | N/A |
77
+
78
+ > Mem0, Letta, and built-in AI memories are **agent memory** — owned by the platform. Cortex is **your memory**, under **your control**.
79
+
80
+ ## How It Works
81
+
82
+ ```
83
+ Chat Exports (ChatGPT, Claude, Gemini, Perplexity)
84
+ + Coding Sessions (Claude Code, Cursor, Copilot)
85
+ |
86
+ Extract ──→ Knowledge Graph ──→ Sign & Version ──→ Push Anywhere
87
+ ```
88
+
89
+ Nodes are entities, not category items. "Python" is ONE node with tags `[technical_expertise, domain_knowledge]` — not duplicated across categories. Edges capture typed relationships: `Python --applied_in--> Healthcare`.
90
+
91
+ ## Installation
92
+
93
+ ```bash
94
+ pip install cortex-identity # Core (zero dependencies)
95
+ pip install cortex-identity[crypto] # + Ed25519 signatures
96
+ pip install cortex-identity[fast] # + 10x faster graph layout
97
+ pip install cortex-identity[full] # Everything
98
+ ```
99
+
100
+ <details>
101
+ <summary><strong>Install from source</strong></summary>
102
+
103
+ ```bash
104
+ git clone https://github.com/Junebugg1214/Cortex-AI.git
105
+ cd Cortex-AI
106
+ pip install -e .
107
+ ```
108
+
109
+ Requires Python 3.10+ (macOS, Linux, Windows). No external packages required for core functionality.
110
+
111
+ </details>
112
+
113
+ ---
114
+
115
+ ## Features
116
+
117
+ <details>
118
+ <summary><strong>Knowledge Graph Engine</strong></summary>
119
+
120
+ ### Graph Foundation
121
+
122
+ Everything is nodes and edges. Nodes have tags (not fixed categories), confidence scores, temporal metadata, and extensible properties. The graph is backward compatible — v4 flat-category JSON converts losslessly.
123
+
124
+ ```bash
125
+ cortex query context.json --node "Python"
126
+ cortex query context.json --neighbors "Python"
127
+ cortex stats context.json
128
+ ```
129
+
130
+ ### Smart Edges
131
+
132
+ Automatic relationship discovery:
133
+
134
+ - **Pattern rules** — `technical_expertise` + `active_priorities` = `used_in` edge
135
+ - **Co-occurrence** — entities appearing together in messages get linked (PMI for large datasets, frequency thresholds for small)
136
+ - **Centrality** — identifies your most important nodes (degree centrality, PageRank for 200+ nodes)
137
+ - **Graph-aware dedup** — merges near-duplicates using 70% text similarity + 30% neighbor overlap
138
+
139
+ ### Query + Intelligence
140
+
141
+ ```bash
142
+ cortex query context.json --category technical_expertise
143
+ cortex query context.json --strongest 10
144
+ cortex query context.json --isolated
145
+ cortex query context.json --path "Python" "Mayo Clinic"
146
+ cortex query context.json --components
147
+ cortex gaps context.json
148
+ cortex digest context.json --previous last_week.json
149
+ ```
150
+
151
+ </details>
152
+
153
+ <details>
154
+ <summary><strong>UPAI Protocol (Cryptographic Identity)</strong></summary>
155
+
156
+ Three capabilities:
157
+
158
+ - **Cryptographic signing** — SHA-256 integrity (always). Ed25519 signatures (with `pynacl`). Proves the graph is yours and untampered.
159
+ - **Selective disclosure** — Policies control what each platform sees. "Professional" shows job/skills. "Technical" shows your tech stack. "Minimal" shows almost nothing.
160
+ - **Version control** — Git-like commits for your identity. Log, diff, checkout, rollback.
161
+
162
+ ```bash
163
+ cortex identity --init --name "Your Name"
164
+ cortex commit context.json -m "Added June ChatGPT export"
165
+ cortex log
166
+ cortex identity --show
167
+ cortex sync context.json --to claude --policy professional -o ./output
168
+ ```
169
+
170
+ **Built-in disclosure policies:**
171
+
172
+ | Policy | What's Shared | Min Confidence |
173
+ |--------|---------------|----------------|
174
+ | `full` | Everything | 0.0 |
175
+ | `professional` | Identity, work, skills, priorities | 0.6 |
176
+ | `technical` | Tech stack, domain knowledge, priorities | 0.5 |
177
+ | `minimal` | Identity, communication preferences only | 0.8 |
178
+
179
+ </details>
180
+
181
+ <details>
182
+ <summary><strong>Temporal Tracking & Contradictions</strong></summary>
183
+
184
+ Every extraction snapshots each node's state. Cortex tracks how your identity evolves, detects contradictions ("said X in January, not-X in March"), and computes drift scores across time windows.
185
+
186
+ ```bash
187
+ cortex timeline context.json --format html
188
+ cortex contradictions context.json --severity 0.5
189
+ cortex drift context.json --compare previous.json
190
+ ```
191
+
192
+ ### Conflict Detection
193
+
194
+ ```
195
+ Input: "I use Python daily" + "I don't use Python anymore"
196
+ Result: negation_conflict detected, resolution: prefer_negation (more recent)
197
+ ```
198
+
199
+ ### Typed Relationships
200
+
201
+ ```
202
+ Input: "We partner with Mayo Clinic. Dr. Smith is my mentor."
203
+ Result: Mayo Clinic (partner), Dr. Smith (mentor)
204
+ ```
205
+
206
+ Supported types: `partner`, `mentor`, `advisor`, `investor`, `client`, `competitor`
207
+
208
+ </details>
209
+
210
+ <details>
211
+ <summary><strong>Visualization & Dashboard</strong></summary>
212
+
213
+ ```bash
214
+ cortex viz context.json --output graph.html # Interactive HTML
215
+ cortex viz context.json --output graph.svg --format svg # Static SVG
216
+ cortex dashboard context.json --port 8420 # Web dashboard
217
+ cortex watch ~/exports/ --graph context.json # Auto-extract
218
+ cortex sync-schedule --config sync_config.json # Scheduled sync
219
+ ```
220
+
221
+ </details>
222
+
223
+ <details>
224
+ <summary><strong>Coding Tool Extraction</strong></summary>
225
+
226
+ Extract identity from what you *actually do*, not just what you say. Coding sessions reveal your real tech stack, tools, and workflow through behavior:
227
+
228
+ ```bash
229
+ cortex extract-coding --discover -o coding_context.json
230
+ cortex extract-coding --discover --project chatbot-memory
231
+ cortex extract-coding --discover --merge context.json -o context.json
232
+ cortex extract-coding --discover --enrich --stats
233
+ ```
234
+
235
+ | Signal | How | Example |
236
+ |--------|-----|---------|
237
+ | Languages | File extensions | Editing `.py` files -> Python |
238
+ | Frameworks | Config files | `package.json` -> Node.js |
239
+ | CLI tools | Bash commands | Running `pytest` -> Pytest |
240
+ | Projects | Working directory | `/home/user/myapp` -> myapp |
241
+ | Patterns | Tool sequence | Uses plan mode before coding |
242
+
243
+ **Project enrichment** (`--enrich`): Reads README, package manifests, and LICENSE files to extract project metadata. Detects CI/CD and Docker presence.
244
+
245
+ Currently supports **Claude Code** (JSONL transcripts). Cursor and Copilot parsers planned.
246
+
247
+ </details>
248
+
249
+ <details>
250
+ <summary><strong>Auto-Inject & Cross-Platform Context</strong></summary>
251
+
252
+ ### Auto-Inject into Claude Code
253
+
254
+ Every new session automatically gets your Cortex identity injected:
255
+
256
+ ```bash
257
+ cortex context-hook install context.json
258
+ cortex context-hook test
259
+ cortex context-export context.json --policy technical
260
+ ```
261
+
262
+ ### Cross-Platform Context Writer
263
+
264
+ Write persistent Cortex identity to every AI coding tool:
265
+
266
+ ```bash
267
+ cortex context-write graph.json --platforms all --project ~/myproject
268
+ cortex context-write graph.json --platforms cursor copilot windsurf
269
+ cortex context-write graph.json --platforms all --dry-run
270
+ cortex context-write graph.json --platforms all --watch
271
+ ```
272
+
273
+ | Platform | Config File | Scope |
274
+ |----------|------------|-------|
275
+ | Claude Code | `~/.claude/MEMORY.md` | Global |
276
+ | Claude Code (project) | `{project}/.claude/MEMORY.md` | Project |
277
+ | Cursor | `{project}/.cursor/rules/cortex.mdc` | Project |
278
+ | GitHub Copilot | `{project}/.github/copilot-instructions.md` | Project |
279
+ | Windsurf | `{project}/.windsurfrules` | Project |
280
+ | Gemini CLI | `{project}/GEMINI.md` | Project |
281
+
282
+ Uses `<!-- CORTEX:START -->` / `<!-- CORTEX:END -->` markers — your hand-written rules are never overwritten.
283
+
284
+ </details>
285
+
286
+ <details>
287
+ <summary><strong>Continuous Extraction</strong></summary>
288
+
289
+ Watch Claude Code sessions in real-time. Auto-extract behavioral signals as you code:
290
+
291
+ ```bash
292
+ cortex extract-coding --watch -o coding_context.json
293
+ cortex extract-coding --watch -o ctx.json --context-refresh claude-code cursor copilot
294
+ cortex extract-coding --watch --project chatbot-memory -o ctx.json
295
+ cortex extract-coding --watch --interval 15 --settle 10 -o ctx.json
296
+ ```
297
+
298
+ Polls for session changes, debounces active writes, and incrementally merges nodes.
299
+
300
+ </details>
301
+
302
+ <details>
303
+ <summary><strong>PII Redaction</strong></summary>
304
+
305
+ Strip sensitive data before extraction:
306
+
307
+ ```bash
308
+ cortex chatgpt-export.zip --to claude --redact
309
+ cortex chatgpt-export.zip --to claude --redact --redact-patterns custom.json
310
+ ```
311
+
312
+ Redacts: emails, phones, SSNs, credit cards, API keys, IP addresses, street addresses.
313
+
314
+ </details>
315
+
316
+ ---
317
+
318
+ <details>
319
+ <summary><strong>Supported Platforms</strong></summary>
320
+
321
+ ### Input (Extract From)
322
+
323
+ | Platform | File Type | Auto-Detected |
324
+ |----------|-----------|---------------|
325
+ | ChatGPT | `.zip` with `conversations.json` | Yes |
326
+ | Claude | `.json` with messages array | Yes |
327
+ | Claude Memories | `.json` array with `text` field | Yes |
328
+ | Gemini / AI Studio | `.json` with conversations/turns | Yes |
329
+ | Perplexity | `.json` with threads | Yes |
330
+ | API Logs | `.json` with requests array | Yes |
331
+ | JSONL | `.jsonl` (one message per line) | Yes |
332
+ | Claude Code | `.jsonl` session transcripts | Yes |
333
+ | Plain Text | `.txt`, `.md` | Yes |
334
+
335
+ ### Output (Export To)
336
+
337
+ | Format | Output | Use Case |
338
+ |--------|--------|----------|
339
+ | Claude Preferences | `claude_preferences.txt` | Settings > Profile |
340
+ | Claude Memories | `claude_memories.json` | memory_user_edits |
341
+ | System Prompt | `system_prompt.txt` | Any LLM API |
342
+ | Notion Page | `notion_page.md` | Notion import |
343
+ | Notion Database | `notion_database.json` | Notion DB rows |
344
+ | Google Docs | `google_docs.html` | Google Docs paste |
345
+ | Summary | `summary.md` | Human overview |
346
+ | Full JSON | `full_export.json` | Lossless backup |
347
+
348
+ ### Extraction Categories
349
+
350
+ Cortex extracts entities into 17 tag categories:
351
+
352
+ | Category | Examples |
353
+ |----------|----------|
354
+ | Identity | Name, credentials (MD, PhD) |
355
+ | Professional Context | Role, title, company |
356
+ | Business Context | Company, products, metrics |
357
+ | Active Priorities | Current projects, goals |
358
+ | Relationships | Partners, clients, collaborators |
359
+ | Technical Expertise | Languages, frameworks, tools |
360
+ | Domain Knowledge | Healthcare, finance, AI/ML |
361
+ | Market Context | Competitors, industry trends |
362
+ | Metrics | Revenue, users, timelines |
363
+ | Constraints | Budget, timeline, team size |
364
+ | Values | Principles, beliefs |
365
+ | Negations | What you explicitly avoid |
366
+ | User Preferences | Style and tool preferences |
367
+ | Communication Preferences | Response style preferences |
368
+ | Correction History | Self-corrections |
369
+ | Mentions | Catch-all for other entities |
370
+
371
+ </details>
372
+
373
+ <details>
374
+ <summary><strong>Full CLI Reference (24 commands)</strong></summary>
375
+
376
+ ### Extract & Import
377
+
378
+ ```bash
379
+ cortex <export> --to <platform> -o ./output # One-step migrate
380
+ cortex extract <export> -o context.json # Extract only
381
+ cortex import context.json --to <platform> # Import only
382
+ cortex extract new.json --merge old.json -o merged.json # Merge contexts
383
+ ```
384
+
385
+ ### Query & Intelligence
386
+
387
+ ```bash
388
+ cortex query <graph> --node <label> # Find node
389
+ cortex query <graph> --neighbors <label> # Find neighbors
390
+ cortex query <graph> --category <tag> # Filter by tag
391
+ cortex query <graph> --path <from> <to> # Shortest path
392
+ cortex query <graph> --strongest <n> # Top N nodes
393
+ cortex query <graph> --weakest <n> # Bottom N nodes
394
+ cortex query <graph> --isolated # Unconnected nodes
395
+ cortex query <graph> --components # Connected clusters
396
+ cortex gaps <graph> # Gap analysis
397
+ cortex digest <graph> --previous <old> # Weekly digest
398
+ cortex stats <graph> # Graph statistics
399
+ ```
400
+
401
+ ### Identity & Sync
402
+
403
+ ```bash
404
+ cortex identity --init --name <name> # Create identity
405
+ cortex commit <graph> -m <message> # Version commit
406
+ cortex log # Version history
407
+ cortex identity --show # Show identity
408
+ cortex sync <graph> --to <platform> --policy <name> # Push to platform
409
+ ```
410
+
411
+ ### Visualization & Flywheel
412
+
413
+ ```bash
414
+ cortex viz <graph> --output graph.html # Interactive HTML
415
+ cortex viz <graph> --output graph.svg --format svg # Static SVG
416
+ cortex dashboard <graph> --port 8420 # Web dashboard
417
+ cortex watch <dir> --graph <graph> # Auto-extract
418
+ cortex sync-schedule --config <config.json> # Scheduled sync
419
+ ```
420
+
421
+ ### Coding Tool Extraction
422
+
423
+ ```bash
424
+ cortex extract-coding <session.jsonl> # From specific file
425
+ cortex extract-coding --discover # Auto-find sessions
426
+ cortex extract-coding --discover -p <project> # Filter by project
427
+ cortex extract-coding --discover -m <context> # Merge with existing
428
+ cortex extract-coding --discover --stats # Show session stats
429
+ cortex extract-coding --discover --enrich # Enrich with project files
430
+ cortex extract-coding --watch -o ctx.json # Watch mode (continuous)
431
+ cortex extract-coding --watch --context-refresh claude-code cursor # Watch + auto-refresh
432
+ ```
433
+
434
+ ### Context Hook (Auto-Inject)
435
+
436
+ ```bash
437
+ cortex context-hook install <graph> --policy technical # Install hook
438
+ cortex context-hook uninstall # Remove hook
439
+ cortex context-hook test # Preview injection
440
+ cortex context-hook status # Check status
441
+ cortex context-export <graph> --policy technical # One-shot export
442
+ ```
443
+
444
+ ### Cross-Platform Context Writer
445
+
446
+ ```bash
447
+ cortex context-write <graph> --platforms all --project <dir> # All platforms
448
+ cortex context-write <graph> --platforms cursor copilot # Specific platforms
449
+ cortex context-write <graph> --platforms all --dry-run # Preview
450
+ cortex context-write <graph> --platforms all --watch # Auto-refresh
451
+ cortex context-write <graph> --platforms all --policy professional # Policy override
452
+ ```
453
+
454
+ ### Temporal Analysis
455
+
456
+ ```bash
457
+ cortex timeline <graph> --format html # Timeline view
458
+ cortex contradictions <graph> --severity 0.5 # Find conflicts
459
+ cortex drift <graph> --compare previous.json # Identity drift
460
+ ```
461
+
462
+ </details>
463
+
464
+ <details>
465
+ <summary><strong>Architecture</strong></summary>
466
+
467
+ ```
468
+ cortex-identity/ # pip install cortex-identity
469
+ ├── pyproject.toml # Package metadata + entry points
470
+ ├── cortex/
471
+ │ ├── cli.py # CLI entry point (24 subcommands)
472
+ │ ├── extract_memory.py # Extraction engine (~1400 LOC)
473
+ │ ├── import_memory.py # Import/export engine (~1000 LOC)
474
+ │ ├── graph.py # Node, Edge, CortexGraph (schema 6.0)
475
+ │ ├── compat.py # v4 <-> v5 conversion
476
+ │ ├── temporal.py # Snapshots, drift scoring
477
+ │ ├── contradictions.py # Contradiction detection
478
+ │ ├── timeline.py # Timeline views
479
+ │ ├── upai/
480
+ │ │ ├── identity.py # UPAI identity, DID, Ed25519/HMAC signing
481
+ │ │ ├── disclosure.py # Selective disclosure policies
482
+ │ │ └── versioning.py # Git-like version control
483
+ │ ├── adapters.py # Claude/SystemPrompt/Notion/GDocs adapters
484
+ │ ├── edge_extraction.py # Pattern-based + proximity edge discovery
485
+ │ ├── cooccurrence.py # PMI / frequency co-occurrence
486
+ │ ├── dedup.py # Graph-aware deduplication
487
+ │ ├── centrality.py # Degree centrality + PageRank
488
+ │ ├── query.py # QueryEngine + graph algorithms
489
+ │ ├── intelligence.py # Gap analysis + weekly digest
490
+ │ ├── coding.py # Coding session behavioral extraction
491
+ │ ├── hooks.py # Auto-inject context into Claude Code
492
+ │ ├── context.py # Cross-platform context writer (6 platforms)
493
+ │ ├── continuous.py # Real-time session watcher
494
+ │ ├── _hook.py # cortex-hook entry point
495
+ │ ├── __main__.py # python -m cortex support
496
+ │ ├── viz/ # Visualization
497
+ │ ├── dashboard/ # Local web dashboard
498
+ │ └── sync/ # File watcher + scheduled sync
499
+ ├── migrate.py # Backward-compat stub → cortex.cli
500
+ ├── cortex-hook.py # Backward-compat stub → cortex._hook
501
+ └── tests/ # 618 tests across 21 files
502
+ ```
503
+
504
+ </details>
505
+
506
+ <details>
507
+ <summary><strong>Version History</strong></summary>
508
+
509
+ | Version | Milestone |
510
+ |---------|-----------|
511
+ | v1.0.0 | **First public release** — 24 CLI commands, knowledge graph, UPAI protocol, temporal tracking, coding extraction, cross-platform context, continuous extraction, visualization, dashboard. 618 tests. Zero required dependencies. |
512
+
513
+ <details>
514
+ <summary>Pre-release development history</summary>
515
+
516
+ | Internal | Milestone |
517
+ |----------|-----------|
518
+ | v6.4 (dev) | pip packaging, continuous extraction, production hardening |
519
+ | v6.3 (dev) | Cross-platform context writer |
520
+ | v6.2 (dev) | Auto-inject context |
521
+ | v6.1 (dev) | Coding tool extraction |
522
+ | v6.0 (dev) | Visualization, dashboard, file monitor, sync scheduler |
523
+ | v5.4 (dev) | Query engine, gap analysis, weekly digest |
524
+ | v5.3 (dev) | Smart edge extraction, co-occurrence, centrality, dedup |
525
+ | v5.2 (dev) | UPAI Protocol — cryptographic signing, selective disclosure, version control |
526
+ | v5.1 (dev) | Temporal snapshots, contradiction engine, drift scoring |
527
+ | v5.0 (dev) | Graph foundation — category-agnostic nodes, edges |
528
+ | v4.x (dev) | PII redaction, typed relationships, Notion/Google Docs, semantic dedup |
529
+
530
+ </details>
531
+
532
+ </details>
533
+
534
+ ---
535
+
536
+ ## License
537
+
538
+ MIT — See [LICENSE](LICENSE)
539
+
540
+ ## Author
541
+
542
+ Created by [@Junebugg1214](https://github.com/Junebugg1214)