Repository navigation
Description
Causing about 2 - 3 seconds slow startup in pi and omp.
Below is prepared by agent itself.
~/.pi/agent/extensions/rtk.ts and ~/.omp/agent/extensions/rtk.ts does a runtime value import:
import { isToolCallEventType } from "@earendil-works/pi-coding-agent"
This resolves to the package barrel (dist/index.js), which re-exports the entire agent core — a ~9.2 MB module graph. bun must parse and evaluate that whole graph at extension load just to obtain one function.
- value import from barrel
- type-only / no runtime import
So the import costs avoidable startup time. Disabling the extension entirely is what made startup noticeably faster.
Root cause: isToolCallEventType is trivial — return event.toolName === toolName (dist/core/extensions/types.js:42). Pulling the full barrel for it is unnecessary.
Fix: drop the value import and inline the check. import type { ExtensionAPI } stays (erased at transpile, zero runtime cost).
// remove: import { isToolCallEventType } from "@earendil-works/pi-coding-agent"
// change: if (!isToolCallEventType("bash", event)) return
// to: if (event.toolName !== "bash") return
Behaviorally identical; startup drops back to baseline.
Note: a subpath import (.../core/extensions) is not a viable al
Note: a subpath import (.../core/extensions) is not a viable alternative — the package's exports map declares only ".", so that specifier fails to resolve (Cannot find module), and even if it resolved, that subpath barrel re-exports loader.js/runner.js . Inlining the comparison is the only clean fix.
sed -i
-e '/^import { isToolCallEventType }/d'
-e 's/if (!isToolCallEventType("bash", event)) return/if (event.toolName !== "bash") return/'
"$target"
Activity
pszymkowiak commentedon Jun 30, 2026
🔍 Automated Triage
bugmediumSummary
Slow startup (2-3s) in pi/omp caused by a full barrel import of a ~9.2MB module just to use one trivial function; fix is to inline the comparison and remove the value import.
📁 Relevant files
~/.pi/agent/extensions/rtk.ts~/.omp/agent/extensions/rtk.tsTriaged automatically by wshm · This is an automated analysis, not a human review.
durkagiri21-ship-it commentedon Jul 5, 2026
Hi @ilkerhk, I'd like to work on this issue. Can you assign it to me?
I'll replace the runtime import with an inline check as suggested.
ilkerhk commentedon Jul 5, 2026
@durkagiri21-ship-it
you can ask maintainers for the assignment.
durkagiri21-ship-it commentedon Jul 5, 2026
@ilkerhk Thanks for the clarification!
@aeppling @KuSh Hi, I'd like to work on this issue. Could you please assign it to me?
I'll implement the fix as described: remove the runtime import and inline the event.toolName check to reduce startup time.
KuSh commentedon Jul 5, 2026
No need for assignment, if there's no PR already feel free to contribute
durkagiri21-ship-it commentedon Jul 5, 2026
Checked the codebase. No
runtimeimport found in:hooks/pi/rtk.tshooks/opencode/rtk.tsfrom ['"]runtime['"]regex - no resultsSeems this was already fixed in a previous commit. Closing this issue.
If I'm looking in the wrong place, please point me to the correct file.
KuSh commentedon Jul 5, 2026
It seems to still be there
imzza commentedon Jul 26, 2026
I also noticed that Pi has become much slower, and its startup time is even worse than that of Codex or OpenCode.
address review comments: explain type-guard rationale and link rtk-ai…