spec: add §9 session-level aggregation extension (Closes #3)#4
Open
nanookclaw wants to merge 1 commit intowillau95:mainfrom
Open
spec: add §9 session-level aggregation extension (Closes #3)#4nanookclaw wants to merge 1 commit intowillau95:mainfrom
nanookclaw wants to merge 1 commit intowillau95:mainfrom
Conversation
Add optional session_summary record type enabling: - Per-session delivery_score: 1 - (retried + incomplete + error) / record_count - calibration_flag_rate: hedged / record_count (neutral context-dependent signal) - prev_session chaining for O(n) cross-session drift detection All derived metrics are computable from existing §3 behavioral flags with no new data sources required. session_summary is strictly additive — existing record format and validation rules are unchanged. Motivation: per-action flags can't surface gradual behavioral regression across hundreds of sessions. A linked chain of session summaries makes slope-based drift detection possible without rescanning raw records. Implementation notes in §9.4 cover server storage semantics and writer/reader obligations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the §9 Session-Level Aggregation spec section proposed in #3.
What's Added
§9 Session-Level Aggregation (ECP-SPEC.md)
A new optional
session_summaryrecord type that aggregates per-action behavioral flags into a session-level view:{ "ecp": "1.0", "id": "sess_<hex32>", "type": "session_summary", "agent": "did:ecp:...", "session_start": 1741766400000, "session_end": 1741769000000, "record_count": 47, "flag_totals": { "retried": 3, "incomplete": 1, "hedged": 12, "error": 0, ... }, "delivery_score": 0.894, "calibration_flag_rate": 0.255, "prev_session": "sess_..." }Two derived metrics:
delivery_score=1 - (retried + incomplete + error) / record_count— fraction of actions completed without failurecalibration_flag_rate=hedged / record_count— hedging frequency (explicitly marked as neutral/context-dependent)Cross-session drift via
prev_sessionchaining:Walk the chain to compute slope of
delivery_scoreacross sessions. O(n) where n = session count, versus O(total records) for raw rescanning. Makes gradual behavioral regression visible even when no single session crosses a flag threshold.Design Decisions
session_summaryrecords.What This Enables
An operator can answer "is this agent's delivery rate declining over 30 days?" by walking a 30-node chain of session summaries rather than rescanning potentially thousands of raw records.
Closes #3