Skip to main content

Layer 8 · place

workspace

blocks/8-place/workspace.yaml

layer 8place
3entities
11commands
11events
3views
34refusals
2KPIs

The files an agent works on: a checkout, a scratch copy or a worktree, at a base revision. A lease names who works in it; it is requested, then granted, and an exclusive workspace has at most one live lease. Only the holder of a live lease writes, and a change leaves the workspace only as a proposal, which is merged, rejected or superseded. A proposal hands its change back as an artifact of a store (agentic.store). A workspace with no live lease may be removed; it names the archive it can be recovered from and takes no lease afterwards.

Depends on​

  • channel · layer 7 · 8 references
  • authority · layer 6 · 5 references
  • store · layer 3 · 10 references
  • shared · layer 0 · 10 references

Used by​

Entities​

Lease​

A party's right to work in a workspace until it expires.

Identified by lease_id (LeaseId).

fieldtypemeaning
workspace_idWorkspaceId
holderPartyId
sharingSharingThe workspace's sharing when the lease was requested.
expires_attimestamp
writesinteger

Relations:

  • workspace references Workspace (one, by workspace_id)

Always holds: writes >= 0.

Lifecycle of Lease

ExpiredLiveReleasedRequestedgrantreleaseexpireExpiredLiveReleasedRequestedgrantreleaseexpire
Ends in Expired, Released.

Proposal​

A change leaving a workspace, made under a live lease.

Identified by proposal_id (ProposalId).

fieldtypemeaning
workspace_idWorkspaceId
lease_idLeaseId
proposed_byPartyId
base_revisionRevision
changeContent
merged_revisionoptional Revision
superseded_byoptional ProposalId
handbackoptional RecordIdThe artifact the change is handed back as, a record of an artifact store (agentic.store).
head_revisionoptional RevisionThe revision the change ends at when it was proposed.
merged_underoptional GrantIdThe standing grant under which it was merged without asking, when one was.

Relations:

  • workspace references Workspace (one, by workspace_id)
  • lease references Lease (one, by lease_id)
  • successor references Proposal (one, by superseded_by)
  • merge_grant references Grant of authority (one, by merged_under)
  • handback_artifact references Record of store (one, by handback)

Lifecycle of Proposal

MergedProposedRejectedSupersededmergerejectsupersedeMergedProposedRejectedSupersededmergerejectsupersede
Ends in Merged, Rejected, Superseded.

Workspace​

One set of files at a base revision, shared as its sharing says.

Identified by workspace_id (WorkspaceId).

fieldtypemeaning
kindWorkspaceKind
sharingSharing
base_revisionRevision
archiveoptional RecordIdThe record of an artifact store (agentic.store) that holds the archive the workspace can be recovered from, once it is removed.

Relations:

  • archive_artifact references Record of store (one, by archive)

Lifecycle of Workspace

HeldReadyRemovedholdfreeremoveremoveHeldReadyRemovedholdfreeremoveremove
Ends in Removed.

Commands​

CreateWorkspace​

Create a workspace.

Called by: Worker.

fieldtype
kindWorkspaceKind
sharingSharing
base_revisionRevision
outcomewhenresult
createdotherwisecreates a Workspace in Ready; emits WorkspaceCreated

ExpireLease​

Expire a lease.

Called by: Keeper.

fieldtype
lease_idLeaseId
outcomewhenresult
unknown refusedno such LeaseUnknownLease: No lease has this identity.
not-expired refusedexpires_at > nowNotExpired: The lease has not reached its expiry.
expiredotherwisemoves the Lease Live → Expired; moves each Workspace with workspace_id == subject.workspace_id and state == Held to Ready; emits LeaseExpired
wrong-state refusedthe Lease is in a state that does not allow itLeaseStateConflict: The lease is not in a state this command acts from.

GrantLease​

Grant a lease. A requested lease goes live; an exclusive workspace is held by it.

Called by: Keeper.

fieldtype
lease_idLeaseId
outcomewhenresult
unknown refusedno such LeaseUnknownLease: No lease has this identity.
workspace-removed refusedthe Workspace of workspace_id has state == RemovedWorkspaceIsRemoved: The workspace is removed; it takes no lease.
exclusive-held refusedthe Workspace of workspace_id has state == HeldLeaseHeld: The workspace is exclusive and another live lease holds it.
granted-exclusivethe Workspace of workspace_id has sharing == Exclusivemoves the Lease Requested → Live; moves each Workspace with workspace_id == subject.workspace_id and state == Ready to Held; emits LeaseGranted
granted-sharedotherwisemoves the Lease Requested → Live; emits LeaseGranted
wrong-state refusedthe Lease is in a state that does not allow itLeaseStateConflict: The lease is not in a state this command acts from.

