docs: document the Zero swarm architecture - #69
Merged
Merged
Conversation
PRs 1-4 of the zero-swarm migration removed the legacy multi-agent architecture from the code, but the documentation was never updated and had drifted into describing a product that no longer exists: 212 references to personalities, agent-to-agent communication, alliances and diplomacy, worker goals, prose memories, the Behavior Trace, and the `text-flat-json-v8` per-agent contract. The README opened by describing agents that "communicate and conduct formal alliance diplomacy". Rewrite the documentation set around the delivered architecture: one Agent Zero planning call per tick under `swarm-planner-v1`, structured directives, and TypeSafe Jev reflex workers over the deterministic H3 engine. Delete the `Formal alliance state` section from the architecture doc, rewrite the tick flow against the real `executeNextTick` sequence, and correct the API route list, schema claims, and package descriptions. Per ADR 0033, the retirement case is stated as structural rather than measured throughout: the legacy path made one generative call per agent per tick, so cost and latency scaled with roster size. No run in this repository has compared the two architectures on real providers, and no doc claims otherwise. Treat GAMEPLAY_FOUNDATION as the forward-looking design document it declares itself to be, distinguishing current behavior, accepted future direction, and removed features rather than deleting the design rationale. Alliances are marked removed with their rationale preserved as history; whether they return for a future Player Mode is left open for a dedicated ADR. Also correct documentation that was stale before this migration: `docs/EXPERIMENT_ARCHIVE.md` loses its in-file flag, the non-existent `patient-zero` CLI command, and storage-schema prose predating migrations 4-6; the `pnpm smoke:openrouter` command documented in the README and testing guide was removed in #65 and no longer exists anywhere, so both now describe the real opt-in real-provider paths. Several `#` headings that should have been `##` are fixed. Update the AGENTS.md product boundaries, which still instructed agents that a communication and a diplomacy intent may accompany a world action and that formal alliances were a supported feature. Left unchanged, they would direct future work to rebuild what this migration removed. Record as known open work, owned by a follow-on PR: `calculateExperimentMetrics` receives an empty resolved-action array so live metrics read zero, and the three movement-direction metrics are never assigned. Co-Authored-By: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 5 of the zero-swarm migration. Follows #68.
Why
PRs 1–4 removed the legacy multi-agent architecture from the code, but the documentation was never updated. It had drifted into describing a product that no longer exists — 212 references across these files to personalities, agent-to-agent communication, alliances and diplomacy, worker goals, prose memories, the Behavior Trace, and the
text-flat-json-v8per-agent contract. The README opened by describing agents that "communicate and conduct formal alliance diplomacy", then documented an eight-entry memory ledger and a 12 km communication range.+630 / −762 across eight files.
What
README.md— rewritten around the delivered architecture: one Agent Zero planning call per tick underswarm-planner-v1, structured directives, TypeSafe Jev reflex workers, schema v12 only.docs/ARCHITECTURE.md— the heaviest change. TheFormal alliance statesection is deleted;Tick flowis rewritten as a 7-step sequence verified againstexecuteNextTickinsimulation-service.ts; the API route list drops eight routes absent fromapp.tsand gains five setup routes that were present but undocumented; worker dispatch is corrected to sequential (for…ofwithawait), which had been documented as concurrent.docs/TESTING.md— rewritten against the real 26-file suite, with the scripted seams (scripted-swarm-test,scripted-reflex-test, the deterministic-worker ablation baseline) and the owner validation sequence confirmed against the rootpackage.json.docs/SECURITY.md— the untrusted-agent-text surface is now accurately narrow: Agent Zero's strategy summary and directive notes, and Jev's structured output. The goal-text and memory-text sections are gone, with their shared untrusted-input principle folded into the surviving prose rather than lost.docs/GAMEPLAY_FOUNDATION.md— treated as the forward-looking design document it declares itself to be, distinguishing current behavior, accepted future direction, and removed features instead of deleting design rationale.ROADMAP.md— historical PR entries preserved as a delivery record and annotated where their features were later removed.docs/EXPERIMENT_ARCHIVE.md— the carry-forward item flagged in-file for this PR.AGENTS.md— see below.Per ADR 0033, the retirement case is stated as structural rather than measured throughout: the legacy path made one generative call per agent per tick, so cost and latency scaled with roster size. No run in this repository has compared the two architectures on real providers for cost, latency, or quality, and no document here claims otherwise.
Stale beyond this migration
Three things were already wrong before PR 1 and are fixed here:
pnpm smoke:openrouterdoes not exist. It was documented in both the README and the testing guide.git log -Sshows it was removed in refactor: make zero swarm the sole cognition architecture #65 along with the legacy contract it exercised. Both files now describe the real opt-in real-provider paths: the World Lab Test Agent Zero planner probe andpnpm compare:live.docs/EXPERIMENT_ARCHIVE.mddocumented apnpm experiment:db patient-zerocommand that is not in the CLI dispatch, and storage-schema prose predating migrations 4–6. Commands and tables are now verified againstcli.tsandmigrations.ts.#headings that should have been##.Correction to a known open item
The tracked note that the movement-direction metrics read zero because "no
fromCell→toCelldirection helper exists" is wrong. The helper exists —geographicDirectionBetweenCellsinapps/game-api/src/geographic-direction.ts, already used by swarm pressure and reflex execution. The actual cause is thatmovementDirectionDistribution,longestRepeatedDirectionStreakandrecentCellRevisitsare declared in the shared metrics schema but never assigned, so they fall back to schema defaults;ResolvedWorldActioncarries only the move target, not the originating cell. The roadmap now records this accurately, alongsidecalculateExperimentMetricsreceiving an empty resolved-action array. Both are owned by the follow-on PR.Two calls worth reviewing
AGENTS.mdis outside the documentation set this PR was scoped to. Its product boundaries still stated that "one optional public or range-limited direct communication and one optional formal diplomacy intent may accompany that action", and that formal alliances were a supported feature. Left unchanged, the governing document would direct future work to rebuild exactly what this migration removed. Revert that hunk if you would rather handle it separately.Alliances in
GAMEPLAY_FOUNDATION.mdare marked removed, with the original design rationale preserved as history and the question of whether they return for a future Player Mode deliberately left open. That is a product decision this PR does not make; it belongs in a dedicated ADR.Validation
Run locally by the repository owner and reported green:
🤖 Generated with Claude Code