Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 63 additions & 33 deletions .beads/.gitignore
Original file line number Diff line number Diff line change
@@ -1,40 +1,70 @@
# SQLite databases
*.db
*.db?*
*.db-journal
*.db-wal
*.db-shm
# Dolt database (managed by Dolt, not git)
dolt/
embeddeddolt/

# Runtime files
bd.sock
bd.sock.startlock
sync-state.json
last-touched
.exclusive-lock

# Local history and recovery
.br_history/
.br_recovery/
# Daemon runtime (lock, log, pid)
daemon.*

# Local version tracking
.local_version
# Push state (runtime, per-machine)
push-state.json

# Runtime files
# Lock files (various runtime locks)
*.lock
*.tmp
*.sock
daemon.lock
daemon.log
daemon.pid
last-touched

# Credential key (encryption key for federation peer auth — never commit)
.beads-credential-key

# Local version tracking (prevents upgrade notification spam after git ops)
.local_version

# Worktree redirect file (contains relative path to main repo's .beads/)
# Must not be committed as paths would be wrong in other clones
redirect
sync-state.json

# Sync state and merge artifacts
# Sync state (local-only, per-machine)
# These files are machine-specific and should not be shared across clones
.sync.lock
beads.base.jsonl
beads.base.meta.json
beads.left.jsonl
beads.left.meta.json
beads.right.jsonl
beads.right.meta.json
sync_base.jsonl

# bv lock file
.bv.lock

# NOTE: Do not add negation patterns here.
# JSONL files and config files are tracked by git by default because no pattern above ignores them.
export-state/
export-state.json

# Ephemeral store (SQLite - wisps/molecules, intentionally not versioned)
ephemeral.sqlite3
ephemeral.sqlite3-journal
ephemeral.sqlite3-wal
ephemeral.sqlite3-shm

# Dolt server management (auto-started by bd)
dolt-server.pid
dolt-server.log
dolt-server.lock
dolt-server.port
dolt-server.activity

# Corrupt backup directories (created by bd doctor --fix recovery)
*.corrupt.backup/

# Backup data (auto-exported JSONL, local-only)
backup/

# Per-project environment file (Dolt connection config, GH#2520)
.env

# Legacy files (from pre-Dolt versions)
*.db
*.db?*
*.db-journal
*.db-wal
*.db-shm
db.sqlite
bd.db
# NOTE: Do NOT add negation patterns here.
# They would override fork protection in .git/info/exclude.
# Config files (metadata.json, config.yaml) are tracked by git by default
# since no pattern above ignores them.
18 changes: 9 additions & 9 deletions .beads/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

AgentV uses Beads for repo-local task tracking.

Use `br` for all Beads operations in this repository:
Use the original Beads CLI (`bd`, installed here as `beads`) for Beads operations in this repository:

```bash
br ready --json
br list --json
br show <issue-id> --json
br update <issue-id> --claim --json
br close <issue-id> --reason "Completed" --json
br sync --flush-only
bd ready --json
bd list --json
bd show <issue-id> --json
bd update <issue-id> --claim --json
bd close <issue-id> --reason "Completed" --json
bd export -o .beads/issues.jsonl
```

The durable task graph is tracked as JSONL in `.beads/issues.jsonl`. Local SQLite
databases, locks, history, and merge scratch files are ignored and should not be
The durable task graph is tracked as JSONL in `.beads/issues.jsonl`. Local database
files, locks, history, and merge scratch files are ignored and should not be
committed.
2 changes: 1 addition & 1 deletion .beads/config.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Beads Project Configuration
issue_prefix: av
issue_prefix: av
Empty file added .beads/interactions.jsonl
Empty file.
52 changes: 27 additions & 25 deletions .beads/issues.jsonl

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions .beads/metadata.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"database": "beads.db",
"jsonl_export": "issues.jsonl"
}
"database": "dolt",
"backend": "dolt",
"dolt_mode": "server",
"dolt_database": "av",
"project_id": "0b918411-8e81-4459-b853-3961bc21937a"
}
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ windsurf.mcp.json

# Gas Town / Beads shared state
.beads/hooks/
.beads/.br_history/
.beads/.bv.lock
.runtime/
.logs/
state.json

# NTM local project config embeds machine-specific paths
.ntm/config.toml

# bv (beads viewer) local config and caches
.bv/

# Claude Code local settings (contains secrets)
.claude/settings.local.json
.grepai/

# Beads / Dolt files (added by bd init)
.dolt/
*.db
.beads-credential-key
105 changes: 28 additions & 77 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,23 @@ AI agents are the primary users of AgentV—not humans reading docs. Design for

