Skip to main content

Module gatelog

Module gatelog 

Source
Expand description

Gate-evaluation logging.

When the CTX_GATE_LOG environment variable is set, ctx score appends one JSON line per gate evaluation to a local log file (default .ctx/gate-log.jsonl). Opt-in, local-only; ctx ships no telemetry.

CTX_GATE_LOG values:

  • unset, empty, or 0 – logging disabled
  • 1 or true – log to DEFAULT_GATE_LOG_PATH under the repo root
  • anything else – treated as the log path (joined to the repo root when relative)

Structs§

GateRecord
One gate evaluation, serialized as a single JSONL line.

Constants§

DEFAULT_GATE_LOG_PATH
Default log location (relative to the repo root) for CTX_GATE_LOG=1.
GATE_LOG_SCHEMA_VERSION
Version of the GateRecord line format.

Functions§

append
Append one record to the log at path as a single JSONL line.
blocking_enabled
Whether blocking mode is requested (CTX_GATE_BLOCKING=1, exactly).
gate_log_target
The gate log path selected by CTX_GATE_LOG, or None when logging is disabled.
now_rfc3339
Current UTC time as an RFC3339 string.
session_id
The Claude Code session id (CLAUDE_SESSION_ID), if present.