@abhishek944/pi-firstmate 0.1.2 → 0.1.3

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
@@ -103,7 +103,7 @@ If delegation is unavailable or fails, the coordinator should report the concret
103
103
 
104
104
  ### Coordinator tool allowlist
105
105
 
106
- While coordinator mode is effective, the model can use only `read`, `grep`, `find`, `ls` and tools registered by an installed pi-tasks, pi-loop-monitor, pi-decisions, pi-herdr or pi-schedulers package. The extension derives that set from the packages' actual registrations, so their task, decision, monitor, loop and Agent tools keep their normal schemas and behavior; `MonitorCreate` is not argument-filtered. Other active tools are hidden from the model and re-filtered before each request, including direct tools registered during a multi-turn run such as a slow MCP connection. Direct or nested calls to them are rejected at Pi's `tool_call` boundary with an actionable delegation message, including nested calls made through codemode or another tool.
106
+ While coordinator mode is effective, the model can use `read`, `grep`, `find`, `ls`, `codemode`, selected Hindsight memory tools, and tools registered by an installed pi-tasks, pi-loop-monitor, pi-decisions, pi-herdr or pi-schedulers package. The extension derives that set from the packages' actual registrations, so their task, decision, monitor, loop and Agent tools keep their normal schemas and behavior; `MonitorCreate` is not argument-filtered. Other active tools are hidden from the model and re-filtered before each request, including direct tools registered during a multi-turn run such as a slow MCP connection. Direct or nested calls to them are rejected at Pi's `tool_call` boundary with an actionable delegation message, including nested calls made through codemode or another tool.
107
107
 
108
108
  Off mode, an explicit `--firstmate-worker` process and verified Core workers keep ordinary tools. `/firstmate off` and `/firstmate default` restore the active-tool set that existed before the restriction, without enabling unrelated inactive tools. The baseline is stored in existing session state under this session's identity, so turning the mode off after resuming a saved session restores the original set even when the restricted declarations were the last ones recorded. A fork does not inherit another session's baseline.
109
109
 
@@ -111,7 +111,7 @@ When pi-research (`/ask`) owns its read-only guard, First Mate keeps that restri
111
111
 
112
112
  This is Pi tool-call enforcement, not an OS sandbox. Allowed tools can still start or control processes, and permissions, trust, user authorization and `/ask` or `/btw` limits still apply. Do not describe it as absolute prevention through every allowed command or monitor.
113
113
 
114
- Shell, codemode and project-edit tools are intentionally unavailable to a coordinator; this is not a missing permission or a broken installation. A blocked call reports the restriction and points to checking the installed delegation backend, not to enabling the tool.
114
+ Shell and project-edit tools are intentionally unavailable to a coordinator, including through codemode. Codemode is for coordination, discovery and Hindsight memory; its Hindsight allowlist permits recall, retain, reflection and read-only discovery, not deletion or administration. Codemode's built-in `models` functions do not pass through the tool-call gate and are not blocked; they remain outside this restriction. A blocked tool call points to delegation, not to enabling the tool.
115
115
 
116
116
  ### Optional scheduler creation
117
117
 
