@howaboua/pi-notes-compaction 0.0.8 → 0.0.9

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @howaboua/pi-notes-compaction
2
2
 
3
+ ## 0.0.9
4
+
5
+ - - Fixed history lookup errors to identify the missing ID and explain how to retry. History arguments now clarify that read_item requires both IDs.
6
+ - GPT-mode checkpoint guidance uses denser prose.
7
+ - New-window guidance tells agents to read task-relevant skills again.
8
+ - Notes write receipts now contain only the saved path.
9
+ - Idle rollover offers Off, 25m, 55m, 2h, 6h and 12h. Hour presets roll over five minutes early; saved 5- and 15-minute settings remain valid.
10
+
3
11
  ## 0.0.8
4
12
 
5
13
  - **Continuity and integrations**
package/README.md CHANGED
@@ -28,7 +28,7 @@ Reminders arrive at 85% and 90% context use. With normal compaction off, `/compa
28
28
 
29
29
  Pi rejects `/compact` when there is too little history to prepare compaction, before extensions run. `new_context` follows the separate **New window requests** setting.
30
30
 
31
- Idle rollover is off by default. Choose 5, 15, 25 or 55 minutes in `/notes`. After that interval, the next input waits for rollover only if the latest completed turn saved fresh notes. Otherwise it proceeds in the current window without requesting a checkpoint. These intervals are user preferences, not provider cache-expiry guarantees. Held input retains its original text, attachments and SDK options. If normal compaction has nothing to summarise, input proceeds in the current window. A failed rollover keeps input pending. Submit another prompt to retry, or reload to cancel it.
31
+ Idle rollover is off by default. Choose 25m, 55m, 2h, 6h or 12h in `/notes`. Hour presets use a five-minute buffer, stored as 115, 355 or 715 minutes. Saved 5- and 15-minute settings remain valid. After the interval, the next input waits for rollover only if the latest completed turn saved fresh notes. Otherwise it proceeds in the current window without requesting a checkpoint. These intervals are user preferences, not provider cache-expiry guarantees. Held input retains its original text, attachments and SDK options. If normal compaction has nothing to summarise, input proceeds in the current window. A failed rollover keeps input pending. Submit another prompt to retry, or reload to cancel it.
32
32
 
33
33
  ## Management
34
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howaboua/pi-notes-compaction",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,7 +39,7 @@
39
39
  "better-sqlite3": "13.0.3"
40
40
  },
41
41
  "devDependencies": {
42
- "@howaboua/pi-codex-conversion": "4.0.2",
42
+ "@howaboua/pi-codex-conversion": "4.0.3",
43
43
  "@types/better-sqlite3": "9.6.0"
44
44
  },
45
45
  "peerDependencies": {
@@ -47,7 +47,7 @@
47
47
  "@earendil-works/pi-agent-core": ">=1.0.4",
48
48
  "@earendil-works/pi-ai": ">=1.0.4",
49
49
  "@earendil-works/pi-tui": ">=1.0.4",
50
- "@howaboua/pi-codex-conversion": ">=4.0.2",
50
+ "@howaboua/pi-codex-conversion": ">=4.0.3",
51
51
  "typebox": "*"
52
52
  },
53
53
  "peerDependenciesMeta": {
package/src/history.ts CHANGED
@@ -129,14 +129,13 @@ export function useHistory(
129
129
  };
130
130
  }
131
131
  if (action === "read_item") {
132
- if (
133
- typeof params["window_id"] !== "string" ||
134
- typeof params["item_id"] !== "string"
135
- )
136
- throw new Error("Supply window_id and item_id unchanged from history");
137
- const item = windows
138
- .get(params["window_id"])
139
- ?.find((item) => item.item_id === params["item_id"]);
132
+ const windowId = params["window_id"];
133
+ const itemId = params["item_id"];
134
+ if (typeof windowId !== "string" || typeof itemId !== "string")
135
+ throw new Error(
136
+ `history read_item requires ${typeof windowId !== "string" ? "window_id" : "item_id"} as a string. Copy window_id and item_id from the same search_contents or list_items result`,
137
+ );
138
+ const item = windows.get(windowId)?.find((item) => item.item_id === itemId);
140
139
  if (!item) return { item: null };
141
140
  const offset = integer(params["offset_chars"], 0, item.content.length);
142
141
  const limit = integer(params["limit_chars"], 8000, 8000);
package/src/notes.ts CHANGED
@@ -331,8 +331,7 @@ export function useNotes(
331
331
  );
332
332
  }
333
333
  return {
334
- source: "pi-session",
335
- file: noteMetadata(revision, root),
334
+ file: { path: `${root}${path}` },
336
335
  };
337
336
  }
338
337
  return readNotes(notes, params, agent);
@@ -29,7 +29,11 @@ export async function openNotesSettings(
29
29
  (tui, theme, _kb, done) => {
30
30
  const settings = options.settings();
31
31
  const idleValue = (minutes: number) =>
32
- minutes === 0 ? "off" : `${minutes} min`;
32
+ minutes === 0
33
+ ? "Off"
34
+ : minutes < 60
35
+ ? `${minutes}m`
36
+ : `${Math.ceil(minutes / 60)}h`;
33
37
  const list = new SettingsList(
34
38
  [
35
39
  {
package/src/settings.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
2
2
  import { dirname } from "node:path";
3
3
 
4
- export const IDLE_MINUTES = [0, 5, 15, 25, 55] as const;
5
- export type IdleMinutes = (typeof IDLE_MINUTES)[number];
4
+ // Hour presets store their effective duration, with five minutes of headroom.
5
+ export const IDLE_MINUTES = [0, 25, 55, 115, 355, 715] as const;
6
+ export type IdleMinutes = (typeof IDLE_MINUTES)[number] | 5 | 15;
6
7
  export const NEW_WINDOW_REQUESTS = [
7
8
  "off",
8
9
  "pi-limits",
@@ -85,9 +86,13 @@ export function readSettings(path: string): NotesSettings {
85
86
  throw new Error(
86
87
  "Invalid task-boundary reminder setting. Save a setting in /notes, then reload Pi.",
87
88
  );
88
- if (!IDLE_MINUTES.some((value) => value === idleMinutes))
89
+ if (
90
+ idleMinutes !== 5 &&
91
+ idleMinutes !== 15 &&
92
+ !IDLE_MINUTES.some((value) => value === idleMinutes)
93
+ )
89
94
  throw new Error(
90
- "Invalid idle rollover interval. Choose off, 5, 15, 25 or 55 minutes.",
95
+ "Invalid idle rollover interval. Set idleMinutes to 0, 25, 55, 115, 355 or 715, then reload Pi.",
91
96
  );
92
97
  return {
93
98
  active,
package/src/tools.ts CHANGED
@@ -78,7 +78,11 @@ const HISTORY_SCHEMA = Type.Object(
78
78
  action: Type.Optional(StringEnum(HISTORY_ACTIONS)),
79
79
  agent_name: Type.Optional(Type.Union([Type.String(), Type.Null()])),
80
80
  item_id: STRING,
81
- window_id: Type.Optional(Type.Union([Type.String(), Type.Null()])),
81
+ window_id: Type.Optional(
82
+ Type.Union([Type.String(), Type.Null()], {
83
+ description: "Required with item_id for read_item",
84
+ }),
85
+ ),
82
86
  query: STRING,
83
87
  limit: INTEGER,
84
88
  limit_chars: INTEGER,
package/src/windows.ts CHANGED
@@ -27,12 +27,16 @@ const GUIDANCE = `<context_window_guidance>
27
27
  Notes are recovery state, not a diary. Keep one concise, authoritative note per task or topic at a stable path. Task checkpoints cover request, constraints, decisions, status, next steps and history IDs. Use write_file to replace stale state and mark completion. Link to existing notes instead of copying or summarising their contents. Recording isn't permission to implement.
