@quantmind-br/pi-goal-x 0.0.0-stage → 0.35.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/LICENSE +21 -0
- package/README.md +131 -2
- package/assets/badge-dark.svg +18 -0
- package/assets/badge-light.svg +18 -0
- package/docs/advanced-usage.md +106 -0
- package/docs/agent-flow-design.md +306 -0
- package/docs/agentic-runtime-prd.md +773 -0
- package/docs/architecture.md +368 -0
- package/docs/controls.md +140 -0
- package/docs/pi-autoresearch-survey.md +50 -0
- package/docs/pi-goal-x-unified-dashboard-plan.md +1667 -0
- package/docs/prompt-caching.md +31 -0
- package/docs/unified-dashboard.md +286 -0
- package/extensions/auditor-selector.ts +74 -0
- package/extensions/goal-accounting.ts +107 -0
- package/extensions/goal-activity.ts +202 -0
- package/extensions/goal-auditor.ts +480 -0
- package/extensions/goal-commands.ts +866 -0
- package/extensions/goal-compaction.ts +197 -0
- package/extensions/goal-completion.ts +173 -0
- package/extensions/goal-context.ts +12 -0
- package/extensions/goal-contract.ts +58 -0
- package/extensions/goal-controls.ts +202 -0
- package/extensions/goal-core-tools.ts +549 -0
- package/extensions/goal-core.ts +78 -0
- package/extensions/goal-detail.ts +65 -0
- package/extensions/goal-dialog-controls.ts +31 -0
- package/extensions/goal-draft.ts +244 -0
- package/extensions/goal-drafting.ts +535 -0
- package/extensions/goal-events.ts +692 -0
- package/extensions/goal-format.ts +376 -0
- package/extensions/goal-interruption.ts +53 -0
- package/extensions/goal-ledger-index.ts +68 -0
- package/extensions/goal-ledger.ts +1007 -0
- package/extensions/goal-live-retention.ts +239 -0
- package/extensions/goal-oracle.ts +346 -0
- package/extensions/goal-policy.ts +370 -0
- package/extensions/goal-pool.ts +103 -0
- package/extensions/goal-prompt-cache.ts +80 -0
- package/extensions/goal-questionnaire.ts +1073 -0
- package/extensions/goal-record.ts +388 -0
- package/extensions/goal-recovery.ts +256 -0
- package/extensions/goal-runtime.ts +277 -0
- package/extensions/goal-scheduler-state.ts +100 -0
- package/extensions/goal-scheduler.ts +436 -0
- package/extensions/goal-service.ts +843 -0
- package/extensions/goal-session-health.ts +130 -0
- package/extensions/goal-session-safety.ts +65 -0
- package/extensions/goal-settings.ts +1370 -0
- package/extensions/goal-state.ts +1069 -0
- package/extensions/goal-status.ts +305 -0
- package/extensions/goal-task-confirmation.ts +174 -0
- package/extensions/goal-task-count.ts +59 -0
- package/extensions/goal-task-derive.ts +46 -0
- package/extensions/goal-task-index.ts +57 -0
- package/extensions/goal-task-tools.ts +595 -0
- package/extensions/goal-tool-inputs.ts +102 -0
- package/extensions/goal-tool-names.ts +73 -0
- package/extensions/goal-tools.ts +16 -0
- package/extensions/goal-widget.ts +455 -0
- package/extensions/goal.ts +42 -0
- package/extensions/network-error-backoff.ts +55 -0
- package/extensions/prompts/goal-prompts.ts +330 -0
- package/extensions/storage/atomic-rename.ts +52 -0
- package/extensions/storage/goal-files.ts +695 -0
- package/extensions/storage/goal-lock.ts +131 -0
- package/extensions/storage/goal-root.ts +95 -0
- package/extensions/widgets/auditor-dashboard-model.ts +174 -0
- package/extensions/widgets/dialog-scaffold.ts +26 -0
- package/extensions/widgets/goal-controls-dialog.ts +329 -0
- package/extensions/widgets/goal-dashboard-model.ts +530 -0
- package/extensions/widgets/goal-dashboard-renderer.ts +674 -0
- package/extensions/widgets/goal-escape-dialog.ts +148 -0
- package/extensions/widgets/goal-notifications.ts +9 -0
- package/extensions/widgets/goal-widget.ts +723 -0
- package/extensions/widgets/task-list-overlay.ts +409 -0
- package/extensions/widgets/text-cache.ts +30 -0
- package/package.json +117 -4
- package/scripts/recover-session-checkpoints.mjs +289 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lucas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,132 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="pi-goal-x.png" alt="pi-goal-x logo" width="560">
|
|
3
|
+
</div>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<div align="center">
|
|
6
|
+
<a href="https://pi.dev/packages?type=extension" target="_blank" rel="noopener noreferrer">
|
|
7
|
+
<picture>
|
|
8
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/badge-dark.svg">
|
|
9
|
+
<img src="assets/badge-light.svg" alt="TOP 0.2% of Pi coding agent extensions: #5 of 3,477 by downloads · Oct 27, 2026 (best recorded rank)" width="480">
|
|
10
|
+
</picture>
|
|
11
|
+
</a>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
# pi-goal-x
|
|
15
|
+
|
|
16
|
+
Adds `/goal` functionality to [pi](https://pi.dev). The agent helps you define a goal and plan, continues working on it automatically, and submits the result to an optional independent completion auditor.
|
|
17
|
+
|
|
18
|
+
The extension saves goal objectives, tasks, and progress across sessions. You can pause, resume, revise, or switch goals as your work changes.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
This is the `@quantmind-br` fork of [pi-goal-x](https://github.com/tmonk/pi-goal-x). It keeps the goal tool profile fixed so provider prompt caches survive goal lifecycle changes; see `CHANGELOG.md`.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pi install npm:@quantmind-br/pi-goal-x
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Create a goal
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
/goal Add CSV export to the reports page, with documentation and tests.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The agent discusses the goal with you, asks focused questions where needed, and proposes an objective, task plan, and completion requirements. You review the proposal and choose whether to use the completion auditor. Once you confirm, the agent starts working and continues automatically while the goal is active.
|
|
35
|
+
|
|
36
|
+
You can specify completion requirements, such as passing the test suite or producing a report with every required section. The agent tracks tasks and subtasks, records evidence, and works toward those requirements. If it gets blocked and needs your input, you can resolve the issue and resume.
|
|
37
|
+
|
|
38
|
+
If you already have a complete objective, use `/goal-direct <objective>` to create the goal and start immediately without drafting.
|
|
39
|
+
|
|
40
|
+
## Goal types
|
|
41
|
+
|
|
42
|
+
| Type | Behaviour | Example uses |
|
|
43
|
+
| --- | --- | --- |
|
|
44
|
+
| **Regular** — `/goal` | An outcome to achieve, with the agent choosing and adapting the plan. | Features, debugging, research, and documentation. |
|
|
45
|
+
| **Sisyphus** — `/sisyphus` | An ordered plan that the agent follows one step at a time. | Migrations, staged refactors, and release procedures. |
|
|
46
|
+
|
|
47
|
+
For an ordered goal, you can provide the steps or define them with the agent:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
/sisyphus Migrate authentication in this order:
|
|
51
|
+
1. Add the new token validator.
|
|
52
|
+
2. Update login and session refresh to use it.
|
|
53
|
+
3. Remove the old validator.
|
|
54
|
+
4. Run the authentication tests.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Use `/sisyphus-direct <objective>` to start an ordered goal without drafting.
|
|
58
|
+
|
|
59
|
+
## Tasks and subtasks
|
|
60
|
+
|
|
61
|
+
The agent can divide a goal into tasks and subtasks, each describing part of the work required to complete it. During guided goal creation, you review the proposed plan before work begins.
|
|
62
|
+
|
|
63
|
+
For example, a CSV export goal could have this task plan:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
Add CSV export to reports
|
|
67
|
+
├─ Review the report data and active filters
|
|
68
|
+
├─ Implement CSV export
|
|
69
|
+
│ ├─ Generate the CSV from filtered results
|
|
70
|
+
│ └─ Add a download button
|
|
71
|
+
├─ Test the export
|
|
72
|
+
└─ Document how to use it
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
As work progresses, the agent marks the current task, records completed work, and explains any skipped tasks. The dashboard shows what is done and what remains, including progress within subtasks. Task progress is saved when you pause and remains available in later sessions.
|
|
76
|
+
|
|
77
|
+
Tasks can also have their own completion requirements—for example, “The download contains only rows matching the active filters.” The agent records evidence against those requirements, and the completion auditor uses that evidence when reviewing the overall result.
|
|
78
|
+
|
|
79
|
+
Use `/goal-tweak <change>` to discuss revisions to the goal and its plan. Task tracking, completion requirements, and subtask depth are configurable in `/goal-settings`.
|
|
80
|
+
|
|
81
|
+
## Completion auditor
|
|
82
|
+
|
|
83
|
+
When enabled, a separate agent reviews the work before the goal is accepted as complete. It checks the objective, tasks, recorded evidence, completion requirements, and workspace.
|
|
84
|
+
|
|
85
|
+
If the auditor approves, the goal is archived as complete. If it identifies unmet requirements, the goal remains open with feedback describing the work still needed. You can choose the auditor model in `/goal-settings` and toggle auditing for the focused goal with `Ctrl+Shift+A`.
|
|
86
|
+
|
|
87
|
+
## Progress and goal controls
|
|
88
|
+
|
|
89
|
+
The dashboard above the editor shows the goal's status, task progress, current task, elapsed time, and token usage. Press `Ctrl+Shift+T` to expand it for the full task tree, completion requirements, evidence, and recent activity. Audit progress and results appear there too.
|
|
90
|
+
|
|
91
|
+
A project can have several open goals, with one focused goal per session. Switch with `/goal-focus`, pause with `/goal-pause`, or use `/goal-tweak` to discuss changes to the current goal. Pressing `Esc` during active work also pauses the goal; in the expanded dashboard, it collapses the view.
|
|
92
|
+
|
|
93
|
+
## Commands
|
|
94
|
+
|
|
95
|
+
| Command | What it does |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| `/goal [idea]` | Discuss, plan, and confirm a regular goal. |
|
|
98
|
+
| `/sisyphus [idea]` | Discuss, plan, and confirm an ordered goal. |
|
|
99
|
+
| `/goal-direct <objective>` | Create and start a regular goal immediately. |
|
|
100
|
+
| `/sisyphus-direct <objective>` | Create and start an ordered goal immediately. |
|
|
101
|
+
| `/goal-list` | List open goals. |
|
|
102
|
+
| `/goal-status` | Show the focused goal and its progress. |
|
|
103
|
+
| `/goal-focus` | Choose an open goal to work on. |
|
|
104
|
+
| `/goal-unfocus` | Leave the current goal open without focusing on it. |
|
|
105
|
+
| `/goal-tweak <change>` | Revise the current goal with the agent. |
|
|
106
|
+
| `/goal-pause` | Pause work on the focused goal. |
|
|
107
|
+
| `/goal-resume` | Resume a paused or blocked goal. |
|
|
108
|
+
| `/goal-clear` | Archive the focused goal after confirmation. |
|
|
109
|
+
| `/goal-cancel` | Cancel an unconfirmed draft. |
|
|
110
|
+
| `/goal-settings` | Configure goal behaviour and the auditor. |
|
|
111
|
+
|
|
112
|
+
For troubleshooting, use `/goal-status verbose` for more detail, `/goal-status health` or `/goal-recovery` to check for problems, and `/goal-refresh` to reload saved goals and settings after external changes. `/goal-recovery repair` offers repairs after confirmation.
|
|
113
|
+
|
|
114
|
+
## Settings
|
|
115
|
+
|
|
116
|
+
Open `/goal-settings` to change these options. You can save defaults for all projects, override them for the current project, or remove an override to use the inherited value.
|
|
117
|
+
|
|
118
|
+
| Setting | What it controls |
|
|
119
|
+
| --- | --- |
|
|
120
|
+
| Explicit execution contracts (`strictExecutionContract`) | Opt-in ready/wait protocol with one missing-decision repair, then pause. Defaults to `false`: successful executions continue automatically. |
|
|
121
|
+
| Autonomous run allowance (`maxAutonomousRuns`) | Positive whole number of extension-started runs per creation or `/goal-resume` period. **Unset means unlimited; zero disables automatic continuation.** Settings edits change the limit without resetting usage. |
|
|
122
|
+
| Autonomous runs line (`showAutonomousRuns`) | Controls the `Autonomous runs: N/limit` line that appears for a finite allowance. Defaults to `true`. |
|
|
123
|
+
| Task tracking (`disableTasks`) | Turn task lists on or off. Set to `true` to disable them. |
|
|
124
|
+
| Subtask depth (`subtaskDepth`) | Limit how many levels of subtasks the agent can create. |
|
|
125
|
+
| Completion requirements (`disableContracts`) | Turn explicit goal and task completion requirements on or off. Set to `true` to disable them. |
|
|
126
|
+
| Unfocused reminder (`hideUnfocusedPrompt`) | When a session has no focused goal but open goals exist in the selected pool, the agent receives a `[PI GOAL UNFOCUSED]` reminder on every request. Set to `true` to stop that reminder. Defaults to `false`. This is independent of `hideUnfocusedBanner`, which hides only the unfocused widget and status hint. Neither setting selects or resumes a goal; the separate `autoSelectSingleGoal` setting still applies. |
|
|
127
|
+
| Auditor disabled | Turn off independent completion review. |
|
|
128
|
+
| Auditor provider, model, and thinking level | Choose which model reviews completed work and its reasoning effort. |
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
MIT
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="480" height="54" viewBox="0 0 480 54" role="img" aria-label="TOP 0.2% of Pi coding agent extensions: #5 of 3,477 by downloads · Oct 27, 2026 (best recorded rank)">
|
|
2
|
+
<!-- Dark mode -->
|
|
3
|
+
<style>
|
|
4
|
+
.frame { fill: #14181f; stroke: #2a3040; stroke-width: 1; }
|
|
5
|
+
.rank { font: 700 15px ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: 0.04em; fill: #d4a656; }
|
|
6
|
+
.label { font: 400 13px ui-monospace, 'SF Mono', Menlo, Consolas, monospace; fill: #e8e6df; }
|
|
7
|
+
.meta { font: 400 11px ui-monospace, 'SF Mono', Menlo, Consolas, monospace; fill: #7d8494; }
|
|
8
|
+
.divider { stroke: #2a3040; stroke-width: 1; }
|
|
9
|
+
.link { text-decoration: none; }
|
|
10
|
+
</style>
|
|
11
|
+
<a class="link" href="https://pi.dev/packages?type=extension" target="_blank" rel="noopener noreferrer">
|
|
12
|
+
<rect class="frame" x="0.5" y="0.5" width="479" height="53" rx="6"/>
|
|
13
|
+
<text class="rank" x="18" y="34">TOP 0.2%</text>
|
|
14
|
+
<line class="divider" x1="128" y1="13" x2="128" y2="41"/>
|
|
15
|
+
<text class="label" x="143" y="25">of Pi coding agent extensions</text>
|
|
16
|
+
<text class="meta" x="143" y="41">#5 of 3,477 by downloads · Oct 27, 2026</text>
|
|
17
|
+
</a>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="480" height="54" viewBox="0 0 480 54" role="img" aria-label="TOP 0.2% of Pi coding agent extensions: #5 of 3,477 by downloads · Oct 27, 2026 (best recorded rank)">
|
|
2
|
+
<!-- Light mode -->
|
|
3
|
+
<style>
|
|
4
|
+
.frame { fill: #f6f8fa; stroke: #d0d7de; stroke-width: 1; }
|
|
5
|
+
.rank { font: 700 15px ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: 0.04em; fill: #9a6700; }
|
|
6
|
+
.label { font: 400 13px ui-monospace, 'SF Mono', Menlo, Consolas, monospace; fill: #1f2328; }
|
|
7
|
+
.meta { font: 400 11px ui-monospace, 'SF Mono', Menlo, Consolas, monospace; fill: #59636e; }
|
|
8
|
+
.divider { stroke: #d0d7de; stroke-width: 1; }
|
|
9
|
+
.link { text-decoration: none; }
|
|
10
|
+
</style>
|
|
11
|
+
<a class="link" href="https://pi.dev/packages?type=extension" target="_blank" rel="noopener noreferrer">
|
|
12
|
+
<rect class="frame" x="0.5" y="0.5" width="479" height="53" rx="6"/>
|
|
13
|
+
<text class="rank" x="18" y="34">TOP 0.2%</text>
|
|
14
|
+
<line class="divider" x1="128" y1="13" x2="128" y2="41"/>
|
|
15
|
+
<text class="label" x="143" y="25">of Pi coding agent extensions</text>
|
|
16
|
+
<text class="meta" x="143" y="41">#5 of 3,477 by downloads · Oct 27, 2026</text>
|
|
17
|
+
</a>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Advanced usage
|
|
2
|
+
|
|
3
|
+
For installation, goal workflows, commands and the settings overview, see the [README](../README.md).
|
|
4
|
+
|
|
5
|
+
## Automatic continuation and optional execution contracts
|
|
6
|
+
|
|
7
|
+
Active goals continue automatically after successful executions, including reasoning-only responses and final-task verification. No tool call, task update, or scheduling declaration is required.
|
|
8
|
+
|
|
9
|
+
Default continuation is immediate. To slow repeated replies without recognized work, enable **slow repeated idle replies (opt-in)** under Advanced execution in `/goal-settings` (`idleContinuationBackoff: true`). Use the scope switch to choose a global default or a project override. An explicit project `false` overrides global `true`; removing the override restores inheritance.
|
|
10
|
+
|
|
11
|
+
When enabled, one execution without recognized work continues immediately. Further such executions wait 30, 60, 120, 240, then 300 seconds between attempts. Work observed anywhere in the execution or a change to the objective, requirements or tasks resets the delay. Goal inspection, echo-only calls, accounting and scheduling declarations alone do not reset it. This heuristic may delay reasoning or unfamiliar custom tools, and repeated recognized tool calls can bypass it. It reduces request rate; it does not guarantee progress or finite spending. Use a run allowance or token budget for a hard limit.
|
|
12
|
+
|
|
13
|
+
The delay survives reloads and shows a relative time, local clock time and resume command. Waiting spends no autonomous runs or active time. Turning the option off cancels a pending delay promptly without renewing spent runs or resuming a paused goal. Turning it on starts observing a subsequent execution, rather than classifying work retroactively. Old saved delay metadata has no effect without opt-in. `/goal-resume` renews the run allowance and continues now; incoming user/producer messages remain ordinary host work outside that allowance. Strict waits and provider-error recovery keep their separate timing.
|
|
14
|
+
|
|
15
|
+
Enable `strictExecutionContract: true` in `/goal-settings` or your global/project settings to require explicit ready/wait decisions. In that mode, a missing decision permits one repair prompt within the remaining allowance, then pauses. This is a user preference; agents should not enable it merely to continue.
|
|
16
|
+
|
|
17
|
+
Set an appropriate allowance in `/goal-settings`, or in `.pi/pi-goal-x-settings.json`:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{ "maxAutonomousRuns": 20 }
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The `Autonomous runs: used/limit` line reports a finite allowance and is left out when
|
|
24
|
+
allowance is unlimited. Set `showAutonomousRuns` to `false` to drop it for a finite
|
|
25
|
+
allowance as well; it defaults to `true`.
|
|
26
|
+
|
|
27
|
+
Agents may edit this setting. Changing it does not replenish consumed runs; explicit `/goal-resume` renews the period and continues now, including from a waiting goal. No configured allowance is required unless the effective limit is zero, which disables resume. Tool calls within a run are not separate runs. Existing token budgets still apply.
|
|
28
|
+
|
|
29
|
+
`showContextUsage` defaults to `false`. Set it to `true` to include context-window occupancy in new goal prompt snapshots. Accounting, budgets and automatic compaction continue normally. Existing snapshots remain historical.
|
|
30
|
+
|
|
31
|
+
Explicit `ready` is optional in default mode. A goal saved before next actions were
|
|
32
|
+
removed still loads, with its `nextAction` field stripped during normalization.
|
|
33
|
+
New `wait` declarations require strict mode; otherwise they return a non-terminating error. Previously saved waits retain their deadline, checks, and repair rules when upgrading or disabling strict mode, and may be re-declared with the same identity. Mode changes never resume a paused goal or renew consumed runs.
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
update_goal({ continuation: { kind: "ready" } })
|
|
37
|
+
update_goal({ continuation: {
|
|
38
|
+
kind: "wait", reason: "Await the remote build",
|
|
39
|
+
deadline: "2026-09-15T12:00:00Z",
|
|
40
|
+
polling: { interval_seconds: 60, max_checks: 3 }
|
|
41
|
+
} })
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Use a future deadline appropriate to the task. Omit `polling` for an event-only wait. Successful declarations terminate the execution segment. On a scheduled check, reuse the returned `wait_id` and original deadline, omitting `polling`; remaining checks cannot be reset. A ready decision ends the wait. Time spent waiting is not active execution time.
|
|
45
|
+
|
|
46
|
+
The dashboard, `/goal-status`, and `get_goal` show scheduling state, timing, checks, and allowance consumption. Expired waits and exhausted checks or allowance pause without another model call. Waits survive reopening the same session, without replaying missed checks; Pi must remain open for timers to execute. Another session requires explicit resume to take ownership. An ambiguous interrupted dispatch requires resume instead of automatic replay.
|
|
47
|
+
|
|
48
|
+
## Background producer integration
|
|
49
|
+
|
|
50
|
+
Budget-controlled producers emit a scheduler signal instead of starting their own model turn:
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
pi.events.emit("pi-goal:wake", { goalId, waitToken });
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`waitToken` is returned in the wait declaration's tool-result details. Register it before the producer completes, or retain the completion until registration (for example, observe the `update_goal` tool result in the host adapter). The token changes after consumption and re-declaration. A matching signal received before agent settlement is retained; duplicate, stale and wrong-goal tokens are ignored. A signal and timer can claim only one wake.
|
|
57
|
+
|
|
58
|
+
Existing producers that directly send `triggerTurn`/`followUp` messages still run as ordinary host work and supersede old pending decisions. Those independently started turns are **outside this extension's allowance**; use `pi-goal:wake` to put them through its spending gate. The allowance also does not limit Pi's own within-run tool loop or native retries. It bounds the goal extension's kickoff, continuation, check, signal, repair and recovery dispatches.
|
|
59
|
+
|
|
60
|
+
## Prompt caching
|
|
61
|
+
|
|
62
|
+
Goal state is refreshed at the request tail while the system prompt and conversation prefix stay stable. Pi retains control of provider cache settings. See [prompt caching](prompt-caching.md) for explicit-cache handling, validation, and cache invalidation boundaries.
|
|
63
|
+
|
|
64
|
+
## Changing a token budget
|
|
65
|
+
|
|
66
|
+
Use the existing tweak flow: `/goal-tweak remove the token budget` or `/goal-tweak set the token budget to 50000`. The proposal shows the current and proposed limits before confirmation. A budget is a total lifetime limit, not an additional allocation; consumed tokens and completed work are preserved. Omitting a budget change retains the current limit.
|
|
67
|
+
|
|
68
|
+
After confirmation, a goal stopped only by its budget can continue if the revised limit allows it and scheduling permits. A still-exhausted budget keeps it stopped. Other-session ownership, interrupted execution and exhausted autonomous-run allowances still require their existing recovery steps. Creation and tweak results always show the effective budget.
|
|
69
|
+
|
|
70
|
+
## Optional arguments on Responses-compatible providers
|
|
71
|
+
|
|
72
|
+
Some Pi `openai-responses` configurations omit the wire-level `strict` flag. OpenAI Responses may normalize schemas into strict mode when that flag is omitted. This can conflict with optional goal arguments; it is separate from pi-goal-x's `strictExecutionContract` scheduling setting.
|
|
73
|
+
|
|
74
|
+
For the reported OpenCode model, a narrowly scoped Pi `models.json` override makes the Pi adapter send `strict: false` for ordinary tools:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"providers": {
|
|
79
|
+
"opencode": {
|
|
80
|
+
"modelOverrides": {
|
|
81
|
+
"gpt-6-astra": { "compat": { "supportsStrictMode": true } }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The capability flag permits the adapter to send the explicit non-strict opt-out; it does not request strict sampling for ordinary goal tools. Merge this into existing model configuration and reload Pi. This is a provider-specific workaround, not a guarantee about third-party model behavior. The local reproduction inspects requests before transmission; the issue's live OpenCode A/B result has not been independently reproduced. See [issue #59](https://github.com/tmonk/pi-goal-x/issues/59) and [OpenAI's function-calling documentation](https://developers.openai.com/api/docs/guides/function-calling).
|
|
89
|
+
|
|
90
|
+
## Sharing a goal pool across worktrees
|
|
91
|
+
|
|
92
|
+
By default goals stay in `<cwd>/.pi/goals`. Set `goalsRoot` in your project or global settings to an absolute directory (or `~/path`), or set `PI_GOAL_ROOT` for the session. Precedence is environment, project, global, then the existing default. For example:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{ "goalsRoot": "~/work/project-goals" }
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Worktrees pointing to the same root share goals, archives, ledger and locks; focus remains session-local and execution ownership still requires explicit resume. The working directory for tools and audits is unchanged. Existing goals are not moved automatically. Reload/reopen the session after changing roots; `/goal-refresh` refreshes the selected pool. `/goal-status verbose` shows the effective location. Saved goal paths remain logical `.pi/goals/...` paths within that selected pool.
|
|
99
|
+
|
|
100
|
+
`hideUnfocusedPrompt: true` suppresses ordinary unfocused reminders to the model independently of `hideUnfocusedBanner`; neither changes focus or bypasses stale-checkpoint checks.
|
|
101
|
+
|
|
102
|
+
Token usage shown in the dashboard is cumulative across goal turns. The model receives a separate context snapshot when Pi can supply one; unavailable context is never reported as zero. Retained snapshots are bounded and newer snapshots supersede older ones.
|
|
103
|
+
|
|
104
|
+
## Diagnostics and recovery
|
|
105
|
+
|
|
106
|
+
Use `/goal-status verbose` for effective settings and storage location, `/goal-status health` or `/goal-recovery` to check for problems, and `/goal-refresh` to reload saved goals and settings after external changes. `/goal-recovery repair` offers repairs after confirmation.
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
# pi-goal Agent Flow Design
|
|
2
|
+
|
|
3
|
+
This document explains the agent flow of the `pi-goal` project: how the user
|
|
4
|
+
states an objective, how the executing agent works, how the independent
|
|
5
|
+
auditor verifies, and how the runtime maintains state, the ledger, the UI, and
|
|
6
|
+
auto-continuation.
|
|
7
|
+
|
|
8
|
+
## 1. Core mental model
|
|
9
|
+
|
|
10
|
+
`pi-goal` is not another general-purpose agent; it is a pi extension. It adds a
|
|
11
|
+
"long-running goal runtime" layer on top of the main coding agent: goals are
|
|
12
|
+
created explicitly, go through a lifecycle, and completion is independently
|
|
13
|
+
audited.
|
|
14
|
+
|
|
15
|
+
The system has four roles:
|
|
16
|
+
|
|
17
|
+
| Role | Responsibility |
|
|
18
|
+
|---|---|
|
|
19
|
+
| User | Owns intent. Starts goals, pauses/resumes/clears them, chooses focus. |
|
|
20
|
+
| Executing agent | Works on the confirmed focused goal. Reports terminal outcomes via `update_goal`. |
|
|
21
|
+
| Auditor agent | An independent in-memory pi agent session that checks whether a completion claim actually satisfies the goal. |
|
|
22
|
+
| `pi-goal` runtime | Maintains goal state, the tool surface, prompts, the ledger, the UI widget, and auto-continuation. |
|
|
23
|
+
|
|
24
|
+
Core principle:
|
|
25
|
+
|
|
26
|
+
> The user owns intent; the executing agent does the work; the auditor
|
|
27
|
+
> independently verifies; the runtime coordinates and records.
|
|
28
|
+
|
|
29
|
+
## 2. Overall flow
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
User command
|
|
33
|
+
-> pi-goal command handler (/goal, /sisyphus, /goal-*)
|
|
34
|
+
-> guided draft and explicit confirmation, direct creation, or focus/lifecycle state update
|
|
35
|
+
-> runtime reconciles from disk, re-computes prompts and the active tool subset
|
|
36
|
+
-> executing agent works on the focused goal
|
|
37
|
+
-> tool call / turn events update accounting and the ledger
|
|
38
|
+
-> update_goal(complete) triggers the independent auditor
|
|
39
|
+
-> approved -> goal archived at turn_end; rejected -> goal stays open
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Five model tools are registered:
|
|
43
|
+
|
|
44
|
+
| Tool | Role |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `create_goal` | Create and focus a new goal after an explicit user request |
|
|
47
|
+
| `get_goal` | Read-only snapshot of the focused goal |
|
|
48
|
+
| `update_goal` | Terminal outcomes: `complete` (audited) or `blocked` (three-turn rule) |
|
|
49
|
+
| `set_goal_tasks` | Define/replace the task tree (with confirmation) |
|
|
50
|
+
| `update_goal_task` | Per-task status updates without stopping the turn |
|
|
51
|
+
|
|
52
|
+
Lifecycle actions the model does not own (pause, resume, clear, focus, tweak,
|
|
53
|
+
settings) are user-owned slash commands.
|
|
54
|
+
|
|
55
|
+
## 3. Main state containers
|
|
56
|
+
|
|
57
|
+
The runtime keeps:
|
|
58
|
+
|
|
59
|
+
- a goal pool `goalsById: Map<goalId, GoalRecord>` reconstructed from
|
|
60
|
+
`.pi/goals/active_goal_*.md` plus compatible legacy session entries;
|
|
61
|
+
- a session focus `focusedGoalId` reconstructed from branch-local
|
|
62
|
+
`pi-goal-focus` custom session entries;
|
|
63
|
+
- `focusRevision` — incremented on every focus change, used to invalidate
|
|
64
|
+
pending async operations (completion, task-list confirmation) so results
|
|
65
|
+
cannot mutate a goal after the session detached from it.
|
|
66
|
+
|
|
67
|
+
## 4. Persistence: goal files and ledger
|
|
68
|
+
|
|
69
|
+
### 4.1 Goal files
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
.pi/goals/active_goal_<timestamp>_<id>.md
|
|
73
|
+
.pi/goals/archived/goal_<timestamp>_<id>.md
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Each file has extension-owned metadata and a user-editable `# Goal Prompt`
|
|
77
|
+
section. Before focused commands, tools, and lifecycle hooks act, the runtime
|
|
78
|
+
re-reads the focused active file and reconciles lifecycle state from disk, so
|
|
79
|
+
external changes win over stale memory. Session focus is never written into
|
|
80
|
+
these files.
|
|
81
|
+
|
|
82
|
+
### 4.2 Ledger files
|
|
83
|
+
|
|
84
|
+
The ledger is one project-level append-only JSONL file
|
|
85
|
+
(`.pi/goals/goal_events.jsonl`). Its 18 event types cover creation,
|
|
86
|
+
tweaks, focus changes, pause/resume/block/clear, completion requests, audit
|
|
87
|
+
start/result/skip, budget limits, and task-list changes. The runtime reads it
|
|
88
|
+
for auditor-rejection memory and compaction summaries; it is never rewritten
|
|
89
|
+
in place.
|
|
90
|
+
|
|
91
|
+
## 5. Command palette: the user owns intent
|
|
92
|
+
|
|
93
|
+
The curated fourteen-command palette:
|
|
94
|
+
|
|
95
|
+
| Command | Behavior |
|
|
96
|
+
|---|---|
|
|
97
|
+
| `/goal [seed]` | Guided regular-goal drafting, questionnaire where useful, then explicit confirmation |
|
|
98
|
+
| `/sisyphus [seed]` | Guided Sisyphus drafting with ordered-work constraints and explicit confirmation |
|
|
99
|
+
| `/goal-direct <objective>` | Direct regular-goal creation without drafting |
|
|
100
|
+
| `/sisyphus-direct <objective>` | Direct Sisyphus creation without drafting |
|
|
101
|
+
| `/goal-list` | List all open goals and the current focus |
|
|
102
|
+
| `/goal-status` | Read-only focused-goal summary plus other-open-goal count; append `verbose` for diagnostics or `health` for storage/runtime checks |
|
|
103
|
+
| `/goal-focus` | Choose this session's focused goal |
|
|
104
|
+
| `/goal-unfocus` | Detach the session without modifying the shared goal |
|
|
105
|
+
| `/goal-settings` | Fully operable settings editor for all eight persisted fields |
|
|
106
|
+
| `/goal-tweak <change>` | Guided, user-confirmed refinement of the focused objective and task plan |
|
|
107
|
+
| `/goal-clear` | Archive the focused goal after confirmation (cancel is a durable no-op) |
|
|
108
|
+
| `/goal-cancel` | Cancel the in-progress guided draft without creating a goal |
|
|
109
|
+
| `/goal-pause` | Pause the focused active goal (Esc also pauses) |
|
|
110
|
+
| `/goal-resume` | Resume a paused or blocked goal |
|
|
111
|
+
|
|
112
|
+
## 6. Goal creation flow
|
|
113
|
+
|
|
114
|
+
`/goal [seed]` and `/sisyphus [seed]` start a guided draft without changing advertised tools.
|
|
115
|
+
The agent can ask questions, select a questionnaire when it adds value, and
|
|
116
|
+
propose both a full objective and a task tree in a single confirmation dialog.
|
|
117
|
+
Confirm creates and focuses the goal atomically; Continue Chatting retains the
|
|
118
|
+
draft. `/goal-direct` and `/sisyphus-direct` are the explicit immediate paths.
|
|
119
|
+
|
|
120
|
+
## 7. Tool surface and runtime gates
|
|
121
|
+
|
|
122
|
+
The tool surface is fixed across execution and guided drafting:
|
|
123
|
+
|
|
124
|
+
- five execution tools are advertised when tasks are enabled — `create_goal`,
|
|
125
|
+
`get_goal`, `update_goal`, `set_goal_tasks`, `update_goal_task`;
|
|
126
|
+
- only the three core execution tools when tasks are disabled;
|
|
127
|
+
- `goal_question`, `goal_questionnaire`, and `propose_goal_draft` stay advertised
|
|
128
|
+
in both profiles, but reject calls without an active user-started draft;
|
|
129
|
+
- profile installation is idempotent; only an explicit `disableTasks` change
|
|
130
|
+
alters the tool set. Focus, status, budget, completion, audit, drafting, and
|
|
131
|
+
compaction transitions never change it;
|
|
132
|
+
- ordinary pi work tools (`read`, `write`, `edit`, `bash`, ...) are never
|
|
133
|
+
touched by the extension;
|
|
134
|
+
- invalid lifecycle calls are rejected by the executor with a concise
|
|
135
|
+
state-aware result (e.g. `update_goal(blocked)` from a paused goal), not by
|
|
136
|
+
hiding tools.
|
|
137
|
+
|
|
138
|
+
The `tool_call` interceptor:
|
|
139
|
+
|
|
140
|
+
- blocks all five execution goal tools during an active draft, and for the rest
|
|
141
|
+
of a turn whose proposal confirmed or cancelled the draft, preserving the
|
|
142
|
+
confirmation boundary without changing tool declarations;
|
|
143
|
+
- blocks work tools after a stop tool has fired in the same turn (post-stop
|
|
144
|
+
guard);
|
|
145
|
+
- blocks work tools when the checkpoint that triggered the turn is no longer
|
|
146
|
+
actionable (stale checkpoint guard);
|
|
147
|
+
- tracks whether the turn did meaningful goal work (the empty-turn gate for
|
|
148
|
+
auto-continuation).
|
|
149
|
+
|
|
150
|
+
## 8. Execution loop and auto-continue
|
|
151
|
+
|
|
152
|
+
When `autoContinue` is on, the extension queues continuation prompts after
|
|
153
|
+
agent turns for the focused goal only. The loop stops or pauses when:
|
|
154
|
+
|
|
155
|
+
- the agent calls `update_goal(status="complete")`;
|
|
156
|
+
- the agent calls `update_goal(status="blocked")`;
|
|
157
|
+
- the user invokes `/goal-pause`, `/goal-clear`, or the user aborts the turn;
|
|
158
|
+
- a turn ends without meaningful goal-work tool activity.
|
|
159
|
+
|
|
160
|
+
Continuation prompts include a goal id so stale prompts can be detected and
|
|
161
|
+
neutralized. If focus changes or the goal is archived before a queued
|
|
162
|
+
checkpoint runs, the checkpoint becomes stale and cannot drive task work.
|
|
163
|
+
|
|
164
|
+
## 9. Completion and the visible audit phases
|
|
165
|
+
|
|
166
|
+
### 9.1 The executing agent requests completion
|
|
167
|
+
|
|
168
|
+
`update_goal({status: "complete"})` has no verification-summary parameter. The
|
|
169
|
+
runtime validates that the goal is in a completable status, optionally warns
|
|
170
|
+
about pending tasks (`blockCompletion`), appends a `completion_requested`
|
|
171
|
+
ledger event, and starts the auditor. When `settings.disabled` is true the
|
|
172
|
+
auditor is skipped immediately: the flow records `audit_skipped` and completes
|
|
173
|
+
through the normal deferred-completion path. Legacy persisted
|
|
174
|
+
`skipAuditor: true` records are honored the same way; Escape during a running
|
|
175
|
+
audit remains the explicit per-attempt user bypass.
|
|
176
|
+
|
|
177
|
+
### 9.2 The audit appears in the conversation
|
|
178
|
+
|
|
179
|
+
A `[GOAL AUDIT STARTED]`-style message is sent with `triggerTurn`, so the
|
|
180
|
+
executing agent's turn yields to the auditor. A `pi-goal-audit-event` message
|
|
181
|
+
with phase `started` is displayed, and the goal widget shows an audit progress
|
|
182
|
+
spinner. Escape during the audit opens a dialog to complete without audit or
|
|
183
|
+
continue working.
|
|
184
|
+
|
|
185
|
+
### 9.3 The independent auditor session
|
|
186
|
+
|
|
187
|
+
A separate in-memory pi session runs with a focused auditor prompt. The
|
|
188
|
+
auditor receives the objective, the executor's completion claim, and goal
|
|
189
|
+
metadata; it can inspect the workspace with `read`, `grep`, `find`, `ls`, and
|
|
190
|
+
`bash`; and it must end with exactly one marker: `<approved/>` or
|
|
191
|
+
`<disapproved/>` (an error or abort also rejects).
|
|
192
|
+
|
|
193
|
+
### 9.4 The audit result appears in the conversation
|
|
194
|
+
|
|
195
|
+
The result is sent as a `pi-goal-audit-event` with phase `approved` or
|
|
196
|
+
`rejected`, and an `audit_result` ledger event records the verdict. A rejected
|
|
197
|
+
completion leaves the goal open and the verdict is remembered so future
|
|
198
|
+
prompts inject the auditor's objections.
|
|
199
|
+
|
|
200
|
+
### 9.5 Archiving
|
|
201
|
+
|
|
202
|
+
On approval, the goal is set complete in memory and the active file is written
|
|
203
|
+
without archiving; archival is deferred to `turn_end` so the agent can see the
|
|
204
|
+
auditor result first. At `turn_end` the goal is archived, a `goal_completed`
|
|
205
|
+
ledger event is appended, and the session focus is cleared.
|
|
206
|
+
|
|
207
|
+
## 10. Blocked, pause, and post-stop behavior
|
|
208
|
+
|
|
209
|
+
- `update_goal({status: "blocked"})` records a distinct `blocked` status with
|
|
210
|
+
an agent stop reason and stops continuation. The three-consecutive-turn
|
|
211
|
+
blocker rule is prompt policy, not a persisted counter.
|
|
212
|
+
- `/goal-pause` and Esc set `paused` (user-owned) with `autoContinue: false`.
|
|
213
|
+
- `/goal-resume` reactivates a paused or blocked goal.
|
|
214
|
+
- After any stop tool fires in a turn, subsequent tool calls in the same turn
|
|
215
|
+
are blocked except read-only inspection.
|
|
216
|
+
|
|
217
|
+
## 11. Compaction and auditor-rejection memory
|
|
218
|
+
|
|
219
|
+
On session compaction the runtime persists the current goal, re-arms
|
|
220
|
+
accounting, and arms a deterministic post-compaction summary for the next
|
|
221
|
+
agent turn. Auditor rejections are read from the ledger and injected into
|
|
222
|
+
future prompts so the agent addresses them before requesting completion again.
|
|
223
|
+
|
|
224
|
+
## 12. Token budgets
|
|
225
|
+
|
|
226
|
+
An optional `token_budget` may be set at creation. When accounted usage
|
|
227
|
+
reaches the budget, the goal transitions to a distinct `budget_limited` status
|
|
228
|
+
exactly once, a `goal_budget_limited` ledger event is emitted, one-time
|
|
229
|
+
wrap-up steering is injected (summarize; do not start new substantive work; do
|
|
230
|
+
not claim completion unless real), and pending continuations are cancelled.
|
|
231
|
+
`budget_limited` never implies completion.
|
|
232
|
+
|
|
233
|
+
## 13. Module map
|
|
234
|
+
|
|
235
|
+
```text
|
|
236
|
+
goal.ts (thin installer)
|
|
237
|
+
├─ goal-state.ts GoalCore: state + service/runtime/accounting wiring
|
|
238
|
+
├─ goal-tools.ts registration composition only
|
|
239
|
+
├─ goal-core-tools.ts create/get/update handlers + blocked and agent-pause flows
|
|
240
|
+
├─ goal-completion.ts audit orchestration + completion commit
|
|
241
|
+
├─ goal-task-tools.ts task structure/status handlers + tree helpers
|
|
242
|
+
├─ goal-task-confirmation.ts task result boundary with neutral labels
|
|
243
|
+
├─ goal-draft.ts drafting prompt/confirmation text helpers
|
|
244
|
+
├─ goal-drafting.ts guided drafting orchestration + durable draft sessions
|
|
245
|
+
├─ goal-commands.ts fourteen-command palette
|
|
246
|
+
├─ goal-events.ts 13 lifecycle event handlers
|
|
247
|
+
├─ goal-widget.ts terminal keybindings + debug helpers
|
|
248
|
+
├─ goal-format.ts pure formatting/message helpers
|
|
249
|
+
├─ goal-service.ts sole mutation boundary
|
|
250
|
+
├─ goal-runtime.ts continuation/stale-checkpoint/turn-stop
|
|
251
|
+
├─ goal-accounting.ts serialized accounting + budgets
|
|
252
|
+
├─ goal-policy.ts lifecycle/task validation + reports
|
|
253
|
+
├─ goal-auditor.ts independent audit session
|
|
254
|
+
├─ goal-ledger.ts ledger reads
|
|
255
|
+
├─ goal-record.ts record types/creation/migration
|
|
256
|
+
├─ goal-pool.ts pool/focus helpers
|
|
257
|
+
├─ prompts/ bounded five-tool steering prompts
|
|
258
|
+
├─ storage/ goal file IO (reads + serializers)
|
|
259
|
+
└─ widgets/ goal widget, notifications, escape dialog, task overlay
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## 14. Key design trade-offs
|
|
263
|
+
|
|
264
|
+
- **Five tools, user-owned lifecycle.** A small stable surface is easier to
|
|
265
|
+
prompt-bound than a large phase-dependent one; lifecycle actions are user
|
|
266
|
+
commands so the model cannot pause/resume/clear on its own.
|
|
267
|
+
- **GoalService as the sole mutation boundary.** Ordering (reconcile → write →
|
|
268
|
+
ledger → memory) is enforced in one place; handlers cannot corrupt files or
|
|
269
|
+
ledger state.
|
|
270
|
+
- **Auditor from actual evidence, not paperwork.** Removing the
|
|
271
|
+
verification-summary field pushes the auditor to inspect real artifacts,
|
|
272
|
+
which is a stronger completion gate.
|
|
273
|
+
- **Budget exhaustion is a system transition, not completion.** The
|
|
274
|
+
`budget_limited` status stops continuation and arms wrap-up steering without
|
|
275
|
+
implying the goal is done.
|
|
276
|
+
- **Disk is authoritative at operation start.** Reconciliation before each
|
|
277
|
+
focused action picks up prior external edits and prevents deleted files from
|
|
278
|
+
being resurrected.
|
|
279
|
+
- **Cross-process mutations are serialized.** Each goal carries a persisted
|
|
280
|
+
monotonic `revision` (missing historical values normalize to zero). A
|
|
281
|
+
short per-goal filesystem lock (atomic create under `.pi/goals/.locks` with
|
|
282
|
+
bounded acquisition and stale-lock recovery) guards reads, and
|
|
283
|
+
`GoalService.apply` re-reads the authoritative file under the lock: a stale
|
|
284
|
+
writer receives a typed conflict carrying the current revision instead of
|
|
285
|
+
overwriting blindly. `update_goal_task` retries once only when the same task
|
|
286
|
+
and status/structure remain unchanged; `set_goal_tasks` surfaces the typed
|
|
287
|
+
conflict. Old readers keep existing data readable.
|
|
288
|
+
|
|
289
|
+
## 15. Hardening and runtime follow-up
|
|
290
|
+
|
|
291
|
+
This document describes the shipped behavior. The 2026-08-04 hardening plan
|
|
292
|
+
([`specs/2026-08-04-goal-simplification-hardening`](../specs/2026-08-04-goal-simplification-hardening/TECH.md))
|
|
293
|
+
is implemented: it addresses paused-record resurrection, operation-start
|
|
294
|
+
task reconciliation, task-confirmation auditor-state coupling, budget
|
|
295
|
+
validation, ledger semantics, the primary legacy runtime surface, and the
|
|
296
|
+
E2E/experiment migration.
|
|
297
|
+
|
|
298
|
+
The runtime follow-up
|
|
299
|
+
([`2026-08-04 goal runtime follow-up`](../specs/2026-08-04-goal-runtime-follow-up/TECH.md))
|
|
300
|
+
then shipped the remaining work: guided drafting restored as a transient
|
|
301
|
+
user-invoked workflow (durable draft sessions, `/goal-cancel`, `/goal-status`,
|
|
302
|
+
per-draft auditor selection), a fully operable settings menu, `/goal-clear`
|
|
303
|
+
confirmation, neutral task-confirmation labels, failure-checked completion
|
|
304
|
+
commits, per-goal revision/lock serialization with typed conflicts, the
|
|
305
|
+
agent-pause outcome, untrusted `completion_summary` claims, the enforced
|
|
306
|
+
experiment matrix, the runner self-check, and the Pi SDK 1.0 family upgrade.
|