package/dist/index.js CHANGED
@@ -98,6 +98,7 @@ export default function firstMateExtension(pi) {
98
98
  let savedActiveTools = null;
99
99
  let savedBaselineKey = null;
100
100
  let offRequestPrepared = false;
101
+ let coordinatorCodemodePending = false;
101
102
  let skillWarningKey = null;
102
103
  // Cached for the synchronous Ask release hook, which receives no context.
103
104
  let sessionCtx;
@@ -327,7 +328,10 @@ export default function firstMateExtension(pi) {
327
328
  // Record everything that is actually active before hiding it. This
328
329
  // includes direct tools registered and auto-activated during the run,
329
330
  // without adding tools that were never active.
330
- savedActiveTools = ordinaryTools(savedActiveTools === null ? active : [...new Set([...savedActiveTools, ...active])]);
331
+ // Codemode activated solely for coordinator use must not enter the saved baseline.
332
+ const baselineActive = savedActiveTools !== null && !savedActiveTools.includes("codemode")
333
+ ? active.filter((name) => name !== "codemode") : active;
334
+ savedActiveTools = ordinaryTools(savedActiveTools === null ? baselineActive : [...new Set([...savedActiveTools, ...baselineActive])]);
331
335
  saveToolBaseline(ctx, savedActiveTools);
332
336
  toolGate.hide();
333
337
  // Never widen ASK's read-only set. Only the owning scheduler can make
@@ -335,9 +339,14 @@ export default function firstMateExtension(pi) {
335
339
  if (coordinatorMode().effective && !askGuardActive()) {
336
340
  const available = pi.getAllTools().filter((tool) => coordinatorOnly.has(tool.name) && tool.exposure === "model-only");
337
341
  const current = pi.getActiveTools();
338
- const missing = available.filter((tool) => !current.includes(tool.name));
342
+ const missing = available.filter((tool) => !current.includes(tool.name)).map((tool) => tool.name);
343
+ if (!current.includes("codemode") && pi.getAllTools().some((tool) => tool.name === "codemode")) {
344
+ missing.push("codemode");
345
+ if (!savedActiveTools.includes("codemode"))
346
+ coordinatorCodemodePending = true;
347
+ }
339
348
  if (missing.length > 0)
340
- pi.setActiveTools([...current, ...missing.map((tool) => tool.name)]);
349
+ pi.setActiveTools([...current, ...missing]);
341
350
  }
342
351
  return;
343
352
  }
@@ -348,9 +357,10 @@ export default function firstMateExtension(pi) {
348
357
  // again after that guard restores its captured list.
349
358
  if (askGuardActive())
350
359
  return;
351
- const active = pi.getActiveTools();
360
+ const active = pi.getActiveTools().filter((name) => name !== "codemode" || !coordinatorCodemodePending);
361
+ coordinatorCodemodePending = false;
352
362
  const activeSet = new Set(active);
353
- if (savedActiveTools.some((name) => !activeSet.has(name))) {
363
+ if (savedActiveTools.some((name) => !activeSet.has(name)) || active.length !== pi.getActiveTools().length) {
354
364
  pi.setActiveTools([...new Set([...savedActiveTools, ...active])]);
355
365
  }
356
366
  }
@@ -663,6 +673,7 @@ export default function firstMateExtension(pi) {
663
673
  refreshConfig();
664
674
  refreshSessionState(ctx);
665
675
  worker = await classifyWorker();
676
+ coordinatorCodemodePending = resolveMode().effective && savedActiveTools !== null && !savedActiveTools.includes("codemode") && pi.getActiveTools().includes("codemode");
666
677
  loadPolicy();
667
678
  const mode = resolveMode();
668
679
  syncIndicator(ctx);
@@ -740,7 +751,7 @@ export default function firstMateExtension(pi) {
740
751
  const coordinatorOnly = toolGate.coordinatorOnlyNames();
741
752
  if (savedActiveTools !== null) {
742
753
  try {
743
- pi.setActiveTools([...new Set([...savedActiveTools, ...pi.getActiveTools()])].filter((name) => !coordinatorOnly.has(name)));
754
+ pi.setActiveTools([...new Set([...savedActiveTools, ...pi.getActiveTools()])].filter((name) => !coordinatorOnly.has(name) && (name !== "codemode" || !coordinatorCodemodePending)));
744
755
  }
745
756
  catch {
746
757
  // Shutdown cleanup is best-effort.
@@ -14,7 +14,7 @@
14
14
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
15
15
  /** Installed packages whose tools stay available to a coordinator. */
16
16
  export declare const APPROVED_PACKAGES: Set<string>;
17
- export declare const COORDINATOR_TOOLS_DESCRIPTION = "read, grep, find, ls and installed pi-tasks, pi-loop-monitor, pi-decisions, pi-herdr and coordinator-only pi-schedulers tools";
17
+ export declare const COORDINATOR_TOOLS_DESCRIPTION = "read, grep, find, ls, codemode, approved Hindsight memory tools and installed pi-tasks, pi-loop-monitor, pi-decisions, pi-herdr and coordinator-only pi-schedulers tools";
18
18
  type ToolHost = Pick<ExtensionAPI, "getActiveTools" | "getAllTools" | "setActiveTools">;
19
19
  export interface ToolGate {
20
20
  /** Actual installed registrations that must never enter the ordinary-tool baseline. */
package/dist/tool-gate.js CHANGED
@@ -13,7 +13,12 @@
13
13
  */
14
14
  import { readFileSync } from "node:fs";
15
15
  import { dirname, join } from "node:path";
16
- const INSPECTION_TOOLS = new Set(["read", "grep", "find", "ls"]);
16
+ const INSPECTION_TOOLS = new Set(["read", "grep", "find", "ls", "codemode"]);
17
+ const HINDSIGHT_TOOLS = new Set([
18
+ "retain", "sync_retain", "recall", "reflect", "list_memories", "get_memory",
19
+ "list_documents", "get_document", "list_operations", "get_operation", "list_tags", "get_bank",
20
+ "get_knowledge_base_tree", "search_knowledge_base", "get_knowledge_page",
21
+ ]);
17
22
  /** Installed packages whose tools stay available to a coordinator. */
18
23
  export const APPROVED_PACKAGES = new Set([
19
24
  "@abhishek944/pi-tasks",
@@ -23,7 +28,7 @@ export const APPROVED_PACKAGES = new Set([
23
28
  "@abhishek944/pi-schedulers",
24
29
  ]);
25
30
  const COORDINATOR_ONLY_PACKAGES = new Set(["@abhishek944/pi-schedulers"]);
26
- export const COORDINATOR_TOOLS_DESCRIPTION = "read, grep, find, ls and installed pi-tasks, pi-loop-monitor, pi-decisions, pi-herdr and coordinator-only pi-schedulers tools";
31
+ export const COORDINATOR_TOOLS_DESCRIPTION = "read, grep, find, ls, codemode, approved Hindsight memory tools and installed pi-tasks, pi-loop-monitor, pi-decisions, pi-herdr and coordinator-only pi-schedulers tools";
27
32
  function isRecord(value) {
28
33
  return typeof value === "object" && value !== null && !Array.isArray(value);
29
34
  }
@@ -73,6 +78,8 @@ export function createToolGate(pi) {
73
78
  for (const tool of pi.getAllTools()) {
74
79
  if (APPROVED_PACKAGES.has(sourcePackage(tool.sourceInfo) ?? ""))
75
80
  allowed.add(tool.name);
81
+ if (tool.namespace?.name === "mcp__hindsight" && tool.name.startsWith("mcp__hindsight__") && HINDSIGHT_TOOLS.has(tool.name.slice("mcp__hindsight__".length)))
82
+ allowed.add(tool.name);
76
83
  }
77
84
  return allowed;
78
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abhishek944/pi-firstmate",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Configurable coordinator-first mode and bundled First Mate skill for Pi.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -6,7 +6,7 @@ license: MIT
6
6
 
7
7
  # Close retrospective
8
8
 
9
- Run this when the coordinator asks for it, normally by sending `/close` after it has verified your result and decided you need nothing further. A close request that arrives after your assignment report supersedes an earlier assignment line that withheld the retrospective. It records what this session learned so later runs are faster and cleaner. It changes nothing.
9
+ Run this when the coordinator asks for it, normally after it has verified your result and decided you need nothing further. It uses `TaskWorkerClose` to request and verify `/close`; no separate human closeout approval is required. A close request that arrives after your assignment report supersedes an earlier assignment line that withheld the retrospective. It records what this session learned so later runs are faster and cleaner. It changes nothing.
10
10
 
11
11
  ## Record location
12
12
 
@@ -23,7 +23,7 @@ Project instructions, specialized skills, permissions, project trust, and `/ask`
23
23
 
24
24
  ## Keep in the main session
25
25
 
26
- - Conversation, clarifying questions, decisions, trade-off explanation and final reporting. Report at coherent milestones: lead with the outcome and decisive evidence, name the owner and exact next action, and skip repeated or unchanged progress notes. In a report with remaining work, state the exact next action, who owns it, and the user action needed, if any. State completion plainly when the outcome is fully complete. In every response, include at least one useful, clearly optional follow-up next step or piece of related work. Keep suggestions grounded in the actual state; do not imply that they are required, approved, or already started. When reporting completed research or review findings that imply downstream work, translate the findings into a short ordered action plan, naming the owner of each action, the smallest first step, and any user decision or live-verification dependency; label the plan as proposed and not started.
26
+ - Conversation, clarifying questions, decisions, trade-off explanation and final reporting. Report at coherent milestones: lead with the outcome and decisive evidence, name the owner and exact next action, and skip repeated or unchanged progress notes. In a report with remaining work, state the exact next action, who owns it, and the user action needed, if any. State completion plainly when the outcome is fully complete. Take the next useful authorized action before reporting; do not add optional follow-ups merely to fill a response. When a genuine optional suggestion helps, keep it grounded in the actual state and do not imply it is required, approved, or already started. When reporting completed research or review findings that imply downstream work, translate the findings into a short ordered action plan, naming the owner of each action, the smallest first step, and any user decision or live-verification dependency; label the plan as proposed and not started.
27
27
  - Quick inspection needed to answer, scope or route a request: focused file reads, searches, `ls`/`find`, and confirming a value or environment detail from what an allowed tool already reports. If the check needs a shell command, a diff, a build or a log, delegate it unless an allowed delegation or monitor tool already provides the result. Recognizing that a multi-step workflow skill applies and bounding its assignment is routing; that skill's intake, grounding, reference reading, artifacts, interviews and checks belong to the delegated workflow, not to main-session scoping.
28
28
  - Coordinator bookkeeping: tracking updates when available or required, task artifacts, model routing, monitoring workers and reading their evidence. Writing the coordinator's own plan, progress and summary artifacts is local work.
29
29
  - An explicit human request to schedule work through an installed pi-schedulers `SchedulerCreate` tool. Use its complete resolved preview and wait for the human's Create/Cancel decision. Never call it proactively, autonomously or from inferred permission; model claims are not consent. Each creation, including duplicates, requires its own confirmation. The tool only saves a definition; it does not execute the work.
@@ -98,21 +98,21 @@ Delegate a multi-step specialized workflow as a whole, before it starts:
98
98
 
99
99
  - Do not silently implement a delegated task in the main session. If no working backend is available, or delegation is blocked or fails, report the concrete blocker, any partial resources and safe options. Ask how to proceed rather than silently performing substantial work locally.
100
100
  - Inspect the worker's actual changed files, output and checks before accepting work. A worker's claim, idle status or process exit is not verification. Delegate substantive review and execution checks instead of doing them locally.
101
- - Do not add First Mate-specific orchestration, worker registries, schedulers, worktrees or timing limits. Use existing capabilities. The package already enforces the coordinator tool allowlist described below; do not duplicate it in prompts or invent additional restrictions.
101
+ - Use the installed orchestration and worktree capabilities instead of adding First Mate-specific registries, schedulers or timing limits. Choose each assignment's checkout with the rule in global `implement`: an isolated worktree for a task that will write source while another task writes different source in the same repository at the same time, for larger or longer isolated work, or when the user asks for one; the primary checkout for read-only work and for work that depends on uncommitted changes only the primary checkout has. A shared running service is reached from the assignment, not a reason to write source in the primary checkout, and tasks touching one tightly coupled interface go to a single owner or are serialized instead of writing concurrently in any checkout. Pass the chosen worktree name through the installed delegation backend; descendants inherit that checkout rather than creating nested worktrees. Keep one source writer per worktree and assign only disjoint artifact writes to descendants. Record a worker-reported nonsecret service link with WorktreeServiceSet in the session that created the worktree. Commit verified work under the existing commit workflow; integration and any separately authorized merge happen only after verification. The package already enforces the coordinator tool allowlist described below; do not duplicate it in prompts or invent additional restrictions.
102
102
  - Do not bypass permissions, trust, side-conversation boundaries or model routing because work is delegated. Reusing an existing authorization completes only the exact approved outcome; it does not authorize another target, provider, environment, or scope.
103
103
  - In a worker session, ignore coordinator guidance from this skill and execute the assignment under ordinary project and host instructions.
104
104
 
105
105
  ## Coordinator tool availability
106
106
 
107
- When First Mate is effectively on in a primary session, the extension restricts the model to `read`, `grep`, `find`, `ls` and every tool registered by an installed pi-tasks, pi-loop-monitor, pi-decisions, pi-herdr or pi-schedulers package. Other registered tools are removed from the model-facing set and re-filtered before each request, including tools registered during a multi-turn run, and direct or nested calls to them are rejected at Pi's `tool_call` boundary with a delegation explanation. The allowlist is derived from the packages' actual installed registrations, not from tool annotations, so their orchestration, tracking, decision and monitor tools stay usable unchanged. In particular, `MonitorCreate` keeps its normal arguments and behavior.
107
+ When First Mate is effectively on in a primary session, the extension permits `read`, `grep`, `find`, `ls`, `codemode`, selected Hindsight memory tools, and every tool registered by an installed pi-tasks, pi-loop-monitor, pi-decisions, pi-herdr or pi-schedulers package. Other registered tools are removed from the model-facing set and re-filtered before each request, including tools registered during a multi-turn run, and direct or nested calls to them are rejected at Pi's `tool_call` boundary with a delegation explanation. The allowlist is derived from the packages' actual installed registrations, not from tool annotations, so their orchestration, tracking, decision and monitor tools stay usable unchanged. In particular, `MonitorCreate` keeps its normal arguments and behavior.
108
108
 
109
109
  Scheduler creation is a coordinator-only optional capability. The scheduler package owns its registration, schema, confirmation and storage; First Mate controls only its exposure through the authoritative effective mode. Absent/off/suppressed First Mate keeps it hidden. Without UI, or after cancellation, abort or an effective-mode change while the confirmation is open, nothing is saved. It does not grant project trust/authentication or create a worktree during authoring. Scheduled workers keep normal configured tools/extensions/MCP with First Mate suppressed and cannot recursively use coordinator-only creation. Never route a scheduling request through a worker to bypass this human gate.
110
110
 
111
- ### Missing shell and codemode are intentional
111
+ ### Shell and project editing are intentionally unavailable
112
112
 
113
- `bash`, `edit`, `write` and `codemode` are intentionally unavailable to a coordinator; calls to them are blocked even though they work in ordinary sessions. This is the coordinator restriction, not a broken package, missing permission or configuration error. Do not ask the user to enable those tools, and do not try to bypass the allowlist with another tool.
113
+ `bash`, `edit` and `write` are intentionally unavailable to a coordinator, including nested calls. Use `codemode` for coordination, tool discovery, and Hindsight memory, not project execution. The Hindsight allowlist permits recall, retain, reflection and read-only discovery, not deletion or other administrative mutations. Codemode's built-in `models` functions are outside the tool-call gate and are not blocked; do not use them for project execution. This is not an OS sandbox and does not constrain the internals of allowed tools.
114
114
 
115
- When a shell or codemode call is blocked, treat it as a routing signal:
115
+ When a shell or project-edit call is blocked, treat it as a routing signal:
116
116
 
117
117
  1. Check that an authorized delegation backend is actually installed and ready—use `/firstmate status`, the backend's own status or list tools (with pi-herdr, its Agent tools), or its documented checks.
118
118
  2. Delegate the work through that backend.
package/src/index.ts CHANGED
@@ -132,6 +132,7 @@ export default function firstMateExtension(pi: ExtensionAPI): void {
132
132
  let savedActiveTools: string[] | null = null;
133
133
  let savedBaselineKey: string | null = null;
134
134
  let offRequestPrepared = false;
135
+ let coordinatorCodemodePending = false;
135
136
  let skillWarningKey: string | null = null;
136
137
  // Cached for the synchronous Ask release hook, which receives no context.
137
138
  let sessionCtx: ExtensionContext | undefined;
@@ -366,7 +367,10 @@ export default function firstMateExtension(pi: ExtensionAPI): void {
366
367
  // Record everything that is actually active before hiding it. This
367
368
  // includes direct tools registered and auto-activated during the run,
368
369
  // without adding tools that were never active.
369
- savedActiveTools = ordinaryTools(savedActiveTools === null ? active : [...new Set([...savedActiveTools, ...active])]);
370
+ // Codemode activated solely for coordinator use must not enter the saved baseline.
371
+ const baselineActive = savedActiveTools !== null && !savedActiveTools.includes("codemode")
372
+ ? active.filter((name) => name !== "codemode") : active;
373
+ savedActiveTools = ordinaryTools(savedActiveTools === null ? baselineActive : [...new Set([...savedActiveTools, ...baselineActive])]);
370
374
  saveToolBaseline(ctx, savedActiveTools);
371
375
  toolGate.hide();
372
376
  // Never widen ASK's read-only set. Only the owning scheduler can make
@@ -374,8 +378,12 @@ export default function firstMateExtension(pi: ExtensionAPI): void {
374
378
  if (coordinatorMode().effective && !askGuardActive()) {
375
379
  const available = pi.getAllTools().filter((tool) => coordinatorOnly.has(tool.name) && tool.exposure === "model-only");
376
380
  const current = pi.getActiveTools();
377
- const missing = available.filter((tool) => !current.includes(tool.name));
378
- if (missing.length > 0) pi.setActiveTools([...current, ...missing.map((tool) => tool.name)]);
381
+ const missing = available.filter((tool) => !current.includes(tool.name)).map((tool) => tool.name);
382
+ if (!current.includes("codemode") && pi.getAllTools().some((tool) => tool.name === "codemode")) {
383
+ missing.push("codemode");
384
+ if (!savedActiveTools.includes("codemode")) coordinatorCodemodePending = true;
385
+ }
386
+ if (missing.length > 0) pi.setActiveTools([...current, ...missing]);
379
387
  }
380
388
  return;
381
389
  }
@@ -386,9 +394,10 @@ export default function firstMateExtension(pi: ExtensionAPI): void {
386
394
  // again after that guard restores its captured list.
387
395
  if (askGuardActive()) return;
388
396
 
389
- const active = pi.getActiveTools();
397
+ const active = pi.getActiveTools().filter((name) => name !== "codemode" || !coordinatorCodemodePending);
398
+ coordinatorCodemodePending = false;
390
399
  const activeSet = new Set(active);
391
- if (savedActiveTools.some((name) => !activeSet.has(name))) {
400
+ if (savedActiveTools.some((name) => !activeSet.has(name)) || active.length !== pi.getActiveTools().length) {
392
401
  pi.setActiveTools([...new Set([...savedActiveTools, ...active])]);
393
402
  }
394
403
  }
@@ -743,6 +752,7 @@ export default function firstMateExtension(pi: ExtensionAPI): void {
743
752
  refreshConfig();
744
753
  refreshSessionState(ctx);
745
754
  worker = await classifyWorker();
755
+ coordinatorCodemodePending = resolveMode().effective && savedActiveTools !== null && !savedActiveTools.includes("codemode") && pi.getActiveTools().includes("codemode");
746
756
  loadPolicy();
747
757
 
748
758
  const mode = resolveMode();
@@ -849,7 +859,7 @@ export default function firstMateExtension(pi: ExtensionAPI): void {
849
859
  const coordinatorOnly = toolGate.coordinatorOnlyNames();
850
860
  if (savedActiveTools !== null) {
851
861
  try {
852
- pi.setActiveTools([...new Set([...savedActiveTools, ...pi.getActiveTools()])].filter((name) => !coordinatorOnly.has(name)));
862
+ pi.setActiveTools([...new Set([...savedActiveTools, ...pi.getActiveTools()])].filter((name) => !coordinatorOnly.has(name) && (name !== "codemode" || !coordinatorCodemodePending)));
853
863
  } catch {
854
864
  // Shutdown cleanup is best-effort.
855
865
  }
package/src/tool-gate.ts CHANGED
@@ -16,7 +16,12 @@ import { readFileSync } from "node:fs";
16
16
  import { dirname, join } from "node:path";
17
17
  import type { ExtensionAPI, SourceInfo } from "@earendil-works/pi-coding-agent";
18
18
 
19
- const INSPECTION_TOOLS = new Set(["read", "grep", "find", "ls"]);
19
+ const INSPECTION_TOOLS = new Set(["read", "grep", "find", "ls", "codemode"]);
20
+ const HINDSIGHT_TOOLS = new Set([
21
+ "retain", "sync_retain", "recall", "reflect", "list_memories", "get_memory",
22
+ "list_documents", "get_document", "list_operations", "get_operation", "list_tags", "get_bank",
23
+ "get_knowledge_base_tree", "search_knowledge_base", "get_knowledge_page",
24
+ ]);
20
25
 
21
26
  /** Installed packages whose tools stay available to a coordinator. */
22
27
  export const APPROVED_PACKAGES = new Set([
@@ -30,7 +35,7 @@ export const APPROVED_PACKAGES = new Set([
30
35
  const COORDINATOR_ONLY_PACKAGES = new Set(["@abhishek944/pi-schedulers"]);
31
36
 
32
37
  export const COORDINATOR_TOOLS_DESCRIPTION =
33
- "read, grep, find, ls and installed pi-tasks, pi-loop-monitor, pi-decisions, pi-herdr and coordinator-only pi-schedulers tools";
38
+ "read, grep, find, ls, codemode, approved Hindsight memory tools and installed pi-tasks, pi-loop-monitor, pi-decisions, pi-herdr and coordinator-only pi-schedulers tools";
34
39
 
35
40
  type ToolHost = Pick<ExtensionAPI, "getActiveTools" | "getAllTools" | "setActiveTools">;
36
41
 
@@ -92,6 +97,7 @@ export function createToolGate(pi: ToolHost): ToolGate {
92
97
  const allowed = new Set(INSPECTION_TOOLS);
93
98
  for (const tool of pi.getAllTools()) {
94
99
  if (APPROVED_PACKAGES.has(sourcePackage(tool.sourceInfo) ?? "")) allowed.add(tool.name);
100
+ if (tool.namespace?.name === "mcp__hindsight" && tool.name.startsWith("mcp__hindsight__") && HINDSIGHT_TOOLS.has(tool.name.slice("mcp__hindsight__".length))) allowed.add(tool.name);
95
101
  }
96
102
  return allowed;
97
103
  }