@the-librarian/pi-extension 1.33.7 → 1.36.0

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/README.md CHANGED
@@ -11,9 +11,9 @@ Librarian primer into the system prompt. One install, zero config files.
11
11
 
12
12
  ## What you get
13
13
 
14
- - **7 tools, identical to every other harness** — `recall`, `remember`,
14
+ - **8 tools, identical to every other harness** — `recall`, `remember`,
15
15
  `flag_memory`, `store_handoff`, `list_handoffs`, `claim_handoff`,
16
- `search_references`. Descriptions and schemas mirror the server's
16
+ `search_references`, `journal`. Descriptions and schemas mirror the server's
17
17
  (a drift-guard test pins them), so the model is taught the same protocol in
18
18
  Pi as in Claude Code, Codex, OpenCode, and Hermes. `flag_memory` asks
19
19
  the curator to review a wrong or outdated memory: it may correct it in place,
@@ -1,7 +1,7 @@
1
1
  // Native Pi slash commands for The Librarian — optional sugar (rethink D9).
2
2
  //
3
3
  // Four thin prompt templates aligned with docs/slash-commands.md and the
4
- // 7-verb surface. Each handler injects a user message that drives the LLM
4
+ // 8-verb surface. Each handler injects a user message that drives the LLM
5
5
  // through the corresponding tool flow; the tools (and the primer) carry the
6
6
  // actual protocol, so these stay deliberately skeletal. Pi's `registerCommand`
7
7
  // is one call per verb — cheap enough to keep.
@@ -28,8 +28,8 @@ const LEARN_PROMPT =
28
28
 
29
29
  const TOGGLE_ON =
30
30
  "Private mode is ON. `[librarian:private=on]` — do not call `remember`, " +
31
- "`store_handoff`, or `flag_memory` until told otherwise. `recall` and " +
32
- "`search_references` stay allowed; note that read queries still reach the " +
31
+ "`store_handoff`, or `flag_memory` until told otherwise. `recall`, " +
32
+ "`search_references` and `journal` stay allowed; note that read queries still reach the " +
33
33
  "Librarian server's logs. Private mode is an in-conversation instruction; " +
34
34
  "the server cannot verify its marker. A curator review queued by a flag " +
35
35
  "from public context may still correct that memory after switching private; " +
@@ -4,8 +4,8 @@
4
4
  // rethink retires the conv-state injection, the per-turn conv_state fetch, and
5
5
  // the 3-tool limitation; what survives is exactly:
6
6
  //
7
- // - the 7 agent verbs (recall / remember / flag_memory / store_handoff /
8
- // list_handoffs / claim_handoff / search_references) as native Pi tool
7
+ // - the 8 agent verbs (recall / remember / flag_memory / store_handoff /
8
+ // list_handoffs / claim_handoff / search_references / journal) as native Pi tool
9
9
  // proxies over the Librarian's stateless /mcp endpoint — see `tools.ts`;
10
10
  // - the ≤2KB primer, fetched from `GET /primer.md` once per process and
11
11
  // appended to the system prompt via `before_agent_start` — see `primer.ts`;
@@ -47,14 +47,14 @@ export default function librarian(pi: ExtensionAPI): void {
47
47
  return;
48
48
  }
49
49
 
50
- // One shared MCP client for all 7 tool proxies.
50
+ // One shared MCP client for all 8 tool proxies.
51
51
  const mcp = createMcpClient({
52
52
  endpoint: config.endpoint,
53
53
  token: config.token,
54
54
  ...(config.timeoutMs !== undefined ? { timeoutMs: config.timeoutMs } : {}),
55
55
  });
56
56
 
57
- // Expose the Librarian's 7 verbs to the model directly (no mcp.json needed).
57
+ // Expose the Librarian's 8 verbs to the model directly (no mcp.json needed).
58
58
  registerLibrarianTools(pi, mcp);
59
59
 
60
60
  // Primer → system prompt, once per turn, cached per process, fail-soft.
@@ -1,4 +1,4 @@
1
- // The Librarian's 7 agent verbs, registered natively in the extension.
1
+ // The Librarian's 8 agent verbs, registered natively in the extension.
2
2
  //
3
3
  // Pi's CORE has no MCP support (the `mcp.json` / mcpServers feature lives in
4
4
  // third-party adapter extensions, not the runtime). So rather than ask every
@@ -42,7 +42,7 @@ export interface LibrarianToolSpec {
42
42
  }
43
43
 
44
44
  /**
45
- * The 7-verb agent surface (rethink spec §5.1), one spec per server tool.
45
+ * The 8-verb agent surface (rethink spec §5.1, ADR 0016), one spec per server tool.
46
46
  * Exposed as a function (fresh schema objects per call) so tests can inspect
47
47
  * the specs without registering anything.
48
48
  */
@@ -174,10 +174,28 @@ export function librarianToolSpecs(): LibrarianToolSpec[] {
174
174
  limit: Type.Optional(Type.Integer({ minimum: 1, maximum: 100 })),
175
175
  }),
176
176
  },
177
+ {
178
+ name: "journal",
179
+ label: "Journal",
180
+ description:
181
+ "Read or search your journal: a dated history of your past conversations with the " +
182
+ "owner — recent days in detail, older weeks and months summarised. Your session may " +
183
+ "already include the last ~6 weeks. Use this for anything older, or to find what " +
184
+ "happened on a project or topic. Facts belong to `recall`; this is what happened and why.",
185
+ parameters: Type.Object({
186
+ query: Type.Optional(Type.String({ maxLength: 500 })),
187
+ from: Type.Optional(Type.String()),
188
+ to: Type.Optional(Type.String()),
189
+ project: Type.Optional(Type.String({ maxLength: 200 })),
190
+ harness: Type.Optional(Type.String({ maxLength: 50 })),
191
+ limit: Type.Optional(Type.Integer({ minimum: 1, maximum: 50 })),
192
+ max_tokens: Type.Optional(Type.Integer({ minimum: 1000, maximum: 40000 })),
193
+ }),
194
+ },
177
195
  ];
178
196
  }
179
197
 
180
- /** The 7 tool names this extension registers (for tests / smoke). */
198
+ /** The 8 tool names this extension registers (for tests / smoke). */
181
199
  export const LIBRARIAN_TOOL_NAMES = [
182
200
  "recall",
183
201
  "remember",
@@ -186,10 +204,11 @@ export const LIBRARIAN_TOOL_NAMES = [
186
204
  "list_handoffs",
187
205
  "claim_handoff",
188
206
  "search_references",
207
+ "journal",
189
208
  ] as const;
190
209
 
191
210
  /**
192
- * Register the 7 Librarian verbs as native Pi tools. Each is a thin proxy:
211
+ * Register the 8 Librarian verbs as native Pi tools. Each is a thin proxy:
193
212
  * forward to the remote MCP `tools/call`, return the server's prose. Failures
194
213
  * come back as an error STRING (never a throw): the model reads it, tells the
195
214
  * user, and keeps working — a Librarian outage must not break the turn.
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@the-librarian/pi-extension",
3
- "version": "1.33.7",
3
+ "version": "1.36.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
- "description": "Pi coding-agent package for The Librarian: the 7 memory/handoff tools + primer injection, backed by a remote Librarian MCP server.",
8
+ "description": "Pi coding-agent package for The Librarian: the 8 memory/handoff/journal tools + primer injection, backed by a remote Librarian MCP server.",
9
9
  "license": "Apache-2.0",
10
10
  "type": "module",
11
11
  "author": {