Skip to content

Advanced Usage

import { Tabs, TabItem, Steps } from ‘@astrojs/starlight/components’;

For teams integrating Cortex into their custom internal tools or extending its capabilities.

Programmatic Scans

You can use the ProjectScanner in your own build pipelines or CI scripts to automatically capture project state.

import { ProjectScanner, MemoryStore } from '@ecuabyte/cortex-core';
const scanner = new ProjectScanner();
const store = new MemoryStore();
const result = await scanner.scan({
path: './src',
scanTodos: true,
scanDocs: true
});
// Save only high-priority memories
for (const memory of result.memories) {
if (memory.content.includes('URGENT')) {
await store.add(memory);
}
}

Custom MCP Tools

The Cortex MCP Server can be extended with project-specific logic.

1. **Define Strategy**: Create a new primitive in `@ecuabyte/cortex-core`. 2. **Register Tool**: Add the tool definition to the `mcp-server.ts` tool list. 3. **Implement Handler**: Add a case to the `CallToolRequestSchema` handler.

Database Management

If you need to perform bulk operations or manual migrations, you can access the SQLite database directly.

```sql -- List all decision-type memories from last 24h SELECT * FROM memories WHERE type = 'decision' AND createdAt > datetime('now', '-1 day'); ``` ```bash cortex list -t decision --limit 100 ```