@matthewfl/pi-contemplator 0.1.9 → 0.1.10

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matthewfl/pi-contemplator",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "A Pi extension that keeps long-running agentic sessions on track with background memory, contemplation, and structural review.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@ import { estimateStringTokens } from "../../tokens.js";
27
27
  import { createRecallAgentTool } from "../../tools/recall-observation.js";
28
28
  import { createSearchMemoriesAgentTool } from "../../tools/search-memories.js";
29
29
  import { logAgentStreamError } from "../stream-errors.js";
30
- import { SUMMARIZER_CONTINUE, SUMMARIZER_SYSTEM } from "./prompts.js";
30
+ import { summarizerContinue, SUMMARIZER_SYSTEM } from "./prompts.js";
31
31
  import {
32
32
  renderSummarizerMemory,
33
33
  sampleSummarizerMemories,
@@ -568,7 +568,7 @@ export async function runSummarizer(args: RunSummarizerArgs): Promise<Summarizer
568
568
 
569
569
  try {
570
570
  await runOnce("The preceding summarize call and receipt are an illustrative example only. Its placeholder ids are not real and it did not create a summary. Now inspect the actual records and use tools to register safe compression, or call done if none is warranted.", false);
571
- for (let invocation = 1; !completedWithDone && invocation < SUMMARIZER_MAX_INVOCATIONS; invocation++) await runOnce(SUMMARIZER_CONTINUE, true);
571
+ for (let invocation = 1; !completedWithDone && invocation < SUMMARIZER_MAX_INVOCATIONS; invocation++) await runOnce(summarizerContinue(drafts.size, invocation), true);
572
572
  } catch (error) {
573
573
  debugLog("summarizer.error", { error: error instanceof Error ? error.message : String(error), acceptedSummaries: drafts.size });
574
574
  if (drafts.size === 0) return { completed: false, reviewedUpToId: coversUpToId, sample };
@@ -43,4 +43,8 @@ Tools:
43
43
 
44
44
  Prefer faithful useful compression over both distortion and indefinite accumulation. Under pressure, make progress on old low-value clusters first; treat durable valuable records and user intent as the last things to compress.`;
45
45
 
46
- export const SUMMARIZER_CONTINUE = "IMPORTANT!!!! CALL summarize TOOL NOW TO RECORD ANY SUMMARIES YOU HAVE DECIDED, OR CALL done IF NO SAFE SUMMARY IS WARRANTED. DO NOT DESCRIBE THE ACTION IN PROSE—USE A TOOL NOW.";
46
+ export function summarizerContinue(recordedSummaries: number, reminderNumber: number): string {
47
+ const count = Math.max(0, Math.floor(recordedSummaries));
48
+ const thinkingMinutes = Math.max(1, Math.floor(reminderNumber)) * 20;
49
+ return `IMPORTANT!!!! YOU HAVE BEEN THINKING FOR ${thinkingMinutes} MINUTES. CALL A TOOL NOW. DO NOT WRITE SUMMARIES IN THE MAIN TEXT. THERE ${count === 1 ? "IS" : "ARE"} CURRENTLY ${count} RECORDED ${count === 1 ? "SUMMARY" : "SUMMARIES"}${count === 0 ? "; NOTHING HAS BEEN SUMMARIZED YET" : ""}. IF YOU WROTE SUMMARIES IN THE MAIN TEXT, RECORD THEM USING THE summarize TOOL NOW. IF NO SAFE SUMMARY IS WARRANTED, CALL done.`;
50
+ }