Files
ruflo/plugins/ruflo-arena
randclaude-flow ab18c33548 fix(deps): zod ^4.6.7 floor, integration agentic-flow ^2.0.14, mcp/codex/shared advisory floors
zod (GHSA-mrhx-c7xc-m3w5): shared, claims, the twelve v3 plugins,
ruvector-upstream, plugins/ruflo-{arena,ai-team,chatgpt-federation,x-gateway}
and goal_ui move to zod ^4.6.7. hooks declared zod but never imported it, so
the dependency is dropped.

gastown-bridge drops uuid/@types/uuid (GHSA-w5hq-g745-h8pq).

integration: peer agentic-flow ^2.0.0-alpha -> ^2.0.14 || ^3.0.0
(GHSA-vcv2-r9jh-99m5). The repo source already matched the published 3.0.2,
so this ships as 3.0.3. A patched agentic-flow leaves a ReasoningBank timer
alive, which made plugins/ruflo-cost-tracker/scripts/compact.mjs print its
result and never exit; compact.mjs now exits after stdout drains, guarded by
scripts/smoke-compact-exit.mjs (hangs on main, passes here) in
cost-tracker-smoke.

Stale ranges outside the cli: mcp ws ^8.21.0 (GHSA-96hv-2xvq-fx4p), express
^4.22.3 (GHSA-qw6h-vgh9-j6wx), ajv ^8.20.0 (GHSA-2g4f-4pwh-qvx6); codex yaml
^2.8.3 (GHSA-48c2-rrv3-qjmp); shared express ^4.22.3 || ^5.1.0. Each package
gets an advisory-ranges test over its own manifest.

ADR-356 metadata on every published manifest: homepage https://ruv.io,
canonical repository with directory, bugs, 8-20 keywords, description
<= 200 characters.

Versions: shared 3.0.8, hooks 3.0.3, claims 3.0.1, integration 3.0.3,
mcp 3.1.7, codex 3.0.7, gastown-bridge 0.1.6, prime-radiant 0.1.7, other
v3 plugins one alpha up. Marketplace plugin.json bumps for the five changed
plugins. The cli, claude-flow and ruflo pins are left for the release lane.

Lockfiles: v3/pnpm-lock.yaml drops the agentic-flow@2.0.0-alpha tree;
standalone plugin locks were regenerated with npm 11 (npm 10 crashed on a
stale optional peer in four of them).

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-11-09 02:21:15 -05:00
..

ruflo-arena

Competitive ruliology for Ruflo swarms — arenas, tournaments, and adaptive co-evolution of program strategies. Implements the first executable slice of Ruflo ADR-147/148/150, following Stephen Wolfram's Games Between Programs: The Ruliology of Competition.

Strategies are programs (deterministic finite-state machines reading opponent history). They compete under payoff games; tournaments produce Wolfram's competitive array; hill-climb and mutual co-evolution discover winners empirically — because, per computational irreducibility, you have to run the competition to find out.

Install & test

cd plugins/ruflo-arena
npm install        # light — runtime dep is just zod
npm run build      # tsc -> dist/
npm test           # vitest (engine + MCP tools + persistence)
npm run lint       # eslint (typescript-eslint)

CLI

node dist/cli.js demo                                   # tournament + evolution + co-evolution
node dist/cli.js tournament --game pd --rounds 200 --seed 1
node dist/cli.js arena --a tit-for-tat --b always-defect
node dist/cli.js evolve --game pd --generations 300 --seed 42
node dist/cli.js coevolve --game pd --generations 400 --seed 7

Sample PD ranking (mean-vs-field): grim ≈ 2.99, always-defect ≈ 2.76, tit-for-tat ≈ 2.50, … always-cooperate ≈ 1.88. The evolution run climbs from a random FSM (~2.78) to ~3.00 with the characteristic plateau→breakthrough fitness curve.

MCP tools (ruflo-arena/mcp-tools)

Tool Purpose
arena/run one deterministic match between two named strategies
tournament/run round-robin → competitive array + mean-vs-field ranking
evolve/run hill-climb an FSM vs the field; returns program + fitness curve
coevolve/run mutual co-evolution (arms race) trace
run/get, run/list fetch/list persisted run records

All return { success, result | error } and validate inputs with Zod. See commands/arena.md and docs/adrs/0001-arena-contract.md.

Persistence

Full run artifacts are written to .ruflo/arena/<runId>.json (exact replay). Each tool result also carries an agentdb payload so the command layer can store a searchable summary via mcp__plugin_ruflo-core_ruflo__memory_store (namespace arena) — the local stand-in for the RuVector data layer (ADR-196/197), enabling queries like "tournaments where grim dominated".

Scope

v1 is intentionally Ruflo-only and core-untouched:

  • In: simple-program + stochastic strategies, PD + zero-sum games, tournaments, hill-climb & co-evolution, file/AgentDB persistence, MCP tools + CLI.
  • Out (tracked elsewhere): LLM-agent strategies + distillation (ADR-151), execution sandboxing/resource governance (ADR-153), dashboard UI (ADR-149/154), and the full RuVector data/intelligence layer (ADR-196–198, ADR-200).

Architecture

src/
  domain/      types (+ Zod schemas) · games · strategies (FSM programs, library, mutation)
  engine/      rng · arena (match) · tournament (competitive array) · evolution (hill-climb, co-evolution)
  persistence/ RunStore (File + InMemory) + AgentDB record builder
  report/      competitive-array tables · ASCII heatmaps · fitness sparklines
  mcp-tools/   arenaTools: MCPTool[]  (the 6 tools above)
  index.ts     export surface + default { tools }
  cli.ts       human-facing CLI

As a mod

Arena also ships as a function-hook mod (ADR-445 pattern; hooks in hooks/, loaded with the plugin). No network, no process, no model call.

  • No guard: this plugin owns no tool a guard could usefully screen, so the mod only reports status.
  • /arena-mod: answered locally. /arena-mod status, /arena-mod strategies.
  • Status file: .claude-flow/arena-mod/status.json (version, updatedMs, counters), written at session start; the console reads it.

Test: claude plugin validate plugins/ruflo-arena, claude plugin test plugins/ruflo-arena (its vitest suites are *.spec.ts, so the kit collects only tests/mod.test.ts), and bash plugins/ruflo-arena/scripts/smoke.sh.