Skip to main content

Layer 3 · capability

store

blocks/3-capability/store.yaml

layer 3capability
4entities
14commands
15events
6views
42refusals
4KPIs

Data a part writes and another part reads. A store has one of five kinds (record, artifact, key-value, semantic, graph), a scope and a retention. A record is one entry of a store under a key: it is put, confirmed by the service that plays the store, and stays present until a newer revision supersedes it, it expires or it is deleted once the authority approved a request to delete it. The block records that a write happened, its key, the digest of its content and who wrote it, never the bytes; the bytes live behind the store's port. An artifact is a record of an artifact store: its content is never revised, its key is its digest, and its provenance (who recorded it, which artifacts it derives from) is required. Reads are recorded too: a get by key and a query, each with the digests of what was asked and answered and a count. A store names no part: the architecture names the store a part links to.

Depends on​

Used by​

Entities​

Query​

One query of a store, recorded as the digest of what was asked, then the digest of the answer and the number of items in it. Requested until the service that plays the store answers or fails.

Identified by query_id (QueryId).

fieldtypemeaning
store_idStoreId
formQueryForm
questionContentDigest of the query (predicate, prefix, vector or text, pattern, path).
limitoptional integerAt most this many items in the answer.
read_byPrincipalId
requested_attimestamp
answeroptional ContentDigest of the answer; present once Answered.
countoptional integerThe number of items in the answer; present once Answered.
answered_atoptional timestamp

Relations:

  • store references Store (one, by store_id)
  • reader references Principal of principal (one, by read_by)

Lifecycle of Query

AnsweredFailedRequestedanswerfailAnsweredFailedRequestedanswerfail
Ends in Answered, Failed.

Read​

One get of a store by key, recorded with what it returned. Requested until the service that plays the store returns the present record of the key or fails.

Identified by read_id (ReadId).

fieldtypemeaning
store_idStoreId
keystring
read_byPrincipalId
requested_attimestamp
record_idoptional RecordIdThe record returned; present once Returned.
answered_atoptional timestamp

Relations:

  • store references Store (one, by store_id)
  • record references Record (one, by record_id)
  • reader references Principal of principal (one, by read_by)

Lifecycle of Read

FailedRequestedReturnedreturnfailFailedRequestedReturnedreturnfail
Ends in Failed, Returned.

Record​

One entry of a store under a key. It is Writing from the put until the service that plays the store confirms or fails it. A confirmed record is Present until a newer revision under its key supersedes it, it expires or it is deleted. A record of an artifact store is an artifact: its key is the digest of its content, and no revision supersedes it.

Identified by record_id (RecordId).

fieldtypemeaning
store_idStoreId
kindStoreKindThe kind of its store, kept on the record so a guard on it needs no second read.
keystringThe key it is stored under; for an artifact the digest of its content.
revisioninteger1 for the first record under a key, one more for each record that supersedes the one before.
contentContentDigest, length and class of the content; for an artifact the class is a row a field registers.
recorded_byPrincipalIdWho put it; an agent is a principal of kind Agent.
recorded_attimestamp
derived_fromlist of RecordIdThe records it derives from; for an artifact the artifacts it is a new version of or is made from.
supersedesoptional RecordIdThe record under the same key that it replaces when confirmed; absent for the first record under a key.
expires_atoptional timestampWhen the clock of the store expires it. The writer sets it from the store's retention: the time of the put plus its seconds for a Duration retention, none for Forever; a Run retention ends the record with the instance of the architecture.

Relations:

  • store references Store (one, by store_id)
  • predecessor references Record (one, by supersedes)
  • derived_from references Record (many, by derived_from)
  • recorder references Principal of principal (one, by recorded_by)

Always holds: revision >= 1.

Lifecycle of Record

DeletedExpiredFailedPresentSupersededWritingconfirmfailsupersedeexpiredeleteDeletedExpiredFailedPresentSupersededWritingconfirmfailsupersedeexpiredelete
Ends in Deleted, Expired, Failed, Superseded.

Store​

One store of one kind. Open until retired; a retired store takes no new put.

