FaultLine 标志

FaultLine

社区
tkalevra

Validated, private, shareable knowledge-graph memory for AI — per-tenant, write-gated, PostgreSQL-authoritative, served over MCP.

发布者tkalevra
代码仓库FaultLine
语言Python
复刻数
1
星标数
20
可用工具
0
传输类型stdio
分类
许可协议AGPL-3.0
链接
  • 将工具接入 AI 工作流

    FaultLine 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 20 个 Star 和 1 个 Fork。


FaultLine adds persistent, validated memory to your local AI. Facts are stored in a structured knowledge graph — not summarised into text blobs, not guessed from documents. When you correct something, it updates. When you ask about it later, the answer is right.


Why FaultLine

1. Private by design

Everything runs on your machine. Your conversations, your memories, your data — none of it leaves. No cloud sync, no accounts, no subscriptions.

2. Share memory across any AI

FaultLine exposes an MCP server. That means the same memory store is available to OpenWebUI, Claude Desktop, or any other MCP-capable endpoint. Change your server IP in one conversation, every model sees the update.

3. Write-validated facts — not RAG guesswork

RAG retrieves documents and asks the LLM to interpret them. The answer depends on wording, context, and luck. FaultLine validates facts before storing them and rejects hallucinations at the gate. Your AI knows "AlphaNode's IP is 10.44.5.20" — not "a document mentioned something about a server."

4. Correctable, relational data

Facts are stored as typed relationships — person, age, occupation, network device, IP address, MAC, hostname. Corrections update the record cleanly; the old value is archived, not lost. Memory strengthens over time: things mentioned once are held lightly, confirmed facts become authoritative.

5. Teach it any domain — on your terms

/expand networking teaches FaultLine how networking works before you mention your first device. /expand kubernetes online https://kubernetes.io/docs/concepts/ reads the actual docs and builds the ontology from them. You point it at the source, it learns the structure, and every fact you mention in that domain from then on is stored and retrieved in context — not as an isolated string. And everything it learns is still correctable by you.


What it looks like in practice

You:  "I'm a sysadmin. My main workstation is called DevBox, IP 10.0.1.5."

Next session:
You:  "What do you know about DevBox?"
AI:   "DevBox is your workstation, IP address 10.0.1.5."
You:  "Actually DevBox moved to 10.0.1.10 after the network change."

Next session:
You:  "What's DevBox's IP?"
AI:   "DevBox has IP address 10.0.1.10."
You:  /expand networking

Later, after mentioning your firewall:
AI:   "Your firewall OPNsense is a networking device — I have that from earlier."

People, preferences, server IPs, MAC addresses, hostnames, relationships, corrections. Anything you tell it, stored and ready.


How it works (briefly)

  • Every message is scanned for facts worth keeping
  • Facts go through a validation gate before storage — hallucinated details are rejected
  • Relevant facts are injected into the conversation before the AI responds
  • Memories strengthen with confirmation; corrections archive the old value cleanly
  • /expand <topic> teaches FaultLine how a domain is structured so facts about it land correctly

/expand — on-demand domain intelligence

Most memory systems store facts. FaultLine can learn how a domain works — the structure, the relationships, the vocabulary — so that facts about it land correctly and mean something.

Without a domain expansion, "my firewall is OPNsense" is stored as a flat string. With /expand networking, FaultLine knows that a firewall is a type of network device, that it has IP addresses, that it sits between your LAN and WAN, and how it relates to switches, routers, and hosts. Every networking fact you mention after that is stored and retrieved in context.

The difference in practice:

Without /expand:

You:  "OPNsense is at 10.0.0.1, the switch is at 10.0.0.2"
AI:   "OPNsense has IP 10.0.0.1 and the switch has IP 10.0.0.2."
      (two isolated facts, no relationship, no structure)

With /expand networking:

You:  "OPNsense is at 10.0.0.1, the switch is at 10.0.0.2"
AI:   "Your firewall OPNsense is at 10.0.0.1. Your switch is at 10.0.0.2,
       downstream from it." (stored relationally — device types, roles, topology)

You control the source

Point it at the actual documentation and it grounds the expansion in that material — not in what the LLM guesses the domain looks like:

/expand kubernetes online https://kubernetes.io/docs/concepts/
/expand tls online https://www.rfc-editor.org/rfc/rfc8446
/expand networking
/expand home lab
/expand kubernetes

Without a URL, it reasons from its training knowledge. With one, it reads the source and builds the ontology from it. You decide how authoritative you need it to be.

Still correctable

Everything /expand builds is subject to the same correction rules as any other fact. If it got the domain structure wrong, tell it — your correction wins and is stored as authoritative. The expansion is a starting point, not a constraint.

