Small Codex-inspired /goal extension for Pi.
This implementation combines:
- Codex/PurpleMyst-style guarded continuation prompts with XML-escaped untrusted objectives.
- zereraz-style runtime features: hidden continuations,
get_goal,update_goal, elapsed time, optional token budgets, and budget-limit wrap-up prompts.
/goal <objective>starts a new active goal./goal <objective> --budget 50kstarts a goal with an approximate token budget./goalor/goal statusshows the current goal./goal pause,/goal resume,/goal clear.
Pi extensions do not expose Codex's internal token accounting or developer-message queue. This extension therefore:
- Injects a guarded goal summary into
before_agent_start. - Sends continuation prompts as hidden Pi messages with
triggerTurn: true. - Tracks elapsed wall-clock time exactly for active turns.
- Estimates token usage conservatively as a configurable fixed amount per completed active turn.
The objective is always framed as untrusted user data and XML-escaped before being placed in prompt templates.