Self-observation: /proc

The kernel keeps a content-free ledger of what its agents do and, from it, learns each partition's routine. When a routine changes for long enough, the kernel offers one observation, as a question in neutral language — never a diagnosis (spec 3.2 §7.10).

adk-rust proc                                   # the observations the kernel offered
adk-rust proc baselines                         # each partition's 28-day baselines
adk-rust proc ledger                            # the last day of the ledger
adk-rust proc ledger --export ledger.jsonl      # every row, for `cargo adk eval --ledger`

The work is split in three tiers:

TierWhereWhat
Ledger and live aggregatesadk-kernel, feature proc (on by default)The ledger; the per-process live view and the OTel GenAI histograms ps and top show (overview)
Statisticsadk-eval's ledger module, pure functionsMedian and MAD baselines, the warm-up, the deviation test, the meaningful and cooldown rules; cargo adk eval --ledger runs them in CI (ledger statistics)
Baselines and observationsadk-kernel, feature proc-baselinesThe daily pass that calls the statistics and records observations; on in adk-cli and in the umbrella's full

The ledger

One append-only table. A row records what kind of thing happened, when, for how long and to which hashed subject:

ColumnHolds
tsWhen, to the millisecond, in the offset of the user's local time
partitionThe partition the activity belongs to: the process's for the kernel's rows, the harness's partition for a partition's harness, else default
agentThe acting agent's id, or kernel for the kernel's own work
kindintent, tool_call, approval, rejection, denial, held, decided, rule_hit, turn, loop_guard, process, wake, spend, governance, observation, audit
effectA label such as the tool's effect class (read_only) or the state a process entered
durationMsHow long a tool call or a process took
subjectHashhmac-sha256:<hex> of what the activity was about
metaAt most eight counts and flags, such as a turn's model_calls and cost_micro_usd
traceIdThe run's invocation

A row never holds a payload, a prompt, a file's content or a secret (K-I19). The ledger refuses a row whose agent, partition or effect is not a label, whose meta holds anything but numbers and booleans, or whose kind is not a short lowercase name; its error names the field, never the value. What an activity was about — a tool call's arguments, a process id, a wake source — reaches the row only as an HMAC under a key kept in the kernel home (ledger.key, owner-only), so an export cannot be matched to subjects without the home.

WriterRows
The kernel, from its event busprocess (with the time the process ran), wake, held, decided, rule_hit, spend, governance, observation; proposal for agenda changes; audit for the daily review and for a driver's state change (effect driver.<state>, its id hashed)
The harness, from each runintent when a run starts; tool_call when a call's response arrives, with the tool's effect class and the time it took
The harness, from its audit recordsturn (from harness.spend: model calls, tool calls, tokens, cost), loop_guard, approval, rejection, denial, held, and audit for the rest

The ledger lives beside the kernel's other stores: in harness.db, or in the --store PostgreSQL or Redis backend replicas share; a kernel built in code can also keep it in MongoDB, Firestore or Neo4j (backends). It never leaves the host unless you export it; "While you were away" (GET /kernel/away) serves only the rows that make its lines.

Baselines and the daily pass

Once a local day has ended, the kernel's maintenance tick enqueues one Maintenance process, the durable run kernel.proc, keyed by the day so replicas run it once. It reads the partition's rows — the kernel's own work and earlier observations left out — and tests each day since its last pass:

RuleValue
DimensionsPer local day: the first and the last activity's time of day; per kind, the count of rows, the median duration and the sum of each meta count
BaselineMedian and MAD over the 28 days before the comparison windows, weekdays and weekends apart
Warm-up14 days with a value before a dimension can deviate
Deviation|recent − baseline| > max(2.5 × MAD, floor) in both the 7- and the 14-day window; the floor is 45 minutes for the time-of-day dimensions
MeaningfulTwo dimensions deviating, or one for ten days running
CooldownSeven days per dimension after an observation names it
Catch-upUp to 42 days after the kernel was down

adk-rust proc baselines shows the last pass; here, an excerpt after two weeks of late finishes:

default — tested through 2026-10-22
    DIMENSION                     DAYS        MEDIAN      MAD    LAST 7   LAST 14  STATE
    activity.first_minute         weekday      09:00      0.0     09:00     09:00  usual
    activity.last_minute          weekday      17:30      0.0     20:30     20:30  changed
    activity.last_minute          weekend      11:30      0.0     11:30     11:30  usual
    intent.count                  weekday          2      0.0         2         2  usual
    tool_call.count               weekday         12      0.0        24        24  changed
    tool_call.duration_ms         weekday      165.5      0.0     207.5     207.5  changed

Observations

An observation names the dimensions that changed, which way and since when, and the comparison windows — no value. Its question is worded by a model only after the deterministic test found the change; the model sees the dimension names, directions and windows, never a ledger row. The kernel keeps the model's wording only when it is one line ending in a question with no diagnosing, judging or instructing word, and uses its own template otherwise, or when the day's phrasing budget is spent (K-I20):