It compounds

Expand once and every future conversation in that domain benefits automatically. New facts slot into the right relationships. Queries about that domain return structured, contextual answers instead of isolated strings. The more you use it, the more useful it gets.


Comparison

FaultLineChatGPT MemoryMemGPT / LettaMem0OpenWebUI RAG
Self-hosted, fully private✅❌ Cloud only✅✅✅
Works with any local LLM✅❌ OpenAI only✅✅✅
MCP server — share across models✅❌❌Partial❌
Write-validated (no hallucination storage)✅❌❌❌❌
Correctable — updates cleanly, archives old✅❌ Overwrites❌❌❌
Relational facts (not document chunks)✅❌PartialPartial❌
Remembers server IPs, MACs, hostnames✅❌❌❌❌
Remembers relationships & people✅✅PartialPartial❌
Short → long-term promotion✅❌Partial❌❌
/expand topic learning✅❌❌❌❌
Web-grounded learning✅❌❌❌❌
Dead-naming / preferred name support✅❌❌❌❌
Per-user private memory✅✅ Account✅✅❌ Shared
Open source✅ AGPLv3❌✅ MITPartial✅ MIT

Multi-tenant isolation

Every user gets a physically separate PostgreSQL schema (faultline_<user_id>) — the sole user-memory boundary. Each request binds to the caller's schema via SET search_path without public, so one tenant's queries cannot even name another tenant's tables. There is no shared user_id column to filter on and forget — the boundary is the schema, enforced by the database. (User memory is PostgreSQL-only; the vector tier is retired, so there are no per-user vector collections in the memory path.)

Verified on a live instance. Three fresh tenants, each told one distinct thing, then inspected:

TenantToldStored in its schemaAny other tenant's data?
Aa cat named Mittenscat → feline → mammal → animalnone
Ba red Tesla Model 3tesla → vehicle → transportation_devicenone
Clives in Berlin, Germanyberlin → city, germany → countrynone

Each schema contained only its own entities and hierarchy — zero cross-tenant tokens. A recall issued as one tenant can only ever read from that tenant's schema, so it is structurally impossible for one user's memory to surface in another's. (The per-tenant ±6 hierarchy also grew independently in each — isolation holds through the growth engine, not just at rest.)


Requirements

  • Docker and Docker Compose
  • An LLM backend — Ollama, LM Studio, OpenWebUI, or a hosted API (OpenAI, Anthropic, Groq)
  • 8 GB RAM minimum, 16 GB recommended

Getting started

bash
git clone https://github.com/tkalevra/FaultLine.git
cd FaultLine

Guided setup (recommended). An interactive wizard first asks Language / Lingua, then picks your LLM backend, tests the connection and lists your available models to choose from, generates a secret MCP_API_KEY, sorts out your tenant id, and writes a ready-to-use .env — then prints exactly what to paste into your client:

bash
./setup.sh            # Linux / macOS
setup.bat             # Windows
#  or, on any platform:  python3 quickstart.py

🌍 Language. The wizard opens with a language choice. English continues on main. Italiano (experimental) switches to the it branch — an unofficial, work-in-progress Italian instance (Italian setup + LEGGIMI-it.md); extraction there rides the LLM path. Not production-ready — use at your own risk; for the stable version stay on English/main.

Or configure manually:

bash
cp .env.example .env
# Set LLM_BACKEND_TYPE + LLM_BASE_URL to point at the LLM you already run
# (Ollama, LM Studio, OpenWebUI, OpenAI, Anthropic, ...)

docker compose up -d

curl http://localhost:8000/health
# {"status": "ok", ...}

Re-run the connectivity check anytime with python3 quickstart.py --validate.

FaultLine hooks into an LLM you already run — it doesn't host one. (If you don't have a model handy, docker compose --profile ollama up -d starts a bundled Ollama alongside the stack.)

The first start downloads the GLiNER2 extraction model (~500 MB, CPU-only — no GPU or CUDA required). Takes 3–5 minutes.

Connecting a client

Two independent choices — the wizard handles both, or set them by hand.

1. Which LLM FaultLine talks to (LLM_BACKEND_TYPE + LLM_BASE_URL — host+port only, no path):

BackendLLM_BACKEND_TYPELLM_BASE_URL (example)
LM Studiolm_studiohttp://host.docker.internal:1234
Ollamaollamahttp://host.docker.internal:11434
OpenWebUIopenwebuihttp://open-webui:8080
OpenAI / Anthropic / Groqopenai / anthropic / groqprovider API base URL

