HomeToolsArchitecture QuickstartBenchmarksPatterns Main Site

Five-Layer Stack

Every request flows through five layers, from the MCP protocol surface down to persistent storage.

MCP Server JSON-RPC over stdio. Receives tool calls, validates params, returns branded responses.
Tool Dispatch Routes 43 tools to the correct engine. Parameter normalization, error wrapping.
𝔻 6 Engines Query, Temporal, Counterfactual, Topology, Resonance, Plasticity. The computation layer.
SharedGraph Arc<RwLock<Graph>> for concurrent multi-agent access. Nodes + weighted edges.
Persistence Auto-persist every 50 queries + on shutdown. Graph JSON + plasticity state on disk.

Nodes and Edges

The graph stores four types of nodes and four types of weighted edges. All edges carry a weight between 0.0 and 1.0 that adapts through Hebbian learning.

Node Types
Module — A file, package, or crate
Function — A callable unit
Type — A struct, enum, trait, or interface
File — A source file on disk
Edge Types
imports — A uses/imports B
calls — A invokes B
contains — A includes B
co-changes — A and B change together
Edge Weights

Every edge has a weight between 0.0 and 1.0. Weights are initialized from static analysis (import depth, call frequency) and adapted at runtime through Hebbian learning. When an agent confirms a connection is useful (via learn), the weight increases. When confirmed wrong, it decays.

Six Engines

Each engine handles a different class of computation against the shared graph. They can be composed -- a single tool call may invoke multiple engines.

QueryOrchestrator
Hybrid Search + Semantic + XLR

The primary query engine. Combines spreading activation (signal propagation along weighted edges) with semantic matching and XLR noise cancellation to produce ranked results.

  • Spreading activation with configurable depth
  • XLR noise filtering (eXtract, Locate, Rank)
  • Threshold-based result pruning
  • Multi-hop semantic chaining
TemporalEngine
Co-change, Causal Chains, Decay

Tracks how the graph evolves over time. Detects co-change patterns (files that change together), builds causal chains, and applies temporal decay to reduce noise from stale connections.

  • Co-change frequency tracking
  • Causal chain inference
  • Temporal decay (older = weaker)
  • Change velocity estimation
CounterfactualEngine
Removal Simulation

Simulates removing nodes from the graph without modifying it. Creates a shadow copy, performs the removal, and reports disconnections, orphans, and broken dependency paths.

  • Shadow graph creation
  • Disconnection detection
  • Orphan identification
  • Path integrity validation
TopologyAnalyzer
Structural Holes, Betweenness

Analyzes the structural properties of the graph topology. Finds structural holes (gaps where connections should exist), computes betweenness centrality, and identifies community boundaries.

  • Structural hole detection
  • Betweenness centrality
  • Community detection
  • Clustering coefficient
ResonanceEngine
Standing Waves, Harmonics

Sends simultaneous signals from multiple seed nodes and detects standing wave patterns -- places where signals from different sources reinforce each other. Reveals deep cross-domain relationships.

  • Multi-source signal emission
  • Standing wave detection
  • Harmonic analysis
  • Cross-domain correlation
PlasticityEngine
Hebbian Learning, Weight Adaptation

Implements the learning loop. When agents provide feedback via learn, the PlasticityEngine adjusts edge weights using Hebbian rules -- "neurons that fire together, wire together."

  • Hebbian weight updates
  • Anti-Hebbian decay
  • Plasticity state persistence
  • Multi-agent weight fusion

MCP Request Lifecycle

The Model Context Protocol (MCP) layer handles communication between AI coding agents and the m1nd binary. JSON-RPC over stdio, no network required.

1
Receive
JSON-RPC request on stdin
2
Parse
Validate params, extract tool name
3
Dispatch
Route to engine via tool handler
4
Execute
Engine computes against SharedGraph
5
Respond
Branded JSON result on stdout
// Example MCP request (JSON-RPC) { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "m1nd_activate", "arguments": { "query": "authentication", "depth": 3, "threshold": 0.4, "agent_id": "jimi" } } }

Multi-Agent Access

One m1nd instance serves all agents. The SharedGraph uses Rust's Arc<RwLock<Graph>> for safe concurrent access. Writes are immediately visible to all agents.

Agent A
Agent B
SharedGraph
Arc<RwLock<Graph>>
Agent C
Agent D
Persistence Strategy

The graph auto-persists to disk every 50 queries and on server shutdown. Two files are written: graph_snapshot.json (full graph state) and plasticity_state.json (learned weights). On startup, both are loaded to restore the full learned state.

Rust Workspace

m1nd is a Rust workspace with 3 crates. The binary is ~4MB, zero runtime dependencies beyond the standard library.

// Workspace layout mcp/m1nd/ Cargo.toml // workspace root m1nd-core/ // graph, engines, query, plasticity src/lib.rs // ~3000 lines m1nd-ingest/ // codebase parsing, AST extraction src/lib.rs // ~1200 lines m1nd-mcp/ // MCP server, tool handlers, branding src/main.rs // ~800 lines