morpheus-cli 0.2.0 → 0.2.3

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 (34) hide show
  1. package/README.md +346 -273
  2. package/dist/cli/commands/doctor.js +36 -1
  3. package/dist/cli/commands/init.js +92 -0
  4. package/dist/cli/commands/start.js +2 -1
  5. package/dist/cli/index.js +1 -17
  6. package/dist/cli/utils/render.js +2 -1
  7. package/dist/cli/utils/version.js +16 -0
  8. package/dist/config/manager.js +16 -0
  9. package/dist/config/schemas.js +15 -8
  10. package/dist/http/api.js +111 -0
  11. package/dist/runtime/__tests__/manual_santi_verify.js +55 -0
  12. package/dist/runtime/display.js +3 -0
  13. package/dist/runtime/memory/sati/__tests__/repository.test.js +71 -0
  14. package/dist/runtime/memory/sati/__tests__/service.test.js +99 -0
  15. package/dist/runtime/memory/sati/index.js +58 -0
  16. package/dist/runtime/memory/sati/repository.js +226 -0
  17. package/dist/runtime/memory/sati/service.js +142 -0
  18. package/dist/runtime/memory/sati/system-prompts.js +42 -0
  19. package/dist/runtime/memory/sati/types.js +1 -0
  20. package/dist/runtime/memory/sqlite.js +5 -1
  21. package/dist/runtime/migration.js +53 -1
  22. package/dist/runtime/oracle.js +32 -7
  23. package/dist/runtime/santi/contracts.js +1 -0
  24. package/dist/runtime/santi/middleware.js +61 -0
  25. package/dist/runtime/santi/santi.js +109 -0
  26. package/dist/runtime/santi/store.js +158 -0
  27. package/dist/runtime/tools/factory.js +31 -25
  28. package/dist/types/config.js +1 -0
  29. package/dist/ui/assets/index-BLLLlr0w.css +1 -0
  30. package/dist/ui/assets/index-Ccml5qIL.js +50 -0
  31. package/dist/ui/index.html +2 -2
  32. package/package.json +2 -2
  33. package/dist/ui/assets/index-AEbYNHuy.css +0 -1
  34. package/dist/ui/assets/index-BjnI8c1U.js +0 -50
