← Back to directory
C

ContextWeaver

Community
A Codebase Context Engine Woven for AI Agents
GitHub source repository ↗
★ 294 Stars Category · Dev Tools Popular Source revision bb0889832456
53FMRS · D
Reliability
10/20
Security and permissions
8/20
Maintenance
12/20
Documentation
13/20
Setup experience
10/20

Overall positive. Hybrid search and context expansion effectively improve retrieval quality, but reliance on external APIs may be a concern for privacy-sensitive environments. Setup is simple, suitable for AI-assisted development.

Read the FMRS scoring method →

ContextWeaver is an MCP-based semantic code retrieval engine that uses hybrid search (vector + lexical), AST-based semantic chunking, three-stage context expansion, and token-aware packing to provide precise, relevant code context for LLMs. Supports TypeScript, JavaScript, Python, Go, Java, Rust.

Tools

codebase-retrieval
Retrieves the most relevant code snippets from the repository based on a semantic request and optional technical terms, including surrounding context.

Setup

  1. Install globally: npm install -g @hsingjui/contextweaver or pnpm add -g @hsingjui/contextweaver.
  2. Initialize config: run contextweaver init to create ~/.contextweaver/.env, then fill in Embedding and Reranker API keys and models.
  3. Index your repository: run contextweaver index in the root directory.
  4. Start MCP server: run contextweaver mcp.
claude_desktop_config.json
{
  "mcpServers": {
    "contextweaver": {
      "command": "contextweaver",
      "args": [
        "mcp"
      ]
    }
  }
}

Fit and risk

Best for

  • AI-assisted programming tools requiring semantic code retrieval.
  • Developers looking to reduce manual code searching.
  • Agent applications that need cross-file dependency understanding.

Not for

  • IDE plugins needing real-time code editing or modification.
  • Offline environments without access to external embedding APIs.
  • Scenarios requiring search over extremely large codebases (millions of files).

Required permissions

  • Needs to access the codebase file system (read).
  • Needs to call external Embedding and Reranker APIs (network requests).
  • Needs to write to the config directory ~/.contextweaver for storing indexes and logs.

Risks and side effects

  • API key leakage risk: store keys in the config file securely.
  • Index building may consume significant memory and CPU, especially on large codebases.
  • Retrieved results may contain sensitive code; output access should be controlled.

Troubleshooting

  1. Check that ~/.contextweaver/.env is correctly configured with API keys and model names.
  2. Ensure the repository path is correct and readable.
  3. View logs at ~/.contextweaver/logs/app.YYYY-MM-DD.log; run with LOG_LEVEL=debug for details.
  4. If index seems stale, run contextweaver index --force to rebuild.

Use cases

AI coding assistants that need to quickly understand large codebase structures and specific functionality implementations.
Developers who want to query the codebase using natural language, e.g., 'How is the user authentication flow implemented?'
Integrating MCP into IDEs or chat tools to provide repo retrieval capabilities to agents.

Supported clients

Claude DesktopFull support