MergeProposal​

Merge a proposal.

Called by: Keeper.

fieldtype
proposal_idProposalId
merged_revisionRevision
merged_underoptional GrantId
outcomewhenresult
unknown refusedno such ProposalUnknownProposal: No proposal has this identity.
mergedotherwisemoves the Proposal Proposed → Merged; emits ProposalMerged
wrong-state refusedthe Proposal is in a state that does not allow itProposalStateConflict: The proposal is no longer Proposed.

Propose​

Propose a change. A change leaves the workspace of a live lease as a proposal.

Called by: Worker.

fieldtype
lease_idLeaseId
holderPartyId
base_revisionRevision
changeContent
handbackoptional RecordId
head_revisionoptional Revision
outcomewhenresult
holder-not-the-caller refusedholder != caller.partyNotTheHolder: Only the holder of the lease acts under it.
no-lease refusedno Lease for lease_idNoLease: The proposal names no lease that exists.
lease-not-live refusedthe Lease of lease_id has state != LiveLeaseNotLive: The lease is not live; it is requested, released or expired.
not-the-holder refusedthe Lease of lease_id has holder != input.holderNotTheHolder: Only the holder of the lease acts under it.
past-expiry refusedthe Lease of lease_id has expires_at <= nowLeasePastExpiry: The lease has reached its expiry; nothing is done under it any more.
proposedotherwisecreates a Proposal in Proposed; emits ChangeProposed

RecordWrite​

Record a write. The holder of a live lease writes one path of the workspace.

Called by: Worker.

fieldtype
lease_idLeaseId
pathPath
outcomewhenresult
unknown refusedno such LeaseUnknownLease: No lease has this identity.
not-the-holder refusedholder != caller.partyNotTheHolder: Only the holder of the lease acts under it.
read-only refusedsharing == SharedReadOnlyReadOnlyWorkspace: The workspace is shared read-only; nothing is written in it.
past-expiry refusedexpires_at <= nowLeasePastExpiry: The lease has reached its expiry; nothing is done under it any more.
writtenthe Lease is Liveupdates the Lease; emits PathWritten
not-live refusedotherwiseLeaseNotLive: The lease is not live; it is requested, released or expired.

RejectProposal​

Reject a proposal.

Called by: Keeper.

fieldtype
proposal_idProposalId
outcomewhenresult
unknown refusedno such ProposalUnknownProposal: No proposal has this identity.
rejectedotherwisemoves the Proposal Proposed → Rejected; emits ProposalRejected
wrong-state refusedthe Proposal is in a state that does not allow itProposalStateConflict: The proposal is no longer Proposed.

ReleaseLease​

Release a lease.

Called by: Worker.

fieldtype
lease_idLeaseId
outcomewhenresult
unknown refusedno such LeaseUnknownLease: No lease has this identity.
not-the-holder refusedholder != caller.partyNotTheHolder: Only the holder of the lease acts under it.
releasedotherwisemoves the Lease Live → Released; moves each Workspace with workspace_id == subject.workspace_id and state == Held to Ready; emits LeaseReleased
wrong-state refusedthe Lease is in a state that does not allow itLeaseStateConflict: The lease is not in a state this command acts from.

RemoveWorkspace​

Remove a workspace. The workspace ends (a checkout deleted, a worktree pruned) and names the archive it can be recovered from. Refused while a lease on it is live; a removed workspace takes no lease.

Called by: Keeper.

fieldtype
workspace_idWorkspaceId
archiveoptional RecordId
attimestamp
outcomewhenresult
unknown refusedno such WorkspaceUnknownWorkspace: No workspace has this identity.
leases-live refuseda Lease with workspace_id == input.workspace_id and state == LiveLeasesLive: A lease on the workspace is live; a workspace is removed only when none is.
removedotherwisemoves the Workspace Held, Ready → Removed; emits WorkspaceRemoved
wrong-state refusedthe Workspace is in a state that does not allow itWorkspaceStateConflict: The workspace is not in a state this command acts from.

RequestLease​

Request a lease. The caller asks for a lease on a workspace until it expires.

Called by: Worker.

fieldtype
workspace_idWorkspaceId
expires_attimestamp
outcomewhenresult
unknown-workspace refusedno Workspace for workspace_idUnknownWorkspace: No workspace has this identity.
workspace-removed refusedthe Workspace of workspace_id has state == RemovedWorkspaceIsRemoved: The workspace is removed; it takes no lease.
requestedotherwisecreates a Lease in Requested; emits LeaseRequested

SupersedeProposal​

