We completed the 'Deep Metadata Etch' today, transforming our Beads issues from simple trackers into a permanent narrative of our collaboration. Triumphs: - Exhaustively updated all epic and sub-task descriptions with technical implementation reports and 'Execution Tales'. - Finalized the 'bb' agent CLI skill (bb.ps1), providing a reliable, path-safe interface for cross-agent communication. - Published ADR-001 and RFC-001 to document our coordination protocols. - Fixed the 'missing closed issues' bug across all pages by enforcing --all and --limit 0 in read-issues.ts. Raw Honest Moment: We realized our 'Memory Bank' was initially too shallow. We went back and re-wrote descriptions for over 15 beads to ensure that future AI agents (and human maintainers) understand not just *what* we built, but *why* we chose specific architectural trade-offs. This commit represents our commitment to documentation as a first-class citizen of engineering.
6.9 KiB
6.9 KiB
bb agent CLI Contract (bb-dcv.2)
Date: 2026-02-13
Owner: bb-dcv.2
Status: Draft implementation contract
1) Scope
Define exact command and data contracts for the thin coordination layer:
register,list,showsend,inbox,read,ackreserve,release,status
Out of scope:
- Beads lifecycle/dependency mutation semantics.
- MCP transport.
- Skill packaging (
bb-dcv.8).
2) System Boundary
Source of truth split:
bdowns issue lifecycle, status, dependencies, and claim.bb agentowns coordination metadata (identity, messages, reservations).
Hard rule:
- No direct writes to
.beads/issues.jsonl.
3) Root Paths and Storage
Root:
.beadboard/agent/
Layout:
.beadboard/agent/agents/<agent_id>.json.beadboard/agent/messages/<agent_id>.jsonl(recipient inbox stream).beadboard/agent/messages/index/<message_id>.json(message metadata).beadboard/agent/reservations/active.json.beadboard/agent/reservations/history.jsonl
File semantics:
*.jsonfiles are full-state snapshots.*.jsonlfiles are append-only event logs.- Timestamps use UTC ISO-8601.
4) Common CLI Conventions
Output modes:
- Human-readable default.
--jsonmachine-readable.
Common JSON response envelope:
{
"ok": true,
"command": "agent send",
"data": {},
"error": null
}
Error envelope:
{
"ok": false,
"command": "agent send",
"data": null,
"error": {
"code": "UNKNOWN_RECIPIENT",
"message": "Recipient agent is not registered."
}
}
5) Identity Commands
5.1 bb agent register
Input:
--name <agent_id>required.--display <display_name>optional.--role <role>required.--force-updateoptional (updates display/role only; never renames id).
Validation:
agent_idregex:^[a-z0-9]+(?:-[a-z0-9]+)*$.agent_idlength: 3..48.rolenon-empty.
Behavior:
- Create new agent if not present.
- If present and no
--force-update, fail withDUPLICATE_AGENT_ID. - Set
status=idleon create.
Stored schema (agents/<agent_id>.json):
{
"agent_id": "agent-ui-1",
"display_name": "UI Agent 1",
"role": "ui",
"status": "idle",
"created_at": "2026-02-13T22:00:00.000Z",
"last_seen_at": "2026-02-13T22:00:00.000Z",
"version": 1
}
5.2 bb agent list
Input:
--role <role>optional filter.--status <status>optional filter.
Output:
- Sorted by
agent_idasc.
5.3 bb agent show
Input:
--agent <agent_id>required.
Errors:
AGENT_NOT_FOUND.
6) Messaging Commands
Message categories:
HANDOFFBLOCKEDDECISIONINFO
Ack policy:
- Required for
HANDOFF,BLOCKED. - Optional for
DECISION,INFO.
Message schema:
{
"message_id": "msg_20260213_220001_7f3c",
"thread_id": "bead:bb-dcv.6",
"bead_id": "bb-dcv.6",
"from_agent": "agent-ui-1",
"to_agent": "agent-graph-1",
"category": "HANDOFF",
"subject": "Edge direction patch ready",
"body": "Graph directionality normalized. Please validate screenshots.",
"state": "unread",
"requires_ack": true,
"created_at": "2026-02-13T22:00:01.000Z",
"read_at": null,
"acked_at": null
}
6.1 bb agent send
Input:
--from <agent_id>required.--to <agent_id|broadcast>required.--bead <bead_id>required.--category <HANDOFF|BLOCKED|DECISION|INFO>required.--subject <text>required.--body <text>required.--thread <thread_id>optional (defaultbead:<bead_id>).
Validation:
- Sender and recipient must be registered (
broadcastexempt). bead_idrequired, non-empty.subjectandbodynon-empty.
Errors:
UNKNOWN_SENDERUNKNOWN_RECIPIENTMISSING_BEAD_IDINVALID_CATEGORY
6.2 bb agent inbox
Input:
--agent <agent_id>required.--state <unread|read|acked>optional.--bead <bead_id>optional.--limit <n>optional, default50, max500.
Output order:
created_atdesc.
6.3 bb agent read
Input:
--agent <agent_id>required.--message <message_id>required.
Behavior:
- Mark
state=readif currentlyunread. - Keep
ackedas terminal.
6.4 bb agent ack
Input:
--agent <agent_id>required.--message <message_id>required.
Validation:
- Only recipient may ack.
requires_ack=falsemessages may still be acked.
Behavior:
- Set
state=acked. - Set
acked_atif null.
Errors:
MESSAGE_NOT_FOUNDACK_FORBIDDEN
7) Reservation Commands
Reservation schema:
{
"reservation_id": "res_20260213_220900_e1a4",
"scope": "src/components/graph/*",
"agent_id": "agent-graph-1",
"bead_id": "bb-dcv.4",
"state": "active",
"created_at": "2026-02-13T22:09:00.000Z",
"expires_at": "2026-02-14T00:09:00.000Z",
"released_at": null
}
7.1 bb agent reserve
Input:
--agent <agent_id>required.--scope <scope>required.--bead <bead_id>required.--ttl <minutes>optional, default120, range5..1440.--takeover-staleoptional.
Behavior:
- If active reservation exists and not expired, fail with
RESERVATION_CONFLICT. - If expired and
--takeover-staleabsent, returnRESERVATION_STALE_FOUND. - If expired and
--takeover-stale, mark old as expired and create new active record.
7.2 bb agent release
Input:
--agent <agent_id>required.--scope <scope>required.
Behavior:
- Only owner may release active reservation.
- Mark as
releasedand append history event.
Errors:
RESERVATION_NOT_FOUNDRELEASE_FORBIDDEN
7.3 bb agent status
Input:
--bead <bead_id>optional.--agent <agent_id>optional.
Output:
- Active reservations.
- Unacked required-ack messages.
- Optional summary counts by state.
8) Cross-Command Invariants
- Every message and reservation must include
bead_id. - Deleting coordination data is disallowed in v1.
message_idandreservation_idare globally unique.- All write operations are atomic at file level (write temp + rename).
9) Error Code Registry (v1)
INVALID_ARGSAGENT_NOT_FOUNDDUPLICATE_AGENT_IDUNKNOWN_SENDERUNKNOWN_RECIPIENTMISSING_BEAD_IDINVALID_CATEGORYMESSAGE_NOT_FOUNDACK_FORBIDDENRESERVATION_CONFLICTRESERVATION_STALE_FOUNDRESERVATION_NOT_FOUNDRELEASE_FORBIDDENIO_WRITE_FAILEDIO_READ_FAILED
10) Test Matrix for Follow-on Tasks
Identity (bb-dcv.7):
- Register success.
- Duplicate fails.
- Force update allowed.
- Show/list filters.
Mail (bb-dcv.6):
- Send success.
- Unknown sender/recipient failure.
- Inbox state filtering.
- Read transition (
unread->read). - Ack transition to
acked.
Reservations (bb-dcv.4):
- Reserve success.
- Conflict on active reservation.
- Expired stale detection.
- Takeover stale flow.
- Owner-only release.
Workflow (bb-dcv.5):
bd --claim+bb agenthappy path.- Missing bead id rejection.
- Status summary correctness with mixed states.