Identified by store_id (StoreId).

fieldtypemeaning
nameName
kindStoreKind
scopeStoreScope
retentionRetention
retention_secondsoptional integerHow long a record is kept, in seconds; required by a Duration retention and read by no other.
record_typeoptional NameThe record type every record of a record store has, a row a field registers; present when the kind is Record.

Lifecycle of Store

OpenRetiredretireOpenRetiredretire
Ends in Retired.

Commands​

AnswerQuery​

Answer a query.

Called by: Store service.

fieldtype
query_idQueryId
answerContent
countinteger
attimestamp
outcomewhenresult
unknown refusedno such QueryUnknownQuery: No query of this identity was requested.
invalid-count refused(input.count < 0 or defined(limit) and input.count > limit)InvalidCount: The count is negative or exceeds the query's limit.
answeredotherwisemoves the Query Requested → Answered; emits QueryAnswered
wrong-state refusedthe Query is in a state that does not allow itQueryStateConflict: The query is not in a state this command acts from.

ConfirmPut​

Confirm a put.

Called by: Store service.

fieldtype
record_idRecordId
attimestamp
outcomewhenresult
unknown refusedno such RecordUnknownRecord: No record of this identity exists.
confirmedstate == Writing and not (defined(supersedes))moves the Record Writing → Present; emits RecordPut
predecessor-missing refusedno Record for supersedesRecordNotPresent: The record named is no longer present: it was superseded, expired or deleted, or it is still being written. A put that supersedes such a record lost a compare-and-set.
predecessor-gone refusedthe Record of supersedes has state != PresentRecordNotPresent: The record named is no longer present: it was superseded, expired or deleted, or it is still being written. A put that supersedes such a record lost a compare-and-set.
confirmed-supersedingotherwisemoves the Record Writing → Present; moves each Record with record_id == subject.supersedes and state == Present to Superseded; emits RecordPut, RecordSuperseded
wrong-state refusedthe Record is in a state that does not allow itRecordStateConflict: The record is not in a state this command acts from.

CreateStore​

Create a store.

Called by: Store owner.

fieldtype
nameName
kindStoreKind
scopeStoreScope
retentionRetention
retention_secondsoptional integer
record_typeoptional Name
outcomewhenresult
seconds-invalid refuseddefined(retention_seconds) and retention_seconds < 1InvalidRetention: A Duration retention names no positive number of seconds.
seconds-missing refusedretention == Duration and not (defined(retention_seconds))InvalidRetention: A Duration retention names no positive number of seconds.
record-type-missing refusedkind == Record and not (defined(record_type))RecordTypeMissing: A record store names no record type.
createdotherwisecreates a Store in Open; emits StoreCreated

DeleteRecord​

Delete a record. The authority's approval deletes a present record; it leaves a tombstone. Deleting data cannot be undone, so no actor issues this command: a request of action class Delete that names the record (agentic.authority.DecideRequest, recorded as ApprovalRequired) awaits a human or a delegate, and its approval issues it through the binding delete-record-on-approval. A rejected request issues nothing: the record stays present.

fieldtypemeaning
record_idRecordId
approved_byDeciderWho approved the request to delete: a human, or a delegate under a delegation of approval.
attimestamp
outcomewhenresult
unknown refusedno such RecordUnknownRecord: No record of this identity exists.
deletedotherwisemoves the Record Present → Deleted; emits RecordDeleted
wrong-state refusedthe Record is in a state that does not allow itRecordStateConflict: The record is not in a state this command acts from.

ExpireRecord​

Expire a record. The clock of the store ends a record whose expiry has come.

Called by: Store service.

fieldtype
record_idRecordId
outcomewhenresult
unknown refusedno such RecordUnknownRecord: No record of this identity exists.
no-expiry refusednot (defined(expires_at))NotExpired: The record has no expiry, or its expiry lies in the future.
not-yet refusedexpires_at > nowNotExpired: The record has no expiry, or its expiry lies in the future.
expiredotherwisemoves the Record Present → Expired; emits RecordExpired
wrong-state refusedthe Record is in a state that does not allow itRecordStateConflict: The record is not in a state this command acts from.