Supersede a proposal. A newer proposal replaces this one.

Called by: Keeper.

fieldtype
proposal_idProposalId
superseded_byProposalId
outcomewhenresult
superseded-by-itself refusedproposal_id == superseded_bySupersededByItself: A proposal is replaced by another proposal, never by itself.
unknown refusedno such ProposalUnknownProposal: No proposal has this identity.
unknown-successor refusedno Proposal for superseded_byUnknownProposal: No proposal has this identity.
successor-not-proposed refusedthe Proposal of superseded_by has state != ProposedSuccessorNotProposed: A proposal is replaced by a proposal that is still Proposed, not by one already merged, rejected or superseded.
supersededotherwisemoves the Proposal Proposed → Superseded; emits ProposalSuperseded
wrong-state refusedthe Proposal is in a state that does not allow itProposalStateConflict: The proposal is no longer Proposed.

Events​

eventfieldsemitted by
ChangeProposedproposal_id ProposalId, lease_id LeaseId, proposed_by PartyId, base_revision Revision, handback optional RecordId, head_revision optional RevisionPropose
LeaseExpiredlease_id LeaseIdExpireLease
LeaseGrantedlease_id LeaseId, workspace_id WorkspaceIdGrantLease
LeaseReleasedlease_id LeaseIdReleaseLease
LeaseRequestedlease_id LeaseId, workspace_id WorkspaceId, holder PartyId, expires_at timestampRequestLease
PathWrittenlease_id LeaseId, workspace_id WorkspaceId, path PathRecordWrite
ProposalMergedproposal_id ProposalId, merged_revision Revision, merged_under optional GrantIdMergeProposal
ProposalRejectedproposal_id ProposalIdRejectProposal
ProposalSupersededproposal_id ProposalId, superseded_by ProposalIdSupersedeProposal
WorkspaceCreatedworkspace_id WorkspaceId, kind WorkspaceKind, sharing Sharing, base_revision RevisionCreateWorkspace
WorkspaceRemovedworkspace_id WorkspaceId, archive optional RecordId, at timestampRemoveWorkspace

Views​

viewrowsfields
Leases
Leases
each Leaselease_id LeaseId, workspace_id WorkspaceId, holder PartyId, sharing Sharing, expires_at timestamp, writes integer, state State
Proposals
Proposals
each Proposalproposal_id ProposalId, workspace_id WorkspaceId, lease_id LeaseId, proposed_by PartyId, base_revision Revision, change Content, merged_revision optional Revision, superseded_by optional ProposalId, handback optional RecordId, head_revision optional Revision, merged_under optional GrantId, state State
Workspaces
Workspaces
each Workspaceworkspace_id WorkspaceId, kind WorkspaceKind, sharing Sharing, base_revision Revision, archive optional RecordId, state State

Types​

typeisvalues or fields
Path
A path inside the workspace.
an identifier or valuestring
Revision
A revision of the files, as the version control system names it.
an identifier or valuestring
WorkspaceKindone ofCheckout, ScratchCopy, Worktree

KPIs​

2 KPIs from the KPI catalogue. A gate must be zero for a variant of an architecture to count.

Correctness​

KPIunitbettergatestatus
writes_without_lease
Writes to a workspace by a holder with no live lease.
How: PathWritten events whose agent holds no LeaseGranted that is unreleased and unexpired at that moment. Must be 0.
countlowergateplanned
source: research/2609.00252

Quality​

KPIunitbettergatestatus
lease_wait_seconds
Time a run waited for a workspace lease.
How: Seconds between LeaseRequested and LeaseGranted, median and 90th percentile.
secondslower–planned
source: design

Settings​

The settings a part of this block carries in an architecture document. agenticspec sim check refuses any other setting (setting_unknown) and a value outside its type (setting_invalid), and a part that lacks a setting marked required in the default column; the contract copies a setting into the ports it narrows. The last rows of each table are the settings every part takes. What no setting here types (a file, a path, an audience, the use of a model) goes into the part's notes, a map with free keys and values that the check takes as written and nothing reads.

A part workspace:

settingtypeunitdefaultcontractwhat
kindenum WorkspaceKind: checkout, scratch_copy, worktreeevery portWhat kind of workspace the part provides: a checkout of the files, a scratch copy of them, or a worktree of a repository.
sharingenum Sharing: exclusive, shared_read_only, shared_read_writeevery portWhether more than one holder may use one workspace.
countinteger of at least 11How many copies of the part run.
perpartOne copy of the part for each copy of the named part.
notesnotesFree notes on the part, a map with keys and values of any kind: what no setting of its block types. The check takes any map; the simulator, the search and the contract never read it.