The Two Collection Layers
The Critiqor OpenClaw plugin is intentionally narrow. It does not score runs, generate diagnoses, or interact with the agent’s logic in any way. Its only job is to observe and record.Extension API Layer
The Extension API layer attaches via OpenClaw’sapi.on(...) event hooks. This layer captures the high-level agent and session lifecycle:
- Agent and session timeline —
agent_start,turn_start,turn_end,agent_end - Provider requests and responses —
before_provider_request,after_provider_response - Messages and input — user messages, agent messages, input events
- User bash events — shell command activity initiated during the session
Tool Hooks Layer
The Tool Hooks layer attaches via OpenClaw’sAgentSession.installAgentToolHooks(). This layer captures the granular, per-tool activity that exposes the most diagnostic signal:
- Tool calls — tool name, arguments, call ID, timestamp
- Tool results — result content, error flag,
duration_ms, status - Memory search —
memory_searchevents with query and status - Memory get —
memory_getevents with key and result status - Errors — tool-level exceptions and failure events
- Duration — execution time per tool invocation
Evidence Hierarchy
The two layers together produce the complete runtime picture Critiqor needs for diagnosis:What a Session File Contains
All collected evidence is written to:critiqor.session.v1 schema:
| Field | Description |
|---|---|
schema_version | Always critiqor.session.v1 — identifies the file format |
run_id | The unique identifier for this run (e.g. run_001) |
session_id | Matches run_id; used internally by the session layer |
events[] | Ordered array of all normalized runtime events |
metrics{} | Aggregate counts — total_events, by_event_type, by_source_layer |
events[] includes an event type, a timestamp, a source_layer (either extension_api or tool_hooks), and a payload containing event-specific fields.
The metrics object provides a fast summary of what was collected without requiring a full scan of the events array:
Immutability and Rerunnable Diagnosis
Evidence is write-once during collection. Oncecritiqor finalize closes the active session, session.json is sealed. Critiqor does not modify it afterward.
The derived artifact — runs/<run_id>/diagnosis.json — is written separately after the session closes. This split is deliberate: the raw evidence is permanently auditable, while the diagnosis logic can improve over time without requiring the OpenClaw session to be re-run. If Critiqor releases an improved detector, you can re-run diagnosis against the same session.json and get a more accurate result without re-executing the agent.