pi-startup-profiling

Profiles pi startup time and ranks slow extensions using built-in timing instrumentation.

Updated Jul 4, 2025
One-click install
npx skills add https://github.com/milespossing/nixdots --skill pi-startup-profiling-milespossing
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pi-startup-profiling
Source: https://github.com/milespossing/nixdots/tree/main/.agents/skills/pi-startup-profiling
Command: npx skills add https://github.com/milespossing/nixdots --skill pi-startup-profiling-milespossing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Interactive pi startup can feel slow, but naive profiling attempts fail because pi falls back to non-interactive mode without a TTY or because the wrapped binary loads every bundled extension. This Skill provides a working, reproducible workflow to measure startup phases and pinpoint which extension causes the delay. ## Core Features & Use Cases - Working benchmark command: Runs pi under a pseudo-TTY via script with PI_TIMING=1, PI_STARTUP_BENCHMARK=1, and PI_OFFLINE=1 to capture phase timings without hanging. - Wrapped vs core comparison: Locates the Nix wrapper and underlying core pi binary to isolate extension overhead from base startup cost. - Extension ranking and confirmation: Measures each bundled extension individually against core pi, then confirms suspects by subtracting them from the full set. - Use Case: A developer notices pi takes several seconds to start in their NixOS flake. Using this Skill, they discover the pi-azure-devops extension loads TypeScript source instead of compiled dist/*.js, and fix the package manifest to cut startup to about 1.2 seconds. ## Quick Start Ask the agent to profile pi startup time and identify which extension is slowing down interactive launch.

Frequently Asked Questions about pi-startup-profiling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I profile pi startup time?▼

Run pi under a pseudo-TTY with `script -qefc` while setting PI_TIMING=1, PI_STARTUP_BENCHMARK=1, and PI_OFFLINE=1. The benchmark flag initializes interactive mode, prints phase timings, and exits automatically instead of waiting for input.

How do I find which pi extension is slowing down startup?▼

Extract the extension paths from the wrapper script, then load each one individually against the core pi binary and compare the createAgentSessionRuntime timings. Confirm the top suspect by measuring the full extension set with that extension removed.

Why does PI_STARTUP_BENCHMARK fail with 'only supports interactive mode'?▼

This error occurs when pi runs without a TTY, such as directly from an agent harness, causing it to resolve to non-interactive mode. Wrap the command in `script -qefc ... /dev/null` so stdin and stdout appear as a terminal.

Can I use pi -p or --version to measure startup performance?▼

No, print mode, JSON mode, --help, and --version do not exercise the interactive UI and runtime path being profiled. Only the interactive initialization path with PI_STARTUP_BENCHMARK produces representative startup timings.

Why is a pi extension slow even with PI_OFFLINE=1?▼

PI_OFFLINE only removes network noise; it does not bypass extension loading. A common cause is the extension manifest pointing at TypeScript source like index.ts, triggering jiti compilation and eager imports instead of loading compiled dist/*.js files.