Expand description
The site’s charter, its KPIs, its jobs’ earned autonomy and the signals the public
partition sends the back office (spec 3.5 §7.6, §7.10, §7.11, §7.21; feature charter).
The charter format is AWP 2.0’s (awp_types::Charter); this module keeps it, measures
against it and enforces what it says:
| Item | What it does | Spec |
|---|---|---|
CharterStore, CharterVersion, CommitDecision, RoleApproval, check_chain, commit_audited | Every charter version with the decision that committed it; a commit refuses a draft that fails Charter::validate() and a decision whose approval chain distinct people did not satisfy | §7.6, §7.11, A-I23 |
CharterDirectory, chain_policy, role_group, group_role | The charter in force as the approval service’s directory: a chain becomes an ApprovalPolicy with one role:{role} slot per role, and only the people the charter names fill them | §7.6, A-I23 |
KpiStore, KpiSample, KpiAggregate, KpiPeriod, KpiState, GuardrailState | Measurements per KPI with daily and weekly aggregates, and the tracker’s state | §7.11 |
KpiSource, KpiTracker, KpiTrackerExecutor, JobControl, JobPauses | The KPI tracker: reads each KPI’s source on its cadence, keeps the measure-only period, checks guardrails and pauses a breaching job before its next action | §7.11, A-I14, A-I15 |
AutonomyStore, AutonomyLadder, JobAutonomy, AutonomyChange, JobDecision, OwnerDecision, PromotionPolicy | Each job’s autonomy level and history: promotion only by an owner’s decision, demotion one level on a breach, two rejections in a row or an incident | §7.11, A-I13 |
SignalStore, SignalSink, SignalRecord, SignalSourceTool | Typed signals filed in the back office’s agenda as AgendaOrigin::Signal items, counted by kind and topic, rate-limited per source, waking Wake::Signal sleepers; never a crossing | §7.10, A-I3 |
SiteProcessKind | The site’s process kinds, site.probe to site.digest | §7.11, §7.19 |
CharterKit | Installs a site’s jobs, KPI tracker and signals on a kernel: each kind bound to the product’s target, the tracker as the kernel.kpi process, the unbound kinds in the kernel’s inventory | §7.10, §7.11, §7.20 |
CharterEvent, CharterEventSink | Commits, baselines, breaches, pauses and autonomy changes, each with its urgency | §7.21 |
Every store has in-memory, SQLite, PostgreSQL and Redis backends that pass one
conformance suite each (conformance::charter, feature conformance):
| Store | In-memory | SQLite (sqlite) | PostgreSQL (postgres) | Redis (redis) |
|---|---|---|---|---|
CharterStore | InMemoryCharterStore | SqliteCharterStore | PostgresCharterStore | RedisCharterStore |
KpiStore | InMemoryKpiStore | SqliteKpiStore | PostgresKpiStore | RedisKpiStore |
AutonomyStore | InMemoryAutonomyStore | SqliteAutonomyStore | PostgresAutonomyStore | RedisAutonomyStore |
SignalStore | InMemorySignalStore | SqliteSignalStore | PostgresSignalStore | RedisSignalStore |
§Example
use adk_kernel::charter::{SiteProcessKind, SITE_PROCESS_LABEL};
assert_eq!(SiteProcessKind::Probe.as_str(), "site.probe");
assert_eq!(SITE_PROCESS_LABEL, "site.process");Modules§
- audit
- Audit actions of the charter module (spec 3.5 §9.3).
Structs§
- Autonomy
Change - One change of a job’s autonomy, kept as its history (spec 3.5 §7.11).
- Autonomy
Ladder - The autonomy ladder of a site’s jobs (spec 3.5 §7.11, A-I13): promotion only by an owner’s decision, demotion one level by the site on a guardrail breach, two owner rejections in a row, or an incident in the job’s area, each with its reason.
- Chain
Refusal - Why an approval chain is not satisfied (A-I23).
- Charter
Directory - The approval service’s
ApproverDirectoryover the site charters in aCharterStore(spec 3.5 §7.6, A-I23): a person’s groups arerole:{role}for every role their site’s charter in force gives them, so a release chain, a charter signature or a promotion is decided only by the people the charter names, whichever surface they decide on. An agent holds no role. The directory governs therole:groups only: a caller’s claim to one is ignored, while other groups, such as an operator scope, stay as the caller’s authentication asserted them. - Charter
Kit - Installs a site’s charter machinery on a kernel (spec 3.5 §7.10, §7.11, §7.19, §7.20):
the product binds each
SiteProcessKindit runs to its own target withjob, andinstallregisters on aKernelBuilder: - Charter
Stores - The four charter stores of one backend (spec 3.5 §7.6, §7.10, §7.11): the
charterfield ofKernelStores, so a site’s charter, KPIs, autonomy and signals sit beside the kernel’s other stores. - Charter
Version - One committed charter version with the decision that committed it (spec 3.5 §7.11).
- Commit
Decision - The decision that commits a charter version (spec 3.5 §7.6, §7.11): its id, the approvals of its chain, and the signed note that seals it in the audit log.
- Guardrail
State - Whether a guardrail is breached, and since when (spec 3.5 §7.11, A-I15): a breach pauses and demotes its jobs once, when it begins, and a later breach after a recovery does so again.
- InMemory
Autonomy Store - An
AutonomyStorein process memory (spec 3.5 §7.11). - InMemory
Charter Store - A
CharterStorein process memory, for tests and a kernel with no durable store (spec 3.5 §7.11). Its versions end with the process. - InMemory
KpiStore - A
KpiStorein process memory (spec 3.5 §7.11). - InMemory
Signal Store - A
SignalStorein process memory (spec 3.5 §7.10). - JobAutonomy
- A job’s autonomy now (spec 3.5 §7.11).
- JobDecision
- One owner decision on one of a job’s proposals (spec 3.5 §7.11).
- JobPauses
- Paused jobs, enforced on the governed path (spec 3.5 §7.11, A-I15): as a
ToolPolicyit denies every tool call of a paused job’s agents until an owner resumes the job. - KpiAggregate
- A KPI’s samples over one period (spec 3.5 §7.11). A period without samples has
count0 and nomin,maxorlast, so a series has no gaps. - KpiReview
- One KPI’s week for the weekly review (spec 3.5 §7.11, §7.21).
- KpiSample
- One measurement of a KPI, as the tracker read it from the KPI’s source (spec 3.5 §7.11).
- KpiState
- What the tracker knows about one KPI between ticks (spec 3.5 §7.11, A-I14): when its measure-only period began, the baseline it locked when the period ended, and when it last read the source.
- KpiStatus
- One KPI against its baseline and target after a tick (spec 3.5 §7.11).
- KpiTracker
- The KPI tracker of one site (spec 3.5 §7.11): a kernel maintenance process that, on each
tick, reads every KPI of the charter in force whose cadence is due from itsKpiSource, records the measurement, compares it with the baseline and target, keeps the measure-only period, and checks the guardrails. - KpiTracker
Executor - Runs the tracker’s maintenance runs (spec 3.5 §7.11): target
KPI_TRACKER_TARGET, input{"site": <uuid>}, output theTrackerReport.KernelBuilder::kpi_trackerregisters one over every tracker it is given, beside the tracker’sKpiTracker::trigger;CharterKitcalls it. - Owner
Decision - An owner’s decision, the proof a promotion takes (spec 3.5 §7.11, A-I13): its id, the owner who made it, when, and the signed note that seals it.
- Postgres
Autonomy Store - An
AutonomyStorein PostgreSQL (spec 3.5 §7.11, featurescharterandpostgres). - Postgres
Charter Store - A
CharterStorein PostgreSQL, shared by every replica (spec 3.5 §7.11, featurescharterandpostgres). - Postgres
KpiStore - A
KpiStorein PostgreSQL (spec 3.5 §7.11, featurescharterandpostgres). - Postgres
Signal Store - A
SignalStorein PostgreSQL (spec 3.5 §7.10, featurescharterandpostgres). - Promotion
Eligibility - Whether a job has earned a promotion (spec 3.5 §7.11):
streakunchanged approvals in a row within the policy’s window since its last change, ofneeded. - Promotion
Policy - When a job is offered a promotion (spec 3.5 §7.11):
approvalsunchanged approvals in a row (20) withinwithin(30 days), with no breach since its last change. - Redis
Autonomy Store - An
AutonomyStorein Redis (spec 3.5 §7.11, featurescharterandredis). - Redis
Charter Store - A
CharterStorein Redis, shared by every replica (spec 3.5 §7.11, featurescharterandredis). See the module documentation for its keys. - Redis
KpiStore - A
KpiStorein Redis (spec 3.5 §7.11, featurescharterandredis). - Redis
Signal Store - A
SignalStorein Redis (spec 3.5 §7.10, featurescharterandredis). - Role
Approval - One approval of a decision by a person holding a role (spec 3.5 §7.6, A-I23).
- Signal
Filter - Which signal records
SignalStore::listreturns (spec 3.5 §7.10); an empty field matches everything. - Signal
Key - What makes two signals repeats of each other (spec 3.5 §7.10): the back-office partition they are filed in, their kind, and a digest of the fields that name their topic.
- Signal
Rate Limit - How many signals one source may send per window (spec 3.5 §7.10): 60 a minute by default; a signal past the limit is refused and not filed.
- Signal
Record - One signal as the back office’s agenda holds it (spec 3.5 §7.10): the latest typed signal of its kind and topic, and how many arrived while its item was open.
- Signal
Sink - Files typed signals in a back-office partition’s agenda (spec 3.5 §7.10, A-I3).
- Signal
Source Tool - The request a back-office agent would make for the raw text behind a signal (spec 3.5
§7.10): a crossing tool into the public partition’s sessions, registered with the
back-office
PartitionPolicy, which denies it — to any agent but the coordinator, and to the coordinator too, since a public partition crosses nowhere. - Sqlite
Autonomy Store - An
AutonomyStorein SQLite (spec 3.5 §7.11, featurescharterandsqlite). Callmigrateonce before use. - Sqlite
Charter Store - A
CharterStorein SQLite (spec 3.5 §7.11, featurescharterandsqlite), on a pool such asharness.db’s. Callmigrateonce before use. - Sqlite
KpiStore - A
KpiStorein SQLite (spec 3.5 §7.11, featurescharterandsqlite). Callmigrateonce before use. - Sqlite
Signal Store - A
SignalStorein SQLite (spec 3.5 §7.10, featurescharterandsqlite). Callmigrateonce before use. - Tracker
Report - What one
KpiTracker::tickdid (spec 3.5 §7.11).
Enums§
- Autonomy
Reason - Why a job’s autonomy changed (spec 3.5 §7.11): the weekly review says it in these words.
- Charter
Event - Something the charter machinery did that the owner hears about (spec 3.5 §7.11, §7.21): the weekly review, alarms and the site view read these.
- Decision
Outcome - How the owner decided one proposal of a job (spec 3.5 §7.11): what promotion and the two-rejections rule count.
- KpiPeriod
- The length of an aggregate’s period (spec 3.5 §7.11): a UTC day, or an ISO week from Monday.
- KpiPhase
- Where a KPI stands (spec 3.5 §7.11, A-I14).
- Signal
Outcome - What
SignalSink::emitdid with a signal (spec 3.5 §7.10). - Site
Process Kind - A kind of process a website’s team runs (spec 3.5 §7.11, §7.19, §7.20): the kernel recognises these, and the product does their work.
Constants§
- CHARTER_
ACTION - The action class of a charter change in a charter’s approval chains (spec 3.5 §7.6): a commit needs every role of the chain with this action, or one owner when the charter names no such chain.
- KPI_
TRACKER_ TARGET - The target of the tracker’s maintenance run (spec 3.5 §7.11): a durable run that a
KpiTrackerExecutorexecutes as oneKpiTracker::tick. - SIGNAL_
SOURCE_ TOOL - The tool a back-office agent would call for the raw text behind a signal (spec 3.5
§7.10): a crossing into the public partition’s sessions, which the partition policy
denies (
SignalSourceTool). - SITE_
PROCESS_ LABEL - The label every site process carries, with its kind’s name as the value (spec 3.5 §7.11).
- WEBSITE_
AUDIT_ KIND - The kind of the charter’s
website.*audit records, asAuditRecordKind::Other(WEBSITE_AUDIT_KIND.into())(spec 3.5 §9.3);kernel.signalis a kernel record of kindKERNEL_AUDIT_KIND.
Traits§
- Autonomy
Store - Every job’s autonomy, its history and the owner’s decisions on its proposals (spec 3.5 §7.11), on in-memory, SQLite, PostgreSQL and Redis.
- Charter
Event Sink - Where
CharterEvents go: the product’s alarms and weekly review (spec 3.5 §7.21). - Charter
Store - Every committed version of every site’s charter (spec 3.5 §7.11), append-only, on in-memory, SQLite, PostgreSQL and Redis.
- JobControl
- The hook a guardrail breach pauses a job through (spec 3.5 §7.11, A-I15): the harness
stops the job’s next action.
JobPausesis an implementation that is also aToolPolicy. - KpiSource
- A source of KPI measurements (spec 3.5 §7.11, §7.12): the edge beacon, host logs, an
analytics driver, the commerce or spend ledger, the email driver. The product and the
edge implement them; the tracker reads each KPI’s source by its name, the KPI’s
SourceRef. - KpiStore
- The KPI time series of every site and the tracker’s state (spec 3.5 §7.11), on in-memory, SQLite, PostgreSQL and Redis.
- Signal
Store - The signal records of every back-office partition and the per-source rate counters (spec 3.5 §7.10), on in-memory, SQLite, PostgreSQL and Redis.
Functions§
- aggregate
- The aggregates of
samplesperperiod(spec 3.5 §7.11), one for every period from the one holdingfromthrough the one holdingto_inclusive, in order, empty periods included; samples of other KPIs than the first sample’s, and samples outside those periods, are left out. - chain_
policy - The approval policy of
action’s chain undergovernance(spec 3.5 §7.6, A-I23): one slot per role of the chain,role:{role}, each filled by a distinct person who holds the role, none of them the requester. A charter that names no chain foractionneeds one owner, ascheck_chaindoes. - check_
chain - Checks that
approvalssatisfy the approval chaingovernancenames foraction(spec 3.5 §7.6, A-I23): every role the chain lists has an approval by a person holding that role, each role’s approval by a different person, none byproposer. A role the chain lists twice needs two people. A charter that names no chain foractionneeds one owner. - commit_
audited - Commits
draftbydecisiononstoreasCharterStore::commitdoes, and records the outcome ontrail(spec 3.5 §9.3):website.approval_chain.satisfiedandwebsite.charter.committedfor a commit,website.approval_chain.refusedfor a decision whose chain is not satisfied. The records name the approvers and the decision, never the charter’s text. - group_
role - The role a
role:{role}group names;Nonefor any other group. - is_
agent_ principal - Whether
idnames an agent rather than a person: anurn:adk:agent:URN or a SPIFFE id, the forms ofadk_core::principal::AgentId(spec 3.5 §7.6: no agent holds a role). - ladder_
rank - The rung of
levelon the autonomy ladder, 0 for Observe up to 4 for “act within budget” (spec 3.5 §7.11); a promotion moves up, a demotion one rung down. - period_
start - The first day of the
periodholdingday(spec 3.5 §7.11):dayitself, or the Monday of its ISO week. - role_
group - The approver group of
role:role:{role}, such asrole:publisher. - signal_
key - The repeat key of
signalfiled inpartition(spec 3.5 §7.10). - signal_
topic - The digest of the fields that name
kind’s topic, 32 hex digits (spec 3.5 §7.10): a content gap’s topic, a lead’s reference, a thread, a requester and capability. Text is compared without case or spacing, and no text is kept.