### Beads-First Orchestration
- Beads is AgentV's normal durable task graph. Use it for assignment, status, dependencies, handoff notes, decomposition, and resumability. Agent sessions are disposable workers that read and write the bead graph.
- Use `br` (beads_rust) for Beads operations. `br` is non-invasive and never commits or pushes; after `br sync --flush-only`, manually run `git add .beads/` and commit the exported state when the bead graph is part of the change.
- Use the original Beads CLI (`bd`, installed here as `beads`) for Beads operations. After mutating beads, explicitly run `bd export -o .beads/issues.jsonl`, then manually run `git add .beads/` and commit the exported state when the bead graph is part of the change. Do not rely on local auto-export behavior.
- Use the upstream bead-aware launcher from the EntityProcess agent plugin tooling for worker launch. The launcher should claim the bead, record a launch note, export `EP_TASK_ID`/`BEAD_ID`/`AGENTV_BEAD_ID`, then delegate to the existing `ep-spawn-agent` workflow.
- Use `ntm` for tmux session orchestration, monitoring, and dispatch when launching or tending worker sessions. NTM project names must resolve under `ntm config get projects_base`; set `AGENTV_NTM_SESSION` when the repo worktree is not directly under that base.
- GitHub remains the PR, CI, review, and merge surface. Do not use GitHub Issues or Projects as the internal AgentV task graph unless explicitly bridging external collaboration.

### Beads Ownership
- Use the `bv` robot workflow below for graph-aware triage and `br` for bead mutations.
- Use `bd ready --json`, `bd list --json`, and `bd show <id> --json` for Beads triage and inspection.
- `bv` may be used as an optional read-only viewer/triage sidecar, but only after refreshing the repo-local export:
```bash
REPO="$(git rev-parse --show-toplevel)"
BEADS_DIR="$REPO/.beads" bd export -o "$REPO/.beads/issues.jsonl"
```
Treat `.beads/issues.jsonl` as a read-only export for viewers. Do not use `bv` as the source of truth for mutations or claims.
- Create beads with short generated IDs. Do not pass `--slug`; the title carries the human-readable name, including `EPIC:` when useful.
- Claim work with the upstream bead-aware launcher when launching a worker, or with `br update <id> --claim --json` / `br update <id> --status in_progress --json` when working manually.
- Claim work with the upstream bead-aware launcher when launching a worker, or with `bd update <id> --claim --json` / `bd update <id> --status in_progress --json` when working manually.
- Keep the bead updated with notes for user-visible decisions, verification evidence, blockers, and handoff state.
- Before handoff or commit, run `br sync --flush-only`, then stage `.beads/` along with the code changes when the bead graph is part of the change.
- Before handoff or commit, run `bd export -o .beads/issues.jsonl`, then stage `.beads/` along with the code changes when the bead graph is part of the change. If hooks are added for this, they should be check-only: fail when `.beads/issues.jsonl` is stale and tell the user to export, but never mutate, stage, stash, or commit files automatically.
- Do not use `git stash` on shared checkouts. Other agents may be editing the same worktree, and stashing can hide or replay their changes in the wrong branch. If you need to isolate work, inspect `git status`, stage only your files, use a dedicated worktree, or ask before moving uncommitted changes. If a stash is genuinely unavoidable, immediately broadcast it through Agent Mail with the stash name, affected paths, reason, and recovery plan.

