openclaw-brain
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@openclaw-brain what is the Miller effect in amplifiers?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
openclaw-brain
An engineering knowledge-graph + memory system — the memory and guardrails for an AI circuit-design mentor.
openclaw-brain ingests semiconductor PDFs (textbooks, papers), extracts concepts / equations / typed relationships via LLMs, and stores them in a Neo4j knowledge graph. It is exposed as an MCP server so any MCP-compatible agent (OpenClaw, Claude Code, …) can query domain knowledge, verify it against the original source text, and write its own design reasoning back into the graph.
What it does
Ingest —
PDF → typed knowledge graphthrough an 11-stage pipeline (parse → figures → chunk → extract → ground → match → reason → reconcile → commit → embed → summarize). Only two stages do the heavy "understanding" (an LLM); the rest are mechanical.Serve — exposes ~35 MCP tools:
query_knowledge,answer_question,why,audit_citations,record_hypothesis/record_decision/record_bench_result,merge_concepts,retract_node, …Operate — for the circuit domain, run topologies: a recipe renders a SKY130 / Verilog deck, simulates it on ngspice / iverilog, and a deterministic oracle certifies a scope-honest claim-card (see below).
Ground — every node is named, typed, confidence-scored, and traceable to the exact source chunk; a grounding stage drops claims the chunk text doesn't support.
A single unit of the graph looks like this — a real node and a real typed edge, exactly as they sit in the graph:
(Cascode Device) ──[ SOLVES_PROBLEM ]──> (Power Supply Rejection)
confidence 0.70 · layer L2 (analog/EDA) · evidence: chunk_c635e958d19e
rationale: "cascode devices raise effective output resistance, improving supply rejection (PSRR)…"Related MCP server: Neo4j GraphRAG MCP Server
The honest bottom line
The project started with one bet — "make a cheap local model reason like an expensive one" — and
measured it false. Because the failure was measured cleanly, two things that genuinely ship came out
of it: (1) a grounding / fabrication-control mechanism that drops source-unsupported claims, with
measured fabrication near-zero on the evaluation arms — and the live production graph's node-description
faithfulness now measured too, at ~0.82–0.89 (judge-scored, n=150; a weak token-overlap evidence
sampler floored the number at 0.745 until embedding-based selection recovered the artifacts), and (2) a
debugging discipline that catches when the measurement instrument itself is lying. The full
development log — including the dead-ends and the numbers — is in docs/DEVLOG.md.
The executable-circuit substrate
For circuits, reading PDFs into text hit a ceiling — the model never operated a topology. So the newer layer makes it run them: a recipe renders a SKY130 SPICE deck (or a Verilog deck), runs it on ngspice / iverilog, and a deterministic oracle certifies a falsifiable claim-card that is projected additively onto the graph.
The knowledge atom becomes an oracle-certified claim that knows its own scope. A verdict is never a bare
VERIFIED — it carries its basis and boundary (VERIFIED@sky130/tt_mm/27/1.8/3σ@200), names the dominant
untested axis, and refuses to generalize beyond what was actually simulated: a 130nm number is never
taught as an advanced node, and a functional digital verdict is scoped to the stimulus it drove. A real
example — sky130 Monte-Carlo refuted textbook ideal Pelgrom scaling (σ ∝ area^−0.5); the open model
follows ~area^−0.375, so the substrate teaches the node-portable law, not the millivolts. The
deterministic simulator, not the model, is the source of truth.
A teaching loop (why, audit_citations) then lets the agent narrate a claim while a pure audit fails
any lesson that over-generalizes a scoped verdict or presents an uncertified mechanism as fact. Design:
docs/DECISIONS.md ADR-040/041.
Quickstart
Requires Python 3.11+ and Neo4j 5.
python -m venv .venv && .venv/bin/pip install -e .
docker compose up -d # Neo4j on :7687
.venv/bin/openclaw-brain apply-schema # constraints + vector indexes
.venv/bin/openclaw-brain serve # MCP server (stdio — used by the agent)
.venv/bin/openclaw-brain status # Neo4j health + node counts
.venv/bin/openclaw-brain export-obsidian # graph → browsable Obsidian vault (~/Semiconductor)Ingesting a PDF and asking questions both happen through the agent calling MCP tools
(ingest_pdf(file_path=…), query_knowledge(query=…)); the full tool list is in
src/openclaw_brain/server/mcp_server.py.
Architecture
src/openclaw_brain/
├── agent.py # BrainAgent — the single public API (all MCP tools delegate here)
├── knowledge/ # pipeline · extraction · reasoning · graph store (Neo4j)
│ └── executable/ # recipe → render → ngspice/iverilog → oracle → scope-honest claim-card
├── memory/ # episodic / semantic / procedural memory + promotion
├── llm/ # provider (model catalog) + resilience (retry / fallback)
└── server/mcp_server.py # FastMCP server exposing BrainAgent as MCP toolsRouting is local-first: shallow stages run on local/cheap models, the depth-bearing extract and
reason stages run on a cheap hosted model (deepseek-v4-flash), and frontier models
(Opus / Codex) are used only as the teacher/ceiling. The authoritative stage→model config lives in
config/default.toml. See CLAUDE.md for the full module map and
docs/DECISIONS.md for the architecture decision records.
Status
Production graph rebuilt clean on deepseek-v4-flash: 5 sources (Razavi textbook + 4 CIS papers) →
4,336 concepts, 2,268 circuit topologies, 581 equations. Knowledge is stored as natural language
(concept descriptions + ~19k typed-edge rationales + a verbatim EvidenceVault); embeddings are a
rebuildable index, not the asset of record.
.venv/bin/python3 -m pytest tests/ -q # Neo4j-backed tests auto-skip without a DBLicense
MIT © 2026 Rick (github.com/xz0831).
Available Tools
35 toolsadd_catalog_modelA
Add a new model to the catalog.
Once added, the model can be used as a stage default or in fallback chains.
Args:
name: Short name for the model (e.g. "gpt-5.4", "llama-70b").
provider: "anthropic", "openai", "google", or "local".
model_id: The actual model ID for the API (e.g. "gpt-5.4", "claude-opus-4-6-20250514").
tier: "frontier", "fast", or "local".
endpoint: API endpoint URL (required for "local" provider, e.g. "http://localhost:8000/v1").
Returns:
Confirmation with the updated catalog.
Inputs: name (required), model_id (required), provider (required), tier, +1 more. Returns: result
analyze_circuit_imageA
Analyze a circuit schematic (or any technical image) using VLM + knowledge graph.
Workflow:
1. Classifies the image (circuit, plot, block_diagram, layout, etc.)
2. Extracts circuit topology, components, signal flow, and design features
using the frontier vision model (e.g. grok-4.20).
3. Cross-references the extracted description against the knowledge graph
(Razavi, ingested papers) to surface related concepts, equations,
principles, and open hypotheses.
Use this when a user sends a circuit schematic and wants engineering insights
grounded in the knowledge base — NOT for ingesting the circuit as new knowledge.
For PDFs/papers to be stored permanently, use ingest_pdf() instead.
Args:
image_path: Absolute path to the image file (PNG, JPG, etc.).
Typically the Telegram download path on disk.
Returns:
Formatted text with: figure type, visual analysis, and knowledge context.
Inputs: image_path (required). Returns: result
answer_questionA
Answer a question grounded in the knowledge graph, with citations.
Cited chunk ids are verifiable via get_evidence(chunk_id). Returned concepts
contain ids that feed the design-reasoning write tools for hypotheses and
decisions. If the context is insufficient, returns a clean abstention.
Inputs: question (required). Returns: result
audit_citationsA
Advisory self-check for a lesson before you teach it. Submit your LessonPlan and this
verifies the ONE boundary that matters: a claim you marked tier="certified" must cite an
existing certified claim-card (so you never present a simulation-verified number you don't
actually have), and every claim must carry a tier label (so an interpretive mechanism is
never disguised as certified fact). It is NOT a hard gate and judges nothing else — your
lesson's structure, ordering, depth, and selection are entirely yours.
Args:
lesson_plan_json: JSON of {topology_class, spec_id?, title?, claims:[{text, tier:
"certified"|"interpretive", cites: claim_card_id (required when certified)}]}.
Returns:
JSON AuditReport {passed, certified_total, certified_ok, interpretive_total,
findings:[{index, ok, reason}]}.
Inputs: lesson_plan_json (required). Returns: result
end_sessionB
End the current session with an optional summary.
Args:
summary: Brief summary of what happened in the session.
Returns:
Confirmation.
Inputs: summary. Returns: result
export_obsidianA
Export the knowledge graph to an Obsidian vault as Markdown files.
Each concept, equation, principle, etc. becomes a note with YAML
frontmatter and [[wikilinks]] for relationships. Open the vault in
Obsidian to browse and visualize the graph.
Args:
vault_path: Path to the Obsidian vault directory.
Defaults to ~/Semiconductor.
Returns:
Summary of exported nodes.
Inputs: vault_path. Returns: result
find_bridgesA
Find potential cross-domain connections in the knowledge graph.
Discovers concept pairs in different domains that share neighbors
but aren't directly connected — candidates for new insights.
Args:
limit: Maximum number of bridges to return.
Returns:
List of potential cross-domain bridges.
Inputs: limit. Returns: result
get_evidenceA
Read SourceChunk evidence for citation verification.
citation 검증용 — query_knowledge가 준 chunk id의 원문 열람.
Args:
chunk_id: SourceChunk ID returned by query_knowledge context/citations.
Returns:
JSON evidence payload with chunk_id, source_id, text, verbatim,
section_title, and pages.
Inputs: chunk_id (required). Returns: result
get_pipeline_configA
Get the current pipeline configuration: stage models, fallback chains, and model catalog.
Returns a human-readable summary of:
- Default model for each pipeline stage (extraction, reasoning, matching)
- Fallback chain for each stage
- Available models in the catalog
- Resilience settings (retry, backoff)
No arguments needed. Call startup() first.
Inputs: no named parameters. Returns: result
get_statsA
Get system-wide statistics.
Returns node counts, memory stats, reinforcement metrics, available skills, and configured models.
Inputs: no named parameters. Returns: result
ingest_pdfA
Ingest a PDF document into the knowledge graph.
Extracts concepts, equations, and parameters, matches them against
existing knowledge, reasons about relationships, and commits changes.
Args:
file_path: Absolute path to the PDF file.
extraction_model: Model name for extraction (optional, uses default).
reasoning_model: Model name for reasoning (optional, uses default).
Returns:
Summary of ingestion results.
Inputs: file_path (required), reasoning_model, extraction_model. Returns: result
list_open_hypothesesA
List all open (unresolved) hypotheses, ordered by confidence.
Use this to review pending hypotheses that need bench verification,
or to find hypotheses related to a current issue.
Args:
limit: Maximum number of hypotheses to return.
Returns:
JSON list of open hypotheses with linked concepts.
Inputs: limit. Returns: result
merge_conceptsA
Merge a duplicate concept node into the primary, re-wiring all edges.
Use when the LLM extracted the same concept twice with slightly different names
(e.g. "MOSFET" and "MOSFET Transistor") and you want to consolidate them.
Steps performed automatically:
1. Gap-fill: properties present on duplicate but absent on primary are copied.
2. All outgoing edges from duplicate are re-created on primary (idempotent MERGE).
3. All incoming edges to duplicate are re-pointed to primary (idempotent MERGE).
4. Duplicate node is permanently deleted.
To find candidates: use query_knowledge to search for near-duplicate concepts,
or check find_bridges for concepts that reference each other indirectly.
Args:
primary_id: concept_id of the node to keep (the canonical one).
duplicate_id: concept_id of the node to absorb and delete.
Returns:
JSON summary with rewired edge counts and deletion confirmation.
Inputs: primary_id (required), duplicate_id (required). Returns: result
project_executableA
Build + project the validated executable-circuit specimens (two-stage Miller OTA, simple NMOS current mirror) onto the knowledge graph. Runs REAL ngspice (sky130) to produce verdicted specimens, then ADDS Specimen/ClaimCard nodes + REALIZES/GROUNDS links to existing graph nodes — additive (existing nodes never modified) and NO-PHANTOM (a link forms only to a resolved existing node). LONG-RUNNING: simulations take minutes. Dry-run by default (apply=False simulates + reports verdicts but writes nothing); apply=True writes.
Args:
apply: True to write the projection; False (default) for a dry-run preview.
Returns:
JSON {apply, specimens:[{topology_class, spec_id, verdicts:{claim_id: verdict},
written?:{nodes, internal_edges, links_resolved, links_total}}]}.
Inputs: apply. Returns: result
query_executableA
Read the executable-circuit substrate: simulation-VERIFIED circuit specimens and their claim-cards. Each claim-card is a falsifiable mechanism claim whose verdict was produced by a DETERMINISTIC oracle re-running a real ngspice simulation (sky130 PDK) under stated R1 conditions (corner/temp/vdd). This is the evidence layer for teaching: the QUANT assertion (direction / elasticity / invariance / value) is oracle-certified; the mechanism NARRATIVE is interpretive and must NOT be taught as oracle-certified fact. Specimens link into the knowledge graph (REALIZES a CircuitTopology, GROUNDS a Parameter).
Args:
topology_class: restrict to one class (e.g. "miller_ota_2stage_nmos_in"), or "" for all.
Returns:
JSON {topology_class, count, specimens:[{spec_id, topology_class, realizes, pdk, tool,
claims:[{claim, knob, metric, verdict, narrative, conditions:{corner,temp_c,vdd},
grounds}]}]}.
Inputs: topology_class. Returns: result
query_knowledgeA
Query the knowledge graph and memory for relevant information.
Searches both the Neo4j knowledge graph and the memory system.
Args:
query: Natural language query (e.g., "MOSFET amplifier gain").
Returns:
JSON envelope:
context — human-readable markdown of concepts/edges/memories
concepts — [{id, name, confidence, layer, domain, cite}] —
pass these ids to
record_hypothesis(related_concepts=[...]),
record_decision, reinforce_concept, etc.
Each concept carries cite.level — 'chunk' claims can
be verified verbatim via get_evidence(chunk_id);
when you use a 'derived' item in an answer, label
that part of your answer as derived/unverified.
open_hypotheses — [{id, statement, status, confidence}] — ids usable
in record_bench_result(tests_hypothesis=...) and
record_decision(motivated_by=[...])
active_decisions — [{id, choice, status}]
Inputs: query (required). Returns: result
recall_memoryA
Search memories only (without knowledge graph).
Useful for recalling past conversations, lessons, or facts.
Args:
query: What to search for in memories.
Returns:
Matching memories formatted as text.
Inputs: query (required). Returns: result
record_bench_resultA
Record a simulation or measurement result, optionally confirming/falsifying a hypothesis.
Links bench results to hypotheses to close the hypothesis→bench→feedback loop.
When a hypothesis is tested, its status is automatically updated.
Args:
setup: Testbench setup description (e.g., "CS amp, W/L=10/0.18, VDD=1.8V").
metric: Measured results (e.g., "gain=22dB, BW=150MHz").
conclusion: What this result means.
bench_type: "simulation", "measurement", or "calculation".
corner: Process/temperature corner (e.g., "SS -40C").
tests_hypothesis: Hypothesis ID to confirm or falsify (optional).
confirms: True if the result confirms the hypothesis, False if it falsifies.
Returns:
The bench result ID.
Inputs: setup (required), metric (required), conclusion (required), corner, +3 more. Returns: result
record_decisionA
Record a design decision with rationale, alternatives, and constraints.
Captures WHY a particular design choice was made, what was considered,
and under what constraints. Enables re-evaluation when specs change.
Args:
choice: The selected design choice (e.g., "Folded cascode OTA").
alternatives: Comma-separated alternatives considered.
rationale: Why this choice was made.
constraints: Comma-separated constraints (e.g., "VDD=1.2V, area<100um2").
related_concepts: Comma-separated concept IDs this decision applies to.
motivated_by: Comma-separated hypothesis IDs that motivated this decision.
Returns:
The decision ID.
Inputs: choice (required), rationale, constraints, alternatives, +2 more. Returns: result
record_eventA
Record an event in the current session.
Args:
event_type: Type of event (user_message, agent_response, observation, etc.).
content: The event content.
Returns:
The memory ID of the recorded event.
Inputs: content (required), event_type (required). Returns: result
record_hypothesisA
Record a testable hypothesis about a circuit or design issue.
Hypotheses are tracked in the knowledge graph and can be confirmed
or falsified by bench results. Use this when exploring root causes,
predicting behavior, or proposing explanations.
Args:
statement: The hypothesis (e.g., "Body effect causes Vth shift > 50mV at SS-cold").
assumptions: Comma-separated assumptions underlying this hypothesis.
test_plan: How to verify this hypothesis via simulation or measurement.
related_concepts: Comma-separated concept IDs to link to.
Returns:
The hypothesis ID.
Inputs: statement (required), test_plan, assumptions, related_concepts. Returns: result
record_lessonB
Record a durable lesson learned.
Lessons are stored as curated semantic memories that persist
across sessions.
Args:
lesson: The lesson text.
tags: Comma-separated tags (optional).
Returns:
The memory ID.
Inputs: lesson (required), tags. Returns: result
reinforce_conceptA
Strengthen a concept's confidence in the knowledge graph.
Call this when a concept is confirmed during conversation,
or when new evidence supports an existing concept.
Args:
concept_id: The concept ID to reinforce.
evidence: Description of the confirming evidence.
Returns:
Confirmation message.
Inputs: concept_id (required), evidence. Returns: result
remove_catalog_modelA
Remove a model from the catalog.
Cannot remove a model that is currently set as a stage default
or in a fallback chain.
Args:
name: Name of the model to remove.
Returns:
Confirmation or error if model is in use.
Inputs: name (required). Returns: result
retract_executableA
Reverse a project_executable apply: DETACH DELETE the Specimen + its ClaimCards (and their REALIZES / HAS_CLAIM / GROUNDS edges) for one spec_id. The existing graph nodes the links pointed at are untouched. Use this to undo a bad projection.
Args:
spec_id: the content-hash id of the specimen to retract (from query_executable).
Returns:
JSON {spec_id, specimens, claim_cards} — counts of nodes deleted.
Inputs: spec_id (required). Returns: result
retract_nodeA
Retract (soft-delete or hard-delete) a knowledge node.
Use when a node was incorrectly extracted, is factually wrong, or is
a hallucination that slipped through grounding checks.
Soft delete (default, hard_delete=false):
Sets retracted=true on the node. It remains in the graph for audit purposes
but is excluded from all searches, retrieval, and concept matching.
Recoverable: set retracted=false manually if needed.
Hard delete (hard_delete=true):
Permanently removes the node and ALL its edges. Irreversible.
Use only for nodes with zero useful relationships.
Supported labels: Concept, Equation, Principle, CircuitTopology, Parameter,
Assumption, Insight, Hypothesis, DesignDecision, BenchResult.
Args:
node_id: The ID value (e.g. the concept_id, equation_id, etc.).
label: Node type — "Concept", "Equation", "Parameter", etc.
reason: Human-readable reason (stored on the node for audit trail).
hard_delete: If True, permanently delete. Default: False (soft-delete).
Returns:
JSON with action taken and whether the node was found.
Inputs: label (required), node_id (required), reason, hard_delete. Returns: result
route_and_executeA
Route a natural language input to the best matching skill.
The agent analyzes the input, selects the most appropriate skill,
and executes it automatically.
Args:
user_input: Natural language instruction.
Returns:
Execution result or fallback message.
Inputs: user_input (required). Returns: result
run_maintenanceA
Run maintenance tasks: memory promotion and confidence decay.
Should be called periodically (e.g., daily) to keep the
knowledge graph and memory system healthy.
Returns:
Summary of maintenance actions.
Inputs: no named parameters. Returns: result
shutdownA
Shut down the openclaw-brain agent.
Inputs: no named parameters. Returns: result
start_sessionA
Start a new episodic memory session.
Events recorded during the session are linked together and can
be summarized at session end.
Args:
session_id: Optional custom session ID.
Returns:
The session ID.
Inputs: session_id. Returns: result
startupA
Start the openclaw-brain agent. Must be called before other tools.
Inputs: no named parameters. Returns: result
update_fallback_chainA
Set the fallback chain for a pipeline stage.
When the primary model fails (after retries), the system tries each
fallback in order. All models must exist in the catalog.
Args:
stage: Pipeline stage — "extraction", "reasoning", or "matching".
models: Comma-separated model names in fallback order
(e.g. "gpt-5.4, minimax-m2.5"). Empty string clears the chain.
Returns:
Confirmation with the new chain.
Inputs: stage (required), models (required). Returns: result
update_stage_modelA
Change the default LLM model for a pipeline stage.
The model must exist in the catalog. Changes are applied immediately
(in-memory) and persisted to config/default.toml.
Args:
stage: Pipeline stage — "extraction", "reasoning", or "matching".
model_name: Name of a model from the catalog (e.g. "claude-opus-4-6", "gpt-5.4").
Returns:
Confirmation of the change.
Inputs: stage (required), model_name (required). Returns: result
upsert_entityB
Create or update a semantic entity (person, project, tool, etc.).
Args:
entity_id: Unique ID for the entity.
entity_type: Type (person, project, tool, system, concept).
name: Display name.
summary: Brief description.
Returns:
The entity ID.
Inputs: name (required), entity_id (required), entity_type (required), summary. Returns: result
whyA
Grounding for one executable-substrate claim-card — the evidence behind a citation. Use it
to inspect (or cite) a specific sim-verdicted claim. Remember the boundary: the claim's QUANT
verdict is oracle-certified, but its narrative is interpretive (a mechanism the engineer
narrates, NEVER an oracle-certified fact).
Args:
claim_card_id: the id from query_executable, format {spec_id}:{claim}.
Returns:
JSON {claim_card_id, found, claim, knob, metric, verdict, narrative, grounds,
conditions:{corner,temp_c,vdd}, spec_id, topology_class}.
Inputs: claim_card_id (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 35 tools
Every tool has a clearly distinct purpose: knowledge graph operations, memory management, session handling, pipeline config, and executable substrate tools are cleanly separated. Even similar tools like ingest_pdf and analyze_circuit_image are explicitly differentiated by workflow, and record_* tools each target a unique entity type.
The vast majority of tools follow a clear verb_noun snake_case pattern (e.g., query_knowledge, record_hypothesis, update_stage_model). A few outliers like 'startup', 'shutdown', and 'why' break the pattern, but they are short, memorable, and do not create confusion.
At 35 tools, the server exceeds the range where tool count is considered appropriate, even for a broad knowledge-management system. Many functions (e.g., model catalog management) are split into five separate tools, which could likely be consolidated without loss of clarity.
The domain is well covered: knowledge graph CRUD, memory management, session tracking, hypothesis/decision/bench-result lifecycle, executable-circuit query/projection/retraction, and pipeline configuration are all present. Minor gaps exist (e.g., no direct memory update/delete tool), but they are easy to work around.
Related MCP Connectors
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Graph-native persistent memory for AI agents — 33 MCP tools, zero-LLM writes.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn advanced MCP server providing RAG-enabled memory through a knowledge graph with vector search capabilities, enabling intelligent information storage, semantic retrieval, and document processing.41 npm47MIT
- AlicenseAqualityDmaintenanceAn MCP server that enables LLMs to perform semantic and fulltext searches within Neo4j while executing complex, search-augmented Cypher queries for GraphRAG applications. It provides tools for database schema discovery and supports multi-provider embeddings to facilitate advanced graph traversals.53MIT
- FlicenseNot gradedqualityNot gradedmaintenanceA knowledge graph MCP server that integrates Graphiti and the ACE framework for conversational management of Neo4j-based entities and relationships. It enables AI agents to perform semantic searches, manage data isolation, and utilize automatic learning strategies.2-
- FlicenseNot gradedqualityDmaintenanceMCP server for manufacturing defect investigation using knowledge graphs and graph analytics. Enables LLM agents to retrieve context, find similar cases, and generate investigation reports from manufacturing data.-