Implementation plan · May 2026 · 6 research reports · 3,220 lines of findings
31.2k
Multica GitHub stars
~45%
ainb primitives reusable
8 phases
sequenced delivery
~16 wks
estimated build
01
What is Multica
Multica is an open-source managed-agents platform: you assign GitHub issues to AI agents through a web Kanban, a daemon on your machine claims tasks, spawns agent CLI subprocesses, and the PR ships while you watch live transcript updates.
Repo topology: Go monolith (internal/) + Next.js (apps/web) + Electron (apps/desktop) + Expo mobile + single CLI/daemon binary
License: Modified Apache 2.0 with SaaS hosting restriction — open-core boundary around the cloud-runtime fleet
Self-host:docker-compose up — Postgres + Redis + single Go binary; daemon runs on the user's laptop
Key insight: the server never sees LLM calls — it sees result, session_id, work_dir, usage. Daemon owns the data plane.
02
Task lifecycle state machine
Every agent assignment becomes a task row. State transitions are driven by the daemon (claim/start/complete/fail) and by server-side TTL sweepers. Retries create new rows with parent_task_id — old row stays for audit.
Unique constraint:idx_one_pending_task_per_issue WHERE status IN ('queued','dispatched') — migration 022 — prevents double-dispatch
Idempotent finalize: if UPDATE matches 0 rows but row is already terminal, return success (task.go:1010) — defeats WS-vs-HTTP race
Retry: only runtime_offline and runtime_recovery failure reasons are retryable; new row created, attempt counter incremented — migration 055
TTLs: queued → 2h, dispatched → 5min, running → 2.5h — all enforced by background sweeper goroutines
Reclaim: stale dispatched tasks (daemon went offline) re-queued via ReclaimStaleDispatchedTask after 90s
03
User journey — assign issue, agent ships PR
The complete path from human action to merged PR. The WS-driven UI watching task lifecycle and comments is what makes the experience feel like a teammate rather than a CLI tool.
04
Patterns worth copying wholesale
Multica made eight architectural bets that consistently reduced blast radius. These should be replicated verbatim in ainb v2 — the invariants are locked in DB constraints and middleware, not conventions.
Dual-WS hub split:realtime.Hub (user fan-out, survives daemon reconnect) + daemonws.Hub (daemon wakeup, per-runtime). Never merge these — different retry semantics.
Polymorphic actor:assignee_type + assignee_id columns on issue row — member, agent, or squad without schema change. Picker is a single component that renders all three.
Per-task env isolation:~/ainb_workspaces/{ws}/{task}/{workdir,output,logs} — each task gets fresh git worktree + materialized skills; no shared state between tasks.
Skills materialized at dispatch time: DB stores skill template rows; daemon writes provider-native paths into the per-task env at claim time. Server never touches the filesystem.
Curated agent templates embedded in binary://go:embed templates/*.json for agent profiles; these are the main onboarding surface — easy to extend, hard to corrupt.
Single binary for CLI + daemon + server: subcommand routing means one release artifact, trivial daemonize (ainb server start), zero coordination between binaries on auto-update.
Idempotent finalize pattern: any task completion/failure endpoint checks existing terminal state before returning error — defeats the WS-vs-HTTP race without distributed locks.
Partial unique index for pending tasks: one DB constraint eliminates an entire class of double-dispatch bugs without application-level locking.
05
ainb today — what exists
ainb is a local-first Rust workspace with a TUI, plugin host, toolkit, and knowledge layer. It has no server, no web UI, and no persistent daemon — all state lives on the filesystem. The gap to Multica is real but largely additive.
06
Capability gap — ainb vs Multica
Coverage is current ainb coverage of that Multica feature. Effort is engineering cost to close the gap. ~45% of Multica primitives map directly onto existing ainb components.
ainb usage analyzer already tracks per-session cost; expose via API
07
ainb v2 target architecture
The target collapses CLI + daemon + server into one Rust binary (same trick Multica uses). New modules are marked ★. Existing ainb primitives are reused as-is. The Beads sync adapter is the leverage move — Stevie keeps using Beads UX while the server backfills the task table.
08
Execution roadmap — 8 phases, ~16 weeks
Sequenced so a usable artifact ships at the end of every phase. No big-bang. Beads sync adapter (P2) is the leverage move — Stevie keeps the existing Beads UX while the server backfills the task table underneath.
Multica has three security issues that must not be replicated. The DE audit also flagged five scaling cliffs. All eight should be addressed explicitly in the ainb v2 design — not deferred.
ainb is MIT today. If cloud offering planned, decide license before any public launch. Apache 2.0 + Commons Clause is the Multica pattern.
No OTEL tracing from day one — impossible to diagnose task stuck issues
low
Add tracing crate + otlp exporter at P0 skeleton. Zero cost to add early; expensive to retrofit.
10
Open decisions before build starts
Three decisions have non-trivial schema cost if changed mid-build. Lock them before P0 migrations are written.
Single-tenant vs multi-tenant from day 1?
Recommendation: multi-tenant. The schema cost is one-time (workspace_id FK on every table). Retrofitting later requires a migration across all existing rows and every query. ainb already has the BEADS_DIR per-worktree pattern — mapping that to workspace_id is straightforward. Single-tenant saves ~2 days in P0/P5 but costs 2 weeks if you ever want to share a server instance.
BYO-LLM-keys vs platform-managed keys?
Recommendation: BYO for the OSS build. Store per-workspace, column-encrypted. Platform-managed keys require a secrets manager (Vault, AWS SM) and billing integration — that is P8+ territory. Multica ships BYO-keys for self-hosted; platform keys are cloud-only.
Trust-the-user vs container-sandboxed execution?
Recommendation: trust-the-user with documented warnings, same as Multica self-hosted. Container sandboxing (gVisor, Firecracker) is a correctness win but adds ~3 weeks and breaks the git worktree isolation pattern that already works. Ship the warning gate (see §09 Codex danger-full-access item), document what the agent can access, and treat sandboxing as a future P9 hardening option. Do not block v1.0 on it.
ainb × Multica — implementation plan · May 2026Research: 6 reports · 3,220 lines · code-archaeologist + community + DE critique + UX analysis