Skip to main content

Layer 10 · evaluation

kpi

blocks/10-evaluation/kpi.yaml

layer 10evaluation
4entities
5commands
5events
3views
17refusals
2KPIs

A KPI as data: its name, unit, kind, the block it belongs to, the events it reads and whether it is a gate. A work mode (autonomous, pairing, review) gives each KPI a direction. A measurement is one value of a KPI for an architecture revision or an observed window, from a simulated or an observed run.

Depends on​

Used by​

Entities​

Kpi​

One KPI definition, read by the code that scores a simulated and an observed run alike.

Identified by kpi_id (KpiId).

fieldtype
nameName
unitUnit
blockBlock
readslist of EventName
kindKpiKind
percentileoptional integer
gateboolean

Lifecycle of Kpi

ActiveRetiredretireActiveRetiredretire
Ends in Retired.

Measurement​

One value of a KPI for an architecture revision or an observed window.

Identified by measurement_id (MeasurementId).

fieldtype
kpi_idKpiId
revision_idoptional ArchitectureRevisionId
windowoptional Window
valuedecimal
sourceSource

Relations:

  • kpi references Kpi (one, by kpi_id)
  • revision references ArchitectureRevision of architecture (one, by revision_id)

Lifecycle: one state, Recorded; a recorded Measurement does not change.

WorkMode​

A way of working (autonomous, pairing, review) under which each KPI has a direction.

Identified by work_mode_id (WorkModeId).

fieldtype
nameName
kindWorkModeKind

Relations:

  • directions owns WorkModeDirection (many, by work_mode_id)

Lifecycle: one state, Active; a recorded WorkMode does not change.

WorkModeDirection​

The direction one KPI has under one work mode.

Identified by direction_id (DirectionId).

fieldtype
work_mode_idWorkModeId
kpi_idKpiId
directionDirection

Relations:

  • kpi references Kpi (one, by kpi_id)

Lifecycle: one state, Set; a recorded WorkModeDirection does not change.

Commands​

CreateWorkMode​

Create a work mode.

fieldtype
nameName
kindWorkModeKind
outcomewhenresult
name-taken refuseda WorkMode with name == input.nameWorkModeNameTaken: A work mode of this name exists, and nothing was created.
createdotherwisecreates a WorkMode in Active; emits WorkModeCreated

DefineKpi​

Define a KPI.

fieldtype
nameName
unitUnit
blockBlock
readslist of EventName
kindKpiKind
percentileoptional integer
gateboolean
outcomewhenresult
no-events-read refusedreads.count == 0NoEventsRead: A KPI reads at least one event, and nothing was defined.
percentile-missing refusedkind == Percentile and not (defined(percentile))PercentileMissing: A Percentile KPI names its percentile, between 1 and 99, and nothing was defined.
percentile-out-of-range refused(percentile < 1 or percentile > 99)PercentileMissing: A Percentile KPI names its percentile, between 1 and 99, and nothing was defined.
name-taken refuseda Kpi with name == input.nameKpiNameTaken: A KPI of this name exists, and nothing was defined.
definedotherwisecreates a Kpi in Active; emits KpiDefined

RecordMeasurement​

Record a measurement.

fieldtype
kpi_idKpiId
revision_idoptional ArchitectureRevisionId
windowoptional Window
valuedecimal
sourceSource
outcomewhenresult
revision-missing refusedsource == Simulated and not (defined(revision_id))RevisionMissing: A simulated measurement names the architecture revision that was simulated, and nothing was recorded.
window-missing refusedsource == Observed and not (defined(window))WindowMissing: An observed measurement names the window it was observed in, and nothing was recorded.
invalid-window refusedwindow.to <= window.fromInvalidWindow: A window ends after it starts, and nothing was recorded.
no-such-kpi refusedno Kpi for kpi_idNoSuchKpi: No KPI has this id, and nothing changed.
no-such-revision refusedno ArchitectureRevision for revision_idNoSuchRevision: No architecture revision has this id, and nothing was recorded.
kpi-retired refusedthe Kpi of kpi_id has state == RetiredRetiredKpi: The KPI is retired, so it takes no direction and no measurement, and nothing changed.
recordedotherwisecreates a Measurement in Recorded; emits MeasurementRecorded

