s11
Autonomous Agents
CollaborationScan Board, Claim Tasks
413 LOC14 toolsTypeScriptTask board polling + timeout-based self-governance
Teammates scan the board and claim tasks themselves; no need for the lead to assign each one
s01 > s02 > s03 > s04 > s05 > s06 | s07 > s08 > s09 > s10 > [ s11 ] s12
"Teammates scan the board and claim tasks themselves" -- no need for the lead to assign each one.
Harness layer: Autonomy -- models that find work without being told.
Problem
In s09-s10, teammates only work when explicitly told to. The lead must spawn each one with a specific prompt. 10 unclaimed tasks on the board? The lead assigns each one manually. Doesn't scale.
True autonomy: teammates scan the task board themselves, claim unclaimed tasks, work on them, then look for more.
One subtlety: after context compression (s06), the agent might forget who it is. Identity re-injection fixes this.
Solution
Teammate lifecycle with idle cycle:
+-------+
| spawn |
+---+---+
|
v
+-------+ tool_use +-------+
| WORK | <------------- | LLM |
+---+---+ +-------+
|
| stop_reason != tool_use (or idle tool called)
v
+--------+
| IDLE | poll every 5s for up to 60s
+---+----+
|
+---> check inbox --> message? ----------> WORK
|
+---> scan .tasks/ --> unclaimed? -------> claim -> WORK
|
+---> 60s timeout ----------------------> SHUTDOWN
Identity re-injection after compression:
if len(messages) <= 3:
messages.insert(0, identity_block)
How It Works
- The teammate loop has two phases: WORK and IDLE. When the LLM stops calling tools (or calls
idle), the teammate enters IDLE.
async loop(name: string, role: string, prompt: string) {
while (true) {
// WORK phase
if (idleRequested) break;
// IDLE phase
if (!resume) return;
}
}
- The idle phase polls inbox and task board in a loop.
while (Date.now() - start < IDLE_TIMEOUT) {
await sleep(POLL_INTERVAL);
const inbox = BUS.readInbox(name);
const unclaimed = scanUnclaimedTasks();
if (inbox.length || unclaimed.length) return true;
}
return false;
- Task board scanning: find pending, unowned, unblocked tasks.
function scanUnclaimedTasks() {
return loadTasks().filter((task) =>
task.status === "pending" && !task.owner && !(task.blockedBy?.length),
);
}
- Identity re-injection: when context is too short (compression happened), insert an identity block.
if (messages.length <= 3) {
messages.unshift({ role: "assistant", content: `I am ${name}. Continuing.` });
messages.unshift(makeIdentityBlock(name, role, teamName));
}
What Changed From s10
| Component | Before (s10) | After (s11) |
|---|---|---|
| Tools | 12 | 14 (+idle, +claim_task) |
| Autonomy | Lead-directed | Self-organizing |
| Idle phase | None | Poll inbox + task board |
| Task claiming | Manual only | Auto-claim unclaimed tasks |
| Identity | System prompt | + re-injection after compress |
| Timeout | None | 60s idle -> auto shutdown |
Try It
cd learn-claude-code
cd agents-ts
npm install
npm run s11
Create 3 tasks on the board, then spawn alice and bob. Watch them auto-claim.Spawn a coder teammate and let it find work from the task board itselfCreate tasks with dependencies. Watch teammates respect the blocked order.- Type
/tasksto see the task board with owners - Type
/teamto monitor who is working vs idle