Badges were fetched via a dedicated IPC that aggregated counts on the server, while the same data lived in ProfileSnapshot on the client. Two paths to the same answer drift whenever one side mutates between refreshes — the visible symptom being "badge = 1 unread" with an empty inbox after a message gets marked read in another screen. Delete the whole server path. Sidebar badges are now derived on the client from the snapshot via `deriveSidebarBadges(snapshot, companyId)` in `src/shared/sidebar-badges.ts`. One source of truth; drift is physically impossible. Deletions: - database/company-settings.ts::getSidebarBadges (120-line SQL aggregation) - database-base.ts::getSidebarBadges pass-through - ipc-core-read-handlers.ts: handler - preload/index.ts: bridge binding - shared/contracts/channels.ts: channel name - shared/contracts/desktop-api/companies.ts: API signature - shared/contracts/schemas-badges.ts::sidebarBadgesSchema Zod schema - renderer/state/slices/company.ts: `badges` field, `setBadges`, `refreshBadges` - useDataLoader: both getSidebarBadges call sites - useCompanyController: badge reset on company switch - useDesktopEvents: refreshBadges call on granular patches - tests/unit/store.test.ts: refreshBadges test (deleted code) The snapshot's agentMessages already carries board-reader read state via boardReadReceiptMap (`snapshot.ts:39-47` has always LEFT JOIN'd agent_message_reads with agent_id = BOARD_READER_ID). So derivation needs no schema change — the infrastructure was in place, just unused. fix(communication/MessageList): render orphaned-reply messages at the top level The thread-flattening used `filteredMessages.filter(m => !m.parentMessageId)` to pick top-level messages. When an agent replies to a company/incident post with a DM (the CEO prompt explicitly instructs this in wake-reasons/en.ts:119), the DM lands in the direct channel with parentMessageId pointing to a message that lives in another channel. That parent is not in `filteredMessages` for the direct channel, so the reply had no parent to nest under AND was excluded from top-level. The channel rendered as a blank pane even though exactly one message matched — the "clicked Dr. X ↔ Dr. Y, got empty" symptom. Fix: a message is top-level when it either has no parent OR its parent is outside the current filtered view. Replies with in-view parents still nest normally.
AgentCompany
Run an AI company from your desktop.
What it does
Type a company name and a goal. A CEO agent boots, hires specialists, forms departments, and runs the business. You approve or steer from the desktop.
Local, SQLite-backed, no external services. Inspired by Paperclip.
26 providers, no CLI
The runtime links pi-mono directly.
OAuth (5): Claude Pro/Max · ChatGPT Plus/Pro (Codex) · GitHub Copilot · Gemini CLI · Antigravity
API key (18): Anthropic · OpenAI · Google · Mistral · Groq · Cerebras · xAI · OpenRouter · Vercel AI Gateway · ZAI · OpenCode · OpenCode Go · Hugging Face · Kimi · MiniMax · MiniMax CN · Fireworks · Fireworks Firepass
Cloud (3): Azure OpenAI · AWS Bedrock · Google Vertex AI
Credentials are SecretVault-encrypted in SQLite.
Two execution modes
- AI CEO — autonomous. Hiring, tasks, deliverables run without you.
- AI Co-Founder — pauses at
hire_agent/document_review/plan_review/strategy_reviewfor your decision.
Switch at Settings → Execution mode.
Features
Self-organizing teams
CEO builds the org chart from one goal.
Agent messaging
Threads and DMs between agents. Messages land in each recipient's transcript as pi AgentMessage turns.
Tasks
Goals break into tasks. Agents pick them up, report progress, escalate blockers.
Approvals
Hiring, deliverables, plan/scope/strategy reviews, budget overrides, production deploys pause for the board.
Documents
Plans, strategies, and specs in a shared center, linked to the tasks that produced them.
Launch in a minute
Name, mission, goal, provider, mode.
Quick Start
Download the latest release — macOS (Apple Silicon & Intel), Windows, Linux.
Build from source
# Node.js 22+, pnpm 10+
pnpm install
pnpm dev
First run
- Onboarding probes your shell PATH for
node(agents call the local HTTP API vianode -e). - Settings → Providers. Sign in or drop a key.
- Create a company: name, mission, goal, mode, workspace.
Verification
pnpm typecheck
pnpm lint
pnpm test:unit
pnpm test:integration
pnpm test:e2e
pnpm build:verify
Packaging
pnpm build # Package for current platform → /build/release
pnpm build:dir # Unpackaged directory
pnpm build:current # Current host platform
pnpm release:local # Signed release pipeline — see docs/release/local-r2.md
Targets: macOS .dmg, Windows .exe (NSIS), Linux .AppImage. Built with electron-builder. Local builds use ad-hoc signing (CSC_IDENTITY_AUTO_DISCOVERY=false). Defaults to --publish never.
Architecture
src/
main/
agent-runtime/ RuntimeBridge, SqliteSessionStore, CostWriter
credentials/ CredentialStore, Resolver, OAuthLoginService
api-server/ Agent HTTP API
orchestration/ Scheduler, run dispatch
prompt-builder/ System prompt assembly
thread-integration/ Thread runtime event routing
worker/ utilityProcess worker — direct new Agent(...)
database/ SQLite schema + migrations
preload/ Typed DesktopApi via contextBridge
renderer/ React 19 UI
shared/ Zod schemas shared across processes
- SQLite local; no external services.
contextIsolation: true,nodeIntegration: false, Zod-validated IPC.- Worker constructs
new Agent({...})from@mariozechner/pi-agent-coredirectly. - Sessions persist as
session_entries; auto-compact viashouldCompact/compact. - Thread runtime (
conversation_threads/conversation_events/thread_wait_states) sits above pi'sAgentMessagestream.
Tech Stack
| Layer | Tech |
|---|---|
| Framework | Electron 39.8.0 |
| Language | TypeScript 5.9 |
| UI | React 19, Tailwind CSS 4, Framer Motion, Zustand |
| Build | electron-vite, Vite 7, electron-builder |
| Database | SQLite via node:sqlite (WAL) |
| Validation | Zod 4 |
| Agent runtime | @mariozechner/pi-ai, @mariozechner/pi-agent-core, @mariozechner/pi-coding-agent |
| Testing | Vitest, Playwright |






