# prompt-autopsy System-prompt autopsy command for Pi. ## Install / load Loaded through the root pi-ext package. See the [root README](../../README.md). ## Commands / tools / settings - Command: `/prompt-autopsy` - Shortcut: `Ctrl+Alt+A` - Hooks: `session_start`, `session_shutdown`, `before_agent_start`, `agent_start` - Tools: none - Settings: none ## Bench Run `mise run bench` here, or `mise //extensions/prompt-autopsy:bench` from the repository root, to benchmark system prompt grouping. ## Behavior Writes the current generated system prompt to `/tmp/sysprompt-autopsy.md`. Opens it with `$VISUAL`, else `$EDITOR`, else `vi`. `before_agent_start` captures Pi's `BuildSystemPromptOptions`. `agent_start` replaces the captured prompt with the final prompt after all `before_agent_start` edits. Grouping uses exact chunks rebuilt from the captured options: - `[APPEND]` for `appendSystemPrompt` - `[CTX]` for context files - `[SKILLS]` for skills not disabled for model invocation - `[DATE]` for Pi date/cwd footer - `[CORE]` for everything else If no turn has started for the current cwd, it falls back to `ctx.getSystemPrompt()`, writes `[PROMPT]`, and shows an ungrouped notice. Duplicate SDK chunks stay `[CORE]` instead of guessed.