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. Always records in stats (even for track-only 0-token calls) so the dashboard command counter stays accurate. Adding 0 tokens does not inflate savings.
record_tree
Record a tree/ls operation with full Context OS side effects.