pi-goal 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.
@@ -137,10 +137,23 @@ function updateStatusBar(ctx: ExtensionContext) {
137
137
  ctx.ui.setStatus(CUSTOM_TYPE, statusBarEnabled ? statusLine(goal) ?? "" : "");
138
138
  }
139
139
 
140
+ const GOAL_TOOL_NAMES = ["get_goal", "update_goal"];
141
+
142
+ // Expose goal tools to the LLM only while a goal is actively being pursued.
143
+ // When no goal exists (or it is paused / complete / budget-limited), keep them
144
+ // hidden so unrelated sessions are not tempted to call them every turn.
145
+ function syncGoalTools(pi: ExtensionAPI) {
146
+ const want = goal?.status === "active";
147
+ const active = new Set(pi.getActiveTools());
148
+ for (const name of GOAL_TOOL_NAMES) (want ? active.add(name) : active.delete(name));
149
+ pi.setActiveTools(Array.from(active));
150
+ }
151
+
140
152
  function persist(pi: ExtensionAPI, ctx: ExtensionContext, next: GoalState | null) {
141
153
  goal = next;
142
154
  pi.appendEntry(CUSTOM_TYPE, { goal: next, statusBarEnabled });
143
155
  updateStatusBar(ctx);
156
+ syncGoalTools(pi);
144
157
  }
145
158
 
146
159
  function persistSettings(pi: ExtensionAPI, ctx: ExtensionContext) {
@@ -247,7 +260,10 @@ export default function piGoal(pi: ExtensionAPI) {
247
260
  name: "get_goal",
248
261
  label: "Get Goal",
249
262
  description: "Read the current active thread goal, if one exists.",
250
- promptSnippet: "Read the current thread goal and budget state",
263
+ promptSnippet: "Read the current pi-goal objective and remaining budget while pursuing it",
264
+ promptGuidelines: [
265
+ "Only call get_goal when you actually need the current objective or remaining budget; the continuation prompt already injects them.",
266
+ ],
251
267
  parameters: {
252
268
  type: "object",
253
269
  properties: {},
@@ -383,6 +399,8 @@ export default function piGoal(pi: ExtensionAPI) {
383
399
  pendingControlPrompt = null;
384
400
  continuationQueued = false;
385
401
  activeTurnStartedAt = null;
402
+ // Hide goal tools from the LLM unless we have an active goal to pursue.
403
+ syncGoalTools(pi);
386
404
  if (goal?.status === "active" && event.reason === "reload") {
387
405
  goal = { ...goal, status: "paused", updatedAt: Date.now() };
388
406
  persist(pi, ctx, goal);
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # pi-goal
2
2
 
3
+ ![pi-goal](docs/assets/pi-goal-poster.png)
4
+
3
5
  Persistent autonomous goals for [pi](https://github.com/badlogic/pi-mono).
4
6
 
5
7
  `pi-goal` adds a `/goal` command and goal tools so Pi can keep working toward a long-running objective until the goal is complete, paused, cleared, or token-budget-limited.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-goal",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Persistent autonomous goals for pi — /goal loops until complete, paused, or budget-limited",
5
5
  "type": "commonjs",
6
6
  "keywords": [