2. How your chat client calls FaultLine's memory tools — all through the MCP server on :8002 (Bearer MCP_API_KEY). Any number of clients can share one store at once:

  • OpenWebUI → Settings → Tools → + (OpenAPI), or Admin Settings → External Tools (native MCP, 0.6.31+) (below)
  • Claude Desktop → the .mcpb extension (below)
  • Cursor / other MCP clients → http://<host>:8002/mcp with header Authorization: Bearer <MCP_API_KEY>

Connect to OpenWebUI

Verified against OpenWebUI v0.10.x (latest); the paths below apply from v0.6.31+. OpenWebUI's menu labels shift between releases — look for Tools (OpenAPI) or External Tools (native MCP) if yours differ.

FaultLine's server on :8002 speaks both OpenAPI and native MCP, so OpenWebUI can reach it two ways. Use Option A — it's the only path that reliably forwards the per-user identity header FaultLine scopes on.

Option A — OpenAPI tool server (recommended):

  1. Settings → Tools → + (Manage Tool Servers). For an instance-wide server, use Admin Settings → Tools instead.
  2. URL: http://faultline-mcp:8002 (same Docker network) or http://<host>:8002. The modal may pre-fill https:// — change it to http:// for a local server, then hit refresh to test.
  3. Auth: Bearer → your MCP_API_KEY.
  4. Set ENABLE_FORWARD_USER_INFO_HEADERS=true in OpenWebUI's environment so each user's memory is scoped to them. It forwards the X-OpenWebUI-User-Id header FaultLine keys on (also -User-Name/-Email/-Role) — without it, per-user memory won't work.

OpenWebUI reads /openapi.json and surfaces all six tools — recall_memory, remember_facts, ingest_document, learn_facts, retract_fact, forget_fact — in every conversation.

