Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ActiveTools = []string{"Write", "Edit", "Bash", "NotebookEdit", "SlashCommand", "KillShell"} QuestionTools = []string{"AskUserQuestion"} PlanningTools = []string{"ExitPlanMode", "TodoWrite"} PassiveTools = []string{"Read", "Grep", "Glob", "WebFetch", "WebSearch", "Search", "Fetch", "Task"} )
Tool categories for state machine classification
TODO: Future improvement - detect passive Bash commands Currently all Bash commands are treated as "active" (code-changing). Could be improved by parsing command strings to differentiate:
- Passive: ls, cd, pwd, git status, git log, git diff, find, grep
- Active: mkdir, rm, mv, cp, git commit, npm install, etc.
This requires:
- Storing tool Input in ToolUse struct (pkg/jsonl)
- Parsing command string from Input["command"]
- Handling complex cases: pipes (|), redirects (>), chains (&&)
Complexity: Medium-High. Edge cases are tricky (e.g. "cat file > output").
Functions ¶
This section is empty.
Types ¶
type Status ¶
type Status string
Status represents the current task status
const ( StatusTaskComplete Status = "task_complete" StatusReviewComplete Status = "review_complete" StatusQuestion Status = "question" StatusPlanReady Status = "plan_ready" StatusSessionLimitReached Status = "session_limit_reached" StatusAPIError Status = "api_error" StatusAPIErrorOverloaded Status = "api_error_overloaded" StatusPermissionRequest Status = "permission_request" StatusUnknown Status = "unknown" )
func AnalyzeTranscript ¶
AnalyzeTranscript analyzes a transcript file and determines the current status
func AnalyzeTranscriptWithMessages ¶
func AnalyzeTranscriptWithMessages(transcriptPath string, cfg *config.Config) (Status, []jsonl.Message, error)
AnalyzeTranscriptWithMessages analyzes a transcript and also returns the parsed messages. This allows callers to reuse the messages (e.g., for summary generation) without re-reading the file.
func ClassifyLastMessage ¶
ClassifyLastMessage derives a status from a host-provided final assistant message when no Claude-format transcript is available (the Codex path).
This is a deliberate MVP simplification: Codex delivers the final message directly in the Stop payload and its rollout transcript format is not parsed, so the rich tool-based state machine above does not apply. An empty message still means the turn finished, so the default is task_complete, with a light question heuristic on top.
func GetStatusForPreToolUse ¶
GetStatusForPreToolUse determines status for PreToolUse hook This is called BEFORE tool execution, so we only have the tool name