Human Approval & Intervention Tracking¶
Chakshu provides first-class Human Approval & Intervention Tracking across local AI coding agent sessions.
Passive Observability Guarantee: Chakshu strictly observes approval interactions by reading agent transcripts from disk. It never intercepts, modifies, authorizes, or blocks agent execution.
Overview¶
Modern AI coding agents periodically pause to request human permission before running shell commands, editing sensitive files, pushing Git branches, invoking MCP tools, making external network calls, or escalating sandbox permissions.
Chakshu extracts, normalizes, correlates, classifies, and persists these interactions so engineers and security teams can answer:
- When did an agent ask for permission?
- What operation and target resource required approval?
- Why was permission required (permission mode, sandbox escalation, policy)?
- What decision did the human make, and how long did it take?
- What actually happened after the decision (did an approved command succeed, fail, or never execute)?
- What patterns emerge across sessions, agents, tools, and risk levels?
Supported Agents & Known Limitations¶
Chakshu ships with agent-specific extractors registered through the extensible approval.ApprovalExtractor interface (internal/approval/extractor.go):
| Agent | Transcript Signals Observed | Known Limitations |
|---|---|---|
OpenAI Codex (codex) |
session_meta / turn_context (approval_policy, sandbox_policy), exec_approval_request, apply_patch_approval_request, mcp_tool_call_approval_request, exec_approval_decision / patch_approval_decision / approval_decision / review_decision, escalated function_call / custom_tool_call (with_escalated_permissions, sandbox_permissions: require_escalated), user rejection outputs, turn_aborted |
Older Codex rollout versions that omit explicit approval_decision events rely on post-request execution or rejection outputs (INFERRED provenance). |
Claude Code (claude-code) |
Top-level permissionMode (default, acceptEdits, bypassPermissions, plan, dontAsk), control_request (can_use_tool) & control_response, permission_request & permission_response, system permission subtypes, ExitPlanMode plan approvals, and user tool_result rejection/cancellation messages ("The user doesn't want to proceed...", "User rejected...", "Interrupted by user") |
Standard Claude Code JSONL transcripts frequently log auto-approved or manually approved tool uses without emitting a separate control_request line; in those versions, rejections are always captured while approvals appear only when explicit permission/control events or plan approvals are written. |
Gemini CLI / Antigravity (gemini) |
Explicit TOOL_CONFIRMATION / APPROVAL_REQUEST / PERMISSION_REQUEST & TOOL_CONFIRMATION_RESPONSE / APPROVAL_RESPONSE / USER_DECISION, Gemini CLI toolCalls[].confirmationDetails & approvalMode, Antigravity PLANNER_RESPONSE flags (BypassSandbox: true, SafeToAutoRun: false, BlockedOnUser: true), and GENERIC step outputs containing explicit approval/rejection text or execution exit codes |
When Antigravity logs BypassSandbox: true followed directly by a GENERIC execution output without a separate user decision step, approval is recorded honestly as INFERRED (DecisionSource: INFERRED). |
Extensibility¶
Additional agent runtimes can be supported without modifying the core correlation engine by implementing approval.ApprovalExtractor and registering it via approval.RegisterExtractor(...).
Supported Approval Categories & Event Types¶
Action Category (action_category) |
Approval Types (approval_type) |
Examples |
|---|---|---|
TERMINAL_SHELL |
COMMAND_EXECUTION |
Shell commands, dangerous commands (rm -rf), scripts, commands outside CWD |
FILESYSTEM |
FILE_OPERATION |
File create/modify/delete, patches, access outside workspace, .env / SSH keys |
GIT |
GIT_OPERATION |
git commit, git push, --force, git reset --hard, branch deletion -D |
MCP_TOOL |
MCP_TOOL, TOOL_CONFIRMATION |
mcp__* tool calls, external tool permissions, tool confirmations |
NETWORK |
NETWORK_ACCESS |
curl, wget, ssh, downloads, external API requests, piped remote scripts |
INFRASTRUCTURE_DB |
INFRASTRUCTURE, DATABASE |
terraform apply/destroy, kubectl apply/delete, DROP/DELETE/UPDATE SQL, migrations |
AGENT_PERMISSIONS |
PERMISSION_ESCALATION, PLAN_APPROVAL, SUBAGENT_DELEGATION |
sudo, BypassSandbox, require_escalated, ExitPlanMode, sub-agent delegation |
Normalized Approval Lifecycle¶
Every approval record tracks a deterministic lifecycle with transition history (transitions):
REQUESTED— Permission requested; no decision observed yet (PENDING).APPROVED— Allowed once (APPROVED) or for session/always (APPROVED_ALWAYS).REJECTED— Explicitly denied by the human.CANCELLED— Cancelled or aborted by the human.TIMED_OUT— Approval prompt timed out.EXPIRED— Session terminated (turn_aborted/ interrupted) before a decision was recorded.UNKNOWN— Decision text could not be mapped unambiguously.
Execution Outcome Independence¶
Approval does not imply successful execution. Chakshu tracks execution_status separately:
- EXECUTED_SUCCESS
- EXECUTED_FAILED
- SKIPPED
- NOT_EXECUTED
- PENDING
- UNKNOWN
Confirmed vs. Inferred Events¶
Chakshu explicitly distinguishes provenance via evidence_type and decision_source:
CONFIRMED: Directly backed by explicit approval request, confirmation, or decision records written by the agent (e.g.,exec_approval_request+exec_approval_decision,control_request+control_response,TOOL_CONFIRMATION, or explicit user rejection text intool_result).INFERRED: Derived only when an explicit approval-requiring request (such asBypassSandbox: trueorSafeToAutoRun: false) is followed by an observed tool execution result for the exact sameToolCallID, with no separate decision event logged by the agent.
Chakshu never fabricates approval events for ordinary auto-run tool calls and never correlates ambiguous events solely by timestamp proximity when multiple open approval requests exist without matching IDs.
Independent Risk Classification¶
Risk levels (INFO, LOW, MEDIUM, HIGH, CRITICAL) are evaluated by approval.RiskClassifier independently of the human decision:
- An approved
terraform destroyorrm -rfremainsCRITICAL/HIGH. - Risk assessment considers action category, destructive patterns, sensitive file access, privilege/sandbox escalation, external network access, and workspace escapes.
Security & Secret Redaction¶
All approval records are redacted before SQLite persistence and before API rendering:
- API keys (ghp_, github_pat_, sk-, sk-ant-, AIza, AKIA, sk_live_, xox*)
- JWT tokens and PEM private keys
- Authorization: Bearer ... headers and URL credentials (https://user:pass@host)
- Sensitive environment assignments and CLI flags (--token, --api-key, --password)
- JSON fields containing secret/token/password/credential keys
REST API Reference¶
| Endpoint | Description | Query Parameters |
|---|---|---|
GET /api/approvals |
Paginated list of approval events with aggregate summary (X-Total-Count, X-Has-More) |
session, agent, category, approval_type, decision, status, risk, tool, project, from, to, q, sort (requested_at|risk_level|latency_ms), order (asc|desc), limit, offset |
GET /api/approvals/{approvalId} |
Full approval detail including redacted arguments, lifecycle transitions, correlated tool call, security findings, and redacted credentials | — |
GET /api/sessions/{sessionId}/approvals |
Session-scoped approval summary and chronological timeline | agent, category, decision, status, risk, tool, q |
GET /api/analytics/approvals |
Global cross-session approval analytics (summary, agent intelligence, tool intelligence, security intelligence, projects) | from, to, project, agent, session |
GET /api/analytics/approvals/agents |
Agent-wise approval rates, latency, top approved and rejected actions | from, to, project, agent, session |
GET /api/analytics/approvals/tools |
Top tools, MCP intervention hotspots, frequent shell commands, repeated requests | from, to, project, agent, session |
CLI & Dashboard Usage¶
# Terminal CLI inspection
./chakshu approvals
./chakshu approvals --session #ab12cd34
./chakshu approvals --agent codex --risk HIGH --decision APPROVED
# Web Dashboard
./chakshu start
# Global Approval Analytics: http://127.0.0.1:7777/#/approvals
# Session Approvals Tab: http://127.0.0.1:7777/#/sessions/<session-id>/approvals
