Skip to main content

Connect AI Agents to your Local Documents

Project description

Banner

🇨🇳 中文 | 🇬🇧 English

ContextBridge (cbridge-agent)

Connect AI Agents to your Local Documents

Local knowledge base for OpenClaw, Cursor and AI assistants. Read your documents instantly—Word, Excel, PDF. No uploads. Privacy first.

License: MIT Python 3.9+ PyPI version

🌐 Official Website: https://contextbridge.chat

OpenClaw Skill

Native skills for ContextBridge local-context-bridge are available on clawhub.ai.

clawhub install local-context-bridge

Once installed, OpenClaw will automatically detect ContextBridge — no additional configuration needed to search your local documents.

Quick Start

Installation

pip install cbridge-agent

The vector model will be downloaded automatically on the first run.

Initialization

cbridge init

Follow the interactive wizard to complete the configuration (the default workspace is at ~/.cbridge).

Add a Document Directory

cbridge watch add /path/to/your/documents

File changes in this directory will be automatically synced to the vector database.

Search Document Content

cbridge search ContextBridge

Core Feature: Intelligent Text Chunking

ContextBridge uses a three-tier progressive retrieval architecture to ensure AI can precisely locate document content:

L0 Layer: Document Abstract

Automatically extracts document title and first paragraph core content for quick relevance assessment.

L1 Layer: Structural Outline

Parses document heading hierarchy (H1-H3) to build a complete content navigation map.

L2 Layer: Semantic Chunking

  • Default chunk size: 800 characters
  • Smart overlap: 150 characters (maintains context continuity)
  • Paragraph-aware: Splits at natural paragraph boundaries to avoid semantic fragmentation
  • Markdown-friendly: Recognizes code blocks, lists, and other structures to preserve formatting integrity

Retrieval Process

  1. Intent Filtering: Quickly match relevant documents at L0/L1 layers
  2. Fine-grained Retrieval: Precisely search relevant fragments in L2 layer of matched documents
  3. Context Assembly: Return document abstract + relevant excerpts to provide complete context

This design allows AI to quickly locate target documents while obtaining precise contextual information, avoiding the "can't see the forest for the trees" problem of traditional RAG systems.

Other AI Clients

In addition to OpenClaw, ContextBridge also works with Claude Desktop, Cursor, and other MCP-compatible clients:

{
  "mcpServers": {
    "context-bridge": {
      "command": "cbridge",
      "args": ["mcp"]
    }
  }
}

CLI Commands

Command Description
cbridge init Interactive initialization (the service starts automatically; no need to run cbridge start manually)
cbridge watch add <dir> Add a directory to watch
cbridge watch list List watched directories
cbridge watch remove <dir> Remove a watched directory
cbridge start Start the watcher service
cbridge serve Start both the API and watcher services
cbridge index Rebuild the index from scratch
cbridge search "query" Test semantic search
cbridge status Check running status
cbridge lang <zh|en> Switch language
cbridge logs -f View logs

FAQ

Q: How do I switch the PDF parsing strategy? A: Edit the configuration file at ~/.cbridge/config.yaml, and set parser.pdf.strategy to docling (higher accuracy but slower) or markitdown (lightweight default).

Q: What file formats are supported? A: PDF, DOCX, XLSX, PPTX, MD, TXT, and more. MarkItDown covers the vast majority of office document formats.

Q: Where is the indexed data stored? A: All data is stored locally in the ~/.cbridge/ directory, including the vector database and configuration files.

Contributing

Issues and Pull Requests are welcome.

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cbridge_agent-0.1.21.tar.gz (59.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cbridge_agent-0.1.21-py3-none-any.whl (66.1 kB view details)

Uploaded Python 3

File details

Details for the file cbridge_agent-0.1.21.tar.gz.

File metadata

  • Download URL: cbridge_agent-0.1.21.tar.gz
  • Upload date:
  • Size: 59.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for cbridge_agent-0.1.21.tar.gz
Algorithm Hash digest
SHA256 2063c618622981b3706475b077e5291593b3c8b2b9f3e2cc0417a2cbf5fa2313
MD5 10eeee4fa29f5e7b580a2c7d6fb5f328
BLAKE2b-256 c74d47ab7b7385c03f510ad87d9903feeac2e5efb4a2003c44f01b351467f241

See more details on using hashes here.

File details

Details for the file cbridge_agent-0.1.21-py3-none-any.whl.

File metadata

  • Download URL: cbridge_agent-0.1.21-py3-none-any.whl
  • Upload date:
  • Size: 66.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for cbridge_agent-0.1.21-py3-none-any.whl
Algorithm Hash digest
SHA256 fcb928639dcdb14987242991e72d89f596a6dcd0236aca6555fba39828b55647
MD5 30e715e9dd4726d99ebb28d3dd7bd4b7
BLAKE2b-256 a615e77a557e50e3af3d57dc563e68a2fee8654c1d153ef0ac643a70a4e559b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page