System model

Two writers. One execution truth.

Humans write through Flutter. Agents write through MCP and the API. Both update the same WorkItem graph and append attributable events.

Current state + immutable history
Selected boundaryFirestore
Credential
Rules or Admin SDK
Responsibility
WorkItem current state and append-only ExecutionEvents
Trust boundary
Integration secrets and key hashes are denied to all clients.
Atomic execution

A transition writes state and evidence together

A completion is not finished unless both the current item and its event commit successfully.

Beforestatus: in_progresszoneId: focuscompletedAt: null
completeone transaction
Afterstatus: donezoneId: donecompletedBy: actorId
+
Appended eventtype: completedactorId: agent:buildidempotencyKey: ...
Firestore shape

Top-level executable work

Stack, Queue, Zones, and Done are derived views. Durable work state is stored once.

users/{uid}/goals/{goalId}Outcome and timeframe
users/{uid}/workItems/{workItemId}Current executable truth
users/{uid}/actors/{actorId}Human and agent identity
users/{uid}/executionEvents/{eventId}Append-only history
users/{uid}/executionZones/{zoneId}Lanes and WIP limits
users/{uid}/integrations/{integrationId}Connection metadata
Secrets never cross into Flutter or MCP

API-key hashes, encrypted Slack tokens, and OAuth state live in server-only collections denied to Firestore clients.

Every accepted action remains attributable