Schemas

@briefs/shared

Single source of truth for items, actors, and activities. Import Zod schemas for validation on clients, scripts, and assistant tools.

Imports

TypeScript
import {
  Item,
  itemSchema,
  itemCreateInputSchema,
  itemUpdateInputSchema,
  ItemStatus,
} from "@briefs/shared/item";

import { Activity, ActivityType } from "@briefs/shared/activity";
import { Actor } from "@briefs/shared/actor";

Item (schema v4)

FieldTypeNotes
schemaVersion4Schema version
idUUIDStable item identity
userIdstringOwning user identity
namestringDisplay title
statusenumopen | in_progress | done | cancelled
dueAtISO datetime?Optional deadline
scheduledAtISO datetime?Optional planned time
completedAtISO datetime?Optional completion time
priorityenum?low | normal | high | urgent
descriptionstring?Optional write-up body
kindstringItem type — task, note, ingest, etc.
ownerActorIdUUIDActor who owns the item
contextstringDomain scope — defaults to core
originContextstringOriginal domain scope — defaults to core
tagsstring[]?Optional labels
refsItemRef[]?Typed links to other items
lifecycleenumactive | archived
sourceItemSource?External provenance: system, externalId, optional externalUrl
ingestedAtISO datetime?When Briefs first ingested the item
stateRecord<string, unknown>?Optional domain-specific state
occurredAtISO datetimeWhen it happened in the world
createdAtISO datetimeWhen the item was created
updatedAtISO datetimeWhen the item was last updated

Activity

Activities are append-only records keyed by itemId. They record who acted, what happened, when it happened, and when Briefs recorded it. Standard verbs include Create, Update, Move, Accept, Reject, Undo, Delete, and Merge.

FieldTypeNotes
schemaVersion1Schema version
idUUIDStable activity identity
typestringCapitalized verb; namespaced verbs may use domain:Verb
actorIdUUIDActor who performed the action
itemIdUUIDItem this activity applies to
originstring?Origin system or workflow
targetstring?Target of the action
summarystring?Human-readable explanation; required for some verbs
occurredAtISO datetimeWhen the action happened in the world
recordedAtISO datetimeWhen Briefs recorded the action
resultActivityResult?Created item or field-level changes
clientKeystring?Client-supplied idempotency key

Updates carry structured deltas in result.changes:

result.changes
{
  "result": {
    "changes": [
      { "field": "status", "before": "open", "after": "in_progress" }
    ]
  }
}

Actor

Actors identify the people and software that act on work. Person actors are ensured on first API use via GET /actors/me; Service and Application actors represent integrations and software clients. Every activity records an actorId.

FieldTypeNotes
schemaVersion1Schema version
idUUIDStable actor identity
typeenumPerson | Service | Application
namestringDisplay name
identitystringSSO principal, service principal, or application identity
createdAtISO datetimeWhen the actor was created

Source layout

shared/src/
actor/           who acted
activity/        append-only event log
item/            durable item + ingest source
common/          shared Zod helpers