Logo Knowledge Layer For Agents (KL4A)

Knowledge Layer For Agents (KL4A)

Tổ chức
CogniSwitch

Extracts claims from SOPs, policies and regulations, has a person approve or reject each one, then serves the approved set to agents over MCP - each claim carrying a byte range to its source sentence. Open Knowledge Format (OKF) bundles, no database.

Nhà phát hànhCogniSwitch
Kho mãKL4A
Ngôn ngữRust
Bản fork
0
Sao
13
Công cụ có sẵn
0
Phương thức truyền tảistdio, streamable-http
Danh mục
Giấy phépApache-2.0
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    Knowledge Layer For Agents (KL4A) cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    13 sao và 0 bản fork từ kho mã được liên kết.

Knowledge Layer For Agents (KL4A)

Create OKF-compliant knowledge bundles from your SOP docs, and enable your agents to use them. Every claim carries the exact source span it came from, and nothing is marked verified until a human approves it.

Feed it a PDF, a DOCX, or a plain-text SOP — real, unstructured prose, not a website's DOM or a codebase's AST. It then:

  • Normalizes the document into clean Markdown.
  • Extracts obligation-shaped claims (must, shall, should record, ...) and attaches each one to the exact byte range of the source sentence it came from.
  • Records every approve, reject, and edit as its own event, with a reviewer, a rationale, and a before/after diff, directly in the bundle.
  • Populates the claim's OKF v0.2 trust fields (provenance, verified, lifecycle_status) on approval with who verified it and when, rather than leaving them blank for someone downstream to fill in by hand.

The result is a plain-file artifact. Markdown with YAML frontmatter: readable in a text editor, diffable with git, and queryable by an agent over MCP or the CLI — with no database, and no server standing between them and the source of truth.

License: Apache-2.0

A native desktop app (Windows/macOS/Linux, built on Tauri) — one application to install, not a server to stand up or a runtime to provision.

Why KL4A exists

Your SOPs, policies, and regulations live in prose written for a human reader, not an agent. Pasting that prose straight into a prompt means the agent is trusting a wall of text with no accountability trail — if it gets a clause wrong, nothing tells you which sentence it misread or who signed off on it.

KL4A's job is to turn that prose into small, sourced, checkable claims before an agent ever sees them: extract, attach evidence, put a person in front of each one, and only then hand it to an agent — with the review trail attached, not thrown away.

Quickstart

Download Desktop

PlatformDownload
Windows⬇ Installer (.exe)
macOS⬇ Disk image (.dmg) - universal, runs on Apple Silicon and Intel
Linux⬇ AppImage

The builds aren't code-signed yet, so your OS will warn you on first launch: on macOS right-click then Open to get past Gatekeeper, on Windows click More info then Run anyway, and on Linux chmod +x the AppImage first.

Install it, open it, and everything else - creating a bundle, ingesting sources, reviewing mined knowledge, exporting, talking to the agent - happens inside the app. See docs/quickstart.md and the Desktop UI Guide for the full walkthrough.

Download CLI and MCP server

If you'd rather not install the desktop app, or you want an agent to read a bundle, both binaries ship with every release. No toolchain, no build.

Platformsopkb-clisopkb-mcp
Windows⬇ .exe⬇ .exe
macOS⬇ universal⬇ universal
Linux⬇ x86_64⬇ x86_64

sopkb-cli runs the whole pipeline: scan, normalize, mine, review, validate, export. sopkb-mcp is a read-only stdio MCP server that serves a finished bundle to any MCP-capable agent.

On macOS and Linux, make the file executable and put it somewhere on your PATH so a client can resolve it by name:

bash
chmod +x sopkb-mcp-linux-x86_64
sudo mv sopkb-mcp-linux-x86_64 /usr/local/bin/sopkb-mcp

The macOS binaries are universal, so one file covers Apple Silicon and Intel.

An empty result is not a bug

An agent can't tell a grounded answer from a confident guess unless the tool is honest about what it doesn't have. Search a bundle for a term it actually contains, and for one it doesn't — real output, captured against a one-line "New hires must confirm identity before systems access is granted" SOP:

