Skip to content

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 ​

TopicPageWhat it covers
IngestionCrawl Jobs · Ingestion PipelinePulling from 25+ connectors, loading, preprocessing, chunking, and VLM/OCR routing
Knowledge & GraphsKnowledge Graphs · Ontologies, Type Schemas & Fuzzy Types · Reasoning Traces & Explainability · Fact Sheets · Portable Knowledge BasesEntity/relationship extraction, GraphSchema & OWL-RL ontologies, fuzzy types, .kgraph portability, reasoning traces & W3C PROV export, Bayesian/PSL/MEBN reasoning, and notebook-scoped facts
Search & RetrievalInformation Retrieval · Code ProjectsDense + sparse hybrid search, Graph RAG, reranking, and repository semantic indexing
Agents & SafetyAgents · Skills & Templates · Guardrails & EvaluationServer/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 answers

Data 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): Install local-runtime (kompile install local-runtime). It bundles kompile-embedding-anserini (io.anserini:anserini dense SameDiff encoders + Lucene), 18+ document/source loaders, and .kgraph reasoning directly into the CLI and mcp-stdio harness — persisting knowledge bases under <project>/data/crawls/ for rag_search, knowledge_search, crawl_documents, and ask_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) ​

bash
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 agents

See 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:

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):

ScreenWhat 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 attribution

You control the trade-off between speed and richness:

What you enableCrawl timeWhat you get
Nothing extraFastVector search + keyword search
--graphSlower (LLM calls per chunk batch)+ entity/relationship graph, Graph RAG, algorithms
--graph --multimodalSlowest+ 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:

MechanismWhat it findsWhen it fires
Dense vector searchSemantically similar chunksAlways (unless disabled)
BM25 keyword searchExact keyword matchesAlways (unless disabled)
Graph RAG localEntity neighborhoodsWhen graph is available
Graph RAG globalCommunity summariesWhen graph + communities are available
Fact sheet injectionCurated factsWhen a fact sheet is active
Freshness scoringRecent documents boostedWhen 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:

StrategyWhen to use it
passthroughSimple, direct questions
hydeQuestions where the answer would look different from the question
multi-queryComplex questions with multiple parts
step-backSpecific 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:

bash
# 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 documents

Fact 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:

  1. Agent receives a task from the user
  2. Agent calls rag_search to find relevant documents
  3. Agent calls code_search if the task involves code
  4. Agent calls knowledge_graph if it needs relationship context
  5. Agent uses the retrieved context to complete the task
  6. Conversation turns are indexed into semantic_memory for 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.

bash
# 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 ​

PageWhat you'll learn
Crawl JobsSource types, pipeline routing, adaptive batching, PDF routing, memory monitoring, distributed crawls, lifecycle management
Ingestion PipelinePipeline phases, subprocess architecture, chunking strategies, monitoring
Knowledge GraphsEntity extraction, entity resolution, graph algorithms, Bayesian networks, MEBN, KG embeddings, Graph RAG, change tracking, maintenance, import/export
Information RetrievalVector search, BM25, hybrid search, query transformation, reranking, contextual RAG, semantic memory, transcript search, code search
Fact SheetsKnowledge partitioning, curated facts, auto-derivation, graph building
AgentsAgent modes, passthrough, KClaw, A2A protocol, policy enforcement, evaluation, session management
Code ProjectsCode indexing, entity types, search, code graph analysis
Skills and TemplatesReusable agent skills, Jinja-style prompt templates
Guardrails and EvaluationInput/output filters, evaluation harness, experiments

Released under the Apache-2.0 License.