Expand description
Pipeline telemetry — per-response event capture for adaptive tuning.
The pipeline emits one PipelineEvent per tool-result it handles.
Events are anonymized by construction: no raw response text, no tool
arguments, no user-facing strings leave this module. The schema carries
just enough signal to drive the tuning rules described in
docs/research/paper-2-mckp-format-adaptive.md §Adaptive Configuration.
§Design
- Sink trait —
TelemetrySinkabstracts persistence. Default implJsonlSinkappends one JSON line per event to a per-session file; alternate impls can stream to stdout, discard for tests, or forward to an in-process aggregator. - Zero-cost when disabled — sinks are dyn-dispatched via an
Option<Arc<dyn TelemetrySink>>; settingNoneeliminates all per-call allocation. - Append-only, crash-safe — JsonlSink opens with
O_APPEND; no in-memory buffering beyond the default kernel write buffer. - Schema additions only —
PipelineEventisnon_exhaustive; downstream analyzers project specific fields.
§Example
use std::sync::Arc;
use devboy_format_pipeline::telemetry::{
JsonlSink, PipelineEvent, Shape, Layer, TelemetrySink,
};
let sink: Arc<dyn TelemetrySink> =
Arc::new(JsonlSink::open("/tmp/devboy-telemetry/sess_abcd.jsonl").unwrap());
// PipelineEvent is #[non_exhaustive]; construct via Default + mutation.
let mut evt = PipelineEvent::default();
evt.session_hash = "abcdef01".into();
evt.tool_call_id_hash = "feed1234".into();
evt.tool_name_anon = "Read".into();
evt.endpoint_class = "Read".into();
evt.response_chars = 1234;
evt.shape = Shape::NumberedList;
evt.content_sha_prefix_hex = "0123456789abcdef".into();
evt.file_path_hash = Some("abc12345".into());
evt.layer_used = Layer::L3;
evt.tokens_baseline = 308;
evt.tokens_final = 308;
evt.ts_ms = 1_700_000_000_000;
sink.record(&evt).unwrap();Structs§
- Enrichment
Effectiveness - Aggregate scoring of how well the Paper 3 enrichment planner served
the agent during a session. Populated by the live pipeline (counters)
plus the offline post-pass (
cited_*numbers, see P-3-08). - Jsonl
Sink - Append-only JSONL sink backed by a single file.
- Memory
Sink - In-memory sink for unit tests — retains events for assertion.
- Null
Sink - No-op sink for tests and for code paths where telemetry is explicitly
disabled. Always returns
Ok; records nothing. - Pipeline
Event - Single pipeline decision — emitted once per tool-result.
- Session
Summary - Session-level roll-up written on session close.
Enums§
- Layer
- Which pipeline layer produced the terminal decision for this response.
- Shape
- Structural classification of a tool response.
- Telemetry
Error
Traits§
- Telemetry
Sink - Persistence backend for telemetry events and summaries.