Reference
How it works
The architecture behind Reigh — the runtime, wakes, the office server, sessions, and how it stays reliable.
Reigh is a native macOS app written in Swift 6 and SwiftUI. Everything runs locally: a SQLite database, a localhost MCP server, and one Claude Code process per active conversation.
ReighApp (SwiftUI)
└─ ReighUI ──────────── AppModel (GRDB observations) + screens
├─ DesignSystem ─── glass backdrop, tint, grain, theme controls
├─ AgentRuntime ─── OfficeEngine: services, dispatcher, per-employee sessions
│ └─ claude -p --input-format stream-json --output-format stream-json
├─ ReighMCP ─────── localhost MCP server exposing mcp__reigh__* office tools
├─ AgentBrowser ─── one off-screen WebKit browser per employee
├─ GitKit ───────── worktrees, diffs, PRs
├─ ReighCompanion ─ the encrypted link to Reigh Mobile
└─ ReighCore ────── SQLite (GRDB) schema, org policy, cron, memory mirror
Event-driven wakes
Agents don’t poll. When a message, task, answer or routine arrives for someone, the dispatcher builds a <reigh-wake> block for one project from the database and writes it to that person’s office conversation over stdin:
<reigh-wake time="Tue 7 Oct 09:00">
## New messages (1)
[msg 41] REQUEST from Sam Okafor (Engineering Manager, your manager) · re NL-2 · needs reply
Subject: Login race
Can you take the token refresh race? Repro steps are in the task.
## Your open tasks
- NL-2 · In Progress · High · "Fix login race on slow networks" (from Sam)
</reigh-wake>
Handle what's above (reply to each request or query), then end your turn.
inform messages don’t start a wake; they wait for the next one. Messages from you come first, then answers to their requests, then requests from their manager, then reviews, then everything else. A short debounce batches bursts of activity into a single wake.
Runs end when Claude goes idle
A run lasts until the CLI reports that the session is idle, so background sub-agents and the turns they trigger belong to the run that started them. Messages you send mid-run are written straight into the running session.
Processes stay warm for a few minutes after a run so the next wake starts instantly (Settings → Agents), and up to eight people work at once by default. Messages from you never wait behind that limit.
Office tools over MCP
Each Claude Code process is launched with an MCP config pointing at http://127.0.0.1:47321/mcp and its own bearer token. Tools like send_message, delegate_task, report_done, escalate, ask_human, remember and request_approval know who’s calling, and the org rules are enforced on the server. See Office tools.
Permissions
Claude Code’s --permission-prompt-tool points at mcp__reigh__approve. Requests become Inbox items, and the tool call waits up to ten minutes for your answer. Deny rules for destructive commands are passed to every process through --settings.
Claude Code first
Reigh adds as little as possible on top of Claude Code. The appended system prompt adds only the role, the project and the office protocol, and tells agents to do exactly what was asked. It stays the same between turns so it can be cached; anything that changes goes into the wake block.
Changing someone’s persona, manager or department changes their prompt, so their conversation is archived and a new one starts with a short handoff note. Memory and tasks carry over.
Costs
Costs come from the CLI’s running total per conversation. Reigh records the difference after each turn and remembers the total when a conversation is resumed, so nothing is counted twice.
Crash recovery
On launch, unfinished runs are marked crashed, leftover process groups are stopped, people who were working get a resume message, stale permission prompts expire, and git worktrees are pruned.
Data
Everything lives in one SQLite database (GRDB) with full-text search over memory, and in your workspace folder. Memory is mirrored to Markdown files and watched with FSEvents, so edits flow both ways.