Skip to main content

Connect AI Agents to your Local Documents

Project description

🇨🇳 中文 | 🇬🇧 English

ContextBridge (cbridge-agent)

Connect AI Agentsto 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.

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.19.tar.gz (54.1 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.19-py3-none-any.whl (63.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cbridge_agent-0.1.19.tar.gz
  • Upload date:
  • Size: 54.1 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.19.tar.gz
Algorithm Hash digest
SHA256 ce17e7e58b90b42f5b556040fe98e38b3a2e0f06fad3252bddad694ac2fd4dff
MD5 ce4067e06af6d43131578a754f97ca9d
BLAKE2b-256 41995399c8a6b602e2142d41b4fcf006d4bfd69dbec8c1ed568f38ee8aaf69f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cbridge_agent-0.1.19-py3-none-any.whl
  • Upload date:
  • Size: 63.9 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.19-py3-none-any.whl
Algorithm Hash digest
SHA256 98f8f4e8aff0c44cb2c849d771d54fdb17da5d5e1b9624b2d63a431149810288
MD5 b7ab24f8665fecb698d02ca7f93fd132
BLAKE2b-256 9d7c8d6be28f3be0a7b815ee6576ed7ec359397ff2c4fbc1141e258c66303a12

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