28
28
 
29
29
  Batch saves at meaningful milestones, not every reply or intermediate step. Before new_context or handoff, save current state and wait for success; include the checkpoint path in handoffs. After rollover, read the checkpoint, then only needed links. Don't reread notes still in context unless they may have changed. Use history for missing details.
30
+
31
+ Previous skill reads don’t carry into this window. Read the skills needed for the current task.
30
32
  </context_window_guidance>`;
31
33
 
32
34
  const GPT_GUIDANCE = `<context_window_guidance>
33
- Notes=recovery state, not diary. One concise authoritative note/task or topic, stable path. Checkpoints: request, constraints, decisions, status, next steps, history IDs. write_file replaces stale state; mark completion. Link existing notes, don't copy/summarise. Recording != permission to implement.
35
+ Notes=recoverystate≠diary. One concise authoritative note/task-or-topic, stablepath. Taskcheckpoint=request/constraints/decisions/status/nextsteps/historyIDs. write_file→replace stalestate; mark completion. Existingnotes→link≠copy/summarise. Recording≠implementationpermission.
36
+
37
+ Savebatch@meaningfulmilestones≠every reply/step. Before new_context/handoff: save currentstate→await success; handoff includes checkpointpath. Postrollover: read checkpoint→neededlinks only. In-context notes: reread only if possiblychanged. Missingdetails→history.
34
38
 
35
- Batch saves at meaningful milestones, not every reply/step. Before new_context/handoff: save current state, await success; handoff includes checkpoint path. After rollover: read checkpoint, then needed links only. Don't reread notes still in context unless possibly changed. history fills missing details.
39
+ Prior skillreads≠currentcontext. Read task-relevant skills.
36
40
  </context_window_guidance>`;
37
41
 
38
42
  export function registerWindowRenderer(pi: ExtensionAPI): void {