Option B — native MCP (OpenWebUI 0.6.31+):

  1. Admin Settings → External Tools → + (Add Server) — native MCP is admin-only.
  2. Type: MCP (Streamable HTTP) (the only transport OpenWebUI's native MCP supports).
  3. URL: http://<host>:8002/mcp · Auth: Bearer → your MCP_API_KEY.

⚠️ Native MCP is the newer, less-tested path with FaultLine (its /mcp is a stateless JSON-RPC endpoint) — if the server or tools don't appear, use Option A. And per-user scoping is weaker here: as of v0.10.x, ENABLE_FORWARD_USER_INFO_HEADERS does not forward X-OpenWebUI-User-* headers over native MCP, and custom-header template tokens ({{USER_ID}}) may not resolve there yet (open-webui#21134). For reliable per-user memory use Option A; if you run native MCP, pin a single tenant with FAULTLINE_USER_ID.

Tool firing (weak models). As of v0.10.0, OpenWebUI defaults every model to Native function calling (the old "Default" mode is renamed "Legacy" and is unsupported). Native works for most 2024+ models; if a smaller model (Qwen, Llama, Mistral, Phi) won't reliably call the tools, switch Chat Controls → Advanced Params → Function Calling → Legacy (or set it per-model / globally under Model Parameters).

Legacy alternative: the inlet/outlet Filter (openwebui/faultline_function.py, Workspace → Functions) still exists for automatic injection, but the tool-server paths above are the supported ones.


Claude Desktop (MCP)

FaultLine ships a .mcpb extension for one-click installation in Claude Desktop.

Install the extension

  1. Build the extension (requires Python):

    bash
    cd tools/claude-desktop
    python build_mcpb.py
    # → produces faultline.mcpb
  2. In Claude Desktop: Settings → Extensions → Advanced settings → Install Extension → select faultline.mcpb

  3. Claude Desktop prompts for three values:

    FieldWhat it isHow to get it
    FaultLine MCP URLHTTP endpoint for the MCP serverDefault: http://localhost:8002. Change the host if FaultLine runs on another machine.
    User IDUUID that isolates your memory storeGenerate one: python -c "import uuid; print(uuid.uuid4())". If you also use OpenWebUI, use the same UUID from OpenWebUI → Settings → Account so both clients share one memory store.
    MCP API KeyBearer token for authenticationMust match MCP_API_KEY in your .env. Generate one: python -c "import secrets; print(secrets.token_hex(32))"
  4. Make sure your Docker stack is running (docker compose up -d) — the extension connects to the MCP server at port 8002.

How it works

The extension is a thin stdio-to-HTTP proxy. Claude Desktop spawns it as a local process; it forwards JSON-RPC messages to your Docker MCP server. No SDK dependencies — just Python stdlib.

Claude Desktop (stdio) → faultline_proxy.py → HTTP → localhost:8002/mcp → Docker

Alternative: direct HTTP (Streamable HTTP clients)

MCP clients that support HTTP transport directly (no stdio needed) can connect without the extension:

json
{
  "mcpServers": {
    "faultline": {
      "url": "http://YOUR-HOST:8002/mcp",
      "headers": { "Authorization": "Bearer YOUR_MCP_API_KEY" }
    }
  }
}

Tools available

ToolDescription
recall_memoryQuery the knowledge graph — retrieves facts relevant to the conversation
remember_factsExtract and store facts from conversation text
ingest_documentStore a document/article/long-form text; chunked and mined for facts
learn_factsIngest structured ontological statements directly (X is a subclass of Y, …)
retract_factRemove a fact from the knowledge graph (natural-language retraction)
forget_factTombstone ONE specific named fact (subject + optional rel_type/old_value)

All six tools are backed by the same store your OpenWebUI conversations write to.

System prompt (important)

FaultLine works best when the model is explicitly told to use the MCP tools for all memory operations. Without a system prompt, some clients (notably Claude Desktop) will use their own built-in memory instead of FaultLine.

Ready-to-paste prompts are in the prompts/ folder:

FileWhen to use
strong-model-prompt.mdClaude, GPT-4o, Gemini Pro — models with reliable tool-calling
weak-model-prompt.mdQwen, Llama, Mistral, Phi — smaller models that need explicit step-by-step instructions

Pick the one that matches your model, copy the prompt block, and paste it into your client's system prompt field.


Environment variables

env
# The LLM hook — which model server FaultLine talks to.
# LLM_BACKEND_TYPE selects the protocol; the API path is appended automatically.
LLM_BACKEND_TYPE=ollama                         # openwebui | ollama | lm_studio | openai | anthropic | groq | localai | raw
LLM_BASE_URL=http://host.docker.internal:11434  # host + port only, no path
LLM_API_KEY=                                    # blank for local servers; token for hosted APIs

# Storage
POSTGRES_DSN=postgresql://faultline:faultline@postgres:5432/faultline
QDRANT_URL=http://qdrant:6333

# MCP server
MCP_API_KEY=          # leave blank for no auth, or set a secret token
FAULTLINE_USER_ID=    # optional — pins the MCP server to one user

See .env.example for the full list with descriptions.


Key files

FileWhat it is
quickstart.py · setup.sh · setup.batGuided setup wizard — writes .env, tests connectivity, lists your models
src/mcp/server.pyThe MCP tool server — the live integration path
src/api/main.pyThe backend API
openwebui/faultline_function.pyLegacy OpenWebUI Filter (the MCP tool server above is preferred)
migrations/Database schema — runs automatically on first start

Built with

PostgreSQL · Qdrant · Redis · FastAPI · GLiNER2 · nomic-embed-text-v1.5 · OpenWebUI


Licensing

FaultLine is open core, licensed under the GNU AGPLv3.

If you are a user, this changes nothing for you. Run it, modify it, self-host it — for yourself or for your company — forever, for free. That is what it is for.

The AGPL asks for one thing back: if you modify FaultLine and offer it to others over a network, your users get your modified source. Improvements to the commons stay in the commons. Don't modify it, and you owe nothing but the licence notice.

If that doesn't suit you — you want to build a closed-source product on FaultLine, or embed it in a proprietary offering — a commercial licence is available. Open an issue or get in touch.

Licence history: FaultLine was Apache-2.0 through commit 433daf1. That grant is perpetual and is not revoked — copies obtained under it stay Apache-2.0. Everything from the relicensing commit onward is AGPLv3. See NOTICE.

Contributing

Contributions are welcome, and there is one gate: a signed CLA. It exists so the project can keep dual-licensing, which is what funds the open engine — the reasoning is laid out honestly in CONTRIBUTING.md. You keep the copyright in your work.

House rules, in short:

  • New relationship types belong in the rel_types database table, not in code
  • GLiNER2 zero-shot labels are never modified to carry extraction patterns or descriptions
  • No UUIDs in anything a user sees
  • Strong ingest, lean query — if recall is wrong, fix it at ingest
  • All tests pass: pytest tests/

安装

TypingMind
{
  "mcpServers": {
    "faultline": {
      "command": "./setup.sh",
      "args": []
    }
  }
}

将 FaultLine MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 FaultLine 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 FaultLine 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 FaultLine MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "faultline": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 FaultLine MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 FaultLine MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 FaultLine 帮我完成这项任务吗?
FaultLine
当然。我已阅读。
以下是我使用 FaultLine 得到的结果。

常见问题

FaultLine MCP 服务器有什么用途?

FaultLine 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 FaultLine MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 FaultLine,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 FaultLine MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 FaultLine 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 FaultLine MCP 连接到 TypingMind?

FaultLine 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

FaultLine MCP 在 TypingMind 中提供哪些工具?

FaultLine 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 FaultLine MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 FaultLine 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