Introduction

OverviewArchitectureAgent Experience

The product

This repository

Structure

Usage

Other

Concepts

Concepts

Every entity in the domain model, where each one is documented, and the invariants that hold across all of them

Not built yet. None of the tables below exist. The Prisma schema in packages/database still ships a single stub model inherited from the template this repository started as. These pages describe the intended shape, taken from spec/01-domain-model.md.

Storage is Cloudflare D1 via @repo/database (Prisma schema for tooling).

Entity map

Every entity in the domain model, and the page that covers it.

EntityWhat it isDocumented in
WorkspaceTenant boundary, mapped to a Clerk organizationAgents and machines
UserHuman, Clerk-backed, with a roleAgents and machines
AgentThe definition of a worker that may claim tasksAgents and machines
MachineA workstation that can host a runtimeAgents and machines
ApiKey / AgentTokenScoped credential for machine accessAgents and machines
ProjectGroups tasks; links a repository and a boardTasks
TaskThe unit of intentTasks
ScheduleRecurring task templateTasks
CommentThreaded human and agent conversation on a TaskTasks
RunOne attempt at a Task by an Agent on a MachineRuns and events
EventAppend-only timelineRuns and events
WebhookSubscriptionOutbound push so a runner is woken, not pollingRuns and events
ArtifactAny output worth keepingDocuments and artifacts
DocumentDurable knowledge not tied to one taskDocuments and artifacts
ApprovalHuman-in-the-loop gateApprovals and leasing

The task state machine is on the Tasks page, with its legal transitions and the guard on each one.

Record conventions

These are designed to apply to every table, not to a chosen few. They are repeated on the Tasks page with more detail.

ConventionRule
IDsULID primary keys, prefixed per entity, lexicographically sortable. No sequential integers are exposed.
SlugsStable, human and agent readable, unique per workspace.
TenancyEvery row carries workspaceId. No cross-workspace read, including for agent tokens.
VersioningEvery mutable row carries version, surfaced as an ETag, checked with If-Match.
ProvenancecreatedByType (user, agent, system) and createdById, plus the same pair for updatedBy.
Soft deletearchivedAt. Rows are never hard deleted.
TimestampsUTC, ISO-8601 on the wire.

Invariants

The four statements the design treats as always true. Each one is a rule the service layer holds, not a convention a caller is trusted to follow.

  • A Task in in_progress always has exactly one Run in running.
  • An Event is never updated and never deleted.
  • An Artifact is immutable once written. A new version is a new row.
  • No table stores a secret value. Only secretRef pointers to the real store.

The last one is the reason there is no field anywhere in this model that holds a token, a password or a key. An agent that needs a credential receives a reference and resolves it on its own machine.

On this page

GitHubEdit this page on GitHub