Platform & Knowledge Concepts
This section explains how Kompile's document ingestion, hybrid retrieval, knowledge graph, and platform subsystems fit together.
TIP
Looking for the CLI/Web agent harness internals (Surfaces, Enforcer, Judge, Subagents, Monitors, Memory, Skills, and Cost Estimation)? Start at the dedicated Harness Deep Dive Overview.
In this section
| Topic | Page | What it covers |
|---|---|---|
| Ingestion | Crawl Jobs · Ingestion Pipeline | Pulling from 25+ connectors, loading, preprocessing, chunking, and VLM/OCR routing |
| Knowledge & Graphs | Knowledge Graphs · Ontologies, Type Schemas & Fuzzy Types · Reasoning Traces & Explainability · Fact Sheets · Portable Knowledge Bases | Entity/relationship extraction, GraphSchema & OWL-RL ontologies, fuzzy types, .kgraph portability, reasoning traces & W3C PROV export, Bayesian/PSL/MEBN reasoning, and notebook-scoped facts |
| Search & Retrieval | Information Retrieval · Code Projects | Dense + sparse hybrid search, Graph RAG, reranking, and repository semantic indexing |
| Agents & Safety | Agents · Skills & Templates · Guardrails & Evaluation | Server/passthrough agent modes, prompt templates, and RAG evaluation guardrails |
The core loop
Everything in Kompile revolves around one loop:
Data in -> Structure it -> Ask questions -> Get grounded answersData in: Crawl jobs pull documents from 25+ source types — files, web pages, email, Slack, Confluence, Google Drive, databases, and more. Each source has a dedicated loader that understands the format.
Structure it: The ingestion pipeline chunks documents, embeds them into vectors, and optionally extracts a knowledge graph of entities and relationships. The result is a searchable index of your data.
Ask questions: The retrieval system finds relevant content through vector search, keyword search, graph traversal, or all three combined.
Get grounded answers: An LLM generates a response using the retrieved context, not its training data. Source attribution shows which documents contributed to the answer.
What connects to what
+------------------+
| Your data |
| (files, web, |
| email, cloud) |
+--------+---------+
|
[Crawl jobs]
|
+--------------+--------------+
| |
+--------v--------+ +--------v--------+
| Vector index | | Knowledge graph |
| (chunks + | | (entities + |
| embeddings) | | relationships) |
+--------+--------+ +--------+--------+
| |
+-------+ [Query] +---------+
| |
+------v-----------v------+
| Retrieved context |
| (chunks + graph nodes |
| + fact sheet data) |
+------------+------------+
|
+------v------+
| LLM |
| (generate |
| answer) |
+------+------+
|
+------v------+
| Response |
| with source|
| attribution|
+-------------+The vector index and knowledge graph are independent. You can use either alone or both together:
Vector index only (default): Good for content questions. "What does the docs say about X?" Fast and effective for most use cases.
Knowledge graph only: Good for structural questions when you've already extracted entities. "How do these teams relate?" Less common as a standalone mode.
Both (Graph RAG): Best for complex questions that need both content and context. "How does the authentication change affect downstream services?" The graph adds relationship context that vector search alone would miss.
Where it runs: local-runtime vs. kompile-app
- Single machine / local RAG &
.kgraph(no server needed): Installlocal-runtime(kompile install local-runtime). It bundleskompile-embedding-anserini(io.anserini:anserinidense SameDiff encoders + Lucene), 18+ document/source loaders, and.kgraphreasoning directly into the CLI andmcp-stdioharness — persisting knowledge bases under<project>/data/crawls/forrag_search,knowledge_search,crawl_documents, andask_graph_*. - Larger distributed systems & team collaboration (
kompile-app): Deploy the 3-process server stack (kompile-server:8080,kompile-chat:8081,kompile-crawl-manager:8082) when multiple users or remote agents share external vector/graph stores (pgvector, Chroma, Vespa, Neo4j), scheduled or clustered multi-node crawls, inbound messaging channels, or server-side query transformers and rerankers.
The three ways to interact
1. CLI & Local Web Harness (no server needed)
kompile chat # Terminal harness (or `kompile chat --web` for local browser UI)
kompile install local-runtime # Adds local Anserini RAG, 18+ loaders, .kgraph reasoning & local LLMs
kompile code-index search "fn" # Local semantic code search
kompile mcp-stdio # Serve MCP tools + local RAG/graph/memory to external agentsSee CLI Overview and The Web Harness.
2. MCP tools (local stdio/daemon or shared kompile-app SSE)
With kompile mcp-stdio (or kompile serve), any MCP-compatible agent gets local tools immediately with no server — and with local-runtime installed, that includes local document crawling, hybrid RAG, and .kgraph reasoning. Connect an optional SSE endpoint when targeting a shared kompile-app deployment:
- Search your documents (
rag_search,knowledge_search) - Query and reason over knowledge graphs (
graph_search,knowledge_graph,ask_graph_verify) - Search code (
code_search,code_graph) - Read and write files (
read,write,edit,patch) - Run commands (
bash,process) - Fetch web pages (
webfetch,websearch,browser) - Delegate to sub-agents (
task,multi_task,quorum_task) - Manage persistent memory (
semantic_memory,memory)
See MCP Integration for tool profiles and transport modes.
3. kompile-app Multi-User Web UI (:8080 / :8081 / :8082)
When running the distributed kompile-app server stack for a team, the Angular frontends expose dedicated persona consoles (see App Persona Boundary and Web UI):
| Screen | What you do there |
|---|---|
Chat (:8081) | Multi-user RAG chat with source attribution over shared team indices and fact sheets |
Knowledge / Crawl Manager (:8082) | Scheduled & clustered crawl jobs, shared knowledge graphs, collaborative fact sheets |
Admin / KClaw / Developer (:8080) | Browser agent hub, inbound team channels, MCP audit logs, ND4J/GPU diagnostics, cluster settings |
How crawls feed everything
A crawl job is where data enters the system. Everything downstream depends on what the crawl produces:
Crawl job
|
+-> Vector index (always)
| Used by: vector search, hybrid search, RAG queries
|
+-> Knowledge graph (when --graph is enabled)
| Used by: Graph RAG, graph algorithms, Cypher queries,
| Bayesian inference, community detection
|
+-> Fact sheet scope (when --fact-sheet is set)
| Used by: scoped retrieval, fact-grounded answers
|
+-> Document metadata (always)
Used by: filters, freshness scoring, source attributionYou control the trade-off between speed and richness:
| What you enable | Crawl time | What you get |
|---|---|---|
| Nothing extra | Fast | Vector search + keyword search |
--graph | Slower (LLM calls per chunk batch) | + entity/relationship graph, Graph RAG, algorithms |
--graph --multimodal | Slowest | + VLM OCR for image-heavy PDFs, table extraction |
You can always re-crawl the same sources with new options. Incremental crawls skip already-processed documents.
See Crawl Jobs for the full crawl system.
How the knowledge graph adds value
Without a graph, you search chunks. With a graph, you also search entities and their connections.
Example without graph:
Q: "What is OpenAI's relationship with Microsoft?" A: (returns chunks that mention both, but doesn't connect them)
Example with graph:
Q: "What is OpenAI's relationship with Microsoft?" A: (returns chunks + a graph path: OpenAI --INVESTED_BY--> Microsoft, OpenAI --PARTNERSHIP--> Microsoft Azure, plus community summaries about the broader AI ecosystem)
The graph also enables:
Community detection: Louvain algorithm finds clusters of related entities. Each cluster gets an LLM-generated summary. Graph RAG global search uses these for big-picture questions.
Graph algorithms: PageRank for importance, betweenness for bottlenecks, shortest path for connection chains.
Bayesian inference: Build probabilistic models over the graph for causal reasoning, event attribution, and risk analysis.
Temporal queries: Graph change tracking records every mutation. You can reconstruct the graph at any past point in time.
See Knowledge Graphs for the full system.
How retrieval composes
When a query arrives, multiple retrieval mechanisms can fire in parallel:
| Mechanism | What it finds | When it fires |
|---|---|---|
| Dense vector search | Semantically similar chunks | Always (unless disabled) |
| BM25 keyword search | Exact keyword matches | Always (unless disabled) |
| Graph RAG local | Entity neighborhoods | When graph is available |
| Graph RAG global | Community summaries | When graph + communities are available |
| Fact sheet injection | Curated facts | When a fact sheet is active |
| Freshness scoring | Recent documents boosted | When configured |
Results are merged, deduplicated (highest score wins), and assembled into a context prompt. The LLM sees all of it together.
Query transformation runs before retrieval to improve results:
| Strategy | When to use it |
|---|---|
passthrough | Simple, direct questions |
hyde | Questions where the answer would look different from the question |
multi-query | Complex questions with multiple parts |
step-back | Specific questions that need broader context |
Reranking runs after retrieval to re-score results. Cross-encoder reranking is the most effective but slowest. RM3 and BM25 feedback are faster alternatives.
See Information Retrieval for the full architecture.
How fact sheets scope your queries
A fact sheet is a named partition of your knowledge base. When a fact sheet is active, queries are scoped to its documents and its curated facts are injected into the context.
This matters when you have multiple distinct knowledge domains:
# Create fact sheets for different domains
# (via web UI: Knowledge > Fact Sheets)
# Crawl with fact sheet scoping
kompile crawl start /data/engineering/ --fact-sheet=engineering
kompile crawl start /data/finance/ --fact-sheet=finance
# Queries hit only the active fact sheet's documents
kompile fact-sheets activate engineering
kompile chat --url=http://localhost:8080
# -> Only retrieves from engineering documentsFact sheets also connect to the knowledge graph: kompile graph build --fact-sheet-id=<id> builds a graph from a specific fact sheet's documents.
How agents use all of this
Agents interact with Kompile through MCP tools. The tools abstract away the complexity — the agent calls rag_search and gets back relevant chunks, or calls knowledge_graph and gets back entity relationships.
The typical agent flow:
- Agent receives a task from the user
- Agent calls
rag_searchto find relevant documents - Agent calls
code_searchif the task involves code - Agent calls
knowledge_graphif it needs relationship context - Agent uses the retrieved context to complete the task
- Conversation turns are indexed into
semantic_memoryfor next time
Policy enforcement wraps all of this: the enforcer watches agent output against rules (banned commands, diff patterns, LLM judge) and can interrupt, rollback, and retry.
See Agents for all agent modes and MCP Integration for the tool catalog.
How code projects integrate
Code projects are source code repositories indexed for semantic search. The indexer (ANTLR4-based) parses source files into entities (classes, methods, functions, interfaces, fields, imports) and relationships (calls, extends, implements, contains).
Code search runs independently of document search. An agent can call code_search to find a function and rag_search to find documentation about that function — both from the same tool set.
# Register and index a code project
kompile project add-code-project --dir=./src
kompile project index-code-project <id>
# Search
kompile code-index search "handleRequest"
kompile code-index callers "processDocument" # Who calls this?
kompile code-index impact "VectorStore" # What breaks if this changes?How configuration flows
All runtime configuration lives in JSON files at ~/.kompile/config/. Three interfaces read and write the same files:
CLI wizards ──┐
├──> ~/.kompile/config/*.json ──> Server reads on startup
Web UI ──┤ (and reloads on change)
REST API ──┘This means you can configure via whichever interface you prefer, and the changes are visible everywhere. kompile configure app runs a 9-section interactive wizard. The web UI Settings screen gives you the same options with a GUI. The REST API gives you programmatic access.
Feature flags (feature-flags-config.json) toggle major features: guardrails, query transformation, contextual RAG, tool gateway, KV cache, Graph RAG, multi-modal. Enable what you need.
Auto-configuration (POST /api/auto-configure/apply) probes your hardware and sets optimal values for subprocess counts, ND4J threads, batch sizes, and memory limits.
See Configuration for the full config reference.
What's in each concept page
| Page | What you'll learn |
|---|---|
| Crawl Jobs | Source types, pipeline routing, adaptive batching, PDF routing, memory monitoring, distributed crawls, lifecycle management |
| Ingestion Pipeline | Pipeline phases, subprocess architecture, chunking strategies, monitoring |
| Knowledge Graphs | Entity extraction, entity resolution, graph algorithms, Bayesian networks, MEBN, KG embeddings, Graph RAG, change tracking, maintenance, import/export |
| Information Retrieval | Vector search, BM25, hybrid search, query transformation, reranking, contextual RAG, semantic memory, transcript search, code search |
| Fact Sheets | Knowledge partitioning, curated facts, auto-derivation, graph building |
| Agents | Agent modes, passthrough, KClaw, A2A protocol, policy enforcement, evaluation, session management |
| Code Projects | Code indexing, entity types, search, code graph analysis |
| Skills and Templates | Reusable agent skills, Jinja-style prompt templates |
| Guardrails and Evaluation | Input/output filters, evaluation harness, experiments |