kogral/docs/diagrams/architecture-overview.svg
2026-01-23 16:11:07 +00:00

117 lines
6.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<svg width="900" height="700" xmlns="http://www.w3.org/2000/svg">
<defs>
<style>
.box { fill: #f0f0f0; stroke: #333; stroke-width: 2; }
.title-box { fill: #4a90e2; stroke: #2c5aa0; stroke-width: 2; }
.storage-box { fill: #e8f4f8; stroke: #4a90e2; stroke-width: 2; }
.interface-box { fill: #fff4e6; stroke: #ff9800; stroke-width: 2; }
.text { font-family: Arial, sans-serif; font-size: 14px; fill: #333; }
.title-text { font-family: Arial, sans-serif; font-size: 16px; font-weight: bold; fill: white; }
.small-text { font-family: Arial, sans-serif; font-size: 12px; fill: #666; }
.arrow { stroke: #666; stroke-width: 2; fill: none; marker-end: url(#arrowhead); }
</style>
<marker id="arrowhead" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto">
<polygon points="0 0, 10 3, 0 6" fill="#666" />
</marker>
</defs>
<!-- Title -->
<text x="450" y="30" class="title-text" text-anchor="middle" font-size="20" fill="#333">Knowledge Base Architecture</text>
<!-- kogral-core (Center) -->
<rect x="300" y="60" width="300" height="380" class="title-box" rx="8"/>
<text x="450" y="85" class="title-text" text-anchor="middle">kogral-core (Rust Library)</text>
<!-- Config Layer -->
<rect x="320" y="100" width="260" height="50" class="box" rx="4"/>
<text x="450" y="125" class="text" text-anchor="middle">Config Layer</text>
<text x="450" y="142" class="small-text" text-anchor="middle">Nickel → JSON → KbConfig</text>
<!-- Storage Layer -->
<rect x="320" y="165" width="260" height="80" class="storage-box" rx="4"/>
<text x="450" y="185" class="text" text-anchor="middle" font-weight="bold">Storage Layer (Hybrid)</text>
<rect x="330" y="195" width="70" height="40" class="box" rx="3"/>
<text x="365" y="220" class="small-text" text-anchor="middle">FileSystem</text>
<rect x="410" y="195" width="70" height="40" class="box" rx="3"/>
<text x="445" y="220" class="small-text" text-anchor="middle">SurrealDB</text>
<rect x="490" y="195" width="70" height="40" class="box" rx="3"/>
<text x="525" y="220" class="small-text" text-anchor="middle">In-Memory</text>
<!-- Graph Engine -->
<rect x="320" y="260" width="260" height="90" class="box" rx="4"/>
<text x="450" y="280" class="text" text-anchor="middle" font-weight="bold">Graph Engine</text>
<text x="450" y="300" class="small-text" text-anchor="middle">Nodes: Note, Decision, Guideline, Pattern, Journal, Execution</text>
<text x="450" y="318" class="small-text" text-anchor="middle">Edges: relates_to, depends_on, implements, extends, supersedes, explains</text>
<text x="450" y="336" class="small-text" text-anchor="middle">Multi-graph: local (project) + shared (central)</text>
<!-- Components Row -->
<rect x="330" y="365" width="70" height="60" class="box" rx="3"/>
<text x="365" y="385" class="small-text" text-anchor="middle" font-weight="bold">Parser</text>
<text x="365" y="402" class="small-text" text-anchor="middle">Markdown</text>
<text x="365" y="417" class="small-text" text-anchor="middle">Frontmatter</text>
<rect x="410" y="365" width="70" height="60" class="box" rx="3"/>
<text x="445" y="385" class="small-text" text-anchor="middle" font-weight="bold">Embeddings</text>
<text x="445" y="402" class="small-text" text-anchor="middle">rig-core</text>
<text x="445" y="417" class="small-text" text-anchor="middle">fastembed</text>
<rect x="490" y="365" width="70" height="60" class="box" rx="3"/>
<text x="525" y="385" class="small-text" text-anchor="middle" font-weight="bold">Query</text>
<text x="525" y="402" class="small-text" text-anchor="middle">Text+Vector</text>
<text x="525" y="417" class="small-text" text-anchor="middle">Cross-graph</text>
<!-- kogral-mcp (Left) -->
<rect x="30" y="480" width="240" height="180" class="interface-box" rx="8"/>
<text x="150" y="505" class="text" text-anchor="middle" font-weight="bold">kogral-mcp (MCP Server)</text>
<text x="150" y="530" class="small-text" text-anchor="middle" font-weight="bold">Tools:</text>
<text x="150" y="548" class="small-text" text-anchor="middle">kogral/search, kogral/add_note, kogral/add_decision</text>
<text x="150" y="563" class="small-text" text-anchor="middle">kogral/link, kogral/get_guidelines, kogral/export</text>
<text x="150" y="590" class="small-text" text-anchor="middle" font-weight="bold">Resources:</text>
<text x="150" y="608" class="small-text" text-anchor="middle">kogral://project/notes, kogral://project/decisions</text>
<text x="150" y="623" class="small-text" text-anchor="middle">kogral://shared/guidelines, kogral://shared/patterns</text>
<text x="150" y="648" class="small-text" text-anchor="middle" font-weight="bold">Prompts:</text>
<text x="150" y="663" class="small-text" text-anchor="middle">kogral/summarize_project, kogral/find_related</text>
<!-- kogral-cli (Right) -->
<rect x="630" y="480" width="240" height="180" class="interface-box" rx="8"/>
<text x="750" y="505" class="text" text-anchor="middle" font-weight="bold">kogral-cli (Command Line)</text>
<text x="750" y="530" class="small-text" text-anchor="middle" font-weight="bold">Commands:</text>
<text x="750" y="548" class="small-text" text-anchor="middle">init, add, search, link, sync</text>
<text x="750" y="563" class="small-text" text-anchor="middle">serve, graph, import, export</text>
<text x="750" y="578" class="small-text" text-anchor="middle">get-guidelines, list, show, stats</text>
<text x="750" y="605" class="small-text" text-anchor="middle" font-weight="bold">Features:</text>
<text x="750" y="623" class="small-text" text-anchor="middle">Interactive prompts</text>
<text x="750" y="638" class="small-text" text-anchor="middle">Template-based document creation</text>
<text x="750" y="653" class="small-text" text-anchor="middle">Graph visualization</text>
<!-- NuShell Scripts (Bottom) -->
<rect x="300" y="480" width="300" height="80" class="box" rx="8"/>
<text x="450" y="505" class="text" text-anchor="middle" font-weight="bold">NuShell Scripts & Plugins</text>
<text x="340" y="530" class="small-text">Scripts:</text>
<text x="340" y="548" class="small-text">kogral-sync.nu, kogral-backup.nu, kogral-reindex.nu</text>
<text x="490" y="530" class="small-text">Plugins:</text>
<text x="490" y="548" class="small-text">kogral-import-logseq.nu, kogral-stats.nu</text>
<!-- Arrows -->
<!-- MCP to kogral-core -->
<path d="M 270 570 L 300 300" class="arrow"/>
<!-- CLI to kogral-core -->
<path d="M 630 570 L 600 300" class="arrow"/>
<!-- NuShell to kogral-core -->
<path d="M 450 480 L 450 440" class="arrow"/>
<!-- Labels on arrows -->
<text x="280" y="420" class="small-text" fill="#666">JSON-RPC</text>
<text x="610" y="420" class="small-text" fill="#666">Direct API</text>
<text x="460" y="460" class="small-text" fill="#666">CLI invocation</text>
</svg>