Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

feat(ruflo-swarm): label teammates by name and unknown loops honestly; document the mod

ruv869101ec1c65
diff --git a/plugins/ruflo-swarm/README.md b/plugins/ruflo-swarm/README.md
index 4a8092924a..4a8212f696 100644
--- a/plugins/ruflo-swarm/README.md
+++ b/plugins/ruflo-swarm/README.md
@@ -68,11 +68,43 @@ This plugin owns the `swarm-state` AgentDB namespace (kebab-case, follows the co
`swarm-state` indexes active swarms, agent assignments, and topology snapshots. Accessed via `memory_*` (namespace-routed).
+## Live swarm pane (Claude Code mod, early access)
+
+With Claude Code function hooks on (`CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1`, or the engine's own rollout), the plugin's
+hooks module (`hooks/register.ts`) draws a pane beside the transcript. Without function hooks nothing loads, and the
+commands, skills and agents above behave as they always have.
+
+- **Tiles**: one per agent: ruflo's agents from `.claude-flow/agents/store.json`, the hive queen, Claude Code's own
+ subagents and teammates (from `agent.spawn` and `$.agent.list()`), and the main loop. The colour shows the state
+ (idle, working, blocked, done, failed) and a word is always drawn beside it. A tile turns blue while its loop reads
+ files and yellow while it writes. The leader is starred.
+- **Topology** (hierarchical, mesh, ring, star) as ruflo wrote it, plus **tasks** with their claims, **hive-mind
+ proposals** and their votes, **cost and context** from `$.session.usage()`, and the **router's last pick** seen this
+ session, with its score. A pick under `routeThreshold` is shown as below threshold. A figure that is not on disk, or
+ that the engine did not give, is shown as `n/a` or listed under "not on disk", never as zero.
+- **Buttons** act through the ruflo CLI with fixed argv and ids checked against ruflo's own format: logs or activity,
+ claim, steal, hand off, pause or resume a claim, stop, offer for stealing, re-route, vote, and put the next command in
+ the prompt (a person still presses Enter). Stop, steal and hand off ask for a second press. After each action the
+ pane re-reads the disk and says whether the change shows there. A CLI that exits 0 while nothing changes on disk is
+ reported as unverified.
+- **Commands**: `/ruflo-swarm-pane`, `/ruflo-swarm-status [json]`, `/ruflo-swarm-topology`, `/ruflo-swarm-claims`,
+ `/ruflo-swarm-consensus`. `/ruflo-swarm:watch` also opens the pane.
+- **Options** (`/config`): `panel` (auto | command | off), `cli` (`npx-offline`, the default, never touches the
+ network), `routeThreshold`, `injectSpawnContext` (off by default: appends a one-line swarm note to spawned subagents'
+ prompts) and `audit` (off by default: event names, tool names and agent ids into ruflo memory, never content).
+- The mod does not register `prompt.submit` or `tool.check` hooks, and its `tool.call` hook only observes.
+
+Tests run on the engine's own kit: `claude plugin test plugins/ruflo-swarm` (run `scripts/fetch-mod-types.sh` once
+first if you want `tsc -p plugins/ruflo-swarm` to typecheck). The pure readers also run under vitest:
+`npx vitest run --root plugins/ruflo-swarm tests/parse.spec.ts`.
+
## Verification
```bash
bash plugins/ruflo-swarm/scripts/smoke.sh
# Expected: "11 passed, 0 failed"
+CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude plugin test plugins/ruflo-swarm
+CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude plugin validate --strict plugins/ruflo-swarm
```
## Architecture Decisions
diff --git a/plugins/ruflo-swarm/hooks/model/members.ts b/plugins/ruflo-swarm/hooks/model/members.ts
index 857f8b77dd..3c790e8ee4 100644
--- a/plugins/ruflo-swarm/hooks/model/members.ts
+++ b/plugins/ruflo-swarm/hooks/model/members.ts
@@ -155,13 +155,18 @@ export function noteDone(activity: Activity, agentId: string, reason: string, no
}
/** `$.agent.list()` as the engine answered it: types and statuses for loops the hooks saw start before this module did. */
-export function noteListed(activity: Activity, listed: readonly { id: string; type: string; status: string; description?: string }[], nowMs: number): void {
+export function noteListed(activity: Activity, listed: readonly { id: string; type: string; status: string; description?: string; name?: string }[], nowMs: number): void {
for (const agent of listed.slice(0, MAX_LOOPS)) {
const loop = loopFor(activity, agent.id, nowMs)
loop.role = roleOf(agent.type)
loop.status = agent.status
+ // A named Agent call runs as an in-process teammate, listed as type `teammate`: its name is what tells it apart.
+ if (agent.name !== undefined && agent.name !== '') {
+ loop.name = agent.name.slice(0, 40)
+ }
+
if (agent.description !== undefined && loop.description === undefined) {
loop.description = agent.description
}
@@ -214,7 +219,8 @@ export function membersOf(snapshot: Snapshot | null, activity: Activity, nowMs:
members.push({
id: loop.id,
- label: isLead ? 'claude (main)' : (loop.name ?? loop.role),
+ // A loop known only from its tool calls (no spawn or listing reached the hooks) is said to be one, not given a role.
+ label: isLead ? 'claude (main)' : (loop.name ?? (loop.role === 'agent' ? `subagent …${loop.id.slice(-4)}` : loop.role)),
role: loop.role,
source: isLead ? 'lead' : 'claude',
state: base === 'working' && isQuiet && !isLead ? 'idle' : base,