chandan-cortex 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 (32) hide show
  1. chandan_cortex-0.1.0/LICENSE +21 -0
  2. chandan_cortex-0.1.0/PKG-INFO +325 -0
  3. chandan_cortex-0.1.0/README.md +269 -0
  4. chandan_cortex-0.1.0/chandan_cortex.egg-info/PKG-INFO +325 -0
  5. chandan_cortex-0.1.0/chandan_cortex.egg-info/SOURCES.txt +30 -0
  6. chandan_cortex-0.1.0/chandan_cortex.egg-info/dependency_links.txt +1 -0
  7. chandan_cortex-0.1.0/chandan_cortex.egg-info/entry_points.txt +2 -0
  8. chandan_cortex-0.1.0/chandan_cortex.egg-info/requires.txt +38 -0
  9. chandan_cortex-0.1.0/chandan_cortex.egg-info/top_level.txt +1 -0
  10. chandan_cortex-0.1.0/cortex/__init__.py +4 -0
  11. chandan_cortex-0.1.0/cortex/__main__.py +5 -0
  12. chandan_cortex-0.1.0/cortex/agent/__init__.py +1 -0
  13. chandan_cortex-0.1.0/cortex/agent/memory.py +231 -0
  14. chandan_cortex-0.1.0/cortex/agent/models.py +426 -0
  15. chandan_cortex-0.1.0/cortex/agent/runtime.py +224 -0
  16. chandan_cortex-0.1.0/cortex/agent/tools.py +51 -0
  17. chandan_cortex-0.1.0/cortex/channels/__init__.py +1 -0
  18. chandan_cortex-0.1.0/cortex/channels/base.py +65 -0
  19. chandan_cortex-0.1.0/cortex/channels/discord.py +78 -0
  20. chandan_cortex-0.1.0/cortex/channels/telegram.py +84 -0
  21. chandan_cortex-0.1.0/cortex/cli.py +625 -0
  22. chandan_cortex-0.1.0/cortex/config.py +207 -0
  23. chandan_cortex-0.1.0/cortex/gateway.py +168 -0
  24. chandan_cortex-0.1.0/cortex/tools/__init__.py +1 -0
  25. chandan_cortex-0.1.0/cortex/tools/system.py +169 -0
  26. chandan_cortex-0.1.0/cortex/tools/tasks.py +135 -0
  27. chandan_cortex-0.1.0/cortex/utils/__init__.py +3 -0
  28. chandan_cortex-0.1.0/cortex/utils/logger.py +30 -0
  29. chandan_cortex-0.1.0/cortex/web/__init__.py +1 -0
  30. chandan_cortex-0.1.0/cortex/web/server.py +245 -0
  31. chandan_cortex-0.1.0/pyproject.toml +75 -0
  32. chandan_cortex-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cortex Contributors
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,325 @@
1
+ Metadata-Version: 2.4
2
+ Name: chandan-cortex
3
+ Version: 0.1.0
4
+ Summary: Your personal AI assistant gateway. Simple. Powerful. Local-first. ๐Ÿง 
5
+ Author: Cortex Contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/chandanhastantram/cortex
8
+ Project-URL: Documentation, https://github.com/chandanhastantram/cortex#readme
9
+ Project-URL: Repository, https://github.com/chandanhastantram/cortex
10
+ Project-URL: Issues, https://github.com/chandanhastantram/cortex/issues
11
+ Keywords: ai,assistant,gateway,chatbot,personal-ai,multi-channel
12
+ Classifier: Development Status :: 4 - Beta
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 :: Scientific/Engineering :: Artificial Intelligence
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: fastapi>=0.104.0
24
+ Requires-Dist: uvicorn[standard]>=0.24.0
25
+ Requires-Dist: websockets>=12.0
26
+ Requires-Dist: httpx>=0.25.0
27
+ Requires-Dist: pyyaml>=6.0
28
+ Requires-Dist: rich>=13.0
29
+ Requires-Dist: click>=8.1
30
+ Requires-Dist: openai>=1.10.0
31
+ Requires-Dist: anthropic>=0.18.0
32
+ Requires-Dist: python-dotenv>=1.0.0
33
+ Requires-Dist: aiosqlite>=0.19.0
34
+ Requires-Dist: jinja2>=3.1.0
35
+ Requires-Dist: pydantic>=2.5.0
36
+ Requires-Dist: apscheduler>=3.10.0
37
+ Requires-Dist: prompt-toolkit>=3.0.0
38
+ Provides-Extra: telegram
39
+ Requires-Dist: python-telegram-bot>=20.7; extra == "telegram"
40
+ Provides-Extra: discord
41
+ Requires-Dist: discord.py>=2.3.0; extra == "discord"
42
+ Provides-Extra: slack
43
+ Requires-Dist: slack-bolt>=1.18.0; extra == "slack"
44
+ Provides-Extra: groq
45
+ Requires-Dist: groq>=0.4.0; extra == "groq"
46
+ Provides-Extra: all
47
+ Requires-Dist: python-telegram-bot>=20.7; extra == "all"
48
+ Requires-Dist: discord.py>=2.3.0; extra == "all"
49
+ Requires-Dist: slack-bolt>=1.18.0; extra == "all"
50
+ Requires-Dist: groq>=0.4.0; extra == "all"
51
+ Provides-Extra: dev
52
+ Requires-Dist: pytest>=7.0; extra == "dev"
53
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
54
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
55
+ Dynamic: license-file
56
+
57
+ <p align="center">
58
+ <h1 align="center">๐Ÿง  Cortex</h1>
59
+ <p align="center">
60
+ <strong>Your personal AI assistant gateway. Simple. Powerful. Local-first.</strong>
61
+ </p>
62
+ <p align="center">
63
+ <a href="#install">Install</a> ยท
64
+ <a href="#quick-start">Quick Start</a> ยท
65
+ <a href="#features">Features</a> ยท
66
+ <a href="#configuration">Configuration</a> ยท
67
+ <a href="#channels">Channels</a> ยท
68
+ <a href="#contributing">Contributing</a>
69
+ </p>
70
+ </p>
71
+
72
+ ---
73
+
74
+ Cortex is a personal AI assistant you run on your own machine. It comes with a beautiful web dashboard, connects to your messaging channels (Telegram, Discord, Slack), remembers your conversations, and tracks your tasks โ€” all in one `pip install`.
75
+
76
+ > **Why Cortex?**
77
+ > Existing open-source AI assistants are either too complex (24+ channels, 50+ config files, Docker/Tailscale required) or too simple (no memory, no dashboard, no channels). Cortex sits in the sweet spot: **powerful enough for real use, simple enough to set up in 60 seconds.**
78
+
79
+ ## Install
80
+
81
+ ```bash
82
+ pip install cortex-ai
83
+ ```
84
+
85
+ Or install from source:
86
+
87
+ ```bash
88
+ git clone https://github.com/chandanhastantram/cortex.git
89
+ cd cortex
90
+ pip install -e ".[all]"
91
+ ```
92
+
93
+ ## Quick Start
94
+
95
+ ```bash
96
+ # 1. Create config (optional โ€” works with env vars too)
97
+ cortex init
98
+
99
+ # 2. Set your API key
100
+ export OPENAI_API_KEY="sk-..."
101
+ # or: export ANTHROPIC_API_KEY="sk-ant-..."
102
+
103
+ # 3. Launch
104
+ cortex start
105
+ ```
106
+
107
+ Open **http://localhost:3100** โ€” that's it! ๐Ÿš€
108
+
109
+ ## Features
110
+
111
+ ### ๐ŸŽจ Beautiful Web Dashboard
112
+ Premium dark-mode chat UI with glassmorphism design, real-time streaming, conversation management, and markdown rendering.
113
+
114
+ ### ๐Ÿง  Conversation Memory (RAG)
115
+ Every conversation is persisted in SQLite. Cortex uses TF-IDF search to recall relevant past conversations when answering new questions โ€” your assistant actually **remembers**.
116
+
117
+ ### ๐Ÿค– Multi-Model Support
118
+ Use any major AI provider with automatic failover:
119
+
120
+ | Provider | Models | How to use |
121
+ |----------|--------|------------|
122
+ | **OpenAI** | GPT-4o, GPT-4o-mini, GPT-4.5 | `OPENAI_API_KEY` |
123
+ | **Anthropic** | Claude Opus, Sonnet, Haiku | `ANTHROPIC_API_KEY` |
124
+ | **Ollama** | Llama, Mistral, Phi (local) | Set provider to `ollama` |
125
+
126
+ ### ๐Ÿ“ฌ Messaging Channels
127
+ Connect Cortex to your existing chat platforms:
128
+
129
+ - **Telegram** โ€” `pip install cortex-ai[telegram]`
130
+ - **Discord** โ€” `pip install cortex-ai[discord]`
131
+ - **Slack** โ€” `pip install cortex-ai[slack]`
132
+ - **WebChat** โ€” Built-in, always available
133
+
134
+ ### โœ… Task Manager
135
+ Built-in task tracking with priorities, tags, and status tracking. Accessible from the dashboard sidebar and the REST API.
136
+
137
+ ### ๐Ÿ“Š Usage Analytics
138
+ Track token consumption, API costs, requests per model, and conversation statistics โ€” all in the dashboard.
139
+
140
+ ### ๐Ÿ”’ Security
141
+ - DM pairing policy (like OpenClaw) โ€” unknown senders must be approved
142
+ - Auth token support for remote access
143
+ - Local-first โ€” all data stays on your machine
144
+
145
+ ### ๐Ÿ” Memory Search
146
+
147
+ ```bash
148
+ # Search past conversations from CLI
149
+ cortex search "python async patterns"
150
+ ```
151
+
152
+ ### ๐Ÿฉบ Health Checks
153
+
154
+ ```bash
155
+ cortex doctor
156
+ ```
157
+
158
+ Validates your config, dependencies, API keys, and more.
159
+
160
+ ## Architecture
161
+
162
+ ```
163
+ Telegram / Discord / Slack / WebChat
164
+ โ”‚
165
+ โ–ผ
166
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
167
+ โ”‚ Gateway โ”‚
168
+ โ”‚ http://127.0.0.1:3100 โ”‚
169
+ โ”‚ โ”‚
170
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
171
+ โ”‚ โ”‚ Agent โ”‚ โ”‚ Memory โ”‚ โ”‚
172
+ โ”‚ โ”‚ Runtime โ”‚ โ”‚ (RAG) โ”‚ โ”‚
173
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”˜ โ”‚
174
+ โ”‚ โ”‚ โ”‚ โ”‚
175
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ” โ”‚
176
+ โ”‚ โ”‚ Models โ”‚ โ”‚ Tasks โ”‚ โ”‚
177
+ โ”‚ โ”‚ OpenAI โ”‚ โ”‚ SQLite โ”‚ โ”‚
178
+ โ”‚ โ”‚ Claude โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
179
+ โ”‚ โ”‚ Ollama โ”‚ โ”‚
180
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
181
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
182
+ ```
183
+
184
+ ## Configuration
185
+
186
+ Cortex uses YAML config with sensible defaults. Create one with:
187
+
188
+ ```bash
189
+ cortex init
190
+ ```
191
+
192
+ Minimal config (`~/.cortex/cortex.yaml`):
193
+
194
+ ```yaml
195
+ model:
196
+ provider: openai
197
+ model: gpt-4o
198
+
199
+ memory:
200
+ enabled: true
201
+
202
+ tasks:
203
+ enabled: true
204
+ ```
205
+
206
+ All settings can be overridden with environment variables:
207
+
208
+ | Env Variable | Config Path |
209
+ |-------------|-------------|
210
+ | `OPENAI_API_KEY` | `model.api_key` |
211
+ | `ANTHROPIC_API_KEY` | `model.api_key` |
212
+ | `CORTEX_PORT` | `gateway.port` |
213
+ | `TELEGRAM_BOT_TOKEN` | `channels.telegram.token` |
214
+ | `DISCORD_BOT_TOKEN` | `channels.discord.token` |
215
+
216
+ ## Channels
217
+
218
+ ### Telegram
219
+
220
+ ```yaml
221
+ channels:
222
+ telegram:
223
+ enabled: true
224
+ token: "123456:ABCDEF" # Or set TELEGRAM_BOT_TOKEN
225
+ dm_policy: pairing
226
+ ```
227
+
228
+ ### Discord
229
+
230
+ ```yaml
231
+ channels:
232
+ discord:
233
+ enabled: true
234
+ token: "your-bot-token" # Or set DISCORD_BOT_TOKEN
235
+ dm_policy: pairing
236
+ ```
237
+
238
+ ### WebChat
239
+
240
+ Always available at the gateway URL. No additional configuration needed.
241
+
242
+ ## CLI Reference
243
+
244
+ | Command | Description |
245
+ |---------|-------------|
246
+ | `cortex start` | Start the gateway server |
247
+ | `cortex init` | Create example config file |
248
+ | `cortex doctor` | Run health checks |
249
+ | `cortex search "query"` | Search conversation memory |
250
+ | `cortex stats` | Show memory/usage statistics |
251
+ | `cortex --version` | Show version |
252
+
253
+ ## API Reference
254
+
255
+ ### REST API
256
+
257
+ | Endpoint | Method | Description |
258
+ |----------|--------|-------------|
259
+ | `GET /api/health` | GET | Health check + stats |
260
+ | `POST /api/chat` | POST | Send a chat message |
261
+ | `GET /api/conversations` | GET | List conversations |
262
+ | `GET /api/conversations/:id/messages` | GET | Get messages |
263
+ | `DELETE /api/conversations/:id` | DELETE | Delete conversation |
264
+ | `GET /api/tasks` | GET | List tasks |
265
+ | `POST /api/tasks` | POST | Create task |
266
+ | `PATCH /api/tasks/:id` | PATCH | Update task |
267
+ | `DELETE /api/tasks/:id` | DELETE | Delete task |
268
+ | `GET /api/memory/search?q=` | GET | Search memory |
269
+ | `GET /api/usage` | GET | Usage statistics |
270
+
271
+ ### WebSocket
272
+
273
+ Connect to `ws://localhost:3100/ws/chat` for real-time streaming chat.
274
+
275
+ ```json
276
+ // Send
277
+ {"action": "chat", "message": "Hello!", "conversation_id": null}
278
+
279
+ // Receive (streaming)
280
+ {"type": "token", "content": "Hello", "conversation_id": "abc123"}
281
+ {"type": "token", "content": "!", "conversation_id": "abc123"}
282
+ {"type": "done", "content": "Hello!", "model": "openai/gpt-4o", "latency_ms": 342}
283
+ ```
284
+
285
+ ## Comparison with OpenClaw
286
+
287
+ | Feature | OpenClaw | Cortex |
288
+ |---------|----------|--------|
289
+ | **Install** | `npm install -g openclaw` + onboarding wizard | `pip install cortex-ai` |
290
+ | **Language** | TypeScript (monorepo) | Python (single package) |
291
+ | **Channels** | 24+ | 5 (focused, plugin-based) |
292
+ | **Memory/RAG** | โŒ Session-only | โœ… Persistent with RAG search |
293
+ | **Web Dashboard** | WebChat only | Full dashboard + analytics |
294
+ | **Task Manager** | โŒ | โœ… Built-in |
295
+ | **Usage Analytics** | โŒ | โœ… Token costs + model stats |
296
+ | **Config** | JSON5 (complex) | YAML (simple) |
297
+ | **Dependencies** | Node 24+, pnpm, Docker | Python 3.10+ |
298
+ | **Lines of Code** | ~100K+ | ~2K |
299
+
300
+ ## Roadmap
301
+
302
+ - [ ] Slack channel plugin
303
+ - [ ] WhatsApp (via Baileys bridge)
304
+ - [ ] Voice input/output (TTS/STT)
305
+ - [ ] Plugin/skill system
306
+ - [ ] Scheduled tasks (cron)
307
+ - [ ] Browser automation tool
308
+ - [ ] Mobile companion app
309
+ - [ ] OpenAPI spec generation
310
+
311
+ ## Contributing
312
+
313
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
314
+
315
+ AI/vibe-coded PRs welcome! ๐Ÿค–
316
+
317
+ ## License
318
+
319
+ [MIT](LICENSE) โ€” free for personal and commercial use.
320
+
321
+ ---
322
+
323
+ <p align="center">
324
+ Built with ๐Ÿง  by <a href="https://github.com/chandanhastantram">Chandan</a> and the community.
325
+ </p>
@@ -0,0 +1,269 @@
1
+ <p align="center">
2
+ <h1 align="center">๐Ÿง  Cortex</h1>
3
+ <p align="center">
4
+ <strong>Your personal AI assistant gateway. Simple. Powerful. Local-first.</strong>
5
+ </p>
6
+ <p align="center">
7
+ <a href="#install">Install</a> ยท
8
+ <a href="#quick-start">Quick Start</a> ยท
9
+ <a href="#features">Features</a> ยท
10
+ <a href="#configuration">Configuration</a> ยท
11
+ <a href="#channels">Channels</a> ยท
12
+ <a href="#contributing">Contributing</a>
13
+ </p>
14
+ </p>
15
+
16
+ ---
17
+
18
+ Cortex is a personal AI assistant you run on your own machine. It comes with a beautiful web dashboard, connects to your messaging channels (Telegram, Discord, Slack), remembers your conversations, and tracks your tasks โ€” all in one `pip install`.
19
+
20
+ > **Why Cortex?**
21
+ > Existing open-source AI assistants are either too complex (24+ channels, 50+ config files, Docker/Tailscale required) or too simple (no memory, no dashboard, no channels). Cortex sits in the sweet spot: **powerful enough for real use, simple enough to set up in 60 seconds.**
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ pip install cortex-ai
27
+ ```
28
+
29
+ Or install from source:
30
+
31
+ ```bash
32
+ git clone https://github.com/chandanhastantram/cortex.git
33
+ cd cortex
34
+ pip install -e ".[all]"
35
+ ```
36
+
37
+ ## Quick Start
38
+
39
+ ```bash
40
+ # 1. Create config (optional โ€” works with env vars too)
41
+ cortex init
42
+
43
+ # 2. Set your API key
44
+ export OPENAI_API_KEY="sk-..."
45
+ # or: export ANTHROPIC_API_KEY="sk-ant-..."
46
+
47
+ # 3. Launch
48
+ cortex start
49
+ ```
50
+
51
+ Open **http://localhost:3100** โ€” that's it! ๐Ÿš€
52
+
53
+ ## Features
54
+
55
+ ### ๐ŸŽจ Beautiful Web Dashboard
56
+ Premium dark-mode chat UI with glassmorphism design, real-time streaming, conversation management, and markdown rendering.
57
+
58
+ ### ๐Ÿง  Conversation Memory (RAG)
59
+ Every conversation is persisted in SQLite. Cortex uses TF-IDF search to recall relevant past conversations when answering new questions โ€” your assistant actually **remembers**.
60
+
61
+ ### ๐Ÿค– Multi-Model Support
62
+ Use any major AI provider with automatic failover:
63
+
64
+ | Provider | Models | How to use |
65
+ |----------|--------|------------|
66
+ | **OpenAI** | GPT-4o, GPT-4o-mini, GPT-4.5 | `OPENAI_API_KEY` |
67
+ | **Anthropic** | Claude Opus, Sonnet, Haiku | `ANTHROPIC_API_KEY` |
68
+ | **Ollama** | Llama, Mistral, Phi (local) | Set provider to `ollama` |
69
+
70
+ ### ๐Ÿ“ฌ Messaging Channels
71
+ Connect Cortex to your existing chat platforms:
72
+
73
+ - **Telegram** โ€” `pip install cortex-ai[telegram]`
74
+ - **Discord** โ€” `pip install cortex-ai[discord]`
75
+ - **Slack** โ€” `pip install cortex-ai[slack]`
76
+ - **WebChat** โ€” Built-in, always available
77
+
78
+ ### โœ… Task Manager
79
+ Built-in task tracking with priorities, tags, and status tracking. Accessible from the dashboard sidebar and the REST API.
80
+
81
+ ### ๐Ÿ“Š Usage Analytics
82
+ Track token consumption, API costs, requests per model, and conversation statistics โ€” all in the dashboard.
83
+
84
+ ### ๐Ÿ”’ Security
85
+ - DM pairing policy (like OpenClaw) โ€” unknown senders must be approved
86
+ - Auth token support for remote access
87
+ - Local-first โ€” all data stays on your machine
88
+
89
+ ### ๐Ÿ” Memory Search
90
+
91
+ ```bash
92
+ # Search past conversations from CLI
93
+ cortex search "python async patterns"
94
+ ```
95
+
96
+ ### ๐Ÿฉบ Health Checks
97
+
98
+ ```bash
99
+ cortex doctor
100
+ ```
101
+
102
+ Validates your config, dependencies, API keys, and more.
103
+
104
+ ## Architecture
105
+
106
+ ```
107
+ Telegram / Discord / Slack / WebChat
108
+ โ”‚
109
+ โ–ผ
110
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
111
+ โ”‚ Gateway โ”‚
112
+ โ”‚ http://127.0.0.1:3100 โ”‚
113
+ โ”‚ โ”‚
114
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
115
+ โ”‚ โ”‚ Agent โ”‚ โ”‚ Memory โ”‚ โ”‚
116
+ โ”‚ โ”‚ Runtime โ”‚ โ”‚ (RAG) โ”‚ โ”‚
117
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”˜ โ”‚
118
+ โ”‚ โ”‚ โ”‚ โ”‚
119
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ” โ”‚
120
+ โ”‚ โ”‚ Models โ”‚ โ”‚ Tasks โ”‚ โ”‚
121
+ โ”‚ โ”‚ OpenAI โ”‚ โ”‚ SQLite โ”‚ โ”‚
122
+ โ”‚ โ”‚ Claude โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
123
+ โ”‚ โ”‚ Ollama โ”‚ โ”‚
124
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
125
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
126
+ ```
127
+
128
+ ## Configuration
129
+
130
+ Cortex uses YAML config with sensible defaults. Create one with:
131
+
132
+ ```bash
133
+ cortex init
134
+ ```
135
+
136
+ Minimal config (`~/.cortex/cortex.yaml`):
137
+
138
+ ```yaml
139
+ model:
140
+ provider: openai
141
+ model: gpt-4o
142
+
143
+ memory:
144
+ enabled: true
145
+
146
+ tasks:
147
+ enabled: true
148
+ ```
149
+
150
+ All settings can be overridden with environment variables:
151
+
152
+ | Env Variable | Config Path |
153
+ |-------------|-------------|
154
+ | `OPENAI_API_KEY` | `model.api_key` |
155
+ | `ANTHROPIC_API_KEY` | `model.api_key` |
156
+ | `CORTEX_PORT` | `gateway.port` |
157
+ | `TELEGRAM_BOT_TOKEN` | `channels.telegram.token` |
158
+ | `DISCORD_BOT_TOKEN` | `channels.discord.token` |
159
+
160
+ ## Channels
161
+
162
+ ### Telegram
163
+
164
+ ```yaml
165
+ channels:
166
+ telegram:
167
+ enabled: true
168
+ token: "123456:ABCDEF" # Or set TELEGRAM_BOT_TOKEN
169
+ dm_policy: pairing
170
+ ```
171
+
172
+ ### Discord
173
+
174
+ ```yaml
175
+ channels:
176
+ discord:
177
+ enabled: true
178
+ token: "your-bot-token" # Or set DISCORD_BOT_TOKEN
179
+ dm_policy: pairing
180
+ ```
181
+
182
+ ### WebChat
183
+
184
+ Always available at the gateway URL. No additional configuration needed.
185
+
186
+ ## CLI Reference
187
+
188
+ | Command | Description |
189
+ |---------|-------------|
190
+ | `cortex start` | Start the gateway server |
191
+ | `cortex init` | Create example config file |
192
+ | `cortex doctor` | Run health checks |
193
+ | `cortex search "query"` | Search conversation memory |
194
+ | `cortex stats` | Show memory/usage statistics |
195
+ | `cortex --version` | Show version |
196
+
197
+ ## API Reference
198
+
199
+ ### REST API
200
+
201
+ | Endpoint | Method | Description |
202
+ |----------|--------|-------------|
203
+ | `GET /api/health` | GET | Health check + stats |
204
+ | `POST /api/chat` | POST | Send a chat message |
205
+ | `GET /api/conversations` | GET | List conversations |
206
+ | `GET /api/conversations/:id/messages` | GET | Get messages |
207
+ | `DELETE /api/conversations/:id` | DELETE | Delete conversation |
208
+ | `GET /api/tasks` | GET | List tasks |
209
+ | `POST /api/tasks` | POST | Create task |
210
+ | `PATCH /api/tasks/:id` | PATCH | Update task |
211
+ | `DELETE /api/tasks/:id` | DELETE | Delete task |
212
+ | `GET /api/memory/search?q=` | GET | Search memory |
213
+ | `GET /api/usage` | GET | Usage statistics |
214
+
215
+ ### WebSocket
216
+
217
+ Connect to `ws://localhost:3100/ws/chat` for real-time streaming chat.
218
+
219
+ ```json
220
+ // Send
221
+ {"action": "chat", "message": "Hello!", "conversation_id": null}
222
+
223
+ // Receive (streaming)
224
+ {"type": "token", "content": "Hello", "conversation_id": "abc123"}
225
+ {"type": "token", "content": "!", "conversation_id": "abc123"}
226
+ {"type": "done", "content": "Hello!", "model": "openai/gpt-4o", "latency_ms": 342}
227
+ ```
228
+
229
+ ## Comparison with OpenClaw
230
+
231
+ | Feature | OpenClaw | Cortex |
232
+ |---------|----------|--------|
233
+ | **Install** | `npm install -g openclaw` + onboarding wizard | `pip install cortex-ai` |
234
+ | **Language** | TypeScript (monorepo) | Python (single package) |
235
+ | **Channels** | 24+ | 5 (focused, plugin-based) |
236
+ | **Memory/RAG** | โŒ Session-only | โœ… Persistent with RAG search |
237
+ | **Web Dashboard** | WebChat only | Full dashboard + analytics |
238
+ | **Task Manager** | โŒ | โœ… Built-in |
239
+ | **Usage Analytics** | โŒ | โœ… Token costs + model stats |
240
+ | **Config** | JSON5 (complex) | YAML (simple) |
241
+ | **Dependencies** | Node 24+, pnpm, Docker | Python 3.10+ |
242
+ | **Lines of Code** | ~100K+ | ~2K |
243
+
244
+ ## Roadmap
245
+
246
+ - [ ] Slack channel plugin
247
+ - [ ] WhatsApp (via Baileys bridge)
248
+ - [ ] Voice input/output (TTS/STT)
249
+ - [ ] Plugin/skill system
250
+ - [ ] Scheduled tasks (cron)
251
+ - [ ] Browser automation tool
252
+ - [ ] Mobile companion app
253
+ - [ ] OpenAPI spec generation
254
+
255
+ ## Contributing
256
+
257
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
258
+
259
+ AI/vibe-coded PRs welcome! ๐Ÿค–
260
+
261
+ ## License
262
+
263
+ [MIT](LICENSE) โ€” free for personal and commercial use.
264
+
265
+ ---
266
+
267
+ <p align="center">
268
+ Built with ๐Ÿง  by <a href="https://github.com/chandanhastantram">Chandan</a> and the community.
269
+ </p>