abbacus-cortex 0.2.1__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.
- abbacus_cortex-0.2.1/PKG-INFO +215 -0
- abbacus_cortex-0.2.1/README.md +192 -0
- abbacus_cortex-0.2.1/pyproject.toml +72 -0
- abbacus_cortex-0.2.1/src/cortex/__init__.py +3 -0
- abbacus_cortex-0.2.1/src/cortex/__main__.py +5 -0
- abbacus_cortex-0.2.1/src/cortex/cli/__init__.py +0 -0
- abbacus_cortex-0.2.1/src/cortex/cli/backup.py +317 -0
- abbacus_cortex-0.2.1/src/cortex/cli/install.py +392 -0
- abbacus_cortex-0.2.1/src/cortex/cli/main.py +2150 -0
- abbacus_cortex-0.2.1/src/cortex/core/__init__.py +13 -0
- abbacus_cortex-0.2.1/src/cortex/core/config.py +182 -0
- abbacus_cortex-0.2.1/src/cortex/core/constants.py +63 -0
- abbacus_cortex-0.2.1/src/cortex/core/errors.py +237 -0
- abbacus_cortex-0.2.1/src/cortex/core/logging.py +184 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/__init__.py +0 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/server.py +344 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/static/css/style.css +293 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/static/js/graph.js +155 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/templates/base.html +34 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/templates/create.html +39 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/templates/detail.html +63 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/templates/documents.html +49 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/templates/entities.html +40 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/templates/error.html +14 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/templates/graph.html +46 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/templates/home.html +54 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/templates/login.html +26 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/templates/settings.html +35 -0
- abbacus_cortex-0.2.1/src/cortex/dashboard/templates/trail.html +27 -0
- abbacus_cortex-0.2.1/src/cortex/db/__init__.py +5 -0
- abbacus_cortex-0.2.1/src/cortex/db/content_store.py +452 -0
- abbacus_cortex-0.2.1/src/cortex/db/graph_store.py +1005 -0
- abbacus_cortex-0.2.1/src/cortex/db/store.py +242 -0
- abbacus_cortex-0.2.1/src/cortex/ontology/__init__.py +5 -0
- abbacus_cortex-0.2.1/src/cortex/ontology/cortex.ttl +428 -0
- abbacus_cortex-0.2.1/src/cortex/ontology/namespaces.py +84 -0
- abbacus_cortex-0.2.1/src/cortex/ontology/resolver.py +35 -0
- abbacus_cortex-0.2.1/src/cortex/pipeline/__init__.py +0 -0
- abbacus_cortex-0.2.1/src/cortex/pipeline/advanced_reason.py +315 -0
- abbacus_cortex-0.2.1/src/cortex/pipeline/enrich.py +118 -0
- abbacus_cortex-0.2.1/src/cortex/pipeline/importer.py +552 -0
- abbacus_cortex-0.2.1/src/cortex/pipeline/link.py +149 -0
- abbacus_cortex-0.2.1/src/cortex/pipeline/normalize.py +134 -0
- abbacus_cortex-0.2.1/src/cortex/pipeline/orchestrator.py +184 -0
- abbacus_cortex-0.2.1/src/cortex/pipeline/reason.py +197 -0
- abbacus_cortex-0.2.1/src/cortex/pipeline/templates.py +104 -0
- abbacus_cortex-0.2.1/src/cortex/pipeline/temporal.py +145 -0
- abbacus_cortex-0.2.1/src/cortex/py.typed +0 -0
- abbacus_cortex-0.2.1/src/cortex/retrieval/__init__.py +0 -0
- abbacus_cortex-0.2.1/src/cortex/retrieval/engine.py +248 -0
- abbacus_cortex-0.2.1/src/cortex/retrieval/graph.py +269 -0
- abbacus_cortex-0.2.1/src/cortex/retrieval/learner.py +142 -0
- abbacus_cortex-0.2.1/src/cortex/retrieval/presenters.py +403 -0
- abbacus_cortex-0.2.1/src/cortex/services/__init__.py +0 -0
- abbacus_cortex-0.2.1/src/cortex/services/embeddings.py +206 -0
- abbacus_cortex-0.2.1/src/cortex/services/llm.py +267 -0
- abbacus_cortex-0.2.1/src/cortex/tools/__init__.py +0 -0
- abbacus_cortex-0.2.1/src/cortex/transport/__init__.py +0 -0
- abbacus_cortex-0.2.1/src/cortex/transport/api/__init__.py +0 -0
- abbacus_cortex-0.2.1/src/cortex/transport/api/server.py +429 -0
- abbacus_cortex-0.2.1/src/cortex/transport/mcp/__init__.py +0 -0
- abbacus_cortex-0.2.1/src/cortex/transport/mcp/__main__.py +6 -0
- abbacus_cortex-0.2.1/src/cortex/transport/mcp/client.py +484 -0
- abbacus_cortex-0.2.1/src/cortex/transport/mcp/server.py +776 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: abbacus-cortex
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Cognitive knowledge system with formal ontology, reasoning, and intelligence serving
|
|
5
|
+
Author: Fabrizzio Silveira
|
|
6
|
+
Author-email: Fabrizzio Silveira <74255714+grayisnotacolor@users.noreply.github.com>
|
|
7
|
+
Requires-Dist: pyoxigraph>=0.4
|
|
8
|
+
Requires-Dist: aiosqlite>=0.20
|
|
9
|
+
Requires-Dist: fastapi>=0.115
|
|
10
|
+
Requires-Dist: uvicorn[standard]>=0.34
|
|
11
|
+
Requires-Dist: typer>=0.15
|
|
12
|
+
Requires-Dist: jinja2>=3.1
|
|
13
|
+
Requires-Dist: python-dotenv>=1.1
|
|
14
|
+
Requires-Dist: bcrypt>=4.2
|
|
15
|
+
Requires-Dist: mcp>=1.6
|
|
16
|
+
Requires-Dist: httpx>=0.28
|
|
17
|
+
Requires-Dist: sentence-transformers>=3.4 ; extra == 'embeddings'
|
|
18
|
+
Requires-Dist: litellm>=1.60 ; extra == 'llm'
|
|
19
|
+
Requires-Python: >=3.12
|
|
20
|
+
Provides-Extra: embeddings
|
|
21
|
+
Provides-Extra: llm
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# Cortex
|
|
25
|
+
|
|
26
|
+
Cognitive knowledge system with formal ontology, reasoning, and intelligence serving.
|
|
27
|
+
|
|
28
|
+
Cortex captures knowledge objects (decisions, lessons, fixes, sessions, research, ideas), classifies them with an OWL-RL ontology, discovers relationships, reasons over the graph, and serves intelligence through hybrid retrieval.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Full install (semantic + keyword search)
|
|
34
|
+
pip install abbacus-cortex[embeddings]
|
|
35
|
+
|
|
36
|
+
# Lightweight (keyword search only, no PyTorch)
|
|
37
|
+
pip install abbacus-cortex
|
|
38
|
+
|
|
39
|
+
# From source
|
|
40
|
+
git clone https://github.com/abbacusgroup/Cortex.git
|
|
41
|
+
cd Cortex
|
|
42
|
+
uv sync --extra embeddings
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# 1. Initialize — creates ~/.cortex/, loads ontology, warms up embedding model
|
|
49
|
+
cortex init
|
|
50
|
+
|
|
51
|
+
# 2. Install background services (auto-start on login)
|
|
52
|
+
cortex install
|
|
53
|
+
|
|
54
|
+
# 3. Register with Claude Code
|
|
55
|
+
cortex register
|
|
56
|
+
|
|
57
|
+
# 4. Use
|
|
58
|
+
cortex capture "Fix: Neo4j pool exhaustion" --type fix --content "Root cause was..."
|
|
59
|
+
cortex search "Neo4j"
|
|
60
|
+
cortex list
|
|
61
|
+
cortex context "Neo4j"
|
|
62
|
+
cortex dashboard # web UI at http://localhost:1315
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Configuration
|
|
66
|
+
|
|
67
|
+
Set via environment variables (prefix `CORTEX_`) or `.env` file:
|
|
68
|
+
|
|
69
|
+
```env
|
|
70
|
+
CORTEX_DATA_DIR=~/.cortex
|
|
71
|
+
CORTEX_LLM_MODEL=claude-sonnet-4-20250514
|
|
72
|
+
CORTEX_LLM_API_KEY=sk-...
|
|
73
|
+
CORTEX_DASHBOARD_PASSWORD= # set via `cortex setup`
|
|
74
|
+
CORTEX_EMBEDDING_MODEL=all-mpnet-base-v2
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
See `.env.example` for all options.
|
|
78
|
+
|
|
79
|
+
## CLI Commands
|
|
80
|
+
|
|
81
|
+
| Command | Description |
|
|
82
|
+
|---------|-------------|
|
|
83
|
+
| `cortex init` | Initialize data directory and stores |
|
|
84
|
+
| `cortex setup` | Interactive setup wizard |
|
|
85
|
+
| `cortex install` | Install background services (macOS/Linux) |
|
|
86
|
+
| `cortex uninstall` | Remove background services |
|
|
87
|
+
| `cortex register` | Register MCP server with Claude Code |
|
|
88
|
+
| `cortex capture` | Capture a knowledge object |
|
|
89
|
+
| `cortex search` | Hybrid keyword + semantic search |
|
|
90
|
+
| `cortex read` | Read object in full |
|
|
91
|
+
| `cortex list` | List objects with filters |
|
|
92
|
+
| `cortex status` | Health and counts |
|
|
93
|
+
| `cortex context` | Briefing mode (summaries) |
|
|
94
|
+
| `cortex dossier` | Entity-centric intelligence brief |
|
|
95
|
+
| `cortex graph` | Show object relationships |
|
|
96
|
+
| `cortex synthesize` | Cross-document synthesis |
|
|
97
|
+
| `cortex entities` | List resolved entities |
|
|
98
|
+
| `cortex serve` | Start MCP or HTTP server |
|
|
99
|
+
| `cortex dashboard` | Start web dashboard |
|
|
100
|
+
| `cortex import-v1` | Import from Cortex v1 database |
|
|
101
|
+
| `cortex import-vault` | Import from Obsidian vault |
|
|
102
|
+
|
|
103
|
+
## MCP Tools
|
|
104
|
+
|
|
105
|
+
22 tools for AI agent integration. Localhost-bound HTTP exposes all; non-localhost binds expose only the public set.
|
|
106
|
+
|
|
107
|
+
**Public**: `cortex_search`, `cortex_context`, `cortex_dossier`, `cortex_read`, `cortex_capture`, `cortex_link`, `cortex_feedback`, `cortex_graph`, `cortex_list`, `cortex_classify`, `cortex_pipeline`
|
|
108
|
+
|
|
109
|
+
**Admin** (localhost only): `cortex_status`, `cortex_synthesize`, `cortex_delete`, `cortex_reason`, `cortex_query_trail`, `cortex_graph_data`, `cortex_list_entities`, `cortex_export`, `cortex_safety_check`, `cortex_debug_sessions`, `cortex_debug_memory`
|
|
110
|
+
|
|
111
|
+
## Architecture
|
|
112
|
+
|
|
113
|
+
Cortex runs as a single **MCP HTTP server** that owns the graph store. Claude Code, the dashboard, the CLI, and the REST API are all HTTP clients of that one server.
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
┌───────────────┐ ┌────────────┐ ┌─────────────┐
|
|
117
|
+
│ Claude Code │ │ Dashboard │ │ CLI │
|
|
118
|
+
│ (MCP client) │ │ (browser) │ │ (terminal) │
|
|
119
|
+
└───────┬───────┘ └─────┬──────┘ └──────┬──────┘
|
|
120
|
+
│ │ │
|
|
121
|
+
│ HTTP JSON-RPC │ HTTP MCP │ HTTP MCP (default)
|
|
122
|
+
│ │ │ direct (--direct)
|
|
123
|
+
▼ ▼ ▼
|
|
124
|
+
┌──────────────────────────────────────┐
|
|
125
|
+
│ cortex serve --transport mcp-http │
|
|
126
|
+
│ (canonical MCP HTTP server) │
|
|
127
|
+
│ PID-locked owner of graph.db │
|
|
128
|
+
└──────────────────────────────────────┘
|
|
129
|
+
│
|
|
130
|
+
▼
|
|
131
|
+
┌─────────────────────────────┐
|
|
132
|
+
│ ~/.cortex/ │
|
|
133
|
+
│ graph.db (Oxigraph) │
|
|
134
|
+
│ cortex.db (SQLite WAL) │
|
|
135
|
+
└─────────────────────────────┘
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
- **Ontology**: OWL-RL formal ontology with 8 knowledge types and 8 relationship types
|
|
139
|
+
- **Storage**: Oxigraph (RDF/SPARQL) + SQLite (FTS5/BM25) dual-write
|
|
140
|
+
- **Pipeline**: Classify → Extract entities → Link → Enrich → Reason
|
|
141
|
+
- **Retrieval**: Hybrid keyword + semantic + graph-boosted ranking
|
|
142
|
+
- **Serving**: 5 presentation modes (briefing, dossier, document, synthesis, alert)
|
|
143
|
+
- **Transports**: MCP (stdio + HTTP), REST API, Web Dashboard
|
|
144
|
+
|
|
145
|
+
## Service Management
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# Install both MCP server and dashboard as background services
|
|
149
|
+
cortex install
|
|
150
|
+
|
|
151
|
+
# Install only the MCP server
|
|
152
|
+
cortex install --service mcp
|
|
153
|
+
|
|
154
|
+
# Remove all services
|
|
155
|
+
cortex uninstall
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
On macOS, this creates LaunchAgent plists (auto-start on login, auto-restart on crash).
|
|
159
|
+
On Linux, this creates systemd user units.
|
|
160
|
+
|
|
161
|
+
Raw templates are available in `deploy/` for manual setup.
|
|
162
|
+
|
|
163
|
+
### `--direct` escape hatch
|
|
164
|
+
|
|
165
|
+
By default, CLI commands route through the running MCP server. If the server is down:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
cortex --direct list # bypass MCP, open store directly
|
|
169
|
+
cortex --direct pipeline --batch # required for bulk SQL operations
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Bootstrap commands (`init`, `setup`, `import-v1`, `import-vault`) always run directly.
|
|
173
|
+
|
|
174
|
+
## Docker
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
docker compose up -d
|
|
178
|
+
# Server at http://localhost:1314
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Troubleshooting
|
|
182
|
+
|
|
183
|
+
### Crashed MCP server
|
|
184
|
+
|
|
185
|
+
If the MCP server is killed hard, stale lock files auto-recover on next start. For manual cleanup:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
cortex doctor unlock # normal cleanup
|
|
189
|
+
cortex doctor unlock --dry-run # report only
|
|
190
|
+
cortex doctor unlock --force # bypass live-holder check
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Log management
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
cortex doctor logs # show log file sizes and status
|
|
197
|
+
cortex doctor logs --tail 20 # last 20 lines
|
|
198
|
+
cortex doctor logs --rotate # rotate log files (safe while running)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Claude Code session staleness
|
|
202
|
+
|
|
203
|
+
After restarting the MCP server, restart Claude Code to clear its stale session ID. `claude --resume` restores your conversation. The dashboard and CLI do not have this issue.
|
|
204
|
+
|
|
205
|
+
## Knowledge Types
|
|
206
|
+
|
|
207
|
+
decision, lesson, fix, session, research, source, synthesis, idea
|
|
208
|
+
|
|
209
|
+
## Relationship Types
|
|
210
|
+
|
|
211
|
+
causedBy, contradicts (symmetric), supports, supersedes (transitive), dependsOn, ledTo (inverse of causedBy), implements, mentions
|
|
212
|
+
|
|
213
|
+
## License
|
|
214
|
+
|
|
215
|
+
Copyright Abbacus Group.
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Cortex
|
|
2
|
+
|
|
3
|
+
Cognitive knowledge system with formal ontology, reasoning, and intelligence serving.
|
|
4
|
+
|
|
5
|
+
Cortex captures knowledge objects (decisions, lessons, fixes, sessions, research, ideas), classifies them with an OWL-RL ontology, discovers relationships, reasons over the graph, and serves intelligence through hybrid retrieval.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Full install (semantic + keyword search)
|
|
11
|
+
pip install abbacus-cortex[embeddings]
|
|
12
|
+
|
|
13
|
+
# Lightweight (keyword search only, no PyTorch)
|
|
14
|
+
pip install abbacus-cortex
|
|
15
|
+
|
|
16
|
+
# From source
|
|
17
|
+
git clone https://github.com/abbacusgroup/Cortex.git
|
|
18
|
+
cd Cortex
|
|
19
|
+
uv sync --extra embeddings
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# 1. Initialize — creates ~/.cortex/, loads ontology, warms up embedding model
|
|
26
|
+
cortex init
|
|
27
|
+
|
|
28
|
+
# 2. Install background services (auto-start on login)
|
|
29
|
+
cortex install
|
|
30
|
+
|
|
31
|
+
# 3. Register with Claude Code
|
|
32
|
+
cortex register
|
|
33
|
+
|
|
34
|
+
# 4. Use
|
|
35
|
+
cortex capture "Fix: Neo4j pool exhaustion" --type fix --content "Root cause was..."
|
|
36
|
+
cortex search "Neo4j"
|
|
37
|
+
cortex list
|
|
38
|
+
cortex context "Neo4j"
|
|
39
|
+
cortex dashboard # web UI at http://localhost:1315
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Configuration
|
|
43
|
+
|
|
44
|
+
Set via environment variables (prefix `CORTEX_`) or `.env` file:
|
|
45
|
+
|
|
46
|
+
```env
|
|
47
|
+
CORTEX_DATA_DIR=~/.cortex
|
|
48
|
+
CORTEX_LLM_MODEL=claude-sonnet-4-20250514
|
|
49
|
+
CORTEX_LLM_API_KEY=sk-...
|
|
50
|
+
CORTEX_DASHBOARD_PASSWORD= # set via `cortex setup`
|
|
51
|
+
CORTEX_EMBEDDING_MODEL=all-mpnet-base-v2
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
See `.env.example` for all options.
|
|
55
|
+
|
|
56
|
+
## CLI Commands
|
|
57
|
+
|
|
58
|
+
| Command | Description |
|
|
59
|
+
|---------|-------------|
|
|
60
|
+
| `cortex init` | Initialize data directory and stores |
|
|
61
|
+
| `cortex setup` | Interactive setup wizard |
|
|
62
|
+
| `cortex install` | Install background services (macOS/Linux) |
|
|
63
|
+
| `cortex uninstall` | Remove background services |
|
|
64
|
+
| `cortex register` | Register MCP server with Claude Code |
|
|
65
|
+
| `cortex capture` | Capture a knowledge object |
|
|
66
|
+
| `cortex search` | Hybrid keyword + semantic search |
|
|
67
|
+
| `cortex read` | Read object in full |
|
|
68
|
+
| `cortex list` | List objects with filters |
|
|
69
|
+
| `cortex status` | Health and counts |
|
|
70
|
+
| `cortex context` | Briefing mode (summaries) |
|
|
71
|
+
| `cortex dossier` | Entity-centric intelligence brief |
|
|
72
|
+
| `cortex graph` | Show object relationships |
|
|
73
|
+
| `cortex synthesize` | Cross-document synthesis |
|
|
74
|
+
| `cortex entities` | List resolved entities |
|
|
75
|
+
| `cortex serve` | Start MCP or HTTP server |
|
|
76
|
+
| `cortex dashboard` | Start web dashboard |
|
|
77
|
+
| `cortex import-v1` | Import from Cortex v1 database |
|
|
78
|
+
| `cortex import-vault` | Import from Obsidian vault |
|
|
79
|
+
|
|
80
|
+
## MCP Tools
|
|
81
|
+
|
|
82
|
+
22 tools for AI agent integration. Localhost-bound HTTP exposes all; non-localhost binds expose only the public set.
|
|
83
|
+
|
|
84
|
+
**Public**: `cortex_search`, `cortex_context`, `cortex_dossier`, `cortex_read`, `cortex_capture`, `cortex_link`, `cortex_feedback`, `cortex_graph`, `cortex_list`, `cortex_classify`, `cortex_pipeline`
|
|
85
|
+
|
|
86
|
+
**Admin** (localhost only): `cortex_status`, `cortex_synthesize`, `cortex_delete`, `cortex_reason`, `cortex_query_trail`, `cortex_graph_data`, `cortex_list_entities`, `cortex_export`, `cortex_safety_check`, `cortex_debug_sessions`, `cortex_debug_memory`
|
|
87
|
+
|
|
88
|
+
## Architecture
|
|
89
|
+
|
|
90
|
+
Cortex runs as a single **MCP HTTP server** that owns the graph store. Claude Code, the dashboard, the CLI, and the REST API are all HTTP clients of that one server.
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
┌───────────────┐ ┌────────────┐ ┌─────────────┐
|
|
94
|
+
│ Claude Code │ │ Dashboard │ │ CLI │
|
|
95
|
+
│ (MCP client) │ │ (browser) │ │ (terminal) │
|
|
96
|
+
└───────┬───────┘ └─────┬──────┘ └──────┬──────┘
|
|
97
|
+
│ │ │
|
|
98
|
+
│ HTTP JSON-RPC │ HTTP MCP │ HTTP MCP (default)
|
|
99
|
+
│ │ │ direct (--direct)
|
|
100
|
+
▼ ▼ ▼
|
|
101
|
+
┌──────────────────────────────────────┐
|
|
102
|
+
│ cortex serve --transport mcp-http │
|
|
103
|
+
│ (canonical MCP HTTP server) │
|
|
104
|
+
│ PID-locked owner of graph.db │
|
|
105
|
+
└──────────────────────────────────────┘
|
|
106
|
+
│
|
|
107
|
+
▼
|
|
108
|
+
┌─────────────────────────────┐
|
|
109
|
+
│ ~/.cortex/ │
|
|
110
|
+
│ graph.db (Oxigraph) │
|
|
111
|
+
│ cortex.db (SQLite WAL) │
|
|
112
|
+
└─────────────────────────────┘
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- **Ontology**: OWL-RL formal ontology with 8 knowledge types and 8 relationship types
|
|
116
|
+
- **Storage**: Oxigraph (RDF/SPARQL) + SQLite (FTS5/BM25) dual-write
|
|
117
|
+
- **Pipeline**: Classify → Extract entities → Link → Enrich → Reason
|
|
118
|
+
- **Retrieval**: Hybrid keyword + semantic + graph-boosted ranking
|
|
119
|
+
- **Serving**: 5 presentation modes (briefing, dossier, document, synthesis, alert)
|
|
120
|
+
- **Transports**: MCP (stdio + HTTP), REST API, Web Dashboard
|
|
121
|
+
|
|
122
|
+
## Service Management
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Install both MCP server and dashboard as background services
|
|
126
|
+
cortex install
|
|
127
|
+
|
|
128
|
+
# Install only the MCP server
|
|
129
|
+
cortex install --service mcp
|
|
130
|
+
|
|
131
|
+
# Remove all services
|
|
132
|
+
cortex uninstall
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
On macOS, this creates LaunchAgent plists (auto-start on login, auto-restart on crash).
|
|
136
|
+
On Linux, this creates systemd user units.
|
|
137
|
+
|
|
138
|
+
Raw templates are available in `deploy/` for manual setup.
|
|
139
|
+
|
|
140
|
+
### `--direct` escape hatch
|
|
141
|
+
|
|
142
|
+
By default, CLI commands route through the running MCP server. If the server is down:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
cortex --direct list # bypass MCP, open store directly
|
|
146
|
+
cortex --direct pipeline --batch # required for bulk SQL operations
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Bootstrap commands (`init`, `setup`, `import-v1`, `import-vault`) always run directly.
|
|
150
|
+
|
|
151
|
+
## Docker
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
docker compose up -d
|
|
155
|
+
# Server at http://localhost:1314
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Troubleshooting
|
|
159
|
+
|
|
160
|
+
### Crashed MCP server
|
|
161
|
+
|
|
162
|
+
If the MCP server is killed hard, stale lock files auto-recover on next start. For manual cleanup:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
cortex doctor unlock # normal cleanup
|
|
166
|
+
cortex doctor unlock --dry-run # report only
|
|
167
|
+
cortex doctor unlock --force # bypass live-holder check
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Log management
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
cortex doctor logs # show log file sizes and status
|
|
174
|
+
cortex doctor logs --tail 20 # last 20 lines
|
|
175
|
+
cortex doctor logs --rotate # rotate log files (safe while running)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Claude Code session staleness
|
|
179
|
+
|
|
180
|
+
After restarting the MCP server, restart Claude Code to clear its stale session ID. `claude --resume` restores your conversation. The dashboard and CLI do not have this issue.
|
|
181
|
+
|
|
182
|
+
## Knowledge Types
|
|
183
|
+
|
|
184
|
+
decision, lesson, fix, session, research, source, synthesis, idea
|
|
185
|
+
|
|
186
|
+
## Relationship Types
|
|
187
|
+
|
|
188
|
+
causedBy, contradicts (symmetric), supports, supersedes (transitive), dependsOn, ledTo (inverse of causedBy), implements, mentions
|
|
189
|
+
|
|
190
|
+
## License
|
|
191
|
+
|
|
192
|
+
Copyright Abbacus Group.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "abbacus-cortex"
|
|
3
|
+
version = "0.2.1"
|
|
4
|
+
description = "Cognitive knowledge system with formal ontology, reasoning, and intelligence serving"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Fabrizzio Silveira", email = "74255714+grayisnotacolor@users.noreply.github.com" }
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.12"
|
|
10
|
+
dependencies = [
|
|
11
|
+
# Graph / Ontology
|
|
12
|
+
"pyoxigraph>=0.4",
|
|
13
|
+
# SQLite (async)
|
|
14
|
+
"aiosqlite>=0.20",
|
|
15
|
+
# Web framework
|
|
16
|
+
"fastapi>=0.115",
|
|
17
|
+
"uvicorn[standard]>=0.34",
|
|
18
|
+
# CLI
|
|
19
|
+
"typer>=0.15",
|
|
20
|
+
# Templates
|
|
21
|
+
"jinja2>=3.1",
|
|
22
|
+
# Config
|
|
23
|
+
"python-dotenv>=1.1",
|
|
24
|
+
# Auth
|
|
25
|
+
"bcrypt>=4.2",
|
|
26
|
+
# MCP
|
|
27
|
+
"mcp>=1.6",
|
|
28
|
+
# HTTP client
|
|
29
|
+
"httpx>=0.28",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
embeddings = ["sentence-transformers>=3.4"]
|
|
34
|
+
llm = ["litellm>=1.60"]
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
cortex = "cortex.cli.main:app"
|
|
38
|
+
|
|
39
|
+
[dependency-groups]
|
|
40
|
+
dev = [
|
|
41
|
+
"pytest>=8.3",
|
|
42
|
+
"pytest-asyncio>=0.25",
|
|
43
|
+
# Bundle 9 / F.1 + F.2: xdist for parallel runs (the CI workflow uses
|
|
44
|
+
# ``pytest -n auto``); forked for the test-isolation suite that needs
|
|
45
|
+
# a fresh process per test.
|
|
46
|
+
"pytest-xdist>=3.8",
|
|
47
|
+
"pytest-forked>=1.6",
|
|
48
|
+
"httpx>=0.28",
|
|
49
|
+
"ruff>=0.11",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[build-system]
|
|
53
|
+
requires = ["uv_build>=0.10.12,<0.11.0"]
|
|
54
|
+
build-backend = "uv_build"
|
|
55
|
+
|
|
56
|
+
[tool.uv]
|
|
57
|
+
build-backend.module-name = "cortex"
|
|
58
|
+
|
|
59
|
+
[tool.pytest.ini_options]
|
|
60
|
+
testpaths = ["tests"]
|
|
61
|
+
asyncio_mode = "auto"
|
|
62
|
+
pythonpath = ["src"]
|
|
63
|
+
markers = [
|
|
64
|
+
"slow: end-to-end tests that spawn subprocesses (skipped in fast loops)",
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
[tool.ruff]
|
|
68
|
+
target-version = "py312"
|
|
69
|
+
line-length = 100
|
|
70
|
+
|
|
71
|
+
[tool.ruff.lint]
|
|
72
|
+
select = ["B", "C4", "E", "F", "I", "N", "RUF", "SIM", "W", "UP"]
|
|
File without changes
|