console
$ sopkb-cli knowledge search demo-bundle "access"
[
  {
    "id": "ki-onboarding-v1-000001",
    "subject": "Access Requirements",
    "predicate": "requires",
    "object": "New hires must confirm identity before systems access is granted.",
    "evidence": "New hires must confirm identity before systems access is granted.",
    "review_status": "proposed",
    "source_id": "onboarding"
  }
]

$ sopkb-cli knowledge search demo-bundle "quantum-encryption-protocol-xyz"
[]

No match, no padding — an empty array, not a low-confidence guess dressed up as an answer. The same discipline applies to extraction itself: when the mining step can't locate an LLM-claimed sentence verbatim in its source section, the knowledge item is written with span_status: "llm_claimed" instead of a fabricated byte range — the gap is recorded, not hidden.

Examples: how an agent uses it

These assume a bundle already exists — built through the desktop app, or via sopkb-cli (the Rust CLI that ships alongside it). To reproduce the exact bundle these examples run against:

bash
mkdir -p sources
printf '# Access SOP\n\n## Access Requirements\n\nNew hires must confirm identity before systems access is granted.\n' > sources/onboarding.md

sopkb-cli init demo-bundle
sopkb-cli scan sources --bundle demo-bundle
sopkb-cli normalize demo-bundle
sopkb-cli mine demo-bundle --provider fixture
sopkb-cli validate demo-bundle

An agent retrieves grounded, task-scoped context (CLI):

console
$ sopkb-cli agent context demo-bundle --task eligibility-check
json
{
  "task": {
    "id": "eligibility-check",
    "title": "Eligibility Check",
    "query_terms": ["eligibility", "identity", "contraindication", "clinical review"]
  },
  "usable_knowledge": [
    {
      "id": "ki-onboarding-v1-000001",
      "subject": "Access Requirements",
      "predicate": "requires",
      "object": "New hires must confirm identity before systems access is granted.",
      "review_status": "proposed",
      "evidence_id": "evidence-ki-onboarding-v1-000001",
      "rule_ids": ["rule-ki-onboarding-v1-000001-requires"]
    }
  ],
  "agent_rules": [
    "Use only usable_knowledge items as task rules.",
    "Treat rejected knowledge as excluded unless include_rejected is true.",
    "Resolve evidence before making a claim to a downstream user or system.",
    "Use Knowledge Relations for graph traversal and RDF-compatible assertions.",
    "Use decision_rules for conditional task handling; do not infer conditions from prose when structured rules exist.",
    "Check freshness and conflict reports before finalizing a decision."
  ]
}

(trimmed for length — the real response also includes decision_rules, concepts, evidence, knowledge_relations, and freshness/conflict reports.)

Connect an MCP-capable agent — the same tools are exposed over the Model Context Protocol on stdio, and the server tells the connecting agent how to ground its answers before it's asked anything.

sopkb-mcp <bundle_dir> doesn't open a network port: it's a stdio server — it reads one JSON-RPC request per line from stdin and writes one response per line to stdout. In practice you don't run it by hand; your MCP client spawns it as a subprocess and owns its stdin/stdout for you. Point your client's config at it:

json
{
  "mcpServers": {
    "kl4a": {
      "command": "sopkb-mcp",
      "args": ["/absolute/path/to/demo-bundle"]
    }
  }
}

Use an absolute path for the bundle — the client launches the process from its own working directory, not the bundle's. In Claude Code, the equivalent one-liner is:

bash
claude mcp add kl4a -- sopkb-mcp /absolute/path/to/demo-bundle

The printf ... | sopkb-mcp ... example below is the same protocol driven by hand, useful for verifying the server works before wiring up a client — not how you'd use it day to day. Real captured output:

console
$ printf '%s\n%s\n' \
    '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \
    '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"bundle.describe","arguments":{}}}' \
    | sopkb-mcp demo-bundle
json
{"id": 1, "jsonrpc": "2.0", "result": {"capabilities": {"tools": {}}, "instructions": "Ground every answer only in what these tools return — never in general/internet/training-data knowledge, even when labeled as such. Call knowledge.search (or agent.context) first; if nothing relevant comes back, say explicitly that this knowledge base has no grounded answer for that part instead of filling the gap. (...)", "protocolVersion": "2024-11-05", "serverInfo": {"name": "sopkb", "version": "0.0.1"}}}
{"id": 2, "jsonrpc": "2.0", "result": {"content": [{"text": "{\n  \"id\": \"demo-bundle\",\n  \"knowledge_item_count\": 1,\n  \"profile\": \"sop-knowledge-bundle\",\n  \"source_count\": 1,\n  \"status\": \"draft\",\n  \"title\": \"Demo Bundle\"\n}", "type": "text"}]}}

