@maphew/pi-beads0.1.0
Pi extensions for Beads (bd): live bd prime workflow context, status, session binding, guardrails, and typed bd tools.
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
@maphew/pi-beads
Pi extensions for Beads (bd).
Pi has no bd SessionStart hook, unlike Claude Code, Cursor, and Codex. These
extensions close that gap so a pi agent always has live Beads workflow context
and the active git-authority policy, without having to remember to run bd prime
itself.
Extensions
| Extension | What it does |
|---|---|
beads-prime |
Injects live bd prime context into the system prompt |
beads-status |
Shows active bead + ready count in the TUI footer |
beads-session |
Binds pi session to claimed bead: BEADS_ACTOR, session name, shutdown handoff notes |
beads-guard |
Blocks/confirm-guards destructive bd shell calls (edit, delete, reason-less/forced close) |
beads-tools |
Typed bd_create / bd_update / bd_close / bd_ready tools with JSON args |
Install
pi install npm:@maphew/pi-beads
or directly from git:
pi install git:github.com/maphew/pi-beads
For a single run without installing:
pi -e git:github.com/maphew/pi-beads
beads-prime
- On
session_start, finds the nearest.beads/workspace (walking up from the current directory, honoringBEADS_DIR) and runsbd prime --hook-json, cachinghookSpecificOutput.additionalContext. - On
before_agent_start, adds that text as a<beads>system-prompt section, so the liveagent.profile/ git-authority policy and workflow rules stay current and survive context compaction. - No-ops in repositories without a
.beads/workspace: nobdprocess is spawned there, so it is safe to install globally and use everywhere.
The /beads command reports or refreshes the injected context.
beads-status
- On
session_startandturn_end, finds the nearest.beads/workspace (walking up from the current directory, honoringBEADS_DIR) and renders the most recently updated in-progress bead plus thebd readycount viactx.ui.setStatus(), e.g.◐ pi-kilo-xg2.1: show active… · ready: 3. - Clears the status on
session_shutdown. - No-ops outside a
.beads/workspace and in non-UI modes (print/RPC): nobdprocess is spawned there.
Configuration
| Env var | Effect |
|---|---|
BD_BIN |
Path/name of the bd binary (default: bd) |
PI_BEADS_STATUS_DISABLE=1 |
Disable this extension |
BEADS_DIR |
Honored when set to a .beads dir or workspace root |
beads-session
- On
session_start, setsBEADS_ACTOR=pi:<sessionId>so everybdinvocation this session makes is attributed to the pi session id inbd history/actor fields (restored on shutdown). - In a
.beads/workspace, binds the session to the most recently updated in-progress bead and, when the session has no name yet, names it<id>: <title>viapi.setSessionName(). - On
session_shutdown, appends a resume note to the bound bead with session id, session file, shutdown reason, and leaf id, so the next session picks up exact state. - Set
PI_BEADS_SESSION_RENAME=0to skip renaming,PI_BEADS_SHUTDOWN_NOTES=0to skip the shutdown note,PI_BEADS_SESSION_DISABLE=1to disable everything.
beads-guard
- On
tool_callforbash/powershell, inspectsbdinvocations:bd edit— always blocked (opens$EDITORand hangs the agent); usebd updateflags instead.bd delete,bd closewithout--reason, and--forceoverrides require confirmation in TUI sessions and are blocked headless (safe default).
- Commands are split on shell separators before analysis, so
bd list; bd edit xis caught too. All otherbdflows pass through untouched. - Set
PI_BEADS_GUARD_DISABLE=1to disable.
beads-tools
- On
session_startin a.beads/workspace, registers typed tools:bd_create(title, description?, type?, priority?, parent?)bd_update(id, claim?, status?, assignee?, title?, description?, notes?, append_notes?, priority?)bd_close(ids, reason)—reasonis required by the schemabd_ready()
- Runs
bdwith the workspace root as cwd; results are the CLI output with the exit code indetails. - Set
PI_BEADS_TOOLS_DISABLE=1to disable.
Configuration
| Env var | Effect |
|---|---|
BD_BIN |
Path/name of the bd binary (default: bd) |
PI_BEADS_PRIME_DISABLE=1 |
Disable this extension |
BEADS_DIR |
Honored when set to a .beads dir or workspace root |
Requirements
The bd CLI must be installed and on PATH (or set BD_BIN).
Development
The extensions are plain TypeScript with no build step. Load a working copy directly:
pi -e ./extensions/beads-prime.ts
License
MIT. See LICENSE.