-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(observability): emit session usage threshold events for prompt turns and context% #2142
Copy link
Copy link
Open
Labels
agentsRelated to agent definitionsRelated to agent definitions
Description
Summary
Add explicit OMC/OMX session observability events for usage thresholds (prompt turns, context-used %, and similar runtime metrics) so clawhip can send reliable alerts without brittle tmux text scraping.
Why
We already have clawhip handling lifecycle-style notifications well (started / finished / failed / stale / keyword hits). But alerts like:
- prompt turn count crossing N
- context-used % crossing 70 / 85 / 92
- maybe long-running + high-context sessions
should come from the runtime itself, not from parsing tmux pane text. Scraping pane output would be brittle, fail-open, and sensitive to HUD/output wording changes.
Desired behavior
When an OMC or OMX session crosses configured thresholds, emit a structured event that clawhip can route to Discord.
Examples:
session.turn-thresholdsession.context-threshold
Example payload shape:
{
"project": "omc",
"session": "omx-pr-2139-review",
"metric": "context_percent",
"value": 72,
"threshold": 70,
"severity": "warning",
"reason": "context_warning"
}Scope
In OMC / OMX
- Identify the runtime/source-of-truth where prompt turns and context usage are already known
- Add thin threshold emitters there
- Avoid repeated spam after the same threshold fires unless a higher threshold is crossed
- Keep it opt-in/configurable if needed
In clawhip
- Route and render the emitted threshold events
- Support mention escalation based on severity (
warning/alert/critical)
Suggested thresholds
- Prompt turns: 20 / 40 / 60
- Context used: 70 / 85 / 92
Acceptance criteria
- A session crossing a configured prompt-turn threshold emits one structured event
- A session crossing a configured context-used threshold emits one structured event
- Repeated polling/refresh does not spam duplicate events for the same threshold
- Higher thresholds can still fire later for the same session
- clawhip can route the events without parsing pane text
Notes
This should preserve a clean boundary:
- OMC/OMX = source of truth for session/runtime metrics
- clawhip = notification router / formatter
—
[repo owner's gaebal-gajae (clawdbot) 🦞]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
agentsRelated to agent definitionsRelated to agent definitions