@narumitw/pi-goal 0.53.0 → 0.53.1

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
@@ -14,6 +14,7 @@ Goal mode adds explicit completion, blocker, and external-wait tools so managed
14
14
  - Tracks active, paused, blocked, usage-limited, budget-limited, waiting, and complete outcomes separately.
15
15
  - Pauses after a configurable response limit or repeated no-progress runs and offers a guided review before continuing.
16
16
  - Supports optional token budgets that stop Goal-owned work immediately when exhausted.
17
+ - Keeps Goal continuation accounting out of the leading system instructions so post-activation provider request prefixes remain stable.
17
18
  - Persists the goal in the current session across reload, resume, compatible forks, and compaction.
18
19
  - Rejects stale continuations and tool calls after replacement, pause, completion, limits, or other terminal state changes.
19
20
  - Optionally exposes a default-off run protocol for trusted sibling extensions to start, observe, and cancel one Goal lifecycle.
@@ -289,10 +290,17 @@ Legacy session entries are migrated by preserving their accumulated seconds and
289
290
 
290
291
  ## ✅ How completion works
291
292
 
292
- While a goal is active, `pi-goal` injects persistence rules, a `<goal_id>` stale-turn guard, and exposes `goal_complete`.
293
- Kickoff, resume, edited-objective, system, and automatic-continuation prompts all place a trust boundary before the escaped objective, identifying it as user-provided task data; they preserve its full scope across turns and require the agent to derive concrete requirements from the objective and referenced artifacts.
293
+ While a goal is active, Goal-owned messages carry persistence rules and a `<goal_id>` stale-turn guard, and pi-goal exposes `goal_complete`.
294
+ Kickoff, resume, edited-objective, wait-resume, and automatic-continuation prompts all place a trust boundary before the escaped objective, identifying it as user-provided task data; they preserve its full scope across turns and require the agent to derive concrete requirements from the objective and referenced artifacts.
294
295
  They treat the current worktree, command output, tests, runtime behavior, PR state, rendered artifacts, and external state as authoritative; previous conversation and plans are context rather than proof.
295
296
 
297
+ With the default `toolVisibility: "after-first-goal"`, the first accepted Goal activation intentionally reveals the three Goal tools and changes the tool-definition prefix once.
298
+ After that activation boundary, pi-goal does not change the base system instructions or ordered active tools merely for continuation, token accounting, or wait resume.
299
+ Current token-budget usage is carried by the newly appended Goal prompt instead of rewriting leading system instructions.
300
+ For every active Goal, one deterministic hidden Goal contract occupies a fixed leading boundary and excludes mutable token, iteration, and elapsed-time counters.
301
+ This contract follows leading summaries after compaction and also restores Goal instructions when persisted active state has no retained handoff.
302
+ These structural guarantees make provider prefix reuse possible, but the provider still decides cache eligibility, cache hits, pricing, and billing.
303
+
296
304
  Before completion, the shared audit tells the agent to treat completion as unproven, inspect requirement-by-requirement evidence for every named artifact, command, test, gate, invariant, and deliverable, and match each check's scope to the requirement it supports.
297
305
  Weak, indirect, missing, or merely consistent evidence means work must continue.
298
306
  This prompt wording is a behavioral guardrail, not proof by itself: `pi-goal` can enforce the current goal id and reject empty or plainly contradictory summaries, but it cannot independently prove that external work is complete.
@@ -482,6 +490,7 @@ packages/pi-goal/
482
490
  │ ├── commands.ts # Per-factory user-command controller
483
491
  │ ├── tools.ts # Goal completion and blocker tool adapters
484
492
  │ ├── lifecycle.ts # Pi session, agent, tool, and compaction event adapter
493
+ │ ├── goal-contract.ts # Deterministic post-compaction model contract
485
494
  │ ├── runtime.ts # Per-factory Goal state, transitions, prompts, and budgets
486
495
  │ ├── tool-policy.ts # Goal tool visibility ownership and rollback
487
496
  │ ├── safety.ts # Output normalization and no-progress fingerprint state
@@ -429,18 +429,18 @@ ${goalContextBlock(goal)}${budgetLine}
429
429
 
430
430
  ${goalModeRules("this goal")}`;
431
431
  }
432
- function buildGoalSystemPrompt(goal) {
433
- const budgetLine = goal.tokenBudget === void 0 ? "" : `
434
- - Respect the goal token budget (${formatBudget(goal)} used).`;
435
- return `Active /goal:
432
+ function buildGoalContextPrompt(goal) {
433
+ return `Active /goal context:
436
434
  ${goalContextBlock(goal)}
437
435
 
438
- ${goalModeRules("the active goal")}${budgetLine}`;
436
+ ${goalModeRules("the active goal")}`;
439
437
  }
440
438
  function buildContinuePrompt(goal, marker) {
439
+ const budgetLine = goal.tokenBudget === void 0 ? "" : `
440
+ Token budget: ${formatBudget(goal)} used.`;
441
441
  return `Continue the active /goal until it is complete:
442
442
 
443
- ${goalContextBlock(goal)}
443
+ ${goalContextBlock(goal)}${budgetLine}
444
444
 
445
445
  This is automatic continuation #${goal.iteration}. The full objective persists across turns; continue from the authoritative current state.
446
446
 
@@ -1892,7 +1892,7 @@ export {
1892
1892
  buildObjectiveUpdatedPrompt,
1893
1893
  buildResumePrompt,
1894
1894
  buildWaitingResumePrompt,
1895
- buildGoalSystemPrompt,
1895
+ buildGoalContextPrompt,
1896
1896
  queueGoalSafetyReset,
1897
1897
  resetGoalSafetyEpoch,
1898
1898
  hasAssistantToolCall,
@@ -1918,4 +1918,4 @@ export {
1918
1918
  isContradictoryCompletionSummary,
1919
1919
  goalIdRejectionReason
1920
1920
  };
1921
- //# sourceMappingURL=chunk-W7AFYZ6J.ts.map
1921
+ //# sourceMappingURL=chunk-4GOI2LMD.ts.map