FailGet​

Fail a get.

Called by: Store service.

fieldtype
read_idReadId
reasonstring
attimestamp
outcomewhenresult
unknown refusedno such ReadUnknownRead: No get of this identity was requested.
failedotherwisemoves the Read Requested → Failed; emits ReadFailed
wrong-state refusedthe Read is in a state that does not allow itReadStateConflict: The get is not in a state this command acts from.

FailPut​

Fail a put.

Called by: Store service.

fieldtype
record_idRecordId
reasonstring
attimestamp
outcomewhenresult
unknown refusedno such RecordUnknownRecord: No record of this identity exists.
failedotherwisemoves the Record Writing → Failed; emits PutFailed
wrong-state refusedthe Record is in a state that does not allow itRecordStateConflict: The record is not in a state this command acts from.

FailQuery​

Fail a query.

Called by: Store service.

fieldtype
query_idQueryId
reasonstring
attimestamp
outcomewhenresult
unknown refusedno such QueryUnknownQuery: No query of this identity was requested.
failedotherwisemoves the Query Requested → Failed; emits QueryFailed
wrong-state refusedthe Query is in a state that does not allow itQueryStateConflict: The query is not in a state this command acts from.

GetRecord​

Get a record. A reader asks for the present record under a key; the get is recorded.

Called by: Reader.

fieldtype
store_idStoreId
keystring
read_byPrincipalId
attimestamp
outcomewhenresult
unknown-store refusedno Store for store_idUnknownStore: No store of this identity exists.
key-not-found refusedno Record with store_id == input.store_id and key == input.key and state == PresentKeyNotFound: No record is present under this key.
requestedotherwisecreates a Read in Requested; emits ReadRequested

PutRecord​

Put a record. A writer asks the store to hold content under a key with no record present or being written. The record is Writing, at revision 1, until the service that plays the store confirms or fails the put. A put into an artifact store creates an artifact.

Called by: Writer.

fieldtype
store_idStoreId
keystring
contentContent
recorded_byPrincipalId
derived_fromlist of RecordId
expires_atoptional timestamp
attimestamp
outcomewhenresult
unknown-store refusedno Store for store_idUnknownStore: No store of this identity exists.
store-retired refusedthe Store of store_id has state != OpenStoreNotOpen: The store is retired and takes no new put.
artifact-not-at-digest refusedthe Store of store_id has kind == Artifact and input.key != input.content.digestArtifactNotAtDigest: A put into an artifact store names a key other than the digest of its content.
key-taken refuseda Record with store_id == input.store_id and key == input.key and (state == Writing or state == Present)KeyTaken: A record is present or being written under this key and the put does not name it as the one it supersedes. In an artifact store, the same content is already stored or being stored.
requestedotherwisecreates a Record in Writing; emits PutRequested

QueryStore​

Query a store. A reader asks a store a question of a form its kind answers; the query is recorded as digests.

Called by: Reader.

fieldtype
store_idStoreId
formQueryForm
questionContent
limitoptional integer
read_byPrincipalId
attimestamp
outcomewhenresult
invalid-limit refuseddefined(limit) and limit < 1InvalidLimit: The limit is less than 1.
unknown-store refusedno Store for store_idUnknownStore: No store of this identity exists.
form-not-served refusedthe Store of store_id has (kind == Record and input.form != Predicate or kind == Artifact and input.form != Listing or kind == KeyValue and input.form != Prefix or kind == Semantic and input.form != Nearest or kind == Graph and input.form != Pattern and input.form != Path)QueryFormNotServed: The store's kind does not answer a query of this form.
requestedotherwisecreates a Query in Requested; emits QueryRequested

RetireStore​

Retire a store.

Called by: Store owner.

fieldtype
store_idStoreId
outcomewhenresult
unknown refusedno such StoreUnknownStore: No store of this identity exists.
retiredotherwisemoves the Store Open → Retired; emits StoreRetired
wrong-state refusedthe Store is in a state that does not allow itStoreStateConflict: The store is not in a state this command acts from.

