[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6E36KB889KHP1V9B9F0Q0A7":3,"skill-same:01M6E36KB889KHP1V9B9F0Q0A7":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":19,"commitSha":49,"skillDirectory":50,"forksCount":51,"repositoryHtmlUrl":52,"repositoryHomepageUrl":53,"ownerHtmlUrl":54,"ownerBlogUrl":6,"ownerDescription":55,"updatedAt":56,"install":57,"resources":70},"01M6E36KB889KHP1V9B9F0Q0A7","pgo",null,"Profile-guided optimization (PGO) for the pi binary. Use when recording a new PGO profile (`make record-pgo`), when a build behaves differently after a profile is added or removed, when `default.pgo` is missing or stale, or when asked to optimize the pi binary with a CPU profile. Covers the go.dev\u002Fdoc\u002Fpgo workflow: collecting a representative CPU profile, merging profiles, and building with PGO via `default.pgo` in the main package directory.","dimetron\u002Fpi-go","dimetron","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F877433?v=4","01M6E34QX9HKYKMWJVZQEPR2Q3","Dmytro Rashko","01M6E34R2A6563XM0PTZE8KPGG",224,"MIT","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002F.pi-go\u002Fskills\u002Fpgo\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"main","new","when","for","profiles","recording","with","via","missing","binary","record","optimize","directory","build","default","stale","use","pi","profile","doc","Optimization","package","dev","workflow","go","2026-11-10 10:12:30",false,"---\nname: pgo\ndescription: >\n  Profile-guided optimization (PGO) for the pi binary. Use when recording a new\n  PGO profile (`make record-pgo`), when a build behaves differently after a\n  profile is added or removed, when `default.pgo` is missing or stale, or when\n  asked to optimize the pi binary with a CPU profile. Covers the go.dev\u002Fdoc\u002Fpgo\n  workflow: collecting a representative CPU profile, merging profiles, and\n  building with PGO via `default.pgo` in the main package directory.\n---\n\n# PGO — Profile-Guided Optimization\n\n**Source**: [go.dev\u002Fdoc\u002Fpgo](https:\u002F\u002Fgo.dev\u002Fdoc\u002Fpgo) (authoritative).\n\nPGO feeds a **CPU pprof profile** from representative runs of the application\nback into the compiler for the next build, which uses it to make more informed\noptimization decisions (e.g. more aggressive inlining of hot functions). As of\nGo 1.22, representative programs improve ~2–14%. The compiler expects a CPU\npprof profile — exactly what `runtime\u002Fpprof` and `net\u002Fhttp\u002Fpprof` produce.\n\n## The core rule: the profile must be representative\n\nA profile that is not representative of real behavior yields little or no gain.\n**Microbenchmarks are bad PGO candidates** — they exercise a small part of the\nprogram. Collect from a representative workload instead. For pi-go that means\n**both** of the binary's hot paths, not one:\n\n- **The headless agent\u002Ftool loop** — the tool-coverage eval suite: one\n  `pi --mode print` scenario per tool family.\n- **The TUI render loop** — `RenderMessages`, `collapseBlankLines`, and\n  `matchLexer`. A live profile attributed ~24% of CPU to the `ansi.Strip` call\n  `blankFast` replaces; bubbletea calls `View()` once per token during\n  streaming, so this is a first-class hot path. It is exercised by the render\n  benchmarks, not by `--mode print`.\n\nA profile from only one workload optimizes only one half of the program.\n\n## How pi-go records a profile\n\n`make record-pgo` does the whole loop:\n\n1. Builds the binary (`make build`).\n2. Runs the eval-tools suite with `PI_EVAL_CPU_PROFILE=tmp\u002Fpgo`, so every\n   scenario's `pi --mode print` writes a per-scenario CPU profile via the\n   `--cpuprofile` flag.\n3. Runs the TUI render benchmarks with `-cpuprofile tmp\u002Fpgo\u002Frender.pprof`.\n4. Merges all profiles into `cmd\u002Fpi\u002Fdefault.pgo` with\n   `go tool pprof -proto`.\n5. Cleans up the scratch profiles.\n\n`go build` auto-detects `default.pgo` in the main package directory\n(`cmd\u002Fpi\u002F`) and enables PGO — no `-pgo` flag needed. So `make build` after a\n`record-pgo` is a PGO build.\n\n### Manual collection\n\nFor a one-off profile of a specific workload:\n\n```bash\npi --cpuprofile \u002Ftmp\u002Fpi.pprof --mode print \"some representative prompt\"\n```\n\nThe `--cpuprofile` flag writes a runtime CPU profile for the process lifetime\nand flushes it on exit. It is a persistent flag, so it works on subcommands too\n(`pi memory mine . --cpuprofile \u002Ftmp\u002Fmine.pprof`).\n\n## Building with PGO\n\n- **Default**: `go build` detects `cmd\u002Fpi\u002Fdefault.pgo` and enables PGO\n  (`-pgo=auto`).\n- **Disable**: `go build -pgo=off`.\n- **Explicit path**: `go build -pgo=\u002Ftmp\u002Ffoo.pprof .\u002Fcmd\u002Fpi`. A path applies to\n  all main packages in the invocation, so keep one profile per binary.\n\n## Merging profiles\n\n```bash\ngo tool pprof -proto a.pprof b.pprof > merged.pprof\n```\n\nThe merge is a straight sum of samples regardless of wall duration, so when\nprofiling a long-running server, keep all slices the same duration or longer\nslices dominate. For pi-go's per-scenario profiles this is not a concern — each\nscenario is a short, bounded run.\n\n## Source and iterative stability\n\nGo PGO is robust to skew between the profiled version and the version being\nbuilt:\n\n- **Source stability**: samples are matched by line offsets within functions.\n  Adding code outside a hot function, or moving a function to another file in\n  the same package, does not break matching. Renaming a function, moving it to\n  another package, or editing inside a hot function may lose some optimizations\n  (graceful degradation).\n- **Iterative stability**: the compiler is conservative, so successive PGO\n  builds do not oscillate. No two-stage canary build is required.\n\n**Consequence**: collect a fresh profile regularly. Degradation accumulates\nslowly as code drifts from the profile, and new code paths get no PGO benefit\nuntil a new profile reflects them. After a large refactor that renames or moves\nmany functions, re-record.\n\n## Guidelines\n\n- **Re-record after meaningful code changes** — a stale profile optimizes the\n  old code shape. `make record-pgo` is the one-step refresh.\n- **Never profile a microbenchmark** for PGO; use the eval suite or a real\n  workload.\n- **Commit `default.pgo`** — the docs recommend committing the profile so builds\n  are reproducible and performant from a fresh clone. It is a build input, not\n  scratch.\n- **`make clean` removes `cmd\u002Fpi\u002Fdefault.pgo`** — re-run `make record-pgo`\n  after a clean if you want PGO back.\n- **Verify PGO is on**: `go build -x .\u002Fcmd\u002Fpi 2>&1 | grep -i pgo` shows the\n  `-pgo` flag the toolchain passes. Or check the binary size \u002F `go version -m`\n  for the profile.\n- **A non-representative profile should not make the program slower** than no\n  PGO — it just optimizes cold paths. If you see a real regression, file an\n  issue at go.dev\u002Fissue\u002Fnew.\n\n## Examples\n\n- `\u002Fpgo` — explain the PGO workflow and check whether `default.pgo` is current.\n- `make record-pgo` — record a fresh profile from the eval suite.\n- `pi --cpuprofile \u002Ftmp\u002Fpi.pprof --mode print \"...\"` — one-off manual profile.\n- `go build -pgo=off .\u002Fcmd\u002Fpi` — build without PGO to compare.\n","# PGO — Profile-Guided Optimization\n\n**Source**: [go.dev\u002Fdoc\u002Fpgo](https:\u002F\u002Fgo.dev\u002Fdoc\u002Fpgo) (authoritative).\n\nPGO feeds a **CPU pprof profile** from representative runs of the application\nback into the compiler for the next build, which uses it to make more informed\noptimization decisions (e.g. more aggressive inlining of hot functions). As of\nGo 1.22, representative programs improve ~2–14%. The compiler expects a CPU\npprof profile — exactly what `runtime\u002Fpprof` and `net\u002Fhttp\u002Fpprof` produce.\n\n## The core rule: the profile must be representative\n\nA profile that is not representative of real behavior yields little or no gain.\n**Microbenchmarks are bad PGO candidates** — they exercise a small part of the\nprogram. Collect from a representative workload instead. For pi-go that means\n**both** of the binary's hot paths, not one:\n\n- **The headless agent\u002Ftool loop** — the tool-coverage eval suite: one\n  `pi --mode print` scenario per tool family.\n- **The TUI render loop** — `RenderMessages`, `collapseBlankLines`, and\n  `matchLexer`. A live profile attributed ~24% of CPU to the `ansi.Strip` call\n  `blankFast` replaces; bubbletea calls `View()` once per token during\n  streaming, so this is a first-class hot path. It is exercised by the render\n  benchmarks, not by `--mode print`.\n\nA profile from only one workload optimizes only one half of the program.\n\n## How pi-go records a profile\n\n`make record-pgo` does the whole loop:\n\n1. Builds the binary (`make build`).\n2. Runs the eval-tools suite with `PI_EVAL_CPU_PROFILE=tmp\u002Fpgo`, so every\n   scenario's `pi --mode print` writes a per-scenario CPU profile via the\n   `--cpuprofile` flag.\n3. Runs the TUI render benchmarks with `-cpuprofile tmp\u002Fpgo\u002Frender.pprof`.\n4. Merges all profiles into `cmd\u002Fpi\u002Fdefault.pgo` with\n   `go tool pprof -proto`.\n5. Cleans up the scratch profiles.\n\n`go build` auto-detects `default.pgo` in the main package directory\n(`cmd\u002Fpi\u002F`) and enables PGO — no `-pgo` flag needed. So `make build` after a\n`record-pgo` is a PGO build.\n\n### Manual collection\n\nFor a one-off profile of a specific workload:\n\n```bash\npi --cpuprofile \u002Ftmp\u002Fpi.pprof --mode print \"some representative prompt\"\n```\n\nThe `--cpuprofile` flag writes a runtime CPU profile for the process lifetime\nand flushes it on exit. It is a persistent flag, so it works on subcommands too\n(`pi memory mine . --cpuprofile \u002Ftmp\u002Fmine.pprof`).\n\n## Building with PGO\n\n- **Default**: `go build` detects `cmd\u002Fpi\u002Fdefault.pgo` and enables PGO\n  (`-pgo=auto`).\n- **Disable**: `go build -pgo=off`.\n- **Explicit path**: `go build -pgo=\u002Ftmp\u002Ffoo.pprof .\u002Fcmd\u002Fpi`. A path applies to\n  all main packages in the invocation, so keep one profile per binary.\n\n## Merging profiles\n\n```bash\ngo tool pprof -proto a.pprof b.pprof > merged.pprof\n```\n\nThe merge is a straight sum of samples regardless of wall duration, so when\nprofiling a long-running server, keep all slices the same duration or longer\nslices dominate. For pi-go's per-scenario profiles this is not a concern — each\nscenario is a short, bounded run.\n\n## Source and iterative stability\n\nGo PGO is robust to skew between the profiled version and the version being\nbuilt:\n\n- **Source stability**: samples are matched by line offsets within functions.\n  Adding code outside a hot function, or moving a function to another file in\n  the same package, does not break matching. Renaming a function, moving it to\n  another package, or editing inside a hot function may lose some optimizations\n  (graceful degradation).\n- **Iterative stability**: the compiler is conservative, so successive PGO\n  builds do not oscillate. No two-stage canary build is required.\n\n**Consequence**: collect a fresh profile regularly. Degradation accumulates\nslowly as code drifts from the profile, and new code paths get no PGO benefit\nuntil a new profile reflects them. After a large refactor that renames or moves\nmany functions, re-record.\n\n## Guidelines\n\n- **Re-record after meaningful code changes** — a stale profile optimizes the\n  old code shape. `make record-pgo` is the one-step refresh.\n- **Never profile a microbenchmark** for PGO; use the eval suite or a real\n  workload.\n- **Commit `default.pgo`** — the docs recommend committing the profile so builds\n  are reproducible and performant from a fresh clone. It is a build input, not\n  scratch.\n- **`make clean` removes `cmd\u002Fpi\u002Fdefault.pgo`** — re-run `make record-pgo`\n  after a clean if you want PGO back.\n- **Verify PGO is on**: `go build -x .\u002Fcmd\u002Fpi 2>&1 | grep -i pgo` shows the\n  `-pgo` flag the toolchain passes. Or check the binary size \u002F `go version -m`\n  for the profile.\n- **A non-representative profile should not make the program slower** than no\n  PGO — it just optimizes cold paths. If you see a real regression, file an\n  issue at go.dev\u002Fissue\u002Fnew.\n\n## Examples\n\n- `\u002Fpgo` — explain the PGO workflow and check whether `default.pgo` is current.\n- `make record-pgo` — record a fresh profile from the eval suite.\n- `pi --cpuprofile \u002Ftmp\u002Fpi.pprof --mode print \"...\"` — one-off manual profile.\n- `go build -pgo=off .\u002Fcmd\u002Fpi` — build without PGO to compare.\n",{"name":5,"description":7},"bcfcd42255878c3d40e545abcdeb2520b6d31a52",".pi-go\u002Fskills\u002Fpgo",34,"https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go","https:\u002F\u002Fpi-go.sh","https:\u002F\u002Fgithub.com\u002Fdimetron","🎸💻 🚧🦞","2026-11-15 03:48:24",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add dimetron\u002Fpi-go --skill pgo",{"tool":63,"command":64},"bunx","bunx skills add dimetron\u002Fpi-go --skill pgo",{"tool":66,"command":67},"pnpm","pnpm dlx skills add dimetron\u002Fpi-go --skill pgo","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002F.pi-go\u002Fskills\u002Fpgo\u002FSKILL.md",true,[],[72,96,119,137,152,171],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":44},"01M70SJ3216A0Y2NXYJJ2MVER0","verify-session-flow","Formally verify the interactive session flow before or after changing it. Use when editing internal\u002Ftui\u002Ftui.go's handleKey, handleInterruptKey, handleInputSubmit, ctrlCCount or quitting, internal\u002Ftui\u002Fagent_loop.go's enqueuePrompt, submit, steerPrompt, cancelAgent or handleAgentDone, or the deferred-init splash — or when a user reports that Ctrl+C quit on the first press, that Esc did not stop a turn or a goal loop, that a queued prompt was lost when they canceled, or that the TUI hung on a spinner nothing could clear.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-session-flow\u002FSKILL.md",[],[79,80,81,82,83,84,85,35,86,87,21,88,89,90,91,92,93,43,94,95],"session","verify session flow","verify","flow","submit","editing","init","loop","prompt","interactive","reports","first","goal","CTRL","clear","spinner","tui",{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":44},"01M70SJ02CTB40V2VFGAF80SBG","verify-run-pipeline","Formally verify the \u002Frun phase machine before or after changing it. Use when editing internal\u002Ftui\u002Frun.go's phase transitions (handleRunAgentDone, runGates result handling, verifyRunComplete, retryRun, reportGateHang, merge), internal\u002Fsop\u002Fverdict.go's Passed, or the checklist refresh — or when a run merged work it should not have, retried a hung gate, lost a cycle at the retry budget, or merged on a stale PASS.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-run-pipeline\u002FSKILL.md",[],[103,104,81,105,106,107,84,108,109,110,35,21,111,112,113,114,115,116,117,118],"pipeline","verify run pipeline","run","run pipeline","retry","cycle","run phase","machine","phase","refresh","work","verdict","transitions","result","merge","sop",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":44},"01M70SHWJV9N3PQWRAMCQE9C2E","verify-history-rewrite","Formally verify the session-history rewrite path before or after changing it. Use when editing internal\u002Fsession\u002Fautocompact.go, internal\u002Fsession\u002Fcompaction*.go, internal\u002Fsession\u002Fstore.go's Compact\u002FClearEvents\u002FrewriteEvents, internal\u002Fagent\u002Fagent.go's Run\u002FRunStreaming\u002FrunPreTurn, or internal\u002Ftui\u002Fcommands.go's clearConversation\u002FclearSessionContext and the context gauge — or when a turn is canceled mid-flight, a tool call and its result get separated, a session's history disappears while the agent is still working, or the model is sent a tool result whose call was compacted away.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-history-rewrite\u002FSKILL.md",[],[126,127,128,81,129,130,84,79,131,132,35,133,21,134,135,116,105,136,43,95],"history","rewrite","verify history rewrite","get","model","tool","call","compact","store","gauge","commands",{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":44},"01M70SHSJ5A2XV5SXBXM96RH7P","verify-goal-loop","Formally verify the \u002Fgoal automatic loop before or after changing it. Use when editing internal\u002Ftui\u002Fgoal.go, internal\u002Ftui\u002Fagent_loop.go's handleAgentDone\u002FcancelAgent\u002FsteerPrompt, or internal\u002Ftools\u002Fgoal.go's GoalController — or when a goal loop will not stop, stops one cycle early, closes a goal that is not met, or restarts a goal you finished.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-goal-loop\u002FSKILL.md",[],[86,144,145,81,91,146,84,108,35,21,147,148,43,95,149,150,151],"verify goal loop","verify goal","goal loop","you","automatic","Tools","it","stop",{"skillNo":153,"name":154,"nameZh":6,"description":155,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":158,"publishedAt":44},"01M70SHPYN1AS6D6RJ8HN270RZ","verify-agent-lifecycle","Formally verify the subagent lifecycle before or after changing it. Use when editing internal\u002Fsubagent\u002Forchestrator.go's Spawn, trackAgent, forwardAgentEvents, terminalStatus, Cancel, ShutdownWithTimeout or evictCompletedAgentsLocked, or internal\u002Fsubagent\u002Fpool.go — or when a canceled agent is reported as failed, an agent vanishes from the list with no verdict, the orchestrator panics on a pool release, or an agent can be canceled twice.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-agent-lifecycle\u002FSKILL.md",[],[159,160,161,81,162,84,35,21,163,164,165,25,114,166,167,168,169,43,150,170],"lifecycle","verify agent lifecycle","agent lifecycle","as","cancel","subagent","can","orchestrator","spawn","release","list","pool",{"skillNo":172,"name":173,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":174,"categories":175,"keywords":176,"publishedAt":44},"01M6E37WZM8ZF36DRYQGZDGP7M","test-new-skill","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Ftui\u002F.pi-go\u002Fskills\u002Ftest-new-skill\u002FSKILL.md",[],[177,178,179,20],"test","new skill","test new skill"]