Environment
- Host: Windows 10 Pro (x64)
- Runtime: Oh My Pi (omp) v17.2.7
- Extension: pi-cache-optimizer@2.8.0 (installed via
omp plugin install npm:pi-cache-optimizer)
Steps to reproduce
- Install under omp:
omp plugin install npm:pi-cache-optimizer
- Run any headless session, e.g.
omp -p "reply with exactly: ok"
Actual behavior
The extension loads successfully (no module-resolution error — omp rewrites @earendil-works/pi-coding-agent imports
onto its host @oh-my-pi/pi-coding-agent), but every run emits:
Extension error (C:\Users\Taam.omp\plugins\node_modules\pi-cache-optimizer\index.ts): undefined is not an object
(evaluating 'opts.skills')
The session itself continues (errors are isolated per extension), but the skill-compression and stable-prefix reorder
features never run.
Root cause
In the before_agent_start handler (index.ts), the code calls compressSkillsInSystemPrompt(strippedPrompt, event.systemPromptOptions) (and later optimizeSystemPrompt(..., event.systemPromptOptions)). On omp, the
before_agent_start event payload does not include a systemPromptOptions field, so event.systemPromptOptions
is undefined, and opts.skills at line ~545 throws. The handler assumes a Pi-specific event payload shape that omp
does not provide.
Expected behavior
- Either omp should populate
systemPromptOptions on before_agent_start (aligning with Pi's event contract), or
- The extension should defensively handle a missing
systemPromptOptions (e.g. opts?.skills, treat as "no rewrite
applicable") so the rest of the extension (footer cache stats, prompt_cache_key fallback, Anthropic cache-control
repair) keeps working.
Suggested fix (minimal, in extension)
Guard the payload access, e.g.:
const opts = event.systemPromptOptions ?? {};
Workaround (for users until fixed)
PI_CACHE_OPTIMIZER_NO_PROMPT_REWRITE=1 skips the failing code path; the remaining features stay active.
Notes
- Install/load path is fully working on omp (package.json#pi.extensions manifest fallback is honored; npm: install
spec accepted). This is purely a runtime event-contract mismatch.
- Happy to test a patched version on omp if you want to add @oh-my-pi/pi-coding-agent to peerDependencies or ship a
package.json#omp.extensions alias.
(it’s from omp agnet)
Environment
omp plugin install npm:pi-cache-optimizer)Steps to reproduce
omp plugin install npm:pi-cache-optimizeromp -p "reply with exactly: ok"Actual behavior
The extension loads successfully (no module-resolution error — omp rewrites
@earendil-works/pi-coding-agentimportsonto its host
@oh-my-pi/pi-coding-agent), but every run emits:The session itself continues (errors are isolated per extension), but the skill-compression and stable-prefix reorder
features never run.
Root cause
In the
before_agent_starthandler (index.ts), the code callscompressSkillsInSystemPrompt(strippedPrompt, event.systemPromptOptions)(and lateroptimizeSystemPrompt(..., event.systemPromptOptions)). On omp, thebefore_agent_startevent payload does not include asystemPromptOptionsfield, soevent.systemPromptOptionsis
undefined, andopts.skillsat line ~545 throws. The handler assumes a Pi-specific event payload shape that ompdoes not provide.
Expected behavior
systemPromptOptionsonbefore_agent_start(aligning with Pi's event contract), orsystemPromptOptions(e.g.opts?.skills, treat as "no rewriteapplicable") so the rest of the extension (footer cache stats,
prompt_cache_keyfallback, Anthropic cache-controlrepair) keeps working.
Suggested fix (minimal, in extension)
Guard the payload access, e.g.:
Workaround (for users until fixed)
PI_CACHE_OPTIMIZER_NO_PROMPT_REWRITE=1 skips the failing code path; the remaining features stay active.
Notes
spec accepted). This is purely a runtime event-contract mismatch.
package.json#omp.extensions alias.
(it’s from omp agnet)