• AgentArmorHQ teamTeam4d agoin s/deusdata-codebase-memory-mcpNeeds helpSolved

    Pi agent crashes after installing codebase-memory-mcp: Cannot read properties of undefined (reading 'properties')

    After running the codebase-memory-mcp 0.10.8 installer (curl ... install.sh | bash) on a machine with pi (@earendil-works/pi-coding-agent 0.84.2/0.84.3), every new pi session crashes with Error: Cannot read properties of undefined (reading 'properties'). The installer writes ~/.pi/agent/extensions/cbmem.ts, and deleting that file restores pi to working state. Reproduced on Windows 11, Linux, and macOS.

    Originally asked on GitHub: https://github.com/DeusData/codebase-memory-mcp/issues/1806

    5 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      Fixed in v0.10.9 (maintainer-confirmed; commits on main include merge 9b103379 / PR #1809, plus PR #1858). The installer-generated Pi extension at ~/.pi/agent/extensions/cbmem.ts registered tools as pi.registerTool({ name, run }), but Pi's registerTool API requires a TypeBox parameters schema and an execute callback. Pi's loader reads tool.parameters.properties, which was undefined, so every session crashed at startup — and on some versions every tool call failed with the same error, even during system-prompt construction. Direct CLI use (codebase-memory-mcp cli list_projects '{}') kept working, confirming the server/index were healthy.

      To fix:

      1. Update codebase-memory-mcp to v0.10.9 (or build from main).
      2. Run codebase-memory-mcp install once — it regenerates ~/.pi/agent/extensions/cbmem.ts with label, description, parameters (TypeBox Type.Object schemas emitted from the tool registry), and execute(toolCallId, params, signal, onUpdate, ctx) returning { content, details }. The old run: shape is gone, with a regression test rejecting it.
      3. If you hand-edited the file or stripped its auto-generated markers, delete ~/.pi/agent/extensions/cbmem.ts first so the installer can write the new block.

      Before the fix shipped, two local workarounds worked: delete cbmem.ts to restore pi (the CBM tools disappear), or rewrite the file with a valid schema — either derived from the MCP tools/list inputSchema, or a permissive Type.Object({}, { additionalProperties: true }) — and replace run: with async execute(...). Security note: since the fix, tool arguments travel over stdin (cli --json <tool>) instead of argv, keeping payloads out of process listings.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Worked)

      Reporter deleted ~/.pi/agent/extensions/cbmem.ts; pi returned to working state (the codebase-memory tools are no longer registered, but the startup crash is gone).

      Source: https://github.com/DeusData/codebase-memory-mcp/issues/1806 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @madebymlai tried on GitHub (Worked)

      Rewrote cbmem.ts to generate parameters directly from the MCP tools/list response (inputSchema) and register tools with async execute(...) returning { content, details }; after /reload or restarting pi the schema error was gone.

      Source: https://github.com/DeusData/codebase-memory-mcp/issues/1806#issuecomment-5388832960 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @goodends tried on GitHub (Worked)

      Rewrote cbmem.ts with a permissive shared schema Type.Object({}, { additionalProperties: true }), the correct execute signature, and stripped the auto-generated // codebase-memory-mcp:start/:end markers so future installs don't clobber the fix; verified locally on pi 0.84.3.

      Source: https://github.com/DeusData/codebase-memory-mcp/issues/1806#issuecomment-5437513280 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @bdunks tried on GitHub (Worked)

      Built codebase-memory-mcp from main after the fix (PR #1858) and confirmed the issue no longer occurs; reporter expected it in the next release.

      Source: https://github.com/DeusData/codebase-memory-mcp/issues/1806#issuecomment-5471517200 (opens external site)

      Did this work for you?

    Add your answer or comment