package/README.md CHANGED
@@ -1,273 +1,346 @@
1
- <div align="center">
2
- <img src="./assets/logo.png" alt="Morpheus Logo" width="220" />
3
- </div>
4
-
5
- # Morpheus
6
-
7
- > **Morpheus is a local-first AI operator that bridges developers and machines.**
8
-
9
- Morpheus is a local AI agent for developers, running as a CLI daemon that connects to **LLMs**, **local tools**, and **MCPs**, enabling interaction via **Terminal, Telegram, and Discord**. Inspired by the character Morpheus from *The Matrix*, the project acts as an **intelligent orchestrator**, bridging the gap between the developer and complex systems.
10
-
11
- ## Installation
12
-
13
- Install Morpheus globally via npm:
14
-
15
- ```bash
16
- npm install -g morpheus-cli
17
- ```
18
-
19
- ## Quick Start
20
-
21
- ### 1. Initialize
22
-
23
- Set up your configuration (API keys, preferences):
24
-
25
- ```bash
26
- morpheus init
27
- ```
28
-
29
- ### 2. Start the Agent
30
-
31
- Run the background daemon and Web UI:
32
-
33
- ```bash
34
- morpheus start
35
- ```
36
-
37
- This will:
38
- - Start the agent process
39
- - Launch the Web UI at http://localhost:3333
40
-
41
- ### Other Commands
42
-
43
- ```bash
44
- # Check if Morpheus is running
45
- morpheus status
46
-
47
- # Stop the agent
48
- morpheus stop
49
-
50
- # Diagnose issues
51
- morpheus doctor
52
- ```
53
-
54
- ## Troubleshooting
55
-
56
- ### Command not found
57
-
58
- If you installed successfully but can't run the `morpheus` command:
59
-
60
- 1. **Check your PATH**: Ensure your global npm bin directory is in your system PATH.
61
- - Run `npm bin -g` to see the folder.
62
- - On Windows, this is usually `%APPDATA%\npm`.
63
- - On Linux/Mac, verify `echo $PATH`.
64
- 2. **Restart Terminal**: New installations might not be visible until you restart your shell.
65
-
66
- ## Using NPX
67
- You can run Morpheus without installing it globally using `npx`:
68
-
69
- ```bash
70
-
71
- npx morpheus-cli init
72
-
73
- npx morpheus-cli start
74
-
75
- ```
76
-
77
- ## Technical Overview
78
-
79
- Morpheus is built with **Node.js** and **TypeScript**, using **LangChain** as the orchestration engine. It runs as a background daemon process, managing connections to LLM providers (OpenAI, Anthropic, Ollama) and external channels (Telegram, Discord).
80
-
81
- ### Core Components
82
-
83
- - **Runtime (`src/runtime/`)**: The heart of the application. Manages the Oracle (agent) lifecycle, provider instantiation, and command execution.
84
- - **CLI (`src/cli/`)**: Built with `commander`, handles user interaction, configuration, and daemon control (`start`, `stop`, `status`).
85
- - **Configuration (`src/config/`)**: Singleton-based configuration manager using `zod` for validation and `js-yaml` for persistence (`~/.morpheus/zaion.yaml`).
86
- - **Channels (`src/channels/`)**: Adapters for external communication. Currently supports Telegram (`telegraf`) with strict user whitelisting.
87
-
88
- ## Features
89
-
90
- ### 🖥️ Web Dashboard
91
- Local React-based UI to manage recordings, chat history, and system status across your agent instances.
92
-
93
- #### 🔒 UI Authentication
94
- To protect your Web UI, use the `THE_ARCHITECT_PASS` environment variable. This ensures only authorized users can access the dashboard and API.
95
-
96
- **Option 1: Using a `.env` file**
97
- Create a `.env` file in the root of your project:
98
-
99
- ```env
100
- THE_ARCHITECT_PASS="your-secure-password"
101
- ```
102
-
103
- **Option 2: Using Shell export**
104
-
105
- ```bash
106
- export THE_ARCHITECT_PASS="your-secure-password"
107
- morpheus start
108
- ```
109
-
110
- When enabled:
111
- - The Web UI will redirect to a Login page.
112
- - API requests require the `x-architect-pass` header.
113
- - The session is persisted locally in your browser.
114
-
115
- ### 🧩 MCP Support (Model Context Protocol)
116
- Full integration with [Model Context Protocol](https://modelcontextprotocol.io/), allowing Morpheus to use standardized tools from any MCP-compatible server.
117
-
118
- ### 📊 Usage Analytics
119
- Track your token usage across different providers and models directly from the Web UI. View detailed breakdowns of input/output tokens and message counts to monitor costs and activity.
120
-
121
- ### 🎙️ Audio Transcription (Telegram)
122
- Send voice messages directly to the Telegram bot. Morpheus will:
123
- 1. Transcribe the audio using **Google Gemini**.
124
- 2. Process the text as a standard prompt.
125
- 3. Reply with the answer.
126
-
127
- *Requires a Google Gemini API Key.*
128
-
129
- ## Development Setup
130
-
131
- This guide is for developers contributing to the Morpheus codebase.
132
-
133
- ### Prerequisites
134
-
135
- - **Node.js**: >= 18.x
136
- - **npm**: >= 9.x
137
- - **TypeScript**: >= 5.x
138
-
139
- ### 1. Clone & Install
140
-
141
- ```bash
142
- git clone https://github.com/your-org/morpheus.git
143
- cd morpheus
144
- npm install
145
- ```
146
-
147
- ### 2. Build
148
-
149
- Compile TypeScript source to `dist/` and build the Web UI.
150
-
151
- ```bash
152
- npm run build
153
- ```
154
-
155
- ### 3. Run the CLI
156
-
157
- You can run the CLI directly from the source using `npm start`.
158
-
159
- ```bash
160
- # Initialize configuration (creates ~/.morpheus)
161
- npm start -- init
162
-
163
- # Start the daemon
164
- npm start -- start
165
-
166
- # Check status
167
- npm start -- status
168
- ```
169
-
170
- ### 4. Configuration
171
-
172
- The configuration file is located at `~/.morpheus/zaion.yaml`. You can edit it manually or use the `morpheus config` command.
173
-
174
- ```yaml
175
- agent:
176
- name: "Morpheus"
177
- personality: "stoic, wise, and helpful"
178
- llm:
179
- provider: "openai" # options: openai, anthropic, ollama, gemini
180
- model: "gpt-4-turbo"
181
- temperature: 0.7
182
- api_key: "sk-..."
183
- memory:
184
- limit: 100 # Number of messages to retain in context
185
- channels:
186
- telegram:
187
- enabled: true
188
- token: "YOUR_TELEGRAM_BOT_TOKEN"
189
- allowedUsers: ["123456789"] # Your Telegram User ID
190
- discord:
191
- enabled: false # Coming soon
192
-
193
- # Web UI Dashboard
194
- ui:
195
- enabled: true
196
- port: 3333
197
-
198
- # Audio Transcription Support
199
- audio:
200
- enabled: true
201
- apiKey: "YOUR_GEMINI_API_KEY" # Optional if llm.provider is 'gemini'
202
- maxDurationSeconds: 300
203
- ```
204
-
205
- ### 5. MCP Configuration
206
-
207
- Morpheus supports external tools via **MCP (Model Context Protocol)**. Configure your MCP servers in `~/.morpheus/mcps.json`:
208
-
209
- ```json
210
- {
211
- "coolify": {
212
- "transport": "stdio",
213
- "command": "npx",
214
- "args": ["-y", "@coolify/mcp-server"],
215
- "env": {
216
- "COOLIFY_URL": "https://app.coolify.io",
217
- "COOLIFY_TOKEN": "your-token"
218
- }
219
- },
220
- "coingecko": {
221
- "transport": "http",
222
- "url": "https://mcps.mnunes.xyz/coingecko/mcp"
223
- }
224
- }
225
- ```
226
-
227
- ## Testing
228
-
229
- We use **Vitest** for testing.
230
-
231
- ```bash
232
- # Run unit tests
233
- npm test
234
-
235
- # Run tests in watch mode
236
- npm run test:watch
237
- ```
238
-
239
- ## Project Structure
240
-
241
- ```text
242
- .
243
- ├── assets/ # Static assets
244
- ├── bin/ # CLI entry point (morpheus.js)
245
- ├── specs/ # Technical specifications & documentation
246
- ├── src/
247
- ├── channels/ # Communication adapters (Telegram, etc.)
248
- │ ├── cli/ # CLI commands and logic
249
- │ ├── config/ # Configuration management
250
- │ ├── runtime/ # Core agent logic, lifecycle, and providers
251
- │ ├── types/ # Shared TypeScript definitions
252
- │ └── ui/ # React Web UI Dashboard
253
- └── package.json
254
- ```
255
-
256
- ## Roadmap
257
-
258
- - [x] **Web Dashboard**: Local UI for management and logs.
259
- - [x] **MCP Support**: Full integration with Model Context Protocol.
260
- - [ ] **Discord Adapter**: Support for Discord interactions.
261
- - [ ] **Plugin System**: Extend functionality via external modules.
262
-
263
- ## Contributing
264
-
265
- 1. Fork the repository.
266
- 2. Create a feature branch (`git checkout -b feature/amazing-feature`).
267
- 3. Commit your changes (`git commit -m 'feat: Add amazing feature'`).
268
- 4. Push to the branch (`git push origin feature/amazing-feature`).
269
- 5. Open a Pull Request.
270
-
271
- ## License
272
-
273
- MIT
1
+ <div align="center">
2
+ <img src="./assets/logo.png" alt="Morpheus Logo" width="220" />
3
+ </div>
4
+
5
+ # Morpheus
6
+
7
+ > **Morpheus is a local-first AI operator that bridges developers and machines.**
8
+
9
+ Morpheus is a local AI agent for developers, running as a CLI daemon that connects to **LLMs**, **local tools**, and **MCPs**, enabling interaction via **Terminal, Telegram, and Discord**. Inspired by the character Morpheus from *The Matrix*, the project acts as an **intelligent orchestrator**, bridging the gap between the developer and complex systems.
10
+
11
+ ## Installation
12
+
13
+ Install Morpheus globally via npm:
14
+
15
+ ```bash
16
+ npm install -g morpheus-cli
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ### 1. Initialize
22
+
23
+ Set up your configuration (API keys, preferences):
24
+
25
+ ```bash
26
+ morpheus init
27
+ ```
28
+
29
+ ### 2. Start the Agent
30
+
31
+ Run the background daemon and Web UI:
32
+
33
+ ```bash
34
+ morpheus start
35
+ ```
36
+
37
+ This will:
38
+ - Start the agent process
39
+ - Launch the Web UI at http://localhost:3333
40
+
41
+ ### Other Commands
42
+
43
+ ```bash
44
+ # Check if Morpheus is running
45
+ morpheus status
46
+
47
+ # Stop the agent
48
+ morpheus stop
49
+
50
+ # Diagnose issues
51
+ morpheus doctor
52
+ ```
53
+
54
+ ## Troubleshooting
55
+
56
+ ### Command not found
57
+
58
+ If you installed successfully but can't run the `morpheus` command:
59
+
60
+ 1. **Check your PATH**: Ensure your global npm bin directory is in your system PATH.
61
+ - Run `npm bin -g` to see the folder.
62
+ - On Windows, this is usually `%APPDATA%\npm`.
63
+ - On Linux/Mac, verify `echo $PATH`.
64
+ 2. **Restart Terminal**: New installations might not be visible until you restart your shell.
65
+
66
+ ## Using NPX
67
+ You can run Morpheus without installing it globally using `npx`:
68
+
69
+ ```bash
70
+
71
+ npx morpheus-cli init
72
+
73
+ npx morpheus-cli start
74
+
75
+ ```
76
+
77
+ ## Technical Overview
78
+
79
+ Morpheus is built with **Node.js** and **TypeScript**, using **LangChain** as the orchestration engine. It runs as a background daemon process, managing connections to LLM providers (OpenAI, Anthropic, Ollama) and external channels (Telegram, Discord).
80
+
81
+ ### Core Components
82
+
83
+ - **Runtime (`src/runtime/`)**: The heart of the application. Manages the Oracle (agent) lifecycle, provider instantiation, and command execution.
84
+ - **CLI (`src/cli/`)**: Built with `commander`, handles user interaction, configuration, and daemon control (`start`, `stop`, `status`).
85
+ - **Configuration (`src/config/`)**: Singleton-based configuration manager using `zod` for validation and `js-yaml` for persistence (`~/.morpheus/zaion.yaml`).
86
+ - **Channels (`src/channels/`)**: Adapters for external communication. Currently supports Telegram (`telegraf`) with strict user whitelisting.
87
+
88
+ ## Features
89
+
90
+ ### 🖥️ Web Dashboard
91
+ Local React-based UI to manage recordings, chat history, and system status across your agent instances.
92
+
93
+ #### 🔒 UI Authentication
94
+ To protect your Web UI, use the `THE_ARCHITECT_PASS` environment variable. This ensures only authorized users can access the dashboard and API.
95
+
96
+ **Option 1: Using a `.env` file**
97
+ Create a `.env` file in the root of your project:
98
+
99
+ ```env
100
+ THE_ARCHITECT_PASS="your-secure-password"
101
+ ```
102
+
103
+ **Option 2: Using Shell export**
104
+
105
+ ```bash
106
+ export THE_ARCHITECT_PASS="your-secure-password"
107
+ morpheus start
108
+ ```
109
+
110
+ When enabled:
111
+ - The Web UI will redirect to a Login page.
112
+ - API requests require the `x-architect-pass` header.
113
+ - The session is persisted locally in your browser.
114
+
115
+ ### 🧩 MCP Support (Model Context Protocol)
116
+ Full integration with [Model Context Protocol](https://modelcontextprotocol.io/), allowing Morpheus to use standardized tools from any MCP-compatible server.
117
+
118
+ ### 🧠 Sati (Long-Term Memory)
119
+ Morpheus features a dedicated middleware system called **Sati** (Mindfulness) that provides long-term memory capabilities.
120
+ - **Automated Storage**: Automatically extracts and saves preferences, project details, and facts from conversations.
121
+ - **Contextual Retrieval**: Injects relevant memories into the context based on your current query.
122
+ - **Data Privacy**: Stored in a local, independent SQLite database (`santi-memory.db`), ensuring sensitive data is handled securely and reducing context window usage.
123
+ - **Memory Management**: View and manage your long-term memories through the Web UI or via API endpoints.
124
+
125
+ ### 📊 Usage Analytics
126
+ Track your token usage across different providers and models directly from the Web UI. View detailed breakdowns of input/output tokens and message counts to monitor costs and activity.
127
+
128
+ ### 🎙️ Audio Transcription (Telegram)
129
+ Send voice messages directly to the Telegram bot. Morpheus will:
130
+ 1. Transcribe the audio using **Google Gemini**.
131
+ 2. Process the text as a standard prompt.
132
+ 3. Reply with the answer.
133
+
134
+ *Requires a Google Gemini API Key.*
135
+
136
+ ## Development Setup
137
+
138
+ This guide is for developers contributing to the Morpheus codebase.
139
+
140
+ ### Prerequisites
141
+
142
+ - **Node.js**: >= 18.x
143
+ - **npm**: >= 9.x
144
+ - **TypeScript**: >= 5.x
145
+
146
+ ### 1. Clone & Install
147
+
148
+ ```bash
149
+ git clone https://github.com/your-org/morpheus.git
150
+ cd morpheus
151
+ npm install
152
+ ```
153
+
154
+ ### 2. Build
155
+
156
+ Compile TypeScript source to `dist/` and build the Web UI.
157
+
158
+ ```bash
159
+ npm run build
160
+ ```
161
+
162
+ ### 3. Run the CLI
163
+
164
+ You can run the CLI directly from the source using `npm start`.
165
+
166
+ ```bash
167
+ # Initialize configuration (creates ~/.morpheus)
168
+ npm start -- init
169
+
170
+ # Start the daemon
171
+ npm start -- start
172
+
173
+ # Check status
174
+ npm start -- status
175
+ ```
176
+
177
+ ### 4. Configuration
178
+
179
+ The configuration file is located at `~/.morpheus/zaion.yaml`. You can edit it manually or use the `morpheus config` command.
180
+
181
+ ```yaml
182
+ agent:
183
+ name: "Morpheus"
184
+ personality: "stoic, wise, and helpful"
185
+ llm:
186
+ provider: "openai" # options: openai, anthropic, ollama, gemini
187
+ model: "gpt-4-turbo"
188
+ temperature: 0.7
189
+ context_window: 100 # Number of messages to load into LLM context
190
+ api_key: "sk-..."
191
+ santi: # Optional: Sati (Long-Term Memory) specific settings
192
+ provider: "openai" # defaults to llm.provider
193
+ model: "gpt-4o"
194
+ memory_limit: 1000 # Number of messages/items to retrieve
195
+ channels:
196
+ telegram:
197
+ enabled: true
198
+ token: "YOUR_TELEGRAM_BOT_TOKEN"
199
+ allowedUsers: ["123456789"] # Your Telegram User ID
200
+ discord:
201
+ enabled: false # Coming soon
202
+
203
+ # Web UI Dashboard
204
+ ui:
205
+ enabled: true
206
+ port: 3333
207
+
208
+ # Audio Transcription Support
209
+ audio:
210
+ enabled: true
211
+ apiKey: "YOUR_GEMINI_API_KEY" # Optional if llm.provider is 'gemini'
212
+ maxDurationSeconds: 300
213
+ ```
214
+
215
+ ### 5. MCP Configuration
216
+
217
+ Morpheus supports external tools via **MCP (Model Context Protocol)**. Configure your MCP servers in `~/.morpheus/mcps.json`:
218
+
219
+ ```json
220
+ {
221
+ "coolify": {
222
+ "transport": "stdio",
223
+ "command": "npx",
224
+ "args": ["-y", "@coolify/mcp-server"],
225
+ "env": {
226
+ "COOLIFY_URL": "https://app.coolify.io",
227
+ "COOLIFY_TOKEN": "your-token"
228
+ }
229
+ },
230
+ "coingecko": {
231
+ "transport": "http",
232
+ "url": "https://mcps.mnunes.xyz/coingecko/mcp"
233
+ }
234
+ }
235
+ ```
236
+
237
+ ## API Endpoints
238
+
239
+ Morpheus exposes several API endpoints for programmatic access to its features:
240
+
241
+ ### Sati Memories Endpoints
242
+
243
+ #### GET `/api/sati/memories`
244
+ Retrieve all memories stored by the Sati agent (long-term memory).
245
+
246
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
247
+ * **Response:**
248
+ ```json
249
+ [
250
+ {
251
+ "id": "unique-id",
252
+ "category": "work",
253
+ "importance": "high",
254
+ "summary": "Memory summary",
255
+ "details": "Additional details of the memory",
256
+ "hash": "unique-hash",
257
+ "source": "source",
258
+ "created_at": "2023-01-01T00:00:00.000Z",
259
+ "updated_at": "2023-01-01T00:00:00.000Z",
260
+ "last_accessed_at": "2023-01-01T00:00:00.000Z",
261
+ "access_count": 5,
262
+ "version": 1,
263
+ "archived": false
264
+ }
265
+ ]
266
+ ```
267
+
268
+ #### DELETE `/api/sati/memories/:id`
269
+ Archive (soft delete) a specific memory from the Sati agent.
270
+
271
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
272
+ * **Parameters:** `id` - ID of the memory to archive.
273
+ * **Response:**
274
+ ```json
275
+ {
276
+ "success": true,
277
+ "message": "Memory archived successfully"
278
+ }
279
+ ```
280
+
281
+ #### POST `/api/sati/memories/bulk-delete`
282
+ Archive (soft delete) multiple memories from the Sati agent at once.
283
+
284
+ * **Authentication:** Requires `Authorization` header with the password set in `THE_ARCHITECT_PASS`.
285
+ * **Body:**
286
+ ```json
287
+ {
288
+ "ids": ["id1", "id2", "id3"]
289
+ }
290
+ ```
291
+ * **Response:**
292
+ ```json
293
+ {
294
+ "success": true,
295
+ "message": "X memories archived successfully",
296
+ "deletedCount": X
297
+ }
298
+ ```
299
+
300
+ ## Testing
301
+
302
+ We use **Vitest** for testing.
303
+
304
+ ```bash
305
+ # Run unit tests
306
+ npm test
307
+
308
+ # Run tests in watch mode
309
+ npm run test:watch
310
+ ```
311
+
312
+ ## Project Structure
313
+
314
+ ```text
315
+ .
316
+ ├── assets/ # Static assets
317
+ ├── bin/ # CLI entry point (morpheus.js)
318
+ ├── specs/ # Technical specifications & documentation
319
+ ├── src/
320
+ │ ├── channels/ # Communication adapters (Telegram, etc.)
321
+ │ ├── cli/ # CLI commands and logic
322
+ │ ├── config/ # Configuration management
323
+ │ ├── runtime/ # Core agent logic, lifecycle, and providers
324
+ │ ├── types/ # Shared TypeScript definitions
325
+ │ └── ui/ # React Web UI Dashboard
326
+ └── package.json
327
+ ```
328
+
329
+ ## Roadmap
330
+
331
+ - [x] **Web Dashboard**: Local UI for management and logs.
332
+ - [x] **MCP Support**: Full integration with Model Context Protocol.
333
+ - [ ] **Discord Adapter**: Support for Discord interactions.
334
+ - [ ] **Plugin System**: Extend functionality via external modules.
335
+
336
+ ## Contributing
337
+
338
+ 1. Fork the repository.
339
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`).
340
+ 3. Commit your changes (`git commit -m 'feat: Add amazing feature'`).
341
+ 4. Push to the branch (`git push origin feature/amazing-feature`).
342
+ 5. Open a Pull Request.
343
+
344
+ ## License
345
+
346
+ MIT
@@ -23,8 +23,30 @@ export const doctorCommand = new Command('doctor')
23
23
  // 2. Check Configuration
