bd-explore

bd-explore

Enables AI agents to query a beads store for issues, notes, comments, and memories, returning full verbatim content and relationship neighborhoods under an output budget.

Category
访问服务器

README

bd-explore

CI Python 3.10+ Zero dependencies License: MIT

Ask a beads store questions, the way codegraph explore asks a codebase: one call returns the most relevant beads verbatim — description, notes, comments, close reason — plus each hit's relationship neighborhood, under an output budget.

Fills the gap the stock bd CLI leaves: bd search covers titles, bd query is structured-only, and nothing searches notes, comments, or close reasons — which is where a mature store keeps most of its knowledge. bd memories is indexed too (the plain CLI truncates memory bodies; this returns them whole).

Docs site: https://halaprix.github.io/bd-explore/

$ bd-explore "why did we re-point SYRP status:open"

═══ SYRP-142 [OPEN · P1 · task · updated 2026-08-12]
    Re-point SYRP feed to the v2 oracle
    The v1 oracle staleness window regressed after the chain upgrade…
    COMMENT (ksz 2026-08-11):
    Decision: re-point rather than patch v1 — see close reason on SYRP-118.
    ── neighborhood ──
    blocked by: SYRP-139 — Oracle failover runbook [in_progress]
    child of: SYRP-100 — Oracle migration epic [in_progress]
    mentions: SYRP-118

