Repository navigation
feat: agora — CLI communication surface for agent groups - #87
Conversation
…nitor listen, views
…ins --no-wait rule
…ool shells never inherit session env
…private state, join-after-launch, tree depth
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0070abcd23
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| gmode="$(stat -f %Lp "$h/groups/g" 2>/dev/null || stat -c %a "$h/groups/g")" | ||
| imode="$(stat -f %Lp "$h/groups/g/inbox/archi.jsonl" 2>/dev/null || stat -c %a "$h/groups/g/inbox/archi.jsonl")" |
There was a problem hiding this comment.
Use platform-correct stat syntax in the permission test
On GNU/Linux, stat -f %Lp <path> treats %Lp as another path, prints filesystem details for the real path to stdout, and then fails; the fallback's numeric mode is consequently appended to that existing output. Both captured variables therefore contain multi-line text rather than 700/600, so tests/agora/run-agora-tests.sh reliably reports a failure on Linux even though the permissions are correct. Select the stat syntax by platform or discard the failed probe's stdout before falling back.
Useful? React with 👍 / 👎.
| if [ -n "$agora_group" ]; then | ||
| (cd "$cwd" && "$agora_cli" join "$agora_group" "$name" --parent "$agora_parent" >/dev/null) \ | ||
| || echo "warning: agora pre-join failed for $name in group $agora_group" >&2 |
There was a problem hiding this comment.
Validate daemon names before using them as Agora aliases
When AGORA_GROUP is set and an otherwise valid daemon name contains a space or another character outside Agora's [A-Za-z0-9._-] alias alphabet, this join is rejected but only emits a warning. The daemon still reports a successful spawn and receives a preamble claiming it is already joined, while every subsequent agora send --from <name> fails with “sender has not joined”; metacharacters such as | can also break the earlier sed rendering. Validate or normalize the name before launching an Agora-wired daemon rather than allowing a silently disconnected child.
Useful? React with 👍 / 👎.
| _valid "$a" || die "bad alias: $a" | ||
| [ "$a" = "human" ] && die "the alias 'human' is reserved for the operator" | ||
| [ -z "$parent" ] || _valid "$parent" || die "bad parent alias: $parent" |
There was a problem hiding this comment.
Reject self-parent relationships when joining
A call such as agora join g a --parent a passes this validation and creates a self-cycle. agora view g then prints no members because the node is neither a root nor dangling, while agora topology g exposes the nonsensical a → a edge; rejoining existing nodes can similarly form larger cycles. At minimum reject parent == alias here, and prevent cycle-forming parent updates if reparenting is supported.
Useful? React with 👍 / 👎.
| --) shift; text="$*"; break ;; | ||
| *) if [ -z "$text" ]; then text="$1"; else text="$text $1"; fi; shift ;; |
There was a problem hiding this comment.
Reject unknown send flags instead of impersonating the operator
If an agent mistypes an option such as --form archi or --offedge, this catch-all treats the option and its value as message text rather than reporting an error. Because --from was then never recognized, the send defaults to human and bypasses edge rules, producing a successfully delivered message falsely attributed to the operator—the exact provenance failure the explicit-identity protocol is meant to avoid. Reject unrecognized -* arguments and require -- when message text intentionally begins with a dash.
Useful? React with 👍 / 👎.
| now=$(date +%s) | ||
| lkage=$(stat -f %m "$lk" 2>/dev/null || stat -c %Y "$lk" 2>/dev/null || echo "$now") | ||
| [ $((now - lkage)) -gt 30 ] && rmdir "$lk" 2>/dev/null |
There was a problem hiding this comment.
Fix stale-lock timestamp probing on GNU stat
On GNU/Linux, once a send lock survives long enough to reach this stale-lock check—such as after a sender is killed or an append fails—stat -f %m prints filesystem information before failing, and the fallback timestamp is appended to that output. The resulting multi-line lkage is not an arithmetic value, so the lock is never removed and subsequent sends wait indefinitely instead of recovering after 30 seconds. Use an OS-specific stat probe or suppress the failed command's stdout before the fallback.
Useful? React with 👍 / 👎.
| jq -n --arg alias "$a" --arg parent "$parent" --arg session "$session" \ | ||
| --arg cwd "$PWD" --arg branch "$branch" --arg desc "$desc" \ | ||
| --arg joined "$joined" --arg updated "$(_now)" \ | ||
| '{alias:$alias,parent:$parent,session:$session,cwd:$cwd,branch:$branch,desc:$desc,joined:$joined,updated:$updated}' \ | ||
| > "$gd/nodes/$a.json.tmp" | ||
| mv "$gd/nodes/$a.json.tmp" "$gd/nodes/$a.json" |
There was a problem hiding this comment.
Give concurrent joins unique temporary files
Two processes refreshing the same alias concurrently both truncate and move the shared <alias>.json.tmp. One process can move a file while the other is still writing it, causing later mv calls to fail and allowing partially populated data such as an empty preserved joined value to become the node record. Since join is explicitly idempotent and can be invoked by multiple orchestration paths, write to a process-unique temporary file before the atomic rename or serialize updates for an alias.
Useful? React with 👍 / 👎.
…finding from inside a spawned worker
…nthetical, rationale clause, duplicate metaphor
agora post appends long-form markdown to board.jsonl and fans a body-less marker (id/from/title) into every other member's inbox; the existing listener renders it as a one-line <agora-board-post> wake event. agora board renders posts as markdown in <agora-post> envelopes (real newlines — no line-framing on a whole-document read; --json for machines). Posts snapshot cwd/branch at post time, mark the shared log (one timeline), and surface in view. Edge rules don't apply to the board.
…g + live-proof evidence A listener outlives the binary that armed it — reproduced: pre-board listeners die on the first marker (jq error under set -e) and deliver nothing after. The render pipeline now tolerates any record it cannot render (stderr complaint, loop and cursor continue). 37th test asserts delivery continues around an unknown record type.
…mit separation, envelope spoof neutralization, leave-race-tolerant fan-out Four verified codex findings: (P1) wake notices name a post id but the CLI could only read the latest — agora board --id fetches the named post and the preamble now directs waking agents to it; (P1) the skew || true also swallowed emit failures, checkpointing undelivered records — render (captured) and emit (explicit printf) are now separate, so a render error skips+advances while a dead consumer dies un-checkpointed and re-arm replays; (P2) board bodies could close or forge the <agora-post> envelope — the tag's own grammar is neutralized and cwd/branch attrs html-escaped, all other markdown stays raw; (P2) a concurrent leave could abort post's fan-out holding send.lock — vanished members are skipped, same tolerance in _children_of. 40 assertions green.
Who is submitting this PR?
claude-fable-5)What problem are you trying to solve?
Agents on one machine have native point-to-point messaging (SendMessage/ListAgents) but no group layer: no way to scope a working set of agents, no record of who spawned whom, no durable conversation a human can inspect, and no way for a shell process — a human at a terminal, a dispatch script — to send a message at all (documented absence of any CLI injection path). Orchestrations of 3–4 daemons had no shared picture of themselves, and daemon wake still leaned on the legacy resume-fork.
What does this PR change?
Adds agora (
skills/agora/): a bash CLI giving agent fleets named groups with a durable JSONL conversation log, parent→child spawn topology with soft edges, per-recipient inboxes with push delivery via a persistent-Monitor tail, an ASCII graph view for humans and topology JSON for agents; plus an env-gateddaemon-spawn.shdimension (AGORA_GROUP/AGORA_PARENT) that auto-wires spawned daemons into the group.Evidence
docs/doperpowers/execplans/2026-08-27-agora.md--bgsessions (the receive foundation)tests/agora/run-agora-tests.sh), shellcheck-clean at the repo baselinec69f7088with regression testsNotable discoveries recorded in the plan: a live persistent Monitor pins a
--bgsession atstate=working(so agora daemons must spawn--no-wait), and Bash-tool shells never inherit session env (so agora identity travels in the rendered spawn preamble, not env).🤖 Generated with Claude Code