### MCP Agent Mail
Expand Down Expand Up @@ -268,7 +274,7 @@ bun run verify
bun run validate:examples
```

Beads sync is explicit. If you change the Beads graph, run `br sync --flush-only`, stage `.beads/`, and include the exported JSONL in the commit. Hooks must not silently mutate or stash shared worktrees.
Beads export is explicit. If you change the Beads graph, run `bd export -o .beads/issues.jsonl`, stage `.beads/`, and include the exported JSONL in the commit. Do not rely on auto-export as the source of truth. Hooks may check that the export is current, but must not silently mutate, stage, commit, or stash shared worktrees.

NTM hooks are optional local coordination tooling. Do not commit generated `.beads/hooks/*` files or local `.ntm/config.toml`; they embed machine-specific paths and can bypass the repo's normal Git behavior when installed via `core.hooksPath`.

Expand Down Expand Up @@ -574,99 +580,44 @@ The release script (`bun scripts/release.ts`) is what the Release workflow calls
## Python Scripts
When running Python scripts, always use: `uv run <script.py>`

<!-- bv-agent-instructions-v2 -->

---

## Beads Workflow Integration

This project uses [beads_rust](https://github.com/Dicklesworthstone/beads_rust) (`br`) for issue tracking and [beads_viewer](https://github.com/Dicklesworthstone/beads_viewer) (`bv`) for graph-aware triage. Issues are stored in `.beads/` and tracked in git.

### Using bv as an AI sidecar

bv is a graph-aware triage engine for Beads projects (.beads/beads.jsonl). Instead of parsing JSONL or hallucinating graph traversal, use robot flags for deterministic, dependency-aware outputs with precomputed metrics (PageRank, betweenness, critical path, cycles, HITS, eigenvector, k-core).

**Scope boundary:** bv handles *what to work on* (triage, priority, planning). `br` handles creating, modifying, and closing beads.

**CRITICAL: Use ONLY --robot-* flags. Bare bv launches an interactive TUI that blocks your session.**

#### The Workflow: Start With Triage

**`bv --robot-triage` is your single entry point.** It returns everything you need in one call:
- `quick_ref`: at-a-glance counts + top 3 picks
- `recommendations`: ranked actionable items with scores, reasons, unblock info
- `quick_wins`: low-effort high-impact items
- `blockers_to_clear`: items that unblock the most downstream work
- `project_health`: status/type/priority distributions, graph metrics
- `commands`: copy-paste shell commands for next steps

```bash
bv --robot-triage # THE MEGA-COMMAND: start here
bv --robot-next # Minimal: just the single top pick + claim command

# Token-optimized output (TOON) for lower LLM context usage:
bv --robot-triage --format toon
```

Before claiming, verify current state with `br show <id> --json` or `br ready --json`. `recommendations` can include graph-important blocked or assigned work; only `quick_ref.top_picks` and non-empty `claim_command` fields represent claimable work.

#### Other bv Commands

| Command | Returns |
|---------|---------|
| `--robot-plan` | Parallel execution tracks with unblocks lists |
| `--robot-priority` | Priority misalignment detection with confidence |
| `--robot-insights` | Full metrics: PageRank, betweenness, HITS, eigenvector, critical path, cycles, k-core |
| `--robot-alerts` | Stale issues, blocking cascades, priority mismatches |
| `--robot-suggest` | Hygiene: duplicates, missing deps, label suggestions, cycle breaks |
| `--robot-diff --diff-since <ref>` | Changes since ref: new/closed/modified issues |
| `--robot-graph [--graph-format=json\|dot\|mermaid]` | Dependency graph export |
This project uses the original Beads CLI (`bd`, installed here as `beads`) for issue tracking. Issues are stored in `.beads/` and tracked in git. Optional viewers such as `bv` read `.beads/issues.jsonl`; refresh that export with `bd` before viewing.

#### Scoping & Filtering
### bd Commands for Issue Management

```bash
bv --robot-plan --label backend # Scope to label's subgraph
bv --robot-insights --as-of HEAD~30 # Historical point-in-time
bv --recipe actionable --robot-plan # Pre-filter: ready to work (no blockers)
bv --recipe high-impact --robot-triage # Pre-filter: top PageRank scores
```

### br Commands for Issue Management

```bash
br ready # Show issues ready to work (no blockers)
br list --status=open # All open issues
br show <id> # Full issue details with dependencies
br create --title="..." --type=task --priority=2 # No --slug for routine work
br update <id> --status=in_progress
br close <id> --reason="Completed"
br close <id1> <id2> # Close multiple issues at once
br sync --flush-only # Export DB to JSONL
bd ready --json # Show issues ready to work (no blockers)
bd list --json # All issues
bd show <id> --json # Full issue details with dependencies
bd create "..." --type=task --priority=2
bd update <id> --status=in_progress --json
bd close <id> --reason="Completed" --json
bd close <id1> <id2> --json # Close multiple issues at once
bd export -o .beads/issues.jsonl
```

### Workflow Pattern

1. **Triage**: Run `bv --robot-triage` to find the highest-impact actionable work
2. **Claim**: Use `br update <id> --status=in_progress`
1. **Triage**: Run `bd ready --json` to find unblocked work and `bd show <id> --json` for details.
2. **Claim**: Use `bd update <id> --claim --json` or `bd update <id> --status=in_progress --json`.
3. **Work**: Implement the task
4. **Complete**: Use `br close <id>`
5. **Sync**: Always run `br sync --flush-only` at session end
4. **Complete**: Use `bd close <id> --reason="Completed" --json`.
5. **Export**: Run `bd export -o .beads/issues.jsonl` at session end when the bead graph changed.

### Key Concepts

- **Dependencies**: Issues can block other issues. `br ready` shows only unblocked work.
- **Dependencies**: Issues can block other issues. `bd ready` shows only unblocked work.
- **Priority**: P0=critical, P1=high, P2=medium, P3=low, P4=backlog (use numbers 0-4, not words)
- **Types**: task, bug, feature, epic, chore, docs, question
- **Blocking**: `br dep add <issue> <depends-on>` to add dependencies
- **Blocking**: `bd dep add <issue> <depends-on>` to add dependencies

### Session Protocol

```bash
git status # Check what changed
git add <files> # Stage code changes
br sync --flush-only # Export beads changes to JSONL
bd export -o .beads/issues.jsonl # Export beads changes to JSONL
git commit -m "..." # Commit everything
git push # Push to remote
```

<!-- end-bv-agent-instructions -->
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Also ensure:
- tests/docs are updated when relevant
- no unrelated refactors in the same PR
- CI-relevant checks pass locally when needed (`bun run verify` and `bun run validate:examples`)
- Beads changes are exported with `br sync --flush-only` and staged under `.beads/`
- Beads changes are exported with `bd export -o .beads/issues.jsonl` and staged under `.beads/`

## Workflow

Expand Down
Loading
Loading