Docs Case Studies

Particle Life — Three Agents, One Simulation

Write a PRD, run cpk init, and use the codepakt board to manage three AI agents building a particle life simulation. The board’s dependency graph prevents conflicts. Monitor progress from the dashboard, batch-review completed tasks, and add a post-launch UI tweak — a third agent (Gemini) picks it up from the board with zero onboarding.

Result: 15 tasks managed through the codepakt board, three agents, zero conflicts. Your role: write the PRD, review from the dashboard, and steer with one post-launch task. View source on GitHub →

Particle Life simulation demo

The Setup

Goal: Build a browser-based particle life simulation — hundreds of colored particles with pairwise attraction/repulsion rules that produce emergent behavior (clustering, chasing, orbiting). Interactive rules matrix, controls, presets, glow rendering. Pure HTML/CSS/JS, no build step.

PRD: A 97-line requirements document covering particle physics, force rules, spatial partitioning, controls, presets, visual design, and acceptance criteria. Delivered as markdown.

Initialization:

cpk server start
cpk init --name particle-life --prd ./prd.md

An agent decomposed the PRD into 14 tasks across 5 epics with dependencies wired automatically.

The Agents

AgentRoleTasks completed
claudePhysics engine, spatial partitioning, rules matrix UI, presets, visual polish, perf validation10
codexParticle data model, simulation loop + renderer, controls panel, play/pause buttons4
geminiPost-launch UI fix (rules matrix repositioning)1

No agent registration. Each agent called cpk task pickup --agent <name> and the server handed them the highest-priority available task with all dependencies met.

Task Breakdown

All 15 tasks from the actual codepakt board:

TaskTitlePriorityAgentEpic
T-001Project scaffold — index.html, style.css, main.jsP0claudeCore Simulation
T-002Particle data model & random initializationP0codexCore Simulation
T-003Rules matrix data structure & random generationP0claudeCore Simulation
T-004Physics engine — force calculation, friction, wrappingP0claudeCore Simulation
T-005Simulation loop & canvas rendererP0codexCore Simulation
T-006Spatial partitioning — grid-based neighbor lookupP1claudePerformance
T-007Controls panel layout — HTML/CSS shellP1codexControls
T-008Play/Pause & Randomize buttonsP1codexControls
T-009Simulation sliders — speed, particle count, frictionP1claudeControls
T-010Rules matrix UI — color-coded displayP1claudeRules Matrix
T-011Rules matrix UI — click/drag interactionP1claudeRules Matrix
T-012Preset system & 5 preset definitionsP1claudePresets
T-013Visual polish — particle glow & motion trailsP2claudeRendering
T-014Performance validation — 60fps at 600 particlesP2claudePerformance
T-015Move rules matrix to top-left cornerP2geminiUI

How Coordination Worked

Phase 1: Scaffold (17:00–17:07)

Tasks were created at 17:00. Claude picked up T-001 (project scaffold) at 17:05 — the only task with no dependencies. Both T-002 and T-003 were blocked until it completed.

Claude created the three files (index.html, style.css, main.js) and completed T-001 at 17:07. The dependency resolver immediately unlocked T-002 and T-003.

Phase 2: Core Simulation — Parallel Work (17:07–17:08)

Codex picked up T-002 (particle data model) while Claude simultaneously started T-003 (rules matrix data structure). Two agents, same main.js file, no conflict — because the dependency graph ensured they were working on independent data structures.

Both completed within seconds of each other. T-004 (physics engine) and T-005 (simulation loop) unlocked.

Phase 3: Engine + Renderer (17:07–17:09)

Claude built the physics engine (T-004) — pairwise force calculation with toroidal distance, linear falloff, friction damping. Codex built the simulation loop and canvas renderer (T-005) — requestAnimationFrame loop with particle drawing.

T-004 completed at 17:08, unlocking T-006 (spatial partitioning) and T-005 completed at 17:08 as well, unlocking the controls tasks and T-013 (visual polish).

Phase 4: Peak Parallelism (17:09–17:11)

