@yandy0725/pi-memory 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.ts +8 -2
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -87,11 +87,17 @@ export default function (pi: ExtensionAPI) {
87
87
  pi.on("before_agent_start", async (event, ctx) => {
88
88
  if (!config?.enabled || !indexSnapshot || !memoryDir) return;
89
89
 
90
- // Auto-surfacing: select relevant topic files via LLM side-query and inject as message
90
+ // Auto-surfacing: select relevant topic files via LLM side-query and inject as message.
91
+ // Skip for subagents: pi-subagents strips "subagent" from all children's
92
+ // tool sets, so its absence reliably identifies subagents. Without this guard,
93
+ // runSideQuery's subagent spawn → before_agent_start → re-enter here → OOM.
94
+ const agentTools = event.systemPromptOptions?.selectedTools;
95
+ const isSubagent = agentTools && !agentTools.includes("subagent");
96
+
91
97
  const autoSurfacing = config.autoSurfacing;
92
98
  // biome-ignore lint/suspicious/noExplicitAny: message injection result
93
99
  let injectedMessage: any;
94
- if (autoSurfacing?.enabled && event.prompt) {
100
+ if (autoSurfacing?.enabled && event.prompt && !isSubagent) {
95
101
  try {
96
102
  if (ctx.hasUI) ctx.ui.setStatus("surfacing", "Searching relevant memories…");
97
103
  const manifest = await scanTopics(memoryDir);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.0.0",
6
+ "version": "1.0.1",
7
7
  "description": "File-system driven persistent memory layer for pi coding agent",
8
8
  "license": "MIT",
9
9
  "repository": {