@snissn/pi-treedb0.2.0
Pi coding agent extension for TreeDB: commit-pinned code search, AST symbols, GitHub history, code-linked agent memory with git drift warnings, and OpenTelemetry spans.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
@snissn/pi-treedb
Pi coding-agent extension for treedb-repo-mcp — commit-pinned local code search, pure-Go AST symbol lookup, GitHub issue/PR search, code-linked persistent agent memory with automatic git drift warnings, and OpenTelemetry span instrumentation.
Prerequisites
Install the static treedb-repo-mcp binary (Linux/macOS, amd64/arm64):
curl -fsSL https://raw.githubusercontent.com/snissn/treedb-repo-mcp/main/scripts/install.sh | sh
Install in Pi
pi install npm:@snissn/pi-treedb
Or test locally from a checkout of this repository:
pi -e ./packages/pi-treedb
Features
- Automatic
HEADcommit pinning: Resolvesgit rev-parse HEADin the active workspace and injectsrefautomatically ontreedb_search,treedb_find_symbol,treedb_phrase_search,treedb_file_context, andtreedb_memory_recall(fail-closed overlay verification; passref: ""or--treedb-no-auto-refto opt out). - Prompt-cache-safe first-turn memory recall: Loads active project memories via
memory_recallon the first turn of a session into a compact<treedb_memories>block, flags[STALE CODE]warnings when linked files changed sincelinked_commit_sha, keeps the block byte-identical across turns to preserve prompt caching, and refreshes automatically aftersession_compactor/treedb-refresh. - OpenTelemetry composition (
pi-otel-compatible): Emitstreedb.mcp.*client spans via@opentelemetry/apiwithgen_ai.tool.name,treedb.latency_ms,treedb.response_bytes,treedb.estimated_tokens,treedb.verified_commit,treedb.overlay_files, andtreedb.stale_memorieswhenever a global OTelTracerProvider(such aspi-otel) is active. - Session telemetry & status commands:
/treedb-stats,/treedb-status, and/treedb-refresh.
Configuration
| Flag | Environment Variable | Purpose |
|---|---|---|
--treedb-url |
TREEDB_MCP_URL |
Connect to a shared Streamable HTTP daemon (e.g. http://127.0.0.1:7337/mcp) |
--treedb-config |
TREEDB_MCP_CONFIG |
Multi-repo repos.toml path (auto-detected at ~/.config/treedb-mcp/repos.toml if present) |
--treedb-bin |
TREEDB_MCP_BIN |
Explicit path to treedb-repo-mcp binary |
| (none) | TREEDB_MCP_REPO |
Default target repo name in multi-repo mode |
--treedb-no-auto-ref |
TREEDB_PI_AUTO_PIN_REF=0 |
Disable automatic HEAD commit pinning |
--treedb-no-auto-memory |
TREEDB_PI_AUTO_MEMORY=0 |
Disable automatic first-turn <treedb_memories> recall |
Registered Tools
treedb_search— Unified BM25F/hybrid search across code, docs, and GitHub issues/PRs (defaults to compactpassagemode)treedb_find_symbol— Pure-Go AST symbol-definition lookup (defs_only: trueby default)treedb_phrase_search— Native Block-Max WAND exact phrase and proximity (slop) searchtreedb_file_context— Targeted commit-pinned line-range or chunk readertreedb_memory_recall— Code-linked memory recall with automatic git drift warningstreedb_memory_retain— Persist code-linked memories (with fail-closed secret scanning andsupersedes_idversioning)treedb_memory_invalidate— Soft-invalidate outdated memoriestreedb_status— Inspect repo commit lag, watcher health, and TreeDB storage stats