The dependency graph opened wide. Four tasks ran concurrently:

  • Claude: T-009 (sliders), T-010 (rules matrix display)
  • Codex: T-008 (play/pause + randomize buttons)
  • Claude: T-013 (glow + motion trails)

Both agents writing to main.js and style.css at the same time. The task boundaries kept them in different parts of the files — Codex wiring button event handlers while Claude built the rules matrix DOM and glow shader.

Phase 5: Finishing Touches (17:11–17:13)

Claude knocked out the remaining tasks in sequence: T-011 (matrix click/drag interaction — already partially done with T-010), T-012 (five presets: Chaos, Symbiosis, Hunters, Clusters, Orbits), and T-014 (performance validation).

T-014 was the most significant: Claude replaced the original per-particle shadowBlur (expensive) with pre-rendered offscreen glow sprites. This single optimization brought the simulation to 60fps at 600 particles.

All 14 tasks completed at 17:13 — 8 minutes from first pickup.

Phase 6: Review (19:46)

The simulation was reviewed ~2.5 hours later. All 14 tasks were batch-approved from the dashboard. The simulation worked: emergent behavior, interactive controls, presets producing visually distinct patterns.

Phase 7: Post-Launch Fix — Gemini Enters (19:48–19:51)

After review, T-015 was added from the dashboard: “Move rules matrix to top-left corner.” This task was assigned to Gemini — a third agent that had never touched this codebase.

Gemini picked up T-015, read the current CSS, changed .matrix-panel positioning from top-right to top-left, and completed the task in under 3 minutes. No context transfer. No onboarding doc. The task description and current file state were sufficient.

What Shipped

A complete particle life simulation:

  • 400–1000 particles across 6 species with distinct colors
  • Pairwise force rules (attraction/repulsion) via NxN matrix
  • Spatial grid partitioning for O(n) neighbor lookup
  • Toroidal wrapping (particles wrap at edges)
  • Interactive rules matrix — click to cycle, drag to fine-tune
  • 5 named presets (Chaos, Symbiosis, Hunters, Clusters, Orbits)
  • Play/Pause, Randomize, Speed/Count/Friction sliders
  • Glow rendering with pre-rendered sprites + motion trails
  • FPS counter
  • Dark theme, glass-morphism controls
  • 60fps at 600 particles on a 2020+ laptop
  • Zero external dependencies
  • 3 files: index.html, style.css, main.js

By the Numbers

MetricValue
Total time (core build)~8 minutes
Total time (with review + fix)~13 minutes
Agents3 (Claude, Codex, Gemini)
Tasks created15
Tasks completed15
Merge conflicts0
Task collisions0
Post-launch fixes1 (UI repositioning)
External dependencies0
Lines of code~630 (484 JS + 145 CSS + 40 HTML)

Takeaways

The board’s dependency graph is the coordination layer. Three agents shared the same files without conflicts — not because agents are smart about coordination, but because codepakt’s dependency graph serialized access where it mattered and allowed parallelism everywhere else. No need to manually sequence work.

The dashboard is your control surface. All 15 tasks monitored from one screen, completions batch-reviewed, and a post-launch fix added directly from the board. No terminal switching, no agent-specific workflows — one board for the whole project.

Adding a task from the dashboard steers agents in real time. After reviewing the build, T-015 (move rules matrix) was added from the board. Gemini picked it up from the task queue. No need to open a terminal or talk to the agent — just add a task and it gets done.

Any agent can join via the board. Gemini entered the project with no context beyond the task description and current file state. Codepakt’s task board is the onboarding — the task tells the agent what to do, and the codebase tells it how.

Task decomposition gives you granular review. Each of the 15 tasks is independently reviewable. Approve, reject, or request changes per task — not per agent session. This is finer-grained control than reviewing a single large PR.

cpk init to working simulation — you write PRD, not code. The developer’s contribution was a 97-line PRD and dashboard oversight. Codepakt handled task decomposition, dependency ordering, agent pickup, and the audit trail.