$ adk-rust proc
2026-10-22  default  Your routine has changed over the last two weeks: your day's last activity has been later than usual, along with higher counts and longer durations for tool calls. Would you like to review what changed?
    activity.last_minute up since 2026-10-15 (8 days)
    tool_call.count up since 2026-10-15 (8 days)
    tool_call.duration_ms up since 2026-10-15 (8 days)
    worded by gemini-3.5-flash-lite; id obs-20261022-37a8eec1

Each observation is also a KernelEvent::Observation on the event bus and a kernel.observation audit record with its id, partition, dimensions and windows.

Answering an observation

An observation of a partition with an audience is also put to a person as an agenda item of origin observation: titled with the question, its rationale the statement of what changed, built from the dimension names alone. adk-rust up makes the harness its partition's audience when long-term memory is on, so the question goes to the user it serves:

$ adk-rust agenda
ID                                    STATE       ORIGIN             AGE  TITLE
obs-20261022-37a8eec1                 proposed    observation         2h  Your routine has changed over the last two weeks: …

1 observation(s) asked as questions: `adk-rust agenda approve ID` confirms one and remembers it, `reject ID` dismisses it.

$ adk-rust agenda approve obs-2026
confirmed obs-20261022-37a8eec1: remembered as known fact 5b0e…

The item is answered, never scheduled (spec 3.2 §7.10):

AnswerEffect
Confirm (agenda approve, or approve in the inbox)The item is done with the answer. Its statement — such as "Since 2026-10-15, compared with the 28 days before: the day's last activity has been later." — is remembered as a user-wide preference fact, or in the partition's memory scope for a partition's harness, known, source user_confirmed (spec 3.1 §7.15); the same text already remembered as an assumption is promoted to known instead
Reject (agenda reject, or reject in the inbox)The item is rejected with the answer; nothing is remembered, so any related fact stays as it was
No answerThe item expires after the longest comparison window, 14 days

Important: an observation needs a person in every mode, Auto included, and never becomes a process or a model turn. Approving it as a service is refused, and adk-rust agenda schedule on it is refused with the reason.

A partition without an audience keeps its observations at adk-rust proc and /api/kernel/proc/observations and asks nobody. In code, KernelBuilder::observation_audience registers an ObservationAudience for a partition; adk_harness::Harness::observation_audience is the harness's. Under partitions each partition's harness is its own partition's audience only (partitions).

Exporting the ledger

adk-rust proc ledger --export ledger.jsonl
cargo adk eval --ledger ledger.jsonl

Each line is one row as camelCase JSON, the format cargo adk eval --ledger reads; a CI job can fail on a cost or latency drift of a nightly run this way. Without --export, adk-rust proc ledger lists the last 24 hours (--since, --kind, --agent, --partition, --limit narrow it):

TIME                        PARTITION   KIND          EFFECT                  MS  AGENT
2026-10-22 11:45:00 +03:00  default     tool_call     read_only              162  urn:adk:agent:adk-rust/harness
2026-10-22 12:13:00 +03:00  default     tool_call     read_only              169  urn:adk:agent:adk-rust/harness

Routes

RouteAnswers
GET /api/kernel/proc/ledgerA page of rows, {entries, next}; ?format=jsonl answers one row per line with the next cursor in x-ledger-next. Filters: partition, kind (comma-separated), agent, from, to, after, limit (500, at most 5 000)
GET /api/kernel/proc/baselinesEach partition's last pass: lastDay, the drift state and the baselines
GET /api/kernel/proc/observationsThe observations, newest day first: partition, since, limit

All three need the operator scope, which the kernel's socket and a loopback bind grant. Each read of the ledger is recorded as kernel.control with action proc.ledger; the ledger leaves the host only through it.

Using it from code

[dependencies]
adk-kernel = { version = "3.0.0", features = ["proc-baselines"] }
use std::sync::Arc;

use adk_core::{InMemoryRunStore, Llm};
use adk_kernel::proc::baselines::{BaselinePolicy, LlmPhraser};
use adk_kernel::proc::{Ledger, LedgerKey, SqliteLedgerStore};
use adk_kernel::{Kernel, KernelConfig};

async fn kernel(
    home: &std::path::Path,
    pool: sqlx::SqlitePool,
    model: Arc<dyn Llm>,
) -> adk_kernel::Result<Kernel> {
    let store = SqliteLedgerStore::new(pool);
    store.migrate().await?;
    let ledger = Ledger::new(Arc::new(store), LedgerKey::load_or_create(&home.join(LedgerKey::FILE))?);
    Kernel::builder()
        .config(KernelConfig::default().with_home(home))
        .run_store(Arc::new(InMemoryRunStore::new()))
        .ledger(ledger)
        .baseline_policy(BaselinePolicy::default().with_floor("tool_call.count", 3.0))
        .observation_phraser(Arc::new(LlmPhraser::new(model)))
        .build()
}

BaselinePass runs the same pass without a kernel, and ledger_store_conformance_tests! (feature conformance) checks a new LedgerStore backend.

Feature of adk-kernelDefaultAdds
proconThe ledger, its stores, the /proc routes, the OTel GenAI histograms
proc-baselinesoffThe daily pass and observations over adk-eval's statistics; the only adk-kernel → adk-eval edge