Add AI prompt tool for natural language graph operations

New MCP tool and portal UI for executing natural language instructions
against the memory graph via Ollama (qwen3-coder:30b). Single LLM call
generates a JSON action plan which is executed sequentially.

Supports 8 action types: add_node, update_node, remove_node, add_edge,
remove_edge, bulk_tag, reorganize, query. Actions can reference previous
results via $result[N].field interpolation. Uses /api/chat with few-shot
assistant example, format:json, and temperature:0 for reliable output.
This commit is contained in:
2026-02-03 02:40:01 +01:00
parent f2f9d729da
commit 661325a235
11 changed files with 569 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
import type { CortexNode, CortexEdge, GraphData, NodeWithConnections, SearchResult, NodeKind, EdgeType, GroupedQueryResult } from './types';
import type { CortexNode, CortexEdge, GraphData, NodeWithConnections, SearchResult, NodeKind, EdgeType, GroupedQueryResult, PromptResult } from './types';
const BASE = '/api';
@@ -50,4 +50,7 @@ export const api = {
runMaintenance: () =>
request<Record<string, any>>('/maintenance/run', { method: 'POST' }),
prompt: (prompt: string) =>
request<PromptResult>('/prompt', { method: 'POST', body: JSON.stringify({ prompt }) }),
};