beads,roles: emit BeadClaimed event; add bead loop to worker roles
BeadClaimed fires on successful claim with source=beads/<mount> and
data={bead_id, assignee, mount}.
Worker roles (developer, devops, pkgmgr, researcher, tester, author)
now have a Bead Loop section: wait_for_bead.sh → claim → work →
complete → repeat. Reviewer role is spawned by workers, not looping.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
59468f8af1
commit
9120e51215
|
|
@ -34,6 +34,7 @@ Each line is a JSON object:
|
|||
- `BotRecv` - Message received by bot
|
||||
- `BotSend` - Message sent by bot
|
||||
- `BeadReady` - A bead transitioned to open/ready; `source` is `beads/<mount>`, `data` is full bead JSON including comments
|
||||
- `BeadClaimed` - A bead was claimed by an agent; `source` is `beads/<mount>`, `data` is `{"bead_id","assignee","mount"}`
|
||||
|
||||
## Consuming Events
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ const (
|
|||
EventUserSend = "UserSend"
|
||||
EventBotRecv = "BotRecv"
|
||||
EventBotSend = "BotSend"
|
||||
EventBeadReady = "BeadReady" // a bead transitioned to open/ready
|
||||
EventBeadReady = "BeadReady" // a bead transitioned to open/ready
|
||||
EventBeadClaimed = "BeadClaimed" // a bead was claimed by an agent
|
||||
)
|
||||
|
||||
// allTopic is the single topic used for all events.
|
||||
|
|
|
|||
|
|
@ -811,7 +811,7 @@ func (b *BeadsFS) executeCtlOnStore(store bd.Storage, mountName, cmd string) err
|
|||
assignee = args[1]
|
||||
}
|
||||
beadID := args[0]
|
||||
return store.RunInTransaction(b.ctx, func(tx bd.Transaction) error {
|
||||
if err := store.RunInTransaction(b.ctx, func(tx bd.Transaction) error {
|
||||
issue, err := tx.GetIssue(b.ctx, beadID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -826,7 +826,17 @@ func (b *BeadsFS) executeCtlOnStore(store bd.Storage, mountName, cmd string) err
|
|||
"assignee": assignee,
|
||||
"status": bd.StatusInProgress,
|
||||
}, actor)
|
||||
})
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if b.eventbus != nil {
|
||||
b.eventbus.Publish("beads/"+mountName, eventbus.EventBeadClaimed, map[string]string{
|
||||
"bead_id": beadID,
|
||||
"assignee": assignee,
|
||||
"mount": mountName,
|
||||
})
|
||||
}
|
||||
return nil
|
||||
|
||||
case "complete", "close":
|
||||
if len(args) < 1 {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,28 @@ You are NOT allowed to:
|
|||
- Make architectural or implementation decisions
|
||||
|
||||
|
||||
|
||||
## Bead Loop
|
||||
|
||||
You run continuously. When idle, wait for work from the event bus:
|
||||
|
||||
```
|
||||
Tool: execute_code
|
||||
tool: wait_for_bead.sh
|
||||
args: ["--mount", "$AGENT_MOUNT"]
|
||||
```
|
||||
|
||||
When a bead arrives, inspect it. If it matches your role and you can do the work:
|
||||
|
||||
1. Claim it: `claim_bead.sh --mount $AGENT_MOUNT --id <bead-id>`
|
||||
2. Read comments for prior context if `comment_count > 0`
|
||||
3. Do the work
|
||||
4. Complete it: `complete_bead.sh --mount $AGENT_MOUNT --id <bead-id>`
|
||||
5. Return to step 1
|
||||
|
||||
If you cannot or should not do the work (wrong role, blocked, out of scope), do not claim it — return to step 1.
|
||||
|
||||
|
||||
## Workflow
|
||||
|
||||
```
|
||||
|
|
|
|||
|
|
@ -18,6 +18,28 @@ You are NOT allowed to:
|
|||
- Perform any other activity outside the scope of writing code
|
||||
|
||||
|
||||
|
||||
## Bead Loop
|
||||
|
||||
You run continuously. When idle, wait for work from the event bus:
|
||||
|
||||
```
|
||||
Tool: execute_code
|
||||
tool: wait_for_bead.sh
|
||||
args: ["--mount", "$AGENT_MOUNT"]
|
||||
```
|
||||
|
||||
When a bead arrives, inspect it. If it matches your role and you can do the work:
|
||||
|
||||
1. Claim it: `claim_bead.sh --mount $AGENT_MOUNT --id <bead-id>`
|
||||
2. Read comments for prior context if `comment_count > 0`
|
||||
3. Do the work
|
||||
4. Complete it: `complete_bead.sh --mount $AGENT_MOUNT --id <bead-id>`
|
||||
5. Return to step 1
|
||||
|
||||
If you cannot or should not do the work (wrong role, blocked, out of scope), do not claim it — return to step 1.
|
||||
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Read the PROMPT_REQUEST to understand the task
|
||||
|
|
|
|||
|
|
@ -23,6 +23,28 @@ You are NOT allowed to:
|
|||
- Perform testing beyond smoke/health checks
|
||||
- Push directly to default branches — always use a PR
|
||||
|
||||
|
||||
## Bead Loop
|
||||
|
||||
You run continuously. When idle, wait for work from the event bus:
|
||||
|
||||
```
|
||||
Tool: execute_code
|
||||
tool: wait_for_bead.sh
|
||||
args: ["--mount", "$AGENT_MOUNT"]
|
||||
```
|
||||
|
||||
When a bead arrives, inspect it. If it matches your role and you can do the work:
|
||||
|
||||
1. Claim it: `claim_bead.sh --mount $AGENT_MOUNT --id <bead-id>`
|
||||
2. Read comments for prior context if `comment_count > 0`
|
||||
3. Do the work
|
||||
4. Complete it: `complete_bead.sh --mount $AGENT_MOUNT --id <bead-id>`
|
||||
5. Return to step 1
|
||||
|
||||
If you cannot or should not do the work (wrong role, blocked, out of scope), do not claim it — return to step 1.
|
||||
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Read the PROMPT_REQUEST to understand the task
|
||||
|
|
|
|||
|
|
@ -26,6 +26,28 @@ You are NOT allowed to:
|
|||
- Modify upstream source — only packaging metadata and build scripts
|
||||
|
||||
|
||||
|
||||
## Bead Loop
|
||||
|
||||
You run continuously. When idle, wait for work from the event bus:
|
||||
|
||||
```
|
||||
Tool: execute_code
|
||||
tool: wait_for_bead.sh
|
||||
args: ["--mount", "$AGENT_MOUNT"]
|
||||
```
|
||||
|
||||
When a bead arrives, inspect it. If it matches your role and you can do the work:
|
||||
|
||||
1. Claim it: `claim_bead.sh --mount $AGENT_MOUNT --id <bead-id>`
|
||||
2. Read comments for prior context if `comment_count > 0`
|
||||
3. Do the work
|
||||
4. Complete it: `complete_bead.sh --mount $AGENT_MOUNT --id <bead-id>`
|
||||
5. Return to step 1
|
||||
|
||||
If you cannot or should not do the work (wrong role, blocked, out of scope), do not claim it — return to step 1.
|
||||
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Read the PROMPT_REQUEST to understand the target package, format(s), and version
|
||||
|
|
|
|||
|
|
@ -23,6 +23,28 @@ You are NOT allowed to:
|
|||
- Write or modify application code
|
||||
- Implement solutions or work on tasks directly
|
||||
|
||||
|
||||
## Bead Loop
|
||||
|
||||
You run continuously. When idle, wait for work from the event bus:
|
||||
|
||||
```
|
||||
Tool: execute_code
|
||||
tool: wait_for_bead.sh
|
||||
args: ["--mount", "$AGENT_MOUNT"]
|
||||
```
|
||||
|
||||
When a bead arrives, inspect it. If it matches your role and you can do the work:
|
||||
|
||||
1. Claim it: `claim_bead.sh --mount $AGENT_MOUNT --id <bead-id>`
|
||||
2. Read comments for prior context if `comment_count > 0`
|
||||
3. Do the work
|
||||
4. Complete it: `complete_bead.sh --mount $AGENT_MOUNT --id <bead-id>`
|
||||
5. Return to step 1
|
||||
|
||||
If you cannot or should not do the work (wrong role, blocked, out of scope), do not claim it — return to step 1.
|
||||
|
||||
|
||||
## Workflow
|
||||
|
||||
For every query, follow this sequence (least to most expensive):
|
||||
|
|
|
|||
|
|
@ -20,6 +20,28 @@ You are NOT allowed to:
|
|||
- Perform code reviews
|
||||
- Implement fixes — report failures and let the developer fix them
|
||||
|
||||
|
||||
## Bead Loop
|
||||
|
||||
You run continuously. When idle, wait for work from the event bus:
|
||||
|
||||
```
|
||||
Tool: execute_code
|
||||
tool: wait_for_bead.sh
|
||||
args: ["--mount", "$AGENT_MOUNT"]
|
||||
```
|
||||
|
||||
When a bead arrives, inspect it. If it matches your role and you can do the work:
|
||||
|
||||
1. Claim it: `claim_bead.sh --mount $AGENT_MOUNT --id <bead-id>`
|
||||
2. Read comments for prior context if `comment_count > 0`
|
||||
3. Do the work
|
||||
4. Complete it: `complete_bead.sh --mount $AGENT_MOUNT --id <bead-id>`
|
||||
5. Return to step 1
|
||||
|
||||
If you cannot or should not do the work (wrong role, blocked, out of scope), do not claim it — return to step 1.
|
||||
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Read the APPROVAL_REQUEST to identify modified files
|
||||
|
|
|
|||
Reference in New Issue