24
24
  try {
25
25
  if (await fs.pathExists(PATHS.config)) {
26
- await ConfigManager.getInstance().load();
26
+ const config = await ConfigManager.getInstance().load();
27
27
  console.log(chalk.green('✓') + ' Configuration: Valid');
28
+ // Check context window configuration
29
+ const contextWindow = config.llm?.context_window;
30
+ const deprecatedLimit = config.memory?.limit;
31
+ if (contextWindow !== undefined) {
32
+ if (typeof contextWindow === 'number' && contextWindow > 0) {
33
+ console.log(chalk.green('✓') + ` LLM context window: ${contextWindow} messages`);
34
+ }
35
+ else {
36
+ console.log(chalk.red('✗') + ` LLM context window has invalid value, using default: 100 messages`);
37
+ allPassed = false;
38
+ }
39
+ }
40
+ else {
41
+ console.log(chalk.yellow('⚠') + ' LLM context window not configured, using default: 100 messages');
42
+ }
43
+ // Check for deprecated field
44
+ if (deprecatedLimit !== undefined && contextWindow === undefined) {
45
+ console.log(chalk.yellow('⚠') + ' Deprecated config detected: \'memory.limit\' should be migrated to \'llm.context_window\'. Will auto-migrate on next start.');
46
+ }
47
+ else if (deprecatedLimit !== undefined && contextWindow !== undefined) {
48
+ console.log(chalk.yellow('⚠') + ' Found both \'memory.limit\' and \'llm.context_window\'. Remove \'memory.limit\' from config.');
49
+ }
28
50
  }
29
51
  else {
30
52
  console.log(chalk.yellow('!') + ' Configuration: Missing (will be created on start)');
@@ -58,6 +80,19 @@ export const doctorCommand = new Command('doctor')
58
80
  console.log(chalk.red('✗') + ` Logs: Cannot write to ${PATHS.logs}`);
59
81
  allPassed = false;
60
82
  }
83
+ // 5. Check Sati Memory DB
84
+ try {
85
+ const satiDbPath = path.join(PATHS.memory, 'santi-memory.db');
86
+ if (await fs.pathExists(satiDbPath)) {
87
+ console.log(chalk.green('✓') + ' Sati Memory: Database exists');
88
+ }
89
+ else {
90
+ console.log(chalk.yellow('!') + ' Sati Memory: Database not initialized (will be created on start)');
91
+ }
92
+ }
93
+ catch (error) {
94
+ console.log(chalk.red('✗') + ` Sati Memory: Check failed (${error.message})`);
95
+ }
61
96
  console.log(chalk.gray('================'));
62
97
  if (allPassed) {
63
98
  console.log(chalk.green('Diagnostics Passed. You are ready to run Morpheus!'));