ReturnRecord​

Return a record.

Called by: Store service.

fieldtype
read_idReadId
record_idRecordId
attimestamp
outcomewhenresult
unknown refusedno such ReadUnknownRead: No get of this identity was requested.
unknown-record refusedno Record for record_idUnknownRecord: No record of this identity exists.
not-present refusedthe Record of record_id has state != PresentRecordNotPresent: The record named is no longer present: it was superseded, expired or deleted, or it is still being written. A put that supersedes such a record lost a compare-and-set.
returnedotherwisemoves the Read Requested → Returned; emits RecordReturned
wrong-state refusedthe Read is in a state that does not allow itReadStateConflict: The get is not in a state this command acts from.

ReviseRecord​

Revise a record. A writer puts a new revision under the key of a present record, in the same store. It is a compare-and-set: refused when that record is no longer present. The new record is Writing until the put is confirmed, which supersedes the old one. An artifact is never revised.

Called by: Writer.

fieldtype
supersedesRecordId
revisioninteger
contentContent
recorded_byPrincipalId
derived_fromlist of RecordId
expires_atoptional timestamp
attimestamp
outcomewhenresult
revision-too-low refusedrevision < 2InvalidRevision: The revision is not 1 for a first record, or not one more than the record it supersedes.
unknown-record refusedno Record for supersedesUnknownRecord: No record of this identity exists.
artifact-revised refusedthe Record of supersedes has kind == ArtifactArtifactImmutable: An artifact is never revised; a new version is a new artifact that derives from it.
not-present refusedthe Record of supersedes has state != PresentRecordNotPresent: The record named is no longer present: it was superseded, expired or deleted, or it is still being written. A put that supersedes such a record lost a compare-and-set.
revision-not-next refusedthe Record of supersedes has input.revision != revision + 1InvalidRevision: The revision is not 1 for a first record, or not one more than the record it supersedes.
requestedotherwisecreates a Record in Writing; emits RevisionRequested

Events​

eventfieldsemitted by
PutFailedrecord_id RecordId, reason string, at timestampFailPut
PutRequestedrecord_id RecordId, store_id StoreId, key string, revision integer, content Content, recorded_by PrincipalId, derived_from list of RecordId, expires_at optional timestamp, at timestampPutRecord
QueryAnsweredquery_id QueryId, answer Content, count integer, at timestampAnswerQuery
QueryFailedquery_id QueryId, reason string, at timestampFailQuery
QueryRequestedquery_id QueryId, store_id StoreId, form QueryForm, question Content, limit optional integer, read_by PrincipalId, at timestampQueryStore
ReadFailedread_id ReadId, reason string, at timestampFailGet
ReadRequestedread_id ReadId, store_id StoreId, key string, read_by PrincipalId, at timestampGetRecord
RecordDeletedrecord_id RecordId, approved_by Decider, at timestampDeleteRecord
RecordExpiredrecord_id RecordIdExpireRecord
RecordPutrecord_id RecordId, store_id StoreId, key string, revision integer, content Content, recorded_by PrincipalId, at timestampConfirmPut
RecordReturnedread_id ReadId, record_id RecordId, content Content, at timestampReturnRecord
RecordSupersededrecord_id optional RecordId, superseded_by RecordId, at timestampConfirmPut
RevisionRequestedrecord_id RecordId, supersedes RecordId, revision integer, content Content, recorded_by PrincipalId, derived_from list of RecordId, expires_at optional timestamp, at timestampReviseRecord
StoreCreatedstore_id StoreId, name Name, kind StoreKind, scope StoreScope, retention Retention, retention_seconds optional integer, record_type optional NameCreateStore
StoreRetiredstore_id StoreIdRetireStore

Views​

