f069a8b27b
Design for a data-oriented static-analysis tool (src/code_path_audit.py) that audits the 3 major actions (AI message lifecycle, discussion save/load, GUI startup) for expensive operations, redundant calls, and pipelining candidates. Output: JSON data files + markdown summaries + Mermaid per-action call graphs in docs/reports/code_path_audit/. 61 src/ files, 27,447 total lines. Call graph is non-trivial; per-action traversal is what makes analysis tractable. Cost model: 7 cost classes (file_io, network, ast_parse, json_io, pickle, deep_copy, loop_amplified) with heuristic weights; EXPENSIVE_THRESHOLD = 40,000 module constant. 5 state mutation kinds (attr_write, container_mutate, file_write, ipc_emit, global_write). The 3 action entry points are per-action defined (see Per-Action Design table). MMA worker spawn is OUT of scope per user (cold until 1:1 discussion UX is dogfooded). Two follow-up tracks recorded but NOT in this track: - pipeline_runtime_profiling_20260607: calibrate the heuristic cost model with real measurements; catch C-extension cost, decorator dispatch, JIT effects that static analysis can't resolve. - pipeline_pruning_20260607: implement the high-priority optimization candidates surfaced by this track's report. 6 atomic commits planned: data structures; trace_action + ActionProfile + cost model; output (JSON/MD/Mermaid); MCP + CLI; run audit + commit report; tracks.md update.