[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-112924":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":9,"pushedAt":26,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":30,"discoverSource":31},112924,"pi-better","nicobailon\u002Fpi-better","nicobailon","\u002Fbetter rewrites your prompt with Felix Rieseberg's \"Depth\" prompt, using your real code and files, and puts it in your input box",null,"TypeScript",128,10,53,1,0,2,21,75,12,65.12,"MIT License",false,"main",[25],"pi-package","2026-11-13 06:25:20","2026-11-23 07:19:37","# pi-better\n\nPut `\u002Fbetter` in front of a prompt and pi-better rewrites it into the version a top professional would ask for, with facts from your own code and files in it. The new prompt lands in your input box, so you read it before anything runs.\n\nYour agent can use it too when it hands work to another agent. With [pi-subagents](https:\u002F\u002Fgithub.com\u002Fnicobailon\u002Fpi-subagents), it starts a subagent's task with `\u002Fbetter`, and the subagent gets a brief that was checked against your repo first.\n\nhttps:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F3479699e-8ee3-4fd9-b850-d496f80f5a63\n\nIt's built on the \"Depth\" prompt from Felix Rieseberg's [How to be more ambitious: A tutorial for humans with models](https:\u002F\u002Ffelixrieseberg.com\u002Fhow-to-be-more-ambitious-a-tutorial-for-humans-with-models\u002F#depth). In his words:\n\n```text\nI want a deeper version of this task, not a bigger one. Before rewriting it: (1) say what a top\nprofessional in this field would do here that I'm not asking for; (2) name the rawest material they\nwould start from instead of what has already been digested for me; (3) name the specific methods\nand tools they would use; (4) say what, other than you or me, would show the result is right. Then\nrewrite my prompt to ask for exactly that.\n```\n\npi-better sends this prompt with two changes: it opens with \"First, without asking me anything, find and read the code, files, docs and logs this touches, so your answers rest on them.\", and \"this task\" becomes \"this task\u002Fplan request\". It adds instructions to keep searches quick and never to start the work itself ([helper.md](helper.md)).\n\n## Why this exists\n\nAsk a model to \"make this better\" and it usually changes its vocabulary, not its methods. It works from whatever summary is already in the chat, does a bigger version of the same task, and then judges its own result. Felix's four questions fix each of those: what a professional would do that you didn't ask for, the raw material instead of the digest, the actual methods and tools, and a check that doesn't come from you or the model.\n\nThe prompt only works as well as the answers to those questions, and good answers need the real material. pi-better runs the prompt with a read-only helper that opens your code, files and logs and runs searches before it answers, so the rewrite names the files, commands and checks that exist in your project. The helper works in the background while you keep chatting, and the result goes into your input box, so you decide what gets sent.\n\n## Example\n\nA real run on this repo, pi-better itself. You type:\n\n```text\n\u002Fbetter make the error messages clearer\n```\n\n44 seconds later the helper had read `index.ts`, `better.ts`, the tests and the README, and wrote this prompt for your input box:\n\n```text\nMake pi-better's error messages tell me what happened, the likely cause, and what to do next. Base\nthat on the text each failure really produces, not on how the template strings in the code read.\n\nStart with the raw material. List every path in `index.ts` and `better.ts` that shows an error: the\nusage notices (index.ts:171, 175, 215, 226, 230), the `askHelper` failures (spawn failure at :95,\nthe 20-minute timeout at :98, non-zero exit with the last 3 stderr lines at :99, model error from\n`message_end` at :100), `parseMarkedPrompt`'s missing-block and empty-block errors (better.ts:25,\n27), and the boomerang \"another extension cancelled\" error (:260). They all go through `failed()` at\n:128. Then cause each one for real with the installed `pi`, and copy down the exact text I'd see:\n- `--model` set to a model that doesn't exist\n- a PATH with no `pi` on it\n- `kill -9` on the helper child, so the exit code is `null`\n- a helper that exits non-zero with empty stderr\n- an auth or rate-limit failure, if you can trigger one safely\n- a reply with no `\u003Cimproved-prompt>` block\n- a timeout shortened for the test, then put back\n\nBefore you change anything, show me a table: trigger → current message → what I should do next.\n\nThen fix what the table shows. I already know about these:\n- \"exited with code null:\" when the child is killed by a signal\n- a message ending in a bare colon when stderr is empty\n- `\u002Fbetter` throwing away the helper's reply when the block is missing. `appendEntry` only runs on\n  success, so \"run \u002Fbetter again\" leaves me no way to see what went wrong. Keep the reply somewhere\n  I can read it (the `\u002Fbetter-boomerang` path already leaves it on the branch), and have the message\n  say where it is.\n\nEvery message should give the next step as a command or setting. Follow the NN\u002Fg error-message\nguidelines: say what happened, say how to fix it, no blame, no internal names I'd have to know. Keep\nthe existing `\u002F\u003Ccommand> failed:` prefix. Don't add recovery or retries; this is about wording and\nkeeping the evidence.\n\nProof it's right:\n- Run the same real failures again and show me the new text for each, next to the old.\n- Update the README Troubleshooting section so every entry matches a real string word for word, and\n  add entries for the paths it doesn't cover yet.\n- Add black-box `node:test` cases in `better.test.ts` only where behavior changed (for example, the\n  parse errors), and check that they fail on the old code.\n- `npm test` and `npm run typecheck` pass.\n- Last check: someone who has never used pi-better should be able to read each message cold and know\n  what to do without opening the README.\n```\n\nIt listed every error path with its line number, said to cause each failure for real before changing anything, and found three problems nobody had asked about, all fixed since: a killed helper reported \"exited with code null\", an empty error output left the message ending in a colon, and a reply with no marked prompt was thrown away. It also says what proves the result right: the real failures rerun, the README matching the real messages word for word, and a cold read by someone new.\n\n## Three ways to run the prompt\n\n| | Type Felix's prompt yourself | `\u002Fbetter` | `\u002Fbetter-boomerang` |\n|---|---|---|---|\n| Where it runs | in this chat | a separate read-only `pi` process with a copy of this chat | in this chat |\n| Keep chatting meanwhile | no | yes, and you can run it while the agent is busy, when a normal message would wait in the queue | no, but you can type your next message |\n| Watch it work | yes | no; two rows show its step, its latest tools and the time | yes |\n| Your context afterwards | holds the four answers, the research and the rewrite | unchanged | rewinds to where it was before you ran it; the rewrite stays in `\u002Ftree` |\n| Model | this chat's | this chat's, reusing its prompt cache, or one you set | this chat's |\n| The improved prompt | in a reply, for you to copy | in your input box | in your input box |\n| Your agent can use it on a subagent's brief | no | yes, with [pi-subagents](https:\u002F\u002Fgithub.com\u002Fnicobailon\u002Fpi-subagents); the subagent starts with the checked brief | no |\n\nUse `\u002Fbetter-boomerang` when you want to watch the agent research and write the prompt live, then have the chat rewind as if it never happened.\n\n## Install\n\n```bash\npi install npm:pi-better\n```\n\nThen run `\u002Freload` (or restart Pi) and the commands are there. To work on pi-better itself, clone it into `~\u002F.pi\u002Fagent\u002Fextensions\u002Fpi-better` instead; Pi loads extensions from that folder on its own.\n\n`\u002Fbetter`'s helper runs on the chat's model and thinking level, with the chat's tools and system prompt, so its copy of your conversation is read from the provider's prompt cache instead of being processed again. To use a different model or thinking level for it, add either key to `settings.json` (`~\u002F.pi\u002Fagent\u002Fsettings.json` or the project's `.pi\u002Fsettings.json`); the cache won't carry over then:\n\n```json\n\"better\": { \"model\": \"anthropic\u002Fclaude-opus-4-5\", \"thinking\": \"high\" }\n```\n\n## What you'll see\n\nWhile `\u002Fbetter` works, two rows above your input box say what the helper is doing and show its latest tools with ✓ or ✗. A six-cell meter fills as it goes: reading your code and files, working through the four questions, then writing your improved prompt. The current cell pulses. Three moments from a real run at 80 columns:\n\n```text\n ▰▱▱▱▱▱  Reading your code and files                        8s · escape cancels\n   ✓ read docs\u002Fhow-it-works.md  ✓ cat package.json better.ts …          5 tools\n\n ▰▰▰▰▱▱  Picking the methods and tools (3 of 4)         1m 27s · escape cancels\n   ✓ grep -m6 \"wasAborted=true\" …                           15 tools · 1 failed\n\n ▰▰▰▰▰▰  Writing your improved prompt                   1m 30s · escape cancels\n   ✓ grep -m6 \"wasAborted=true\" …                           15 tools · 1 failed\n```\n\nEsc stops the helper, even while the agent is busy. Press Esc again to stop the agent.\n\nWhen it's done, the improved prompt is in your input box with this notice:\n\n```text\nThe improved prompt is in your input box. Edit it, then press Enter to send.\n```\n\nAnything you'd typed meanwhile stays in the box, below the prompt, and the notice says so. Nothing is sent until you press Enter. The helper can use `read` and your shell (`bash`, or `powershell` if you use it), plus `grep`, `find` and `ls` when your chat has them; pi-better refuses any other tool it calls, including edit and write. It stops after 20 minutes.\n\n## Common tasks\n\n| Want | Do |\n|---|---|\n| Deepen a prompt | `\u002Fbetter \u003Cprompt>` |\n| Deepen the task you're working on now, including your feedback so far | `\u002Fbetter` with no prompt |\n| Stop the helper | Esc (press it again to stop the agent) |\n| Watch the rewrite happen in the chat | `\u002Fbetter-boomerang \u003Cprompt>` (or no prompt, for the task in progress) |\n| Have a subagent's brief checked against the repo before it starts, for anything the subagent can't see | with [pi-subagents](https:\u002F\u002Fgithub.com\u002Fnicobailon\u002Fpi-subagents), tell your agent (in AGENTS.md or a skill) to start the subagent's task with `\u002Fbetter` ([how](docs\u002Fhow-it-works.md#subagent-briefs)) |\n\n[How it works](docs\u002Fhow-it-works.md) covers the helper process, the copy of your chat, print and RPC mode, the prompt cache, every error message and the limitations.\n","pi-better 是一个轻量级 TypeScript 工具，用于在本地开发环境中智能重写用户提示词（prompt），使其更专业、更具体、更基于真实项目上下文。它基于 Felix Rieseberg 提出的 'Depth' 方法论，自动读取用户代码、文档和日志等原始材料，生成包含具体文件路径、命令、校验方式的增强版提示，并将结果置入输入框供人工确认后提交。核心特点是只读式上下文感知、零模型调用、实时后台分析、支持主\u002F子代理协作流程。适用于需要提升 LLM 提示质量的开发者、技术团队及 AI 辅助编程场景，尤其适合在已有代码库中进行精准调试、错误改进或任务拆解。","2026-11-24 04:44:37","CREATED_QUERY"]