viewrowsfields
Artifacts
Artifacts
each Record with kind == Artifactrecord_id RecordId, store_id StoreId, content Content, recorded_by PrincipalId, recorded_at timestamp, derived_from list of RecordId, state State
PresentRecords
Present records
each Record with state == Presentrecord_id RecordId, store_id StoreId, key string, revision integer, content Content, expires_at optional timestamp
Queries
Queries
each Queryquery_id QueryId, store_id StoreId, form QueryForm, question Content, limit optional integer, read_by PrincipalId, requested_at timestamp, answer optional Content, count optional integer, answered_at optional timestamp, state State
Reads
Reads
each Readread_id ReadId, store_id StoreId, key string, read_by PrincipalId, requested_at timestamp, record_id optional RecordId, answered_at optional timestamp, state State
Records
Records
each Recordrecord_id RecordId, store_id StoreId, kind StoreKind, key string, revision integer, content Content, recorded_by PrincipalId, recorded_at timestamp, derived_from list of RecordId, supersedes optional RecordId, expires_at optional timestamp, state State
Stores
Stores
each Storestore_id StoreId, name Name, kind StoreKind, scope StoreScope, retention Retention, retention_seconds optional integer, record_type optional Name, state State

Types​

typeisvalues or fields
QueryForm
How a query asks. Predicate filters records by their fields, with order and limit (a record store); Listing lists artifacts by class or provenance (an artifact store); Prefix scans keys by a prefix (a key-value store); Nearest finds the k items nearest a vector or a text, with a filter over the payload (a semantic store); Pattern matches a pattern and Path traverses a path (a graph store).
one ofPredicate, Listing, Prefix, Nearest, Pattern, Path
Retention
How long a record is kept. Duration keeps it for a declared number of seconds from its put, Run until the instance of the architecture ends, Forever until it is deleted.
one ofDuration, Run, Forever
StoreKind
What a store holds. Record holds typed records of one declared record type, each under a key and revised by a newer put; Artifact holds immutable content addressed by its digest, with provenance; KeyValue holds an opaque value per key, with an optional expiry; Semantic holds items with a vector and a payload; Graph holds nodes and typed edges as facts, a put asserts one and a delete retracts it.
one ofRecord, Artifact, KeyValue, Semantic, Graph
StoreScope
Who shares a store. Part gives one store to each instance of one part (an agent's memory), Architecture one store to every part that links to it, External a store that outlives the architecture and is shared beyond it; which one and where is the binding's concern.
one ofPart, Architecture, External

KPIs​

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

Correctness​

KPIunitbettergatestatus
deleted_without_approval
Records deleted before their expiry without a principal's approval.
How: RecordDeleted events of a record that had not expired, with no ApprovalGranted for that deletion before it. Deleting data cannot be undone. Must be 0.
countlowergateplanned
source: design

Quality​

KPIunitbettergatestatus
store_put_failure_share
Share of puts into a store that the store service failed.
How: PutFailed events divided by PutRequested events, per store. A failed put stores nothing and leaves the record it would supersede present.
sharelower–planned
source: design
store_read_seconds
Median time from a get or query of a store to its answer.
How: Seconds from ReadRequested to RecordReturned and from QueryRequested to QueryAnswered, median per store. Failed reads are counted apart.
secondslower–planned
source: design
records_never_read
Share of records that ended without being read once.
How: Records put that expired, were deleted or were superseded with no RecordReturned naming them, divided by records that ended. A store written and never read costs writes for nothing.
sharelower–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 store:

settingtypeunitdefaultcontractwhat
kindenum StoreKind: record, artifact, key_value, semantic, graphrequiredWhat the store holds: records of one record type, artifacts, a value per key, items with a vector, or graph facts.
scopeenum StoreScope: part, architecture, externalarchitectureWho shares the store: one store in each copy of the part its per names (part), one store for every part that links to it (architecture), or a store outside the architecture that outlives it (external), which the sandbox of each part that reaches it names in its egress.
retentionstringforeverHow long a record is kept: a duration from its put (30d), run until the instance of the architecture ends, or forever until it is deleted.
vectorsenum: supplied, madesuppliedOn a semantic store: whether the writer supplies each item's vector or the store makes it with a model call, over its own model_call link to a gateway or a model.
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.