an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
release(v0.4.1): the app speaks the site's language
Chaitanya Giric64d7aee8096
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 418f7586..c51ea161 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,6 +4,31 @@ All notable changes to this project are documented here. The format is based on[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to[Semantic Versioning](https://semver.org/spec/v2.0.0.html).+## [0.4.1] — 2026-08-13++**The app says what the site says.**+munderdiffl.in describes Munder Difflin as a clone of you that works around the clock; the app+still called it a "GOD agent." This release closes that gap. Wording only — no behaviour changes.++### Changed+- **Michael is your clone.** Onboarding refers to him as your clone throughout, and his card on+ the floor now carries a **BOSS** tag instead of **GOD** — he's the boss of the agents, you're+ still the boss of him.+- **Onboarding leads with the product, not the feature list.** The first screen opens on "a clone+ of you, working 24/7"; step 2 is "your clone's engine."+- **The engine card names all ten engines.** It had advertised three (Claude Code, Antigravity,+ Codex) since before seven more shipped — Grok, Kimi, Qwen, OpenCode, Crush, pi and Copilot are+ now named too.+- **Site copy fixes.** A misspelled "requrired" in the hero, `cli` → `CLI`, a pricing FAQ that+ named plans ("Basic"/"Pro") the pricing table doesn't sell, and an interactive demo card that+ claimed a clone ran on Cursor — which is not one of the supported engines.+- **README back in sync.** It listed nine engines (Qwen was missing in four places) and still+ reported v0.3.8.++### Note+The `god` agent id, the hive folder layout, and message routing are **unchanged**. Existing hives,+memory, and running agents carry over as-is; there is nothing to migrate.+## [0.4.0] — 2026-08-12**The brand grew up — and the landing page with it.**diff --git a/README.md b/README.mdindex f2834ffb..0c29d945 100644--- a/README.md+++ b/README.md@@ -5,8 +5,9 @@# Munder Difflin**Local multi-agent harness for the terminal coding CLIs you already run** —-[Claude Code](https://claude.com/claude-code), Antigravity (Gemini), OpenAI Codex,-**OpenCode**, **Crush**, **pi.dev**, and **GitHub Copilot CLI** — with bring-your-own keys and local LLMs.+[Claude Code](https://claude.com/claude-code), Antigravity (Gemini), OpenAI Codex, **xAI Grok**,+**Kimi Code**, **Qwen**, **OpenCode**, **Crush**, **pi.dev**, and **GitHub Copilot CLI** —+with bring-your-own keys and local LLMs.Autonomous agents that message, route, and remember — coordinated by a **GOD** orchestratoryou talk to, and visualized as avatars at work on a shared office floor.@@ -16,7 +17,7 @@ you talk to, and visualized as avatars at work on a shared office floor.<p><a href="./LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-F4D35E.svg?style=flat-square&labelColor=6E1423"></a>- <a href="./CHANGELOG.md"><img alt="Version: 0.3.8" src="https://img.shields.io/badge/version-0.3.8-F4D35E.svg?style=flat-square&labelColor=6E1423"></a>+ <a href="./CHANGELOG.md"><img alt="Version: 0.4.0" src="https://img.shields.io/badge/version-0.4.0-F4D35E.svg?style=flat-square&labelColor=6E1423"></a><img alt="Status: prototype" src="https://img.shields.io/badge/status-working%20prototype-F4F1EA.svg?style=flat-square&labelColor=6E1423"><img alt="Platform: macOS | Windows | Linux" src="https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-F4F1EA.svg?style=flat-square&labelColor=6E1423"><a href="./CONTRIBUTING.md"><img alt="PRs welcome" src="https://img.shields.io/badge/PRs-welcome-F4D35E.svg?style=flat-square&labelColor=6E1423"></a>@@ -39,8 +40,8 @@ you talk to, and visualized as avatars at work on a shared office floor.> [!NOTE]> **The world's best agents. The world's worst paper company.**-> Munder Difflin takes the terminal-agent CLIs you already run — `claude`, `agy`, `codex`, `opencode`,-> `crush`, `pi`, and `copilot` — and turns them+> Munder Difflin takes the terminal-agent CLIs you already run — `claude`, `agy`, `codex`, `grok`,+> `kimi`, `qwen`, `opencode`, `crush`, `pi`, and `copilot` — and turns them> into a self-coordinating team: each agent gets long-term memory, a mailbox, and a desk on a 2D> office floor — and a **GOD orchestrator agent** routes work between them while you watch.@@ -65,7 +66,7 @@ wires them into a **hive mind**, and puts a **GOD orchestration agent** in charg*you* talk to in order to get things done. Under the hood it runs the **fastest memory layer in theworld** so every agent remembers what it learns and recalls it instantly.-- **Every terminal is an agent.** Each `claude`, `agy`, `codex`, `opencode`, `crush`, `pi`, `copilot`, or custom session runs as a real+- **Every terminal is an agent.** Each `claude`, `agy`, `codex`, `grok`, `kimi`, `qwen`, `opencode`, `crush`, `pi`, `copilot`, or custom session runs as a realprocess in a pseudo-terminal (`node-pty`), byte-for-byte authentic, rendered with xterm.js.- **Every agent is an avatar.** Sessions appear as characters on a Pixi.js office floor — they walkto stations as they work, and envelopes fly desk-to-desk when they message each other.@@ -110,7 +111,7 @@ terminal/event plane, and [`DESIGN.md`](./DESIGN.md) for the visual system.## Features**The floor**-- **Every terminal is a real agent.** Claude Code, Antigravity (Gemini), OpenAI Codex, xAI Grok, Kimi Code, OpenCode, Crush, pi.dev, GitHub Copilot CLI, or a custom command — each in its own `node-pty` PTY, rendered with xterm.js.+- **Every terminal is a real agent.** Claude Code, Antigravity (Gemini), OpenAI Codex, xAI Grok, Kimi Code, Qwen, OpenCode, Crush, pi.dev, GitHub Copilot CLI, or a custom command — each in its own `node-pty` PTY, rendered with xterm.js.- **Every agent is an avatar.** A Pixi.js office floor where agents walk to stations, envelopes fly desk to desk, and avatar state reflects real work.- **A GOD orchestrator you talk to.** It routes tasks, adjudicates traffic, and escalates only what needs a human. Or press **Talk** and run the floor by voice.- **Per-agent git worktrees.** Optional isolation so parallel agents never collide on branches.@@ -136,12 +137,11 @@ terminal/event plane, and [`DESIGN.md`](./DESIGN.md) for the visual system.- **Auto-update** — new releases download in the background; you click restart.> [!NOTE]-> **Status: v0.3.9 — ask the app whether it's up to date.** Settings → General now names the-> version you're running, says whether it's the latest, and gives you one button that states what-> it does. **If you're on 0.3.8, update:** that build's usage-limit guard never released the agents-> it held, and it has been removed entirely. 0.3.8 also brought memory condensation that works for-> the first time, a Triggers hub, one compaction schedule instead of two, and a readable commit-> history — all of that stays.+> **Status: v0.4.0 — the brand grew up.** New app icon on every platform, a landing page that+> shows the product instead of describing it, and Settings → General now names the version you're+> running, says whether it's the latest, and gives you one button that states what it does.+> **If you're on 0.3.8, update:** that build's usage-limit guard never released the agents it held,+> and it has been removed entirely.> macOS (signed & notarized), Windows, and Linux builds are on the> [releases page](https://github.com/chaitanyagiri/munder-difflin/releases/latest).@@ -159,8 +159,8 @@ terminal/event plane, and [`DESIGN.md`](./DESIGN.md) for the visual system.```- At least one supported agent CLI on your `PATH` — **[Claude Code](https://claude.com/claude-code)**(`claude`, the default), **Antigravity** (`agy`), **OpenAI Codex** (`codex`), **xAI Grok** (`grok`),- **Kimi Code** (`kimi`), **OpenCode** (`opencode`), **Crush** (`crush`), **pi.dev** (`pi`), or- **GitHub Copilot** (`copilot`). Most missing CLIs self-heal: the harness runs the installer in the+ **Kimi Code** (`kimi`), **Qwen** (`qwen`), **OpenCode** (`opencode`), **Crush** (`crush`),+ **pi.dev** (`pi`), or **GitHub Copilot** (`copilot`). Most missing CLIs self-heal: the harness runs the installer in theterminal and continues into the new binary.- *Optional:* **your own API keys and local LLMs** in **Settings → AI Engines** (Ollama / LM Studio / vLLM).- *Optional:* the semantic memory index for instant cross-session recall — markdown memory works without it.@@ -274,7 +274,7 @@ chrome. The 15 avatars are the cast of *The Office*, differentiated by hair/skin## Roadmap-Shipped through **v0.3.8** — nine agent engines with BYOK keys and local LLMs, voice orchestration,+Shipped through **v0.4.0** — ten agent engines with BYOK keys and local LLMs, voice orchestration,the hive (memory · mailboxes · blackboard · event log), Command Center with kanban and schedules,a built-in Monaco IDE with git rails, integrations registry + secret broker, Slack-spawned workers,shareable hires and the Agent Gallery, observability and the circuit breaker, durable persistence,diff --git a/RELEASE.md b/RELEASE.mdindex 205a92d8..3ce48a44 100644--- a/RELEASE.md+++ b/RELEASE.md@@ -1,13 +1,33 @@-# Munder Difflin v0.4.0+# Munder Difflin v0.4.1**A local hive of Claude Code, Antigravity, Codex, Grok & Copilot agents that run themselves** — messaging,-routing, and remembering, coordinated by a GOD orchestrator you talk to. Local-first and open source.+routing, and remembering, coordinated by your clone, Michael, who you talk to. Local-first and open source.### → [**munderdiffl.in**](https://munderdiffl.in/) — see it in action, then grab a build below----## What's new in 0.4.0 — *The brand grew up*+## What's new in 0.4.1 — *The app says what the site says*++**Michael is your clone.** The website has been describing Munder Difflin as a clone of you that+works around the clock — the app still called it a "GOD agent." Now they match.++- **Your clone, not the GOD agent.** Michael is described as your clone throughout onboarding,+ and his card on the floor carries a **BOSS** tag — he's the boss of the agents, you're still+ the boss of him.+- **Onboarding was rewritten.** It opens on what you actually get ("a clone of you, working+ 24/7") instead of a feature list, and the engine card no longer advertises three engines when+ ten ship — Claude Code, Codex, Grok, Kimi, Antigravity, Qwen, OpenCode, Crush, pi and Copilot+ are all named.++> [!NOTE]+> **This release changes wording only.** The `god` agent id, the hive folder layout, and message+> routing are untouched, so existing hives, memory, and running agents carry over exactly as they+> are. Nothing to migrate.++---++## Still new in 0.4.0 — *The brand grew up***Munder Difflin looks like one product now.** The dock icon, the in-app logo, the site favicon,and munderdiffl.in all carry the same yellow "MD" mark — and the landing page was rebuilt to show@@ -80,22 +100,22 @@ Apple Silicon and Intel.### 🍎 macOS| Build | File ||---|---|-| Universal (Apple Silicon + Intel) | [`Munder-Difflin-0.4.0-mac-universal.dmg`](https://github.com/chaitanyagiri/munder-difflin/releases/latest/download/Munder-Difflin-0.4.0-mac-universal.dmg) |+| Universal (Apple Silicon + Intel) | [`Munder-Difflin-0.4.1-mac-universal.dmg`](https://github.com/chaitanyagiri/munder-difflin/releases/latest/download/Munder-Difflin-0.4.1-mac-universal.dmg) |### 🪟 Windows| Build | File ||---|---|-| Installer (x64) — *recommended* | [`Munder-Difflin-0.4.0-win-x64-setup.exe`](https://github.com/chaitanyagiri/munder-difflin/releases/latest/download/Munder-Difflin-0.4.0-win-x64-setup.exe) |-| Portable (x64, no install) | [`Munder-Difflin-0.4.0-win-x64-portable.exe`](https://github.com/chaitanyagiri/munder-difflin/releases/latest/download/Munder-Difflin-0.4.0-win-x64-portable.exe) |+| Installer (x64) — *recommended* | [`Munder-Difflin-0.4.1-win-x64-setup.exe`](https://github.com/chaitanyagiri/munder-difflin/releases/latest/download/Munder-Difflin-0.4.1-win-x64-setup.exe) |+| Portable (x64, no install) | [`Munder-Difflin-0.4.1-win-x64-portable.exe`](https://github.com/chaitanyagiri/munder-difflin/releases/latest/download/Munder-Difflin-0.4.1-win-x64-portable.exe) |### 🐧 Linux| Build | File ||---|---|-| AppImage (x86_64) | [`Munder-Difflin-0.4.0-linux-x86_64.AppImage`](https://github.com/chaitanyagiri/munder-difflin/releases/latest/download/Munder-Difflin-0.4.0-linux-x86_64.AppImage) |+| AppImage (x86_64) | [`Munder-Difflin-0.4.1-linux-x86_64.AppImage`](https://github.com/chaitanyagiri/munder-difflin/releases/latest/download/Munder-Difflin-0.4.1-linux-x86_64.AppImage) |### 📦 Source-[Source code (zip)](https://github.com/chaitanyagiri/munder-difflin/archive/refs/tags/v0.4.0.zip) ·-[Source code (tar.gz)](https://github.com/chaitanyagiri/munder-difflin/archive/refs/tags/v0.4.0.tar.gz)+[Source code (zip)](https://github.com/chaitanyagiri/munder-difflin/archive/refs/tags/v0.4.1.zip) ·+[Source code (tar.gz)](https://github.com/chaitanyagiri/munder-difflin/archive/refs/tags/v0.4.1.tar.gz)> **Verify your download:** [`SHA256SUMS.txt`](https://github.com/chaitanyagiri/munder-difflin/releases/latest/download/SHA256SUMS.txt) — then `shasum -a 256 -c SHA256SUMS.txt` (macOS/Linux) or `Get-FileHash` (Windows).diff --git a/docs/index.html b/docs/index.htmlindex 7ca1c70b..97ee1b91 100644--- a/docs/index.html+++ b/docs/index.html@@ -29,11 +29,11 @@"@context": "https://schema.org","@type": "SoftwareApplication","name": "Munder Difflin",- "description": "Munder Difflin turns each person on a team into an always-on AI clone of themselves. It wraps the CLI agent they already use (Claude Code, Cursor, Codex, GitHub Copilot CLI), captures their workflow, tooling, and knowledge, and works 24/7 — on their laptop or a dedicated sandbox VM. Clones share one org knowledge base, coordinate over an end-to-end encrypted org network, hand off work, and unblock each other; new clones inherit the org's collective knowledge on day one. Free and open source for individuals; Secure Org Network licenses for teams (Basic up to 10 members, Pro up to 20, larger on request) and a Cloud + Network license that adds dedicated sandbox VMs and a hosted knowledge base in the customer's own controlled environment.",+ "description": "Munder Difflin turns each person on a team into an always-on AI clone of themselves. It wraps the CLI agent they already use (Claude Code, Codex, Grok, Qwen, GitHub Copilot CLI, and more), captures their workflow, tooling, and knowledge, and works 24/7 — on their laptop or a dedicated sandbox VM. Clones share one org knowledge base, coordinate over an end-to-end encrypted org network, hand off work, and unblock each other; new clones inherit the org's collective knowledge on day one. Free and open source for individuals; Secure Org Network licenses for teams (Teams Lite and Teams PRO, from 10 to 100+ seats) and a Cloud + Network license that adds dedicated sandbox VMs and a hosted knowledge base in the customer's own controlled environment.","url": "https://munderdiffl.in/","applicationCategory": "DeveloperApplication","operatingSystem": "macOS, Windows, Linux",- "softwareVersion": "0.4.0",+ "softwareVersion": "0.4.1","downloadUrl": "https://github.com/chaitanyagiri/munder-difflin/releases/latest","softwareHelp": "https://github.com/chaitanyagiri/munder-difflin#readme","license": "https://github.com/chaitanyagiri/munder-difflin/blob/main/LICENSE",@@ -854,7 +854,7 @@<span class="badge"><span class="dot"></span> OPEN SOURCE · LOCAL-FIRST · WORKS 24/7</span><h1><span class="u">Clones for</span> you and your team</h1><p class="lead">- <strong>Free, open sourced and performant</strong> multi-agent harness that acts as your digital clone. No set up requrired, uses your existing subscription.+ <strong>Free, open source and performant</strong> multi-agent harness that acts as your digital clone. No setup required, uses your existing subscription.<br></p><div class="btn-row">@@ -863,8 +863,8 @@</div></div><div class="cli-bar rv">- <h3>Munder Difflin uses cli agents running on your computer to do anything you can do</h3>- <p>Supports 10 cli agent providers off the shelf, more coming soon</p>+ <h3>Munder Difflin uses CLI agents running on your computer to do anything you can do</h3>+ <p>Supports 10 CLI agent providers off the shelf, more coming soon</p><div class="cli-logos"><div class="clp"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z" fill="currentColor"/></svg><span>Claude Code</span></div><div class="clp"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z" fill="currentColor"/></svg><span>Codex</span></div>@@ -881,7 +881,7 @@<video class="hero-video" src="./media/hero-demo.mp4?v=2" width="2300" height="1440"autoplay muted loop playsinlinearia-label="Munder Difflin home screen: a pixel office floor with agents at desks, speech bubbles, and a live Claude Code terminal open for the agent Michael"></video>- <figcaption>Monitor agents in 'the office' themed simulation or use the cleaner fullscreen mode. Simulation is deterministic, does not consume token.</figcaption><br>+ <figcaption>Monitor agents in 'the office' themed simulation or use the cleaner fullscreen mode. Simulation is deterministic, does not consume tokens.</figcaption><br></figure></div>@@ -891,12 +891,12 @@<div class="teams-bar rv"><div class="dex-head rv center"><span class="kicker">PRIVATE CLOUD + NETWORK</span>- <h2>Get teams plan to double your productivity</h2>+ <h2>Get the Teams plan and double your productivity</h2><p><br><b>Private Cloud:</b> Run agents 24/7 for each teammate in isolated sandboxes<br>- <b>Private Network:</b> Allow clones of your team to talk to each other autonomously(E2E encrypted)+ <b>Private Network:</b> Allow clones of your team to talk to each other autonomously (E2E encrypted)</p></div>@@ -1017,7 +1017,7 @@<span class="kicker">WHAT EACH TEAM MEMBER GETS</span><h2>Understand the clone's capabilities.</h2><p class="lead" style="margin:18px auto 0">- Munder Difflin doesn't give your team one shared bot. It acts as a clone of the individual and controls their computer</p>+ Munder Difflin doesn't give your team one shared bot. It acts as a clone of the individual and controls their computer.</p><!-- ── how a node works: god-orchestrated, clone-to-clone ── --><div class="sysmap rv"><!-- desktop · 16:9 -->@@ -1042,7 +1042,7 @@<rect x="20" y="88" width="560" height="432" rx="14" fill="none" stroke="var(--border-strong)" stroke-width="1.4" stroke-dasharray="7 7" opacity="0.75" /><rect x="36" y="77" width="252" height="22" rx="7" fill="var(--surface-2)" stroke="var(--border-strong)" stroke-width="1.1" />- <text x="162" y="89" text-anchor="middle" dominant-baseline="middle" font-size="11" font-weight="600" letter-spacing="1" fill="var(--ink)">YOUR CLONE . YOUR COMPUTER</text>+ <text x="162" y="89" text-anchor="middle" dominant-baseline="middle" font-size="11" font-weight="600" letter-spacing="1" fill="var(--ink)">YOUR CLONE · YOUR COMPUTER</text><rect x="150" y="112" width="280" height="60" rx="12" fill="var(--accent-soft)" stroke="var(--accent-line)" stroke-width="1.5" /><rect x="168" y="128" width="26" height="26" rx="6" fill="var(--accent)" opacity="0.9" />@@ -1074,7 +1074,7 @@<rect x="48" y="384" width="484" height="48" rx="10" fill="var(--surface-2)" stroke="var(--border-strong)" stroke-width="1.3" /><rect x="64" y="396" width="24" height="24" rx="6" fill="var(--accent)" opacity="0.85" /><text x="100" y="401" dominant-baseline="middle" font-size="14.5" font-weight="700" fill="var(--ink)">MemPalace</text>- <text x="100" y="420" dominant-baseline="middle" font-size="11" fill="var(--faint)">his memory · his machine · nowhere else</text>+ <text x="100" y="420" dominant-baseline="middle" font-size="11" fill="var(--faint)">their memory · their machine · nowhere else</text><rect x="175" y="458" width="230" height="26" rx="9" fill="var(--accent)" opacity="0.92" /><text x="290" y="472" text-anchor="middle" dominant-baseline="middle" font-size="12" font-weight="700" fill="var(--accent-ink)">⟳ 24/7</text>@@ -1090,7 +1090,7 @@<rect x="700" y="88" width="240" height="432" rx="14" fill="none" stroke="var(--border-strong)" stroke-width="1.4" stroke-dasharray="7 7" opacity="0.75" /><rect x="710" y="77" width="220" height="22" rx="7" fill="var(--surface-2)" stroke="var(--border-strong)" stroke-width="1.1" />- <text x="820" y="89" text-anchor="middle" dominant-baseline="middle" font-size="10.5" font-weight="600" letter-spacing="0.1" fill="var(--ink)">TEAMMATE's CLONE . THEIR COMPUTER</text>+ <text x="820" y="89" text-anchor="middle" dominant-baseline="middle" font-size="10.5" font-weight="600" letter-spacing="0.1" fill="var(--ink)">TEAMMATE’S CLONE · THEIR COMPUTER</text><rect x="720" y="112" width="200" height="56" rx="10" fill="var(--accent-soft)" stroke="var(--accent-line)" stroke-width="1.3" /><rect x="734" y="126" width="18" height="18" rx="5" fill="var(--accent)" opacity="0.9" /><text x="762" y="132" dominant-baseline="middle" font-size="13.5" font-weight="700" fill="var(--ink)">GOD orchestrator</text>@@ -1107,7 +1107,7 @@<rect x="720" y="340" width="200" height="46" rx="10" fill="var(--surface-2)" stroke="var(--border-strong)" stroke-width="1.2" /><rect x="734" y="351" width="18" height="18" rx="5" fill="var(--accent)" opacity="0.85" /><text x="762" y="356" dominant-baseline="middle" font-size="12.5" font-weight="700" fill="var(--ink)">MemPalace</text>- <text x="762" y="374" dominant-baseline="middle" font-size="10" fill="var(--faint)">his memory · his machine</text>+ <text x="762" y="374" dominant-baseline="middle" font-size="10" fill="var(--faint)">their memory · their machine</text><rect x="770" y="458" width="100" height="26" rx="9" fill="var(--accent)" opacity="0.92" /><text x="820" y="472" text-anchor="middle" dominant-baseline="middle" font-size="12" font-weight="700" fill="var(--accent-ink)">⟳ 24/7</text></svg>@@ -1133,7 +1133,7 @@<rect x="16" y="126" width="508" height="418" rx="14" fill="none" stroke="var(--border-strong)" stroke-width="1.4" stroke-dasharray="7 7" opacity="0.75" /><rect x="32" y="115" width="252" height="22" rx="7" fill="var(--surface-2)" stroke="var(--border-strong)" stroke-width="1.1" />- <text x="158" y="127" text-anchor="middle" dominant-baseline="middle" font-size="11" font-weight="600" letter-spacing="1" fill="var(--ink)">YOUR CLONE . YOUR COMPUTER</text>+ <text x="158" y="127" text-anchor="middle" dominant-baseline="middle" font-size="11" font-weight="600" letter-spacing="1" fill="var(--ink)">YOUR CLONE · YOUR COMPUTER</text><rect x="120" y="150" width="300" height="62" rx="12" fill="var(--accent-soft)" stroke="var(--accent-line)" stroke-width="1.5" /><rect x="140" y="167" width="27" height="27" rx="6" fill="var(--accent)" opacity="0.9" />@@ -1165,7 +1165,7 @@<rect x="36" y="412" width="468" height="50" rx="10" fill="var(--surface-2)" stroke="var(--border-strong)" stroke-width="1.3" /><rect x="52" y="424" width="25" height="25" rx="6" fill="var(--accent)" opacity="0.85" /><text x="89" y="430" dominant-baseline="middle" font-size="14.5" font-weight="700" fill="var(--ink)">MemPalace</text>- <text x="89" y="450" dominant-baseline="middle" font-size="11" fill="var(--faint)">his memory · his machine</text>+ <text x="89" y="450" dominant-baseline="middle" font-size="11" fill="var(--faint)">their memory · their machine</text><rect x="152" y="486" width="236" height="28" rx="9" fill="var(--accent)" opacity="0.92" /><text x="270" y="501" text-anchor="middle" dominant-baseline="middle" font-size="12.5" font-weight="700" fill="var(--accent-ink)">⟳ 24/7</text>@@ -1178,7 +1178,7 @@<rect x="16" y="668" width="508" height="252" rx="14" fill="none" stroke="var(--border-strong)" stroke-width="1.4" stroke-dasharray="7 7" opacity="0.75" /><rect x="32" y="657" width="248" height="22" rx="7" fill="var(--surface-2)" stroke="var(--border-strong)" stroke-width="1.1" />- <text x="156" y="669" text-anchor="middle" dominant-baseline="middle" font-size="11" font-weight="600" letter-spacing="0.1" fill="var(--ink)">TEAMMATE's CLONE . THEIR COMPUTER</text>+ <text x="156" y="669" text-anchor="middle" dominant-baseline="middle" font-size="11" font-weight="600" letter-spacing="0.1" fill="var(--ink)">TEAMMATE’S CLONE · THEIR COMPUTER</text><rect x="36" y="694" width="204" height="56" rx="10" fill="var(--accent-soft)" stroke="var(--accent-line)" stroke-width="1.3" /><rect x="50" y="708" width="18" height="18" rx="5" fill="var(--accent)" opacity="0.9" /><text x="78" y="714" dominant-baseline="middle" font-size="13.5" font-weight="700" fill="var(--ink)">GOD orchestrator</text>@@ -1195,7 +1195,7 @@<rect x="36" y="774" width="468" height="46" rx="10" fill="var(--surface-2)" stroke="var(--border-strong)" stroke-width="1.2" /><rect x="52" y="785" width="20" height="20" rx="5" fill="var(--accent)" opacity="0.85" /><text x="84" y="791" dominant-baseline="middle" font-size="13" font-weight="700" fill="var(--ink)">MemPalace</text>- <text x="84" y="810" dominant-baseline="middle" font-size="10.5" fill="var(--faint)">his memory · his machine</text>+ <text x="84" y="810" dominant-baseline="middle" font-size="10.5" fill="var(--faint)">their memory · their machine</text><rect x="204" y="850" width="132" height="28" rx="9" fill="var(--accent)" opacity="0.92" /><text x="270" y="865" text-anchor="middle" dominant-baseline="middle" font-size="12.5" font-weight="700" fill="var(--accent-ink)">⟳ 24/7</text></svg>@@ -1466,7 +1466,7 @@<span class="svc-chips"><span>CLOUD</span><span>NETWORK</span></span><span class="plan-price">Teams PRO<small>agents use our network + run on our cloud</small></span><ul>- <li>Everything in Team + Network</li>+ <li>Everything in Teams Lite</li><li>Dedicated sandbox VM per clone</li><li>The whole floor ships with laptops closed</li><li>Hosted org knowledge base, in your controlled environment</li>@@ -1518,8 +1518,9 @@<summary>What does it cost?</summary><p>Your own clone is free and open source (MIT) — you only pay whoeverpowers your agent (your existing Claude, OpenAI, or Copilot plan). Teams- license the Secure Org Network: Basic covers up to 10 members, Pro up to- 20, larger teams on request. Cloud + Network adds dedicated sandbox VMs+ license the Secure Org Network: Teams Lite covers clone-to-clone messaging and the+ shared org knowledge base; Teams PRO adds a dedicated sandbox VM per+ clone. Seats scale from 10 to 100+. Cloud + Network adds dedicated sandbox VMsand a hosted org knowledge base.</p></details></div>@@ -1828,11 +1829,11 @@michael: { name:'Michael', role:"Team Lead's clone", agent:'Claude Code', serial:'NODE #001',tasks:['triaging the PR queue','writing standup notes','re-planning sprint 12','unblocking two threads'],ships:['standup notes posted','sprint re-planned','3 threads unblocked'] },- jim: { name:'Jim', role:"Engineer's clone", agent:'Cursor', serial:'NODE #002',+ jim: { name:'Jim', role:"Engineer's clone", agent:'Antigravity', serial:'NODE #002',tasks:['shipping PR #142','fixing a flaky CI test','refactoring the auth module','writing tests overnight'],ships:['PR #147 merged','CI back to green','tests written'] },pam: { name:'Pam', role:"Designer's clone", agent:'Copilot CLI', serial:'NODE #003',- tasks:['auditing the design system','exporting onboarding assets','specing the empty states','tokenizing the palette'],+ tasks:['auditing the design system','exporting onboarding assets','speccing the empty states','tokenizing the palette'],ships:['assets exported','spec drafted','tokens updated'] },dwight: { name:'Dwight', role:"Sales clone", agent:'Codex', serial:'NODE #004',tasks:['updating the CRM','drafting 12 outreach emails','prepping the demo brief','scoring new leads'],@@ -2511,7 +2512,7 @@// download picker — pick macOS / Windows / Linux, click starts the download(function () {var REPO = 'chaitanyagiri/munder-difflin';- var REL = '0.4.0'; // fallback version; live links are resolved from the GitHub API below+ var REL = '0.4.1'; // fallback version; live links are resolved from the GitHub API belowvar BASE = 'https://github.com/' + REPO + '/releases/latest/download/';var PLATFORMS = [{ key: 'mac', icon: '🍎', os: 'macOS', sub: 'Universal · Apple Silicon + Intel', match: 'mac-universal.dmg', file: 'Munder-Difflin-' + REL + '-mac-universal.dmg' },diff --git a/docs/media/ph-thumbnail-240.gif b/docs/media/ph-thumbnail-240.gifnew file mode 100644index 00000000..e983ce01Binary files /dev/null and b/docs/media/ph-thumbnail-240.gif differdiff --git a/package.json b/package.jsonindex 2c7493c0..24751ea6 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "munder-difflin",- "version": "0.4.0",+ "version": "0.4.1","private": true,"description": "Local multi-agent harness for Claude Code: autonomous agents that message, route, and remember — coordinated by a GOD orchestrator and visualized as avatars at work.","main": "out/main/index.js",diff --git a/src/renderer/src/components/AgentCard.tsx b/src/renderer/src/components/AgentCard.tsxindex 92523ad0..c598f375 100644--- a/src/renderer/src/components/AgentCard.tsx+++ b/src/renderer/src/components/AgentCard.tsx@@ -26,7 +26,8 @@ export interface AgentCardProps {/** Context-window limit (tokens) assumed for the agent's model. */contextLimit?: number;selected?: boolean;- /** The orchestrator — gets a persistent accent frame + GOD tag so it stands out. */+ /** Your clone — gets a persistent accent frame + BOSS tag so it stands out.+ * (`isGod` / the `god` agent id stay as-is internally; this is display only.) */isGod?: boolean;onClick?: () => void;/** Number of ledger tasks this agent is actively DOING — rendered as a blue@@ -137,7 +138,7 @@ export function AgentCard({</div><div style={{ flex: 1, display: 'flex', flexDirection: 'column', gap: 2, minWidth: 0 }}>- {/* Identity row: name (+ GOD tag) + status. */}+ {/* Identity row: name (+ BOSS tag) + status. */}<div style={{ display: 'flex', alignItems: 'center', gap: 6, justifyContent: 'space-between', minWidth: 0 }}><span style={{ display: 'inline-flex', alignItems: 'center', gap: 5, minWidth: 0 }}><span style={{@@ -152,7 +153,7 @@ export function AgentCard({fontFamily: 'var(--cth-font-display)', fontSize: 7, lineHeight: '11px',background: `var(--cth-${accent})`, color: 'var(--cth-ink-900)',padding: '1px 4px 0', flexShrink: 0- }}>GOD</span>+ }}>BOSS</span>)}</span><PixelBadge status={typing ? 'typing' : status} />diff --git a/src/renderer/src/components/OnboardingWizard.tsx b/src/renderer/src/components/OnboardingWizard.tsxindex 04a9632a..00ae6dc0 100644--- a/src/renderer/src/components/OnboardingWizard.tsx+++ b/src/renderer/src/components/OnboardingWizard.tsx@@ -28,16 +28,16 @@ interface Feature {const FEATURES: Feature[] = [{icon: 'mcp',- label: 'MULTI-PROVIDER HIVE',- desc: 'Claude Code, Antigravity & Codex run as live agents in one shared office.',- descPlain: 'Use different AI assistants (Claude, Gemini, Codex) side by side in one shared office.',+ label: 'TEN ENGINES, ONE OFFICE',+ desc: 'Claude Code, Codex, Grok, Kimi, Antigravity, Qwen, OpenCode, Crush, pi & Copilot — live agents on one floor.',+ descPlain: 'Ten AI assistants — Claude, Codex, Gemini, Grok and more — working side by side in one shared office.',tint: 'var(--cth-lilac-light)', edge: 'var(--cth-lilac)'},{icon: 'gear',- label: 'MICHAEL ORCHESTRATES',- desc: 'An always-on GOD agent triages requests, routes tasks, and escalates only what needs you.',- descPlain: 'A manager agent, Michael, takes your requests, hands work to the right agent, and only interrupts you when it matters.',+ label: 'MICHAEL IS YOUR CLONE',+ desc: 'Your clone runs the floor — triages requests, routes tasks, and escalates only what needs you.',+ descPlain: 'Your clone, Michael, takes your requests, hands work to the right agent, and only interrupts you when it matters.',tint: 'var(--cth-sky-light)', edge: 'var(--cth-sky)'},{@@ -188,7 +188,7 @@ export function OnboardingWizard({ onComplete }: OnboardingWizardProps) {step === 'persona' ? 'WELCOME TO MUNDER DIFFLIN': step === 'welcome' ? 'MEET YOUR OFFICE': step === 'home' ? (plain ? 'STEP 1 OF 4 · A HOME FOR THE APP' : 'STEP 1 OF 4 · HARNESS HOME')- : step === 'orchestrator' ? (plain ? 'STEP 2 OF 4 · YOUR MANAGER AGENT' : "STEP 2 OF 4 · MICHAEL'S ENGINE")+ : step === 'orchestrator' ? (plain ? "STEP 2 OF 4 · YOUR CLONE" : "STEP 2 OF 4 · YOUR CLONE'S ENGINE"): step === 'repos' ? (plain ? 'STEP 3 OF 4 · YOUR PROJECTS' : 'STEP 3 OF 4 · YOUR REPOS'): step === 'permissions' ? 'STEP 4 OF 4 · PERMISSIONS & RELIABILITY': 'ALL SET'@@ -210,14 +210,14 @@ export function OnboardingWizard({ onComplete }: OnboardingWizardProps) {</div><div><div style={{ fontFamily: 'var(--cth-font-display)', fontSize: 12, lineHeight: '18px' }}>- RUN AN OFFICE OF AI AGENTS+ A CLONE OF YOU, WORKING 24/7</div><div style={{ fontSize: 12, color: 'var(--cth-ink-700)', lineHeight: '19px' }}>- Munder Difflin lets you run an office of long-running, highly capable AI- agents that can take on almost any task. It uses the CLI agents you already- have and manages everything around them — their context, memory, tasks,+ Munder Difflin turns the CLI agent you already use into a clone of you —+ one that runs an office of long-running agents and keeps working while+ you're away. It manages everything around them: context, memory, tasks,triggers, environment, files, and integrations.- <span style={{ color: 'var(--cth-ink-500)' }}> (We call this harnessing your agents.)</span>+ <span style={{ color: 'var(--cth-ink-500)' }}> Everything runs on this machine.</span></div></div></div>@@ -259,11 +259,11 @@ export function OnboardingWizard({ onComplete }: OnboardingWizardProps) {<div style={{fontFamily: 'var(--cth-font-display)',fontSize: 12, lineHeight: '18px'- }}>A CONTROL ROOM FOR A TEAM OF AGENTS</div>+ }}>YOUR CLONE AND THE FLOOR IT RUNS</div><div style={{ fontSize: 12, color: 'var(--cth-ink-700)', lineHeight: '18px' }}>{plain- ? "Think of it as a small office of AI workers you manage from one screen. Here's what's inside:"- : "You run a hive of AI coding agents — coordinated, persistent, and watchable. Here's what's inside:"}+ ? "Your clone runs a small office of AI workers, and you watch it all from one screen. Here's what's inside:"+ : "Your clone coordinates a hive of AI coding agents — persistent, watchable, all local. Here's what's inside:"}</div></div></div>@@ -346,18 +346,18 @@ export function OnboardingWizard({ onComplete }: OnboardingWizardProps) {<><p style={{ margin: 0, lineHeight: '22px' }}>{plain ? (- <><strong>Michael</strong> is the manager of your office — he reads your- requests, breaks them into tasks, and hands them to the right agent. Choose- which AI engine powers him.</>+ <><strong>Michael is your clone</strong> — he reads your requests, breaks+ them into tasks, and hands them to the right agent. He's the boss of the+ floor; you're still the boss of him. Choose which AI engine powers him.</>) : (- <><strong>Michael</strong>, the orchestrator you just met, coordinates the- whole floor — he triages your requests, assigns tasks, and manages the team.- Pick the engine and model that power him; give him a longer-context,- higher-capability model.</>+ <><strong>Michael is your clone</strong> — the boss of the floor you just+ met. He triages your requests, assigns tasks, and manages the team, while+ escalating anything that genuinely needs you. Pick the engine and model that+ power him; give him a longer-context, higher-capability model.</>)}</p>- {/* What is a CLI agent / GOD agent — item 3 */}+ {/* What is a CLI agent / your clone — item 3 */}<div style={{display: 'flex', gap: 8, alignItems: 'flex-start', padding: 10,background: 'var(--cth-lemon-light)', boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)',@@ -368,13 +368,13 @@ export function OnboardingWizard({ onComplete }: OnboardingWizardProps) {{plain ? (<>A <strong>CLI agent</strong> is an AI coding assistant that runs on yourcomputer — popular ones are Claude Code (Anthropic), Codex (OpenAI) and- Antigravity (Google Gemini). The <strong>GOD agent</strong> is the always-on- manager that runs your whole office. We recommend Claude Code on Opus 4.8 (1M).+ Antigravity (Google Gemini). <strong>Your clone</strong> is the always-on+ one that runs your whole office. We recommend Claude Code on Opus 4.8 (1M).You can add or switch the others later.</>) : (<>Each option is a <strong>CLI engine</strong> you have installed (Claude Code,- Codex, Antigravity/Gemini, or a local proxy like Qwen). The- <strong> GOD agent</strong> (Michael) is the orchestrator engine for the whole+ Codex, Antigravity/Gemini, or a local proxy like Qwen).+ <strong> Your clone</strong> (Michael) is the engine that orchestrates the wholehive. Recommended: Claude Code · Opus 4.8 · 1M — other providers can be wiredper agent later.</>)}diff --git a/tools/make-ph-thumbnail.cjs b/tools/make-ph-thumbnail.cjsnew file mode 100644index 00000000..5da83964--- /dev/null+++ b/tools/make-ph-thumbnail.cjs@@ -0,0 +1,221 @@+'use strict';+/**+ * Product Hunt thumbnail generator — 240x240 animated GIF.+ *+ * Michael alone, avatar-style, on a light brand ground, glancing around and+ * blinking. Renders the REAL sprite (src/renderer/src/scene/office/portraitArt.ts+ * is procedural pixel art with no DOM dependency outside its paint helper, so it+ * runs straight in Node), then patches the eye pixels per frame.+ *+ * No text: at ~50px in a scrolling feed the only things that survive are big+ * shapes, colour, and motion — and a face looking back at you is the one shape+ * everybody parses instantly.+ */++const fs = require('node:fs');+const path = require('node:path');++const ROOT = '/Users/chaitanya/dev/claudeTerminalHarness';+const loadTs = require(path.join(ROOT, 'test/load-ts.cjs'));+const art = loadTs('src/renderer/src/scene/office/portraitArt.ts');++const W = 240, H = 240;+const SW = art.SCENE_W, SH = art.SCENE_H;++// ── palette ───────────────────────────────────────────────────────────────+const GROUND = [253, 244, 209]; // light tint of the brand yellow — flat,+ // edge to edge. No disc, no vignette: any+ // shape behind him competes with the face.++// ── sprite geometry ───────────────────────────────────────────────────────+const SCALE = 10; // 18x32 sprite pixel -> 10px block+const CROP_TOP = 1; // sprite row where the drawing starts+const CROP_ROWS = 23; // head + shoulders, bled off the bottom+ // edge; the legs fall outside the frame+const OX = Math.round((W - SW * SCALE) / 2);+const OY = 12;++// ── eyes ──────────────────────────────────────────────────────────────────+// Whites occupy x 5-6 and 10-11. The art draws pupils at x=6 and x=10 (the+// inner pixel of each pair), so "centre" is free and one step either way gives+// a clean left/right glance. Row 9 is canon; row 10 is skin we borrow for a+// downward look.+const EYE_ROWS = [9, 10];+const WHITE = [250, 248, 244];+const PUPIL = [46, 38, 42];+const LID = [168, 112, 82]; // SKIN.light.line+const SKIN_HI = [255, 221, 189]; // x=5 sits on the lit side of the face+const SKIN_BS = [247, 201, 170];++const setPx = (sp, x, y, c) => {+ const i = (y * SW + x) * 4;+ sp[i] = c[0]; sp[i + 1] = c[1]; sp[i + 2] = c[2]; sp[i + 3] = 255;+};+const skinAt = (x) => (x === 5 ? SKIN_HI : SKIN_BS);++/** Copy the sprite and repaint just the eyes. `h` -1/0/1, `v` 0/1. */+function patchEyes(base, { h = 0, v = 0, blink = false }) {+ const sp = Uint8ClampedArray.from(base);+ const cols = [5, 6, 10, 11];+ if (blink) {+ for (const x of cols) { setPx(sp, x, 10, skinAt(x)); setPx(sp, x, 9, LID); }+ return sp;+ }+ for (const x of cols) for (const y of EYE_ROWS) setPx(sp, x, y, WHITE);+ setPx(sp, h === -1 ? 5 : 6, 9 + v, PUPIL);+ setPx(sp, h === 1 ? 11 : 10, 9 + v, PUPIL);+ return sp;+}++// ── canvas helpers ────────────────────────────────────────────────────────+const px = (buf, x, y, c) => {+ if (x < 0 || y < 0 || x >= W || y >= H) return;+ const i = (y * W + x) * 3;+ buf[i] = c[0]; buf[i + 1] = c[1]; buf[i + 2] = c[2];+};+const rect = (buf, x0, y0, x1, y1, c) => {+ for (let y = y0; y < y1; y++) for (let x = x0; x < x1; x++) px(buf, x, y, c);+};++/** Blit the sprite at SCALE, cropped to the bust, skipping transparent pixels. */+function blitSprite(buf, sprite) {+ for (let sy = CROP_TOP; sy < CROP_TOP + CROP_ROWS && sy < SH; sy++) {+ for (let sx = 0; sx < SW; sx++) {+ const i = (sy * SW + sx) * 4;+ if (sprite[i + 3] < 128) continue;+ const c = [sprite[i], sprite[i + 1], sprite[i + 2]];+ const dx0 = OX + sx * SCALE, dy0 = OY + (sy - CROP_TOP) * SCALE;+ for (let dy = 0; dy < SCALE; dy++)+ for (let dx = 0; dx < SCALE; dx++) px(buf, dx0 + dx, dy0 + dy, c);+ }+ }+}++// ── compose one frame ─────────────────────────────────────────────────────+function composeFrame(sprite) {+ const buf = Buffer.alloc(W * H * 3);+ rect(buf, 0, 0, W, H, GROUND);+ blitSprite(buf, sprite);+ return buf;+}++// ── the loop: glance around, twice back to camera ─────────────────────────+// Delays are per-frame (centiseconds): darts are fast, holds are long. A single+// uniform delay makes eye movement read as a metronome instead of a person.+const BEATS = [+ [{ h: 0, v: 0 }, 100],+ [{ blink: true }, 8],+ [{ h: 0, v: 0 }, 24],+ [{ h: -1, v: 0 }, 52],+ [{ h: 0, v: 0 }, 16],+ [{ h: 1, v: 0 }, 50],+ [{ h: 1, v: 1 }, 28],+ [{ h: 0, v: 1 }, 22],+ [{ h: 0, v: 0 }, 44],+ [{ blink: true }, 8],+ [{ h: 0, v: 0 }, 90],+];++// ── quantise to an indexed palette ────────────────────────────────────────+function quantise(frames) {+ const map = new Map();+ const palette = [];+ for (const f of frames) {+ for (let i = 0; i < f.length; i += 3) {+ const key = (f[i] << 16) | (f[i + 1] << 8) | f[i + 2];+ if (!map.has(key)) { map.set(key, palette.length); palette.push([f[i], f[i + 1], f[i + 2]]); }+ }+ }+ if (palette.length > 256) throw new Error(`palette overflow: ${palette.length} colours`);+ const indexed = frames.map((f) => {+ const out = Buffer.alloc(W * H);+ for (let p = 0; p < W * H; p++) {+ const i = p * 3;+ out[p] = map.get((f[i] << 16) | (f[i + 1] << 8) | f[i + 2]);+ }+ return out;+ });+ return { palette, indexed };+}++// ── GIF LZW ───────────────────────────────────────────────────────────────+function lzwEncode(indexed, minCodeSize) {+ const clear = 1 << minCodeSize, end = clear + 1;+ let codeSize = minCodeSize + 1, next = end + 1;+ let dict = new Map();+ const resetDict = () => { dict = new Map(); next = end + 1; codeSize = minCodeSize + 1; };++ const out = [];+ let cur = 0, curBits = 0;+ const emit = (code) => {+ cur |= code << curBits; curBits += codeSize;+ while (curBits >= 8) { out.push(cur & 0xff); cur >>= 8; curBits -= 8; }+ };++ resetDict();+ emit(clear);+ let prefix = String(indexed[0]);+ for (let i = 1; i < indexed.length; i++) {+ const k = indexed[i];+ const combined = prefix + ',' + k;+ if (dict.has(combined)) { prefix = combined; continue; }+ emit(prefix.includes(',') ? dict.get(prefix) : Number(prefix));+ dict.set(combined, next++);+ if (next > (1 << codeSize)) {+ if (codeSize < 12) codeSize++;+ else { emit(clear); resetDict(); }+ }+ prefix = String(k);+ }+ emit(prefix.includes(',') ? dict.get(prefix) : Number(prefix));+ emit(end);+ if (curBits > 0) out.push(cur & 0xff);+ return Buffer.from(out);+}++function subBlocks(data) {+ const parts = [];+ for (let i = 0; i < data.length; i += 255) {+ const chunk = data.subarray(i, i + 255);+ parts.push(Buffer.from([chunk.length]), chunk);+ }+ parts.push(Buffer.from([0]));+ return Buffer.concat(parts);+}++function buildGif(palette, indexed, delays) {+ let bits = 1; while ((1 << bits) < palette.length) bits++;+ const tableSize = 1 << bits;+ const gct = Buffer.alloc(tableSize * 3);+ palette.forEach((c, i) => { gct[i * 3] = c[0]; gct[i * 3 + 1] = c[1]; gct[i * 3 + 2] = c[2]; });++ const u16 = (n) => { const b = Buffer.alloc(2); b.writeUInt16LE(n); return b; };+ const parts = [Buffer.from('GIF89a', 'ascii'), u16(W), u16(H),+ Buffer.from([0xf0 | (bits - 1), 0, 0]), gct,+ // Netscape 2.0 application extension = loop forever+ Buffer.from([0x21, 0xff, 0x0b]), Buffer.from('NETSCAPE2.0', 'ascii'),+ Buffer.from([0x03, 0x01]), u16(0), Buffer.from([0x00])];++ const minCodeSize = Math.max(2, bits);+ indexed.forEach((frame, i) => {+ parts.push(Buffer.from([0x21, 0xf9, 0x04, 0x04]), u16(delays[i]), Buffer.from([0x00, 0x00]));+ parts.push(Buffer.from([0x2c]), u16(0), u16(0), u16(W), u16(H), Buffer.from([0x00]));+ parts.push(Buffer.from([minCodeSize]), subBlocks(lzwEncode(frame, minCodeSize)));+ });+ parts.push(Buffer.from([0x3b]));+ return Buffer.concat(parts);+}++// ── run ───────────────────────────────────────────────────────────────────+const stand = art.sceneFrameBufs('michael').front[0];+const rgbFrames = BEATS.map(([eyes]) => composeFrame(patchEyes(stand, eyes)));+const delays = BEATS.map(([, d]) => d);++const { palette, indexed } = quantise(rgbFrames);+const gif = buildGif(palette, indexed, delays);++const outPath = process.argv[2] || path.join(__dirname, 'ph-thumbnail-240.gif');+fs.writeFileSync(outPath, gif);+const secs = (delays.reduce((a, b) => a + b, 0) / 100).toFixed(1);+console.log(`wrote ${outPath}`);+console.log(` ${W}x${H} frames=${rgbFrames.length} loop=${secs}s colours=${palette.length} ${(gif.length / 1024).toFixed(1)} KB`);