(the instructions string is truncated above with (...) — it's several sentences longer in the real response, laying out the full grounding contract for the connecting agent.)

All MCP tools are read-only by default (knowledge.search, knowledge.get, sections.get, evidence.get, agent.context, ...); the one mutating tool, review.note, is disabled unless the server is started with --enable-review-notes. See the Desktop UI Guide for the in-app agent chat that consumes the same context.

Commands

CommandPurpose
sopkb-cli init <bundle_dir>Create an empty knowledge bundle
sopkb-cli scan <source_dir> --bundle <bundle_dir>Inventory and checksum source documents (.md, .txt, .pdf, .docx)
sopkb-cli normalize <bundle_dir>Convert sources to normalized Markdown, split into sections
sopkb-cli mine <bundle_dir> --provider fixture|azure-llmPropose knowledge items from normalized sections
sopkb-cli review approve|reject|defer|comment <bundle_dir> <id> --rationale <text>Record a human review decision, with rationale
sopkb-cli review edit <bundle_dir> <id> --field <f> --value <v> --rationale <text>Correct a field on a knowledge item, with rationale
sopkb-cli validate <bundle_dir>Check bundle structure and required fields; non-zero exit on errors
sopkb-cli export <bundle_dir> --format graph-json,rdfRe-sync OKF documents and write derivative exports
sopkb-cli knowledge search <bundle_dir> <query>Free-text search over knowledge items
sopkb-cli agent context <bundle_dir> --task TASKTask-scoped context: usable knowledge, rules, evidence, relations
sopkb-mcp <bundle_dir>Expose the same read-only tools over MCP for any MCP-capable agent

The desktop app wraps this same pipeline behind a GUI — see the Desktop UI Guide.

The schema layer: OKF v0.2

Every bundle is built on OKF, Google's Open Knowledge Format — Markdown files with YAML frontmatter that turn a folder of documents into a queryable knowledge graph. KL4A populates the v0.2 trust-signal fields for real, not as placeholders:

  • provenance — where a claim's evidence came from, down to the exact source span.
  • verified — actor and date, written only when a human approves the item through the review screen or sopkb-cli review approve.
  • lifecycle_status — active, superseded, retired, or conflicted, so a stale claim doesn't sit next to a current one unmarked.

Because it's plain OKF, the bundle is readable and diffable without KL4A at all — the app is one way to produce and consume it, not a required runtime.

Fixture or LLM — both are first class

mine runs either way, and every other command works the same regardless of which one produced the knowledge:

  • fixture — offline, deterministic pattern matching over obligation phrases (must, shall, should record, ...). No key, no network call, no per-run variance. (Note: unlike the app's other steps, mine's own default provider is azure-llm, not fixture — pass --provider fixture explicitly for the offline path, as shown above.)
  • azure-llm trades determinism for recall: an LLM proposes claims (including ones that don't use an obligation keyword), each still required to carry a source_text span — checked against the section it claims to come from, and flagged span_status: "llm_claimed" rather than trusted blindly when it can't be located verbatim.

Learn more

License

Apache-2.0 — see LICENSE.

Cài đặt

TypingMind
{
  "mcpServers": {
    "kl4a": {
      "command": "sopkb-mcp",
      "args": [
        "/absolute/path/to/demo-bundle"
      ]
    }
  }
}

Dùng MCP Knowledge Layer For Agents (KL4A) với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối Knowledge Layer For Agents (KL4A), bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. Bạn có thể chạy MCP ngay trên thiết bị của mình hoặc kết nối qua URL của máy chủ MCP từ xa.

Cách 1: Dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm Knowledge Layer For Agents (KL4A) làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của Knowledge Layer For Agents (KL4A).
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "kl4a": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của Knowledge Layer For Agents (KL4A), sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của Knowledge Layer For Agents (KL4A).
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng Knowledge Layer For Agents (KL4A) giúp tôi làm việc này không?
Knowledge Layer For Agents (KL4A)
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng Knowledge Layer For Agents (KL4A).

Cách 2: Thêm URL máy chủ MCP

Dùng cách này khi Knowledge Layer For Agents (KL4A) đã được lưu trữ từ xa hoặc nhóm của bạn muốn có một trình kết nối dùng chung cho nhiều người dùng.

1

Mở mục Trình kết nối MCP

Trong TypingMind, vào Plugin, mở mục Trình kết nối MCP, rồi chọn Thêm URL.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Vào mục Plugin.
  3. Mở mục Trình kết nối MCP.
  4. Nhấp vào Thêm URL.
Biểu mẫu Thêm URL máy chủ MCP tùy chỉnh của TypingMind
2

Dán URL máy chủ

Nhập URL máy chủ MCP do nhà cung cấp cung cấp vào trường URL máy chủ. Thêm tên kết nối, mô tả, biểu tượng, header HTTP tùy chỉnh hoặc cài đặt ứng dụng khách OAuth nếu máy chủ yêu cầu.

  1. Dán URL máy chủ MCP do nhà cung cấp cung cấp vào trường URL máy chủ.
  2. Nhập tên kết nối cho Knowledge Layer For Agents (KL4A).
  3. Thêm mô tả và biểu tượng nếu bạn muốn dễ nhận biết kết nối hơn.
  4. Thêm header HTTP tùy chỉnh hoặc thông tin ứng dụng khách OAuth nếu máy chủ yêu cầu xác thực.
3

Tạo kết nối

Nhấp vào Tạo kết nối, sau đó quay lại danh sách Plugin và xác nhận kết nối MCP mới đang hoạt động.

  1. Nhấp vào Tạo kết nối.
  2. Quay lại danh sách trình kết nối MCP.
  3. Xác nhận kết nối Knowledge Layer For Agents (KL4A) hiển thị trạng thái đang hoạt động.
  4. Làm mới danh sách plugin nếu kết nối chưa xuất hiện ngay.
4

Đổi mô hình mà không cần kết nối lại

Bắt đầu cuộc trò chuyện với mô hình bạn thích, bật các công cụ của Knowledge Layer For Agents (KL4A) trong mục Plugin và chuyển sang mô hình khác khi cần. Kết nối MCP vẫn sẵn dùng trong không gian làm việc TypingMind.

  1. Bắt đầu cuộc trò chuyện mới trong TypingMind.
  2. Chọn mô hình AI bạn muốn dùng.
  3. Bật các công cụ của Knowledge Layer For Agents (KL4A) trong mục Plugin.
  4. Yêu cầu mô hình dùng công cụ khi cần.
  5. Chuyển sang mô hình AI khác và dùng lại cùng kết nối MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng Knowledge Layer For Agents (KL4A) giúp tôi làm việc này không?
Knowledge Layer For Agents (KL4A)
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng Knowledge Layer For Agents (KL4A).

Câu hỏi thường gặp

Máy chủ MCP Knowledge Layer For Agents (KL4A) dùng để làm gì?

Knowledge Layer For Agents (KL4A) là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP Knowledge Layer For Agents (KL4A) với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng Knowledge Layer For Agents (KL4A) với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP Knowledge Layer For Agents (KL4A) với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối Knowledge Layer For Agents (KL4A), bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP Knowledge Layer For Agents (KL4A) với TypingMind?

Bạn có thể kết nối Knowledge Layer For Agents (KL4A) trong TypingMind bằng trình kết nối MCP cục bộ hoặc bằng cách thêm URL máy chủ MCP từ xa. Dùng trình kết nối cục bộ khi máy chủ cần truy cập tệp, ứng dụng hoặc tài nguyên riêng trên thiết bị của bạn; dùng URL máy chủ khi máy chủ MCP được lưu trữ từ xa.

MCP Knowledge Layer For Agents (KL4A) cung cấp những công cụ nào trong TypingMind?

Knowledge Layer For Agents (KL4A) cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP Knowledge Layer For Agents (KL4A) không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu Knowledge Layer For Agents (KL4A) yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