Expand description
Opt-in human-readable debug log of intercepted tool activity (#520).
Off by default. Enable with the LEAN_CTX_DEBUG_LOG env var (truthy) or the
debug_log = true config key. Records two kinds of events to
<state_dir>/logs/debug.log:
- MCP tool calls handled by the lean-ctx server (
ctx_*) — tool name, a redacted argument summary, a one-line result preview, byte size, token savings and wall time. - Hook routing decisions — for every native tool call lean-ctx can
intercept (shell / Read / Grep), whether it was routed to
lean-ctxor left to the editor’s native tool, and why. This is #520’s core ask: explain why one call used lean-ctx and the next fell back to the native Read/Grep tool.
All writes are best-effort and never panic — logging must never break a hook
subprocess or a tool call. Secrets in arguments/commands/results are scrubbed
via crate::core::redaction::redact_text before they hit disk.
Enums§
- Route
- Where a hook sent an intercepted native tool call.
Functions§
- clear
- Delete the debug log (and its rotated backup). Returns a status line.
- is_
enabled - Whether the opt-in debug log is active.
- log_
hook_ decision - Record a hook routing decision for an intercepted native tool call.
- log_
mcp_ call - Record an MCP tool call handled by the lean-ctx server.
- log_
mcp_ error - Record an MCP tool call that failed before producing a result.
- log_
path <state_dir>/logs/debug.log. ReturnsNoneif the state dir cannot be resolved or thelogs/directory cannot be created.- read_
log - Return the log content for display (most-recent
tail_lines,0= all).