omni-cortex 1.2.0__py3-none-any.whl → 1.11.3__py3-none-any.whl
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.
- omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/.env.example +12 -0
- omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/backfill_summaries.py +280 -0
- {omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/chat_service.py +59 -32
- {omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/database.py +305 -18
- {omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/image_service.py +35 -16
- {omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/logging_config.py +34 -4
- {omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/main.py +451 -13
- {omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/models.py +64 -12
- omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/prompt_security.py +111 -0
- omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/security.py +104 -0
- {omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/uv.lock +414 -1
- {omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/websocket_manager.py +24 -2
- omni_cortex-1.11.3.data/data/share/omni-cortex/hooks/post_tool_use.py +429 -0
- {omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/hooks/pre_tool_use.py +52 -2
- omni_cortex-1.11.3.data/data/share/omni-cortex/hooks/session_utils.py +186 -0
- {omni_cortex-1.2.0.dist-info → omni_cortex-1.11.3.dist-info}/METADATA +237 -8
- omni_cortex-1.11.3.dist-info/RECORD +25 -0
- omni_cortex-1.2.0.data/data/share/omni-cortex/hooks/post_tool_use.py +0 -160
- omni_cortex-1.2.0.dist-info/RECORD +0 -20
- {omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/project_config.py +0 -0
- {omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/project_scanner.py +0 -0
- {omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/dashboard/backend/pyproject.toml +0 -0
- {omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/hooks/stop.py +0 -0
- {omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/hooks/subagent_stop.py +0 -0
- {omni_cortex-1.2.0.dist-info → omni_cortex-1.11.3.dist-info}/WHEEL +0 -0
- {omni_cortex-1.2.0.dist-info → omni_cortex-1.11.3.dist-info}/entry_points.txt +0 -0
- {omni_cortex-1.2.0.dist-info → omni_cortex-1.11.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: omni-cortex
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.11.3
|
|
4
4
|
Summary: Give Claude Code a perfect memory - auto-logs everything, searches smartly, and gets smarter over time
|
|
5
5
|
Project-URL: Homepage, https://github.com/AllCytes/Omni-Cortex
|
|
6
6
|
Project-URL: Repository, https://github.com/AllCytes/Omni-Cortex
|
|
@@ -21,9 +21,11 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
21
21
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
23
|
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: claude-agent-sdk>=0.1.0
|
|
24
25
|
Requires-Dist: httpx>=0.25.0
|
|
25
26
|
Requires-Dist: mcp>=1.0.0
|
|
26
27
|
Requires-Dist: pydantic>=2.0.0
|
|
28
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
27
29
|
Requires-Dist: pyyaml>=6.0.0
|
|
28
30
|
Provides-Extra: dev
|
|
29
31
|
Requires-Dist: black>=23.0.0; extra == 'dev'
|
|
@@ -76,7 +78,180 @@ A universal memory system for Claude Code that combines activity logging with in
|
|
|
76
78
|
- **Importance Decay**: Frequently accessed memories naturally surface
|
|
77
79
|
- **Auto Activity Logging**: Automatically logs all tool calls via hooks
|
|
78
80
|
|
|
79
|
-
##
|
|
81
|
+
## Getting Started (5 Minutes)
|
|
82
|
+
|
|
83
|
+
A step-by-step guide to get Omni Cortex running on your machine.
|
|
84
|
+
|
|
85
|
+
### Prerequisites
|
|
86
|
+
|
|
87
|
+
- **Python 3.10+** - Check with `python --version`
|
|
88
|
+
- **Claude Code CLI** - The Anthropic CLI tool
|
|
89
|
+
- **pip** - Python package manager (comes with Python)
|
|
90
|
+
|
|
91
|
+
### Step 1: Install the Package
|
|
92
|
+
|
|
93
|
+
**Option A: From PyPI (Recommended for most users)**
|
|
94
|
+
```bash
|
|
95
|
+
pip install omni-cortex
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Option B: From Source (For development/contributions)**
|
|
99
|
+
```bash
|
|
100
|
+
git clone https://github.com/AllCytes/Omni-Cortex.git
|
|
101
|
+
cd Omni-Cortex
|
|
102
|
+
pip install -e ".[semantic]"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Expected output:**
|
|
106
|
+
```
|
|
107
|
+
Successfully installed omni-cortex-1.7.1
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Step 2: Run the Setup
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
omni-cortex-setup
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
This automatically:
|
|
117
|
+
- Adds Omni Cortex as an MCP server in `~/.claude.json`
|
|
118
|
+
- Configures hooks in `~/.claude/settings.json` for activity logging
|
|
119
|
+
|
|
120
|
+
**Expected output:**
|
|
121
|
+
```
|
|
122
|
+
✓ MCP server configured
|
|
123
|
+
✓ Hooks configured
|
|
124
|
+
Setup complete! Restart Claude Code to activate.
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Step 3: Restart Claude Code
|
|
128
|
+
|
|
129
|
+
Close and reopen your Claude Code terminal. This loads the new MCP configuration.
|
|
130
|
+
|
|
131
|
+
### Step 4: Verify It's Working
|
|
132
|
+
|
|
133
|
+
In Claude Code, try storing a memory:
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
Ask Claude: "Remember that the database uses SQLite for storage"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Claude should use the `cortex_remember` tool. Then verify:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
Ask Claude: "What do you remember about the database?"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Claude should use `cortex_recall` and find your memory.
|
|
146
|
+
|
|
147
|
+
### Step 5: Start the Dashboard (Optional)
|
|
148
|
+
|
|
149
|
+
The web dashboard lets you browse and search memories visually.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Start the dashboard (opens http://localhost:5173)
|
|
153
|
+
omni-cortex-dashboard
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Or manually:
|
|
157
|
+
```bash
|
|
158
|
+
# Terminal 1: Backend (uses dashboard's own venv)
|
|
159
|
+
cd dashboard/backend
|
|
160
|
+
.venv/Scripts/python -m uvicorn main:app --host 127.0.0.1 --port 8765 --reload
|
|
161
|
+
|
|
162
|
+
# Terminal 2: Frontend
|
|
163
|
+
cd dashboard/frontend
|
|
164
|
+
npm install
|
|
165
|
+
npm run dev
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Open http://localhost:5173 in your browser.
|
|
169
|
+
|
|
170
|
+
**Note:** The dashboard has its own virtual environment at `dashboard/backend/.venv` with FastAPI and other web dependencies. This is separate from the project root `.venv` which contains the MCP server package.
|
|
171
|
+
|
|
172
|
+
### Troubleshooting
|
|
173
|
+
|
|
174
|
+
<details>
|
|
175
|
+
<summary><b>❌ "omni-cortex-setup" command not found</b></summary>
|
|
176
|
+
|
|
177
|
+
**Cause:** pip installed to a location not in your PATH.
|
|
178
|
+
|
|
179
|
+
**Solution:**
|
|
180
|
+
```bash
|
|
181
|
+
# Find where pip installed it
|
|
182
|
+
python -m omni_cortex.setup
|
|
183
|
+
|
|
184
|
+
# Or add Python scripts to PATH (Windows)
|
|
185
|
+
# Add %APPDATA%\Python\Python3x\Scripts to your PATH
|
|
186
|
+
|
|
187
|
+
# On macOS/Linux, ensure ~/.local/bin is in PATH
|
|
188
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
189
|
+
```
|
|
190
|
+
</details>
|
|
191
|
+
|
|
192
|
+
<details>
|
|
193
|
+
<summary><b>❌ Claude doesn't see cortex_* tools</b></summary>
|
|
194
|
+
|
|
195
|
+
**Cause:** MCP server not configured or Claude Code not restarted.
|
|
196
|
+
|
|
197
|
+
**Solution:**
|
|
198
|
+
1. Check `~/.claude.json` contains the `omni-cortex` MCP server entry
|
|
199
|
+
2. Fully close and reopen Claude Code (not just the terminal)
|
|
200
|
+
3. Run `omni-cortex-setup` again if needed
|
|
201
|
+
</details>
|
|
202
|
+
|
|
203
|
+
<details>
|
|
204
|
+
<summary><b>❌ "ModuleNotFoundError: No module named 'omni_cortex'"</b></summary>
|
|
205
|
+
|
|
206
|
+
**Cause:** Python environment mismatch.
|
|
207
|
+
|
|
208
|
+
**Solution:**
|
|
209
|
+
```bash
|
|
210
|
+
# Ensure you're using the same Python that pip used
|
|
211
|
+
which python # or `where python` on Windows
|
|
212
|
+
pip show omni-cortex # Check if installed
|
|
213
|
+
|
|
214
|
+
# Reinstall if needed
|
|
215
|
+
pip install --force-reinstall omni-cortex
|
|
216
|
+
```
|
|
217
|
+
</details>
|
|
218
|
+
|
|
219
|
+
<details>
|
|
220
|
+
<summary><b>❌ Dashboard won't start</b></summary>
|
|
221
|
+
|
|
222
|
+
**Cause:** Missing dependencies or port conflict.
|
|
223
|
+
|
|
224
|
+
**Solution:**
|
|
225
|
+
```bash
|
|
226
|
+
# Install backend dependencies
|
|
227
|
+
cd dashboard/backend
|
|
228
|
+
pip install -e .
|
|
229
|
+
|
|
230
|
+
# Check if port 8765 is in use
|
|
231
|
+
# Windows: netstat -ano | findstr :8765
|
|
232
|
+
# macOS/Linux: lsof -i :8765
|
|
233
|
+
|
|
234
|
+
# Use a different port if needed
|
|
235
|
+
uvicorn main:app --port 8766
|
|
236
|
+
```
|
|
237
|
+
</details>
|
|
238
|
+
|
|
239
|
+
<details>
|
|
240
|
+
<summary><b>❌ Semantic search not working</b></summary>
|
|
241
|
+
|
|
242
|
+
**Cause:** Semantic extras not installed.
|
|
243
|
+
|
|
244
|
+
**Solution:**
|
|
245
|
+
```bash
|
|
246
|
+
pip install omni-cortex[semantic]
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
First search will download the embedding model (~100MB).
|
|
250
|
+
</details>
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Installation (Detailed)
|
|
80
255
|
|
|
81
256
|
### Quick Install (Recommended)
|
|
82
257
|
|
|
@@ -294,18 +469,72 @@ The PDFs use a light theme with blue/purple/green accents. Edit `docs/create_pdf
|
|
|
294
469
|
|
|
295
470
|
## Development
|
|
296
471
|
|
|
472
|
+
### Quick Setup (with Claude Code)
|
|
473
|
+
|
|
474
|
+
If you're using Claude Code, just run:
|
|
475
|
+
|
|
297
476
|
```bash
|
|
298
|
-
|
|
299
|
-
|
|
477
|
+
/dev-setup
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
This will guide you through setting up the development environment.
|
|
481
|
+
|
|
482
|
+
### Manual Setup
|
|
300
483
|
|
|
301
|
-
|
|
484
|
+
```bash
|
|
485
|
+
# Clone and install in editable mode
|
|
486
|
+
git clone https://github.com/AllCytes/Omni-Cortex.git
|
|
487
|
+
cd Omni-Cortex
|
|
488
|
+
pip install -e .
|
|
489
|
+
|
|
490
|
+
# Dashboard backend has its own venv (already included in repo)
|
|
491
|
+
# If missing, set it up:
|
|
492
|
+
cd dashboard/backend
|
|
493
|
+
python -m venv .venv
|
|
494
|
+
.venv/Scripts/pip install -r requirements.txt # Windows
|
|
495
|
+
# .venv/bin/pip install -r requirements.txt # macOS/Linux
|
|
496
|
+
cd ../frontend && npm install
|
|
497
|
+
cd ../..
|
|
498
|
+
|
|
499
|
+
# Verify installation
|
|
500
|
+
omni-cortex --help
|
|
501
|
+
omni-cortex-dashboard --help
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
**Important**: Always use `pip install -e .` (editable mode) so changes are immediately reflected without reinstalling.
|
|
505
|
+
|
|
506
|
+
### Project Structure
|
|
507
|
+
|
|
508
|
+
```
|
|
509
|
+
omni-cortex/
|
|
510
|
+
├── .venv/ # Project root venv (omni-cortex MCP package)
|
|
511
|
+
├── src/omni_cortex/ # MCP server source code
|
|
512
|
+
├── dashboard/
|
|
513
|
+
│ ├── backend/
|
|
514
|
+
│ │ ├── .venv/ # Dashboard backend venv (FastAPI, uvicorn)
|
|
515
|
+
│ │ ├── main.py # FastAPI application
|
|
516
|
+
│ │ └── database.py # Database queries
|
|
517
|
+
│ └── frontend/ # Vue 3 + Vite frontend
|
|
518
|
+
├── adws/ # Agentic Development Workflows
|
|
519
|
+
├── specs/ # Implementation plans
|
|
520
|
+
│ ├── todo/ # Plans waiting to be built
|
|
521
|
+
│ └── done/ # Completed plans
|
|
522
|
+
└── tests/ # Unit tests
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
**Why two venvs?** The dashboard is a standalone web application that can be packaged/deployed separately from the MCP server. They have different dependencies (MCP server needs `mcp`, dashboard needs `fastapi`).
|
|
526
|
+
|
|
527
|
+
### Running Tests
|
|
528
|
+
|
|
529
|
+
```bash
|
|
302
530
|
pytest
|
|
303
531
|
|
|
304
|
-
#
|
|
305
|
-
|
|
306
|
-
ruff check src tests
|
|
532
|
+
# With coverage
|
|
533
|
+
pytest --cov=src/omni_cortex
|
|
307
534
|
```
|
|
308
535
|
|
|
536
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for full development guidelines.
|
|
537
|
+
|
|
309
538
|
## Security
|
|
310
539
|
|
|
311
540
|
Omni Cortex v1.0.3 has been security reviewed:
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/hooks/post_tool_use.py,sha256=kHBRCP6VctSk3evApsgDaL3UElGSEBGwRfV4hBZPqgE,14539
|
|
2
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/hooks/pre_tool_use.py,sha256=mkZ7eeBnjWkIgNnrqfYSXIhhLNYYk4hQx_6F0pNrGoc,6395
|
|
3
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/hooks/session_utils.py,sha256=3SKPCytqWuRPOupWdzmwBoKBDJqtLcT1Nle_pueDQUY,5746
|
|
4
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/hooks/stop.py,sha256=T1bwcmbTLj0gzjrVvFBT1zB6wff4J2YkYBAY-ZxZI5g,5336
|
|
5
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/hooks/subagent_stop.py,sha256=V9HQSFGNOfkg8ZCstPEy4h5V8BP4AbrVr8teFzN1kNk,3314
|
|
6
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/.env.example,sha256=9xS7-UiWlMddRwzlyyyKNHAMlNTsgH-2sPV266guJpQ,372
|
|
7
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/backfill_summaries.py,sha256=ElchfcBv4pmVr2PsePCgFlCyuvf4_jDJj_C3AmMhu7U,8973
|
|
8
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/chat_service.py,sha256=5UCvLayZGeSdGsYAzOeupumclAhoFLusGYLdyl33ANc,9304
|
|
9
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/database.py,sha256=LAN7GSM2tvMcJaL0RrGJurH9-tw3cs2QtPduqCbLvj0,34974
|
|
10
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/image_service.py,sha256=NP6ojFpHb6iNTYRkXqYu1CL6WvooZpZ54mjLiWSWG_g,19205
|
|
11
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/logging_config.py,sha256=WnunFGET9zlsn9WBpVsio2zI7BiUQanE0xzAQQxIhII,3944
|
|
12
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/main.py,sha256=rJrmYJvkGhRsXOdYKOTRPMVnwA00W5QoGJ_Aa3v-TRE,46219
|
|
13
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/models.py,sha256=LkmcYq1imsyDlMYnX3Z_FOTmPsu37MQEfJSI-w5EjvM,7330
|
|
14
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/project_config.py,sha256=ZxGoeRpHvN5qQyf2hRxrAZiHrPSwdQp59f0di6O1LKM,4352
|
|
15
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/project_scanner.py,sha256=lwFXS8iJbOoxf7FAyo2TjH25neaMHiJ8B3jS57XxtDI,5713
|
|
16
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/prompt_security.py,sha256=LcdZhYy1CfpSq_4BPO6lMJ15phc2ZXLUSBAnAvODVCI,3423
|
|
17
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/pyproject.toml,sha256=9pbbGQXLe1Xd06nZAtDySCHIlfMWvPaB-C6tGZR6umc,502
|
|
18
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/security.py,sha256=nQsoPE0n5dtY9ive00d33W1gL48GgK7C5Ae0BK2oW2k,3479
|
|
19
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/uv.lock,sha256=miB9zGGSirBkjDE-OZTPCnv43Yc98xuAz_Ne8vTNFHg,186004
|
|
20
|
+
omni_cortex-1.11.3.data/data/share/omni-cortex/dashboard/backend/websocket_manager.py,sha256=gNQLd94AcC-InumGQmUolREhiogCzilYWpLN8SRZjHI,3645
|
|
21
|
+
omni_cortex-1.11.3.dist-info/METADATA,sha256=oM6RvKOj_J7rCFrqbgZOiYHxFLxy-eLnIlq5QHIEf_o,15712
|
|
22
|
+
omni_cortex-1.11.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
23
|
+
omni_cortex-1.11.3.dist-info/entry_points.txt,sha256=rohx4mFH2ffZmMb9QXPZmFf-ZGjA3jpKVDVeET-ttiM,150
|
|
24
|
+
omni_cortex-1.11.3.dist-info/licenses/LICENSE,sha256=oG_397owMmi-Umxp5sYocJ6RPohp9_bDNnnEu9OUphg,1072
|
|
25
|
+
omni_cortex-1.11.3.dist-info/RECORD,,
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""PostToolUse hook - logs tool result after execution.
|
|
3
|
-
|
|
4
|
-
This hook is called by Claude Code after each tool completes.
|
|
5
|
-
It logs the tool output, duration, and success/error status.
|
|
6
|
-
|
|
7
|
-
Hook configuration for settings.json:
|
|
8
|
-
{
|
|
9
|
-
"hooks": {
|
|
10
|
-
"PostToolUse": [
|
|
11
|
-
{
|
|
12
|
-
"type": "command",
|
|
13
|
-
"command": "python hooks/post_tool_use.py"
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
import json
|
|
21
|
-
import sys
|
|
22
|
-
import os
|
|
23
|
-
import sqlite3
|
|
24
|
-
from datetime import datetime, timezone
|
|
25
|
-
from pathlib import Path
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def get_db_path() -> Path:
|
|
29
|
-
"""Get the database path for the current project."""
|
|
30
|
-
project_path = os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd())
|
|
31
|
-
return Path(project_path) / ".omni-cortex" / "cortex.db"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def ensure_database(db_path: Path) -> sqlite3.Connection:
|
|
35
|
-
"""Ensure database exists and is initialized.
|
|
36
|
-
|
|
37
|
-
Auto-creates the database and schema if it doesn't exist.
|
|
38
|
-
This enables 'out of the box' functionality.
|
|
39
|
-
"""
|
|
40
|
-
db_path.parent.mkdir(parents=True, exist_ok=True)
|
|
41
|
-
conn = sqlite3.connect(str(db_path))
|
|
42
|
-
|
|
43
|
-
# Check if schema exists
|
|
44
|
-
cursor = conn.cursor()
|
|
45
|
-
cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='activities'")
|
|
46
|
-
if cursor.fetchone() is None:
|
|
47
|
-
# Apply minimal schema for activities (full schema applied by MCP)
|
|
48
|
-
conn.executescript("""
|
|
49
|
-
CREATE TABLE IF NOT EXISTS activities (
|
|
50
|
-
id TEXT PRIMARY KEY,
|
|
51
|
-
session_id TEXT,
|
|
52
|
-
agent_id TEXT,
|
|
53
|
-
timestamp TEXT NOT NULL,
|
|
54
|
-
event_type TEXT NOT NULL,
|
|
55
|
-
tool_name TEXT,
|
|
56
|
-
tool_input TEXT,
|
|
57
|
-
tool_output TEXT,
|
|
58
|
-
duration_ms INTEGER,
|
|
59
|
-
success INTEGER DEFAULT 1,
|
|
60
|
-
error_message TEXT,
|
|
61
|
-
project_path TEXT,
|
|
62
|
-
file_path TEXT,
|
|
63
|
-
metadata TEXT
|
|
64
|
-
);
|
|
65
|
-
CREATE INDEX IF NOT EXISTS idx_activities_timestamp ON activities(timestamp DESC);
|
|
66
|
-
CREATE INDEX IF NOT EXISTS idx_activities_tool ON activities(tool_name);
|
|
67
|
-
""")
|
|
68
|
-
conn.commit()
|
|
69
|
-
|
|
70
|
-
return conn
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def generate_id() -> str:
|
|
74
|
-
"""Generate a unique activity ID."""
|
|
75
|
-
timestamp_ms = int(datetime.now().timestamp() * 1000)
|
|
76
|
-
random_hex = os.urandom(4).hex()
|
|
77
|
-
return f"act_{timestamp_ms}_{random_hex}"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
def truncate(text: str, max_length: int = 10000) -> str:
|
|
81
|
-
"""Truncate text to max length."""
|
|
82
|
-
if len(text) <= max_length:
|
|
83
|
-
return text
|
|
84
|
-
return text[:max_length - 20] + "\n... [truncated]"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def main():
|
|
88
|
-
"""Process PostToolUse hook."""
|
|
89
|
-
try:
|
|
90
|
-
# Read all input at once (more reliable than json.load on stdin)
|
|
91
|
-
raw_input = sys.stdin.read()
|
|
92
|
-
if not raw_input or not raw_input.strip():
|
|
93
|
-
print(json.dumps({}))
|
|
94
|
-
return
|
|
95
|
-
|
|
96
|
-
input_data = json.loads(raw_input)
|
|
97
|
-
|
|
98
|
-
# Extract data from hook input
|
|
99
|
-
tool_name = input_data.get("tool_name")
|
|
100
|
-
tool_input = input_data.get("tool_input", {})
|
|
101
|
-
tool_output = input_data.get("tool_output", {})
|
|
102
|
-
agent_id = input_data.get("agent_id")
|
|
103
|
-
|
|
104
|
-
# Determine success/error
|
|
105
|
-
is_error = input_data.get("is_error", False)
|
|
106
|
-
error_message = None
|
|
107
|
-
if is_error and isinstance(tool_output, dict):
|
|
108
|
-
error_message = tool_output.get("error") or tool_output.get("message")
|
|
109
|
-
|
|
110
|
-
# Skip logging our own tools to prevent recursion
|
|
111
|
-
# MCP tools are named like "mcp__omni-cortex__cortex_remember"
|
|
112
|
-
if tool_name and ("cortex_" in tool_name or "omni-cortex" in tool_name):
|
|
113
|
-
print(json.dumps({}))
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
session_id = os.environ.get("CLAUDE_SESSION_ID")
|
|
117
|
-
project_path = os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd())
|
|
118
|
-
|
|
119
|
-
# Auto-initialize database (creates if not exists)
|
|
120
|
-
db_path = get_db_path()
|
|
121
|
-
conn = ensure_database(db_path)
|
|
122
|
-
|
|
123
|
-
# Insert activity record
|
|
124
|
-
cursor = conn.cursor()
|
|
125
|
-
cursor.execute(
|
|
126
|
-
"""
|
|
127
|
-
INSERT INTO activities (
|
|
128
|
-
id, session_id, agent_id, timestamp, event_type,
|
|
129
|
-
tool_name, tool_input, tool_output, success, error_message, project_path
|
|
130
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
131
|
-
""",
|
|
132
|
-
(
|
|
133
|
-
generate_id(),
|
|
134
|
-
session_id,
|
|
135
|
-
agent_id,
|
|
136
|
-
datetime.now(timezone.utc).isoformat(),
|
|
137
|
-
"post_tool_use",
|
|
138
|
-
tool_name,
|
|
139
|
-
truncate(json.dumps(tool_input, default=str)),
|
|
140
|
-
truncate(json.dumps(tool_output, default=str)),
|
|
141
|
-
0 if is_error else 1,
|
|
142
|
-
error_message,
|
|
143
|
-
project_path,
|
|
144
|
-
),
|
|
145
|
-
)
|
|
146
|
-
conn.commit()
|
|
147
|
-
conn.close()
|
|
148
|
-
|
|
149
|
-
# Return empty response (no modification)
|
|
150
|
-
print(json.dumps({}))
|
|
151
|
-
|
|
152
|
-
except Exception as e:
|
|
153
|
-
# Hooks should never block - log error but continue
|
|
154
|
-
print(json.dumps({"systemMessage": f"Cortex post_tool_use: {e}"}))
|
|
155
|
-
|
|
156
|
-
sys.exit(0)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if __name__ == "__main__":
|
|
160
|
-
main()
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/hooks/post_tool_use.py,sha256=zXy30KNDW6UoWP0nwq5n320r1wFa-tE6V4QuSdDzx8w,5106
|
|
2
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/hooks/pre_tool_use.py,sha256=SlvvEKsIkolDG5Y_35VezY2e7kRpbj1GiDlBW-naj2g,4900
|
|
3
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/hooks/stop.py,sha256=T1bwcmbTLj0gzjrVvFBT1zB6wff4J2YkYBAY-ZxZI5g,5336
|
|
4
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/hooks/subagent_stop.py,sha256=V9HQSFGNOfkg8ZCstPEy4h5V8BP4AbrVr8teFzN1kNk,3314
|
|
5
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/dashboard/backend/chat_service.py,sha256=hmTvlwK5w29nOLUGCwaaIslEuLgA1-JezXbLwxWDSdM,8265
|
|
6
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/dashboard/backend/database.py,sha256=HNwfyfebHq0Gdooc4bZdyNp_FD7WFx9z6KJkWLWtHp8,25400
|
|
7
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/dashboard/backend/image_service.py,sha256=fHP4AA9rM9r05PMglO1eY9Fd93v0JaNuaUX2HiRA-PI,18013
|
|
8
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/dashboard/backend/logging_config.py,sha256=dFcNqfw2jTfUjFERV_Pr5r5PjY9wSQGXEYPf0AyR5Yk,2869
|
|
9
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/dashboard/backend/main.py,sha256=RCKdsvOp1oJC64dZjh08b2NqCozSJdvla2wCmRexrk4,30478
|
|
10
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/dashboard/backend/models.py,sha256=lWb4Rvy6E-x21CGAeahSdVRzxGCVrEgYdc5vKbfo6_A,5671
|
|
11
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/dashboard/backend/project_config.py,sha256=ZxGoeRpHvN5qQyf2hRxrAZiHrPSwdQp59f0di6O1LKM,4352
|
|
12
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/dashboard/backend/project_scanner.py,sha256=lwFXS8iJbOoxf7FAyo2TjH25neaMHiJ8B3jS57XxtDI,5713
|
|
13
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/dashboard/backend/pyproject.toml,sha256=9pbbGQXLe1Xd06nZAtDySCHIlfMWvPaB-C6tGZR6umc,502
|
|
14
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/dashboard/backend/uv.lock,sha256=e7IMinX0BR2EcnpPwHYCdDJQDzuDzQ3D-FmPOiPKfGA,131248
|
|
15
|
-
omni_cortex-1.2.0.data/data/share/omni-cortex/dashboard/backend/websocket_manager.py,sha256=fv16XkRkgN4SDNwTiP_p9qFnWta9lIpAXgKbFETZ7uM,2770
|
|
16
|
-
omni_cortex-1.2.0.dist-info/METADATA,sha256=FYI3wuEZJ6oV0Mvla_GvwumdOzhvl938i-g2ZV4SM18,9855
|
|
17
|
-
omni_cortex-1.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
18
|
-
omni_cortex-1.2.0.dist-info/entry_points.txt,sha256=rohx4mFH2ffZmMb9QXPZmFf-ZGjA3jpKVDVeET-ttiM,150
|
|
19
|
-
omni_cortex-1.2.0.dist-info/licenses/LICENSE,sha256=oG_397owMmi-Umxp5sYocJ6RPohp9_bDNnnEu9OUphg,1072
|
|
20
|
-
omni_cortex-1.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{omni_cortex-1.2.0.data → omni_cortex-1.11.3.data}/data/share/omni-cortex/hooks/subagent_stop.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|