Summary
The generated Pi extension currently exports a named register(pi) function, but Pi expects an extension file to default-export a factory function.
This makes Pi fail on startup whenever the generated extension is present.
Environment
- codebase-memory-mcp:
0.10.1
- Pi coding agent:
0.84.1
- macOS arm64
Repro
After installing codebase-memory-mcp with Pi integration, the generated file at:
~/.pi/agent/extensions/cbmem.ts
contained:
export function register(pi) {
pi.registerTool({ name: 'index_repository', run: (args, ctx) => call('index_repository', args, ctx?.signal) });
// ...
}
Running any Pi command with extensions enabled then failed:
with:
Error: Failed to load extension "/Users/musichen/.pi/agent/extensions/cbmem.ts": Extension does not export a valid factory function: /Users/musichen/.pi/agent/extensions/cbmem.ts
Hint: Start without extensions using "pi -ne".
Local fix verified
Changing the generated export to a default factory fixed Pi startup:
-export function register(pi) {
+export default function (pi) {
After this change, both commands worked with extensions enabled:
pi doctor
pi -p 'reply exactly: pi-ok'
Expected generator output
The Pi extension generator should emit:
export default function (pi) {
pi.registerTool({ name: 'index_repository', run: (args, ctx) => call('index_repository', args, ctx?.signal) });
}
Related
I also opened a Pi issue asking for a clearer loader diagnostic when the default export is missing:
earendil-works/pi#7985
Summary
The generated Pi extension currently exports a named
register(pi)function, but Pi expects an extension file to default-export a factory function.This makes Pi fail on startup whenever the generated extension is present.
Environment
0.10.10.84.1Repro
After installing codebase-memory-mcp with Pi integration, the generated file at:
contained:
Running any Pi command with extensions enabled then failed:
with:
Local fix verified
Changing the generated export to a default factory fixed Pi startup:
After this change, both commands worked with extensions enabled:
pi doctor pi -p 'reply exactly: pi-ok'Expected generator output
The Pi extension generator should emit:
Related
I also opened a Pi issue asking for a clearer loader diagnostic when the default export is missing:
earendil-works/pi#7985