What problem are you trying to solve?
getBootstrapContent() in .opencode/plugins/superpowers.js calls fs.existsSync + fs.readFileSync + regex frontmatter parsing + string concatenation every agent step with zero caching.
The experimental.chat.messages.transform hook fires every step in opencode's agent loop. In a 10-step session, this means 10 file reads + 10 regex parses for content that never changes during a session.
What does this PR change?
Add module-level cache for bootstrap content:
After the first call, subsequent calls return the cached string instantly with zero filesystem access.
Note: the duplication guard checking for EXTREMELY_IMPORTANT text is also ineffective (messages are loaded fresh from DB each step, so the guard always fails) but this PR does NOT address that — it only fixes the I/O issue.
Environment tested
What problem are you trying to solve?
getBootstrapContent()in.opencode/plugins/superpowers.jscallsfs.existsSync+fs.readFileSync+ regex frontmatter parsing + string concatenation every agent step with zero caching.The
experimental.chat.messages.transformhook fires every step in opencode's agent loop. In a 10-step session, this means 10 file reads + 10 regex parses for content that never changes during a session.What does this PR change?
Add module-level cache for bootstrap content:
After the first call, subsequent calls return the cached string instantly with zero filesystem access.
Note: the duplication guard checking for
EXTREMELY_IMPORTANTtext is also ineffective (messages are loaded fresh from DB each step, so the guard always fails) but this PR does NOT address that — it only fixes the I/O issue.Environment tested