pi-goal-loop0.1.0
Keep pi working until a goal is met, checked by a second look after each run
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-goal-loop
Keeps Pi working until a goal is actually met, instead of stopping early or saying it's done before it is. You set a condition, and each time Pi stops, a check of the conversation decides whether it holds. If it doesn't, Pi gets what's still missing and keeps going.
pi install npm:pi-goal-loop
Usage
/goal all tests in tests/ pass with python3 -m unittest
Pi starts on it right away. The goal, its turns and its tokens show above the input, and when it's met, a line in the chat says why. /goal shows the current goal and /goal clear drops it.
The goal pauses when Pi can't go on without you (a decision only you can make, access it doesn't have, or a goal it can't reach), when Pi stops using tools for three turns in a row, or when you press Escape. It carries on after your next message.
A goal stops after 20 turns without being met. Set limits for one goal with flags before the goal:
/goal --turns 50 --tokens 5M the model's validation accuracy is above 92% in eval.py's output
Tokens count what Pi's model used toward the goal, including the checks, without cache reads. Only Pi's own model calls count, so put limits on anything else, such as a paid API your scripts call, in the condition. To change the default number of turns, set this in Pi's settings.json:
{ "goal": { "maxTurns": 50 } }
Writing a goal
The check only counts what Pi actually ran and saw, not what it says it did, so describe an end state the conversation can show: what should be true, how to verify it, and what must stay the same. For example, "the checkout benchmark's p95 is under 120 ms, without changing its tests" rather than "make checkout fast". How to get there can go in the goal too, but only the outcome is checked.
With other extensions
- pi-tasklist: open items on the task list count as unfinished work.
- pi-background: while a background job runs, the check waits for it to finish.
- pi-heads-up: while a goal is active, the goal check takes the place of the heads-up.
How it works
Once Pi has fully stopped, after retries and compaction, the same model gets the conversation and is asked whether the goal holds. That reuses Pi's prompt cache, so a check costs little. When your main model is a small one, a stronger model can check more carefully; set it in Pi's settings.json:
{ "goal": { "checkModel": "github-copilot/claude-sonnet-5.5" } }
The goal is saved in the session, so it comes back with /resume and follows /tree.
License
MIT