RetireKpi​

Retire a KPI.

fieldtype
kpi_idKpiId
outcomewhenresult
no-such-kpi refusedno such KpiNoSuchKpi: No KPI has this id, and nothing changed.
retiredotherwisemoves the Kpi Active → Retired; emits KpiRetired
wrong-state refusedthe Kpi is in a state that does not allow itRetiredKpi: The KPI is retired, so it takes no direction and no measurement, and nothing changed.

SetDirection​

Give a KPI a direction under a work mode.

fieldtype
work_mode_idWorkModeId
kpi_idKpiId
directionDirection
outcomewhenresult
no-such-work-mode refusedno WorkMode for work_mode_idNoSuchWorkMode: No work mode has this id, and nothing changed.
no-such-kpi refusedno Kpi for kpi_idNoSuchKpi: No KPI has this id, and nothing changed.
kpi-retired refusedthe Kpi of kpi_id has state == RetiredRetiredKpi: The KPI is retired, so it takes no direction and no measurement, and nothing changed.
direction-exists refuseda WorkModeDirection with work_mode_id == input.work_mode_id and kpi_id == input.kpi_idDirectionExists: The work mode already gives this KPI a direction, and nothing changed.
setotherwisecreates a WorkModeDirection in Set; emits DirectionSet

Events​

eventfieldsemitted by
DirectionSetdirection_id DirectionId, work_mode_id WorkModeId, kpi_id KpiId, direction DirectionSetDirection
KpiDefinedkpi_id KpiId, name Name, block Block, kind KpiKind, gate booleanDefineKpi
KpiRetiredkpi_id KpiIdRetireKpi
MeasurementRecordedmeasurement_id MeasurementId, kpi_id KpiId, value decimal, source SourceRecordMeasurement
WorkModeCreatedwork_mode_id WorkModeId, name Name, kind WorkModeKindCreateWorkMode

Views​

viewrowsfields
Directionseach WorkModeDirection with work_mode_id == param.work_mode_id
asked with work_mode_id WorkModeId
direction_id DirectionId, work_mode_id WorkModeId, kpi_id KpiId, direction Direction
Kpiseach Kpikpi_id KpiId, name Name, unit Unit, block Block, reads list of EventName, kind KpiKind, percentile optional integer, gate boolean, state State
Measurementseach Measurement with kpi_id == param.kpi_id
asked with kpi_id KpiId
measurement_id MeasurementId, kpi_id KpiId, revision_id optional ArchitectureRevisionId, window optional Window, value decimal, source Source

Types​

typeisvalues or fields
Blockone ofPrincipal, Delegation, Model, Gateway, Tool, Knowledge, Store, TimeSource, Agent, Harness, Work, Process, Authority, Channel, Question, Trigger, Derivation, Workspace, Sandbox, Runtime, Resource, Architecture, Deployment, Run
Directionone ofHigher, Lower, Ignore
DirectionIdan identifier or valueuuid
EventNamean identifier or valuestring
KpiKindone ofCount, Sum, Ratio, Duration, Percentile
MeasurementIdan identifier or valueuuid
Sourceone ofSimulated, Observed
Unit
The unit a value is in (seconds, tokens, micro-USD, a share).
an identifier or valuestring
Windowa recordfrom timestamp, to timestamp
WorkModeKindone ofAutonomous, Pairing, Review

KPIs​

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

Correctness​

KPIunitbettergatestatus
kpi_without_direction
Defined KPIs that lack a direction for some work mode.
How: KpiDefined events whose KPI has no DirectionSet for one of the created work modes. Must be 0.
countlowergateplanned
source: design

Completeness​

KPIunitbettergatestatus
kpi_measured_share
Share of defined, unretired KPIs with at least one measurement.
How: KPIs with a MeasurementRecorded divided by KPIs with a KpiDefined and no KpiRetired.
sharehigher–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 kpi:

settingtypeunitdefaultcontractwhat
kindstringWhat the KPI measures.
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.