System Design

The Loom of
Structured Intelligence.

Weaver is built on a foundation of explicit state and semantic fusion. It treats code not just as text, but as a queryable, structured fabric of logic.

System Topology

The Weaver architecture separates the ephemeral nature of CLI commands from the persistent state of the analysis daemon. This split ensures speed for user interactions while maintaining deep, semantic context in the background.

  • CLI Client (Ephemeral)
  • Weaver Daemon (Persistent)
  • LSP / Tree-sitter Integrations
FIG 3.0
System-topology illustration showing the Weaver CLI shell, daemon, semantic fusion core, JSONL output, and analysis engines.
CORE COMPONENT

Semantic Fusion Engine

The heart of Weaver is the Fusion Engine. It ingests raw code, AST data, and LSP diagnostics to build internal semantic data structures that power every observe, act, and verify operation.

Multi-Source Ingestion

Combines static analysis (Tree-sitter) with dynamic runtime data (LSP) to resolve references that static analysis misses.

Provenance Tagging

Every piece of data carries a provenance trail. We know exactly why the AI thinks a function is relevant.

INTERNAL TELEMETRY: FUSION_OUTPUT ● LIVE
{"timestamp": "2026-03-15T10:00:01Z", "type": "scan_start", "target": "src/"}
{
"type": "semantic_node",
"id": "fn::process_data",
"provenance": {
"source": "tree-sitter-rust",
"confidence": 0.98
},
"relationships": [
"calls::validate_input",
"uses::DataStruct"
]
}
{"timestamp": "2026-03-15T10:00:02Z", "type": "scan_complete", "nodes": 142}

Figure 3.1: Internal fusion telemetry, not the public CLI and daemon JSONL envelope.

ARCHITECTURE

Client–Daemon Model

Decoupling the user interface from the intelligence engine allows for persistent context and faster CLI response times.

The Daemon

weaver daemon
  • Hosts LSP child processes (rust-analyzer, pyrefly lsp, etc.).
  • Dispatches JSONL requests from the CLI and streams responses.
  • Listens on Unix Domain Socket (or TCP via --daemon-socket).
  • Auto-starts when a domain command is issued — no manual launch needed.
Manual lifecycle:
$ weaver daemon start

The Client

weaver <domain> <operation>
  • Parses config (--config-path, XDG, env vars) and CLI flags.
  • Sends JSONL requests to the daemon, streams the response.
  • Renders human-readable output when stdout is a TTY (--output auto).
Usage example:
$ weaver observe get-definition --uri file:///src/main.rs --position 10:5

Data Flow & Provenance

Weaver ensures that every insight provided to the AI agent can be traced back to a source of truth.

Ingestion & Parsing

When a file is observed, the Daemon invokes Tree-sitter to generate a Concrete Syntax Tree (CST).

source.rs CST

Sempai Pattern Matching

The Sempai Engine runs structural queries against the CST to identify high-level constructs (functions, classes, API endpoints).

LSP Enrichment

If available, the Language Server is queried for type definitions, references, and documentation, enriching the static nodes with semantic context.

Graph Fusion

All data points are merged into the Semantic Graph. Nodes are tagged with confidence scores based on their source (e.g., LSP > Regex).

Graph Integrity 75% Confirmed

Explore the Toolkit

Now that you understand the architecture, see how to wield it.