Skip to main content

Module tool_lifecycle

Module tool_lifecycle 

Source
Expand description

Shared tool lifecycle โ€” ensures CLI and MCP paths have identical side effects.

The MCP server dispatcher handles session, ledger, heatmap, intent detection, and knowledge consolidation inline (via in-memory state). When the daemon is unavailable, CLI commands call functions here to achieve the same coverage by loading/saving state from disk.

NOTE: When the daemon IS running, CLI routes through daemon_client which calls the MCP server โ€” these functions are NOT called in that path.

Functionsยง

record_file_read
Record a file-read operation with full Context OS side effects.
record_search
Record a search/grep operation with full Context OS side effects.
record_shell_command
Record a shell command with full Context OS side effects. When both original and output are 0 (track-only, no compression), only updates the session command counter without inflating token statistics.
record_tree
Record a tree/ls operation with full Context OS side effects.