Key Features

  • Deep Verbatim Search: Full Porter-stemmed FTS5 search across title, description, design, acceptance criteria, notes, dated author comments, close reasons, and memories.
  • Relational Neighborhood Graphs: Surfaces 1-hop dependencies (blocks, blocked-by, parent-child, supersedes, discovered-from, related), cross-prose mention references, and GitHub issue/PR links (#NNN).
  • Transitive Blast Radius: Query transitive dependency chains (--blast <id>) to see blockers, downstream dependents, and epic hierarchy before touching code.
  • Built-in Stdio MCP Server: Zero-dependency JSON-RPC 2.0 stdio Model Context Protocol (MCP) server providing the bd_explore tool to modern AI coding assistants.
  • Multi-Target Platform Installer: Automated discovery and setup for Claude Code, Gemini CLI, Antigravity IDE, OpenAI Codex, Cursor, and AGENTS.md.
  • Beads Persistent Memory Injection: Automatically sets beads memory (bd remember --key bd-explore) so every bd prime session primes agents with bd-explore context.
  • Strict Output Budgeting: Output character budget (--budget 24000) prevents context-window blowout in LLM workflows.
  • Zero Runtime Dependencies: Pure Python 3.10+ standard library (sqlite3, json, argparse).

Installation

Standalone Shell Installer

Install bd-explore into ~/.local/bin and automatically configure detected agent platforms:

# From repository clone
./install.sh

# Standalone uninstall
./install.sh --uninstall

Python Package Installation

# Standard pip install
pip install .

# Editable install for development
pip install -e .

Usage

CLI Search

# Free text search across all fields (porter-stemmed FTS)
bd-explore "why did we re-point SYRP"

# Compose field filters with free text (codegraph-style)
bd-explore "hash refresh status:open type:task priority:1"
bd-explore "swap oracle epic:rpm5"

# Target specific store or force reindex
bd-explore --store ~/Projects/my-project "auth refactor"
bd-explore --rebuild

# Control limits and output budget
bd-explore -n 3 --budget 16000 "database migration"

Supported Filters

Filter Syntax / Values Description
status: open, in_progress, closed, deferred, all Filter by status (all searches closed beads with lower rank)
type: bug, feature, task, epic, chore Filter by issue type
priority: 0, 1, 2, 3, 4 (or P0..P4) Filter by priority level
epic: <id-or-suffix> Filter issues belonging to an epic
id: <id-or-substring> Match issues by ID (substring / prefix)

Non-filter tokens (e.g. foo:bar) automatically fall through to free-text search. Tip: Quote your search string when it contains spaces, filter colons, or words matching subcommands (e.g. bd-explore "serve refactor").


Transitive Blast Radius

Compute the full transitive dependency graph for any bead:

bd-explore --blast 9o32

Outputs:

  • Upstream Blockers: All issues directly or transitively blocking this bead.
  • Downstream Blocked: All issues directly or transitively waiting on this bead.
  • Epic Ancestry: Direct and ancestor epics.

Stdio MCP Server

bd-explore includes a built-in JSON-RPC 2.0 stdio MCP server for agent integration. It supports both newline-delimited JSON (NDJSON) and HTTP-style Content-Length: header framing.

Run server directly:

bd-explore serve --mcp
# Or with explicit store:
bd-explore serve --mcp --store ~/Projects/my-project

MCP Tool: bd_explore

Exposes the bd_explore tool with schema:

  • query (string): Search query string with optional field filters (status:open type:task).
  • blast (string): Bead ID to calculate transitive blast radius.
  • limit (integer, default 5): Maximum number of seed beads.
  • budget (integer, default 24000): Output character budget cap.
  • store (string, optional): Explicit store path or repository directory.

Multi-Target Agent Installer

bd-explore install discovers installed AI developer tools, adds MCP configuration, injects marker-fenced agent guidelines, and injects beads persistent memory.

# Interactive setup (prompts for targets and location)
bd-explore install

# Automated non-interactive batch install
bd-explore install --yes

# Install for specific targets and location
bd-explore install --targets claude,gemini,cursor --location global --auto-allow --yes

# Uninstall configurations
bd-explore uninstall --yes

# Print MCP configuration snippet without modifying files
bd-explore print-config claude
bd-explore print-config cursor

Supported Platforms

Platform MCP Configuration Instructions & Rules
Claude Code ~/.claude.json / .mcp.json ~/.claude/CLAUDE.md / CLAUDE.md
Gemini CLI / Antigravity CLI ~/.gemini/settings.json / .gemini/settings.json ~/.gemini/GEMINI.md / GEMINI.md
Antigravity IDE ~/.gemini/config/mcp_config.json IDE instructions / workspace rules
OpenAI Codex ~/.codex/config.toml ~/.codex/AGENTS.md
Cursor ~/.cursor/mcp.json / .cursor/mcp.json .cursor/rules/bd-explore.mdc
Generic Agent Rules — ~/.config/AGENTS.md / AGENTS.md

Marker-Fenced Instructions

Instructions are safely injected with marker fences for clean updates and uninstalls:

<!-- BD_EXPLORE_START -->
## bd-explore

In repositories with a beads store (a `.beads/` directory exists at the repo root), reach for `bd-explore` BEFORE searching raw files or relying only on `bd search`:

- **MCP tool** (when available): `bd_explore` answers questions about beads/issues/decisions/memories verbatim — description, notes, comments, close reason, plus relationship neighborhood under an output budget.
- **Shell** (always works): `bd-explore "<query>"` (e.g. `bd-explore "why did we re-point SYRP status:open"`, `bd-explore --blast <id>`).

If there is no `.beads/` directory, skip bd-explore.
<!-- BD_EXPLORE_END -->

What Gets Indexed

Content Source Notes
Title, description, design, acceptance criteria .beads/issues.jsonl Primary issue content
Notes, close reason .beads/issues.jsonl Critical context and postmortems
Author comments .beads/issues.jsonl Timestamped conversation history
Full memory bodies bd memories --json Persistent memory records
Explicit dependency edges dependencies array blocks, parent-child, supersedes, related, etc.
Mention edges Prose cross-references Mined regex matches of bead IDs cited across issue prose
GitHub references Prose cross-references Mined #NNN issue and pull request references

Design Principles

  1. Derived and disposable. Reads .beads/issues.jsonl (requires export.auto: true) into a SQLite FTS5 index under ~/.cache/bd-explore/, rebuilt automatically when the export changes. The beads store remains the sole source of truth; delete the cache freely.
  2. Staleness is first-class. Every hit is stamped [STATUS · P<n> · type · updated YYYY-MM-DD].
  3. Closed beads included by default. History is most of the value; closed hits rank below open ones at equal relevance. Use status:open to narrow.
  4. Context window friendly. Strictly enforces output character budgets to fit comfortably into agent conversations.

Architecture

The explore pipeline sits behind one deep module; everything else adapts to it.

              CLI (cli.py)              MCP server (mcp.py)
                   │  thin adapters: args / JSON-RPC  │
                   └──────────────┬───────────────────┘
                                  ▼
                      Explorer (explorer.py)
        explore(query, …) → str   ·   blast(id, …) → str
     owns store discovery, index freshness, connection
       lifetime, defaults/clamping, canonical errors
                   ┌──────────────┴───────────────────┐
                   ▼                                  ▼
          index.py (SQLite FTS5,             search.py (BM25 search,
          mention mining, cache)             hydrate → pure render)
  • explorer.py — the only interface callers need: explore() / blast() in, formatted text out, ExploreError on failure.
  • index.py — parses .beads/issues.jsonl and bd memories into a derived SQLite FTS5 cache, rebuilt atomically when the export changes.
  • search.py — BM25 search and query parsing; hydrate() batch-fetches neighborhoods and titles (two queries total), render() is pure and owns all budget/truncation logic.
  • installer/ — multi-target platform adapters behind a common install/uninstall seam.

Domain vocabulary lives in CONTEXT.md; repo conventions in CLAUDE.md.


Development

# Run the full test suite (stdlib unittest — no test dependencies either)
PYTHONPATH=src python3 -m unittest discover tests -v

# Run one module / one case
PYTHONPATH=src python3 -m unittest tests.test_explorer
PYTHONPATH=src python3 -m unittest tests.test_render.TestRenderPure

# Editable install
pip install -e .

CI runs the suite on Linux and macOS across Python 3.10–3.14. See CHANGELOG.md for release history.


Requirements

  • Python 3.10+
  • SQLite with FTS5 virtual table support (standard in official CPython distributions)

License

MIT License. See LICENSE for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选