@zihanw/pi-forge 0.5.4 → 0.5.6
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/CHANGELOG.md +83 -0
- package/README.md +67 -103
- package/README.zh-CN.md +67 -95
- package/assets/pi-forge-header-concept-1.png +0 -0
- package/assets/readme/PROVENANCE.md +95 -0
- package/assets/readme/en/capability-tools.gif +0 -0
- package/assets/readme/en/context-composition.gif +0 -0
- package/assets/readme/en/context-toggle.gif +0 -0
- package/assets/readme/en/draft-diff.png +0 -0
- package/assets/readme/en/edit-draft-diff.gif +0 -0
- package/assets/readme/en/editor-overview-v3.png +0 -0
- package/assets/readme/en/editor-overview.png +0 -0
- package/assets/readme/en/mode-tools.gif +0 -0
- package/assets/readme/en/regex-transforms.gif +0 -0
- package/assets/readme/en/tool-selection.gif +0 -0
- package/assets/readme/tui-quickstart.gif +0 -0
- package/assets/readme/zh-CN/capability-tools.gif +0 -0
- package/assets/readme/zh-CN/context-composition.gif +0 -0
- package/assets/readme/zh-CN/context-toggle.gif +0 -0
- package/assets/readme/zh-CN/draft-diff.png +0 -0
- package/assets/readme/zh-CN/edit-draft-diff.gif +0 -0
- package/assets/readme/zh-CN/editor-overview-v3.png +0 -0
- package/assets/readme/zh-CN/editor-overview.png +0 -0
- package/assets/readme/zh-CN/mode-tools.gif +0 -0
- package/assets/readme/zh-CN/regex-transforms.gif +0 -0
- package/assets/readme/zh-CN/tool-selection.gif +0 -0
- package/dist/active-state.d.ts +148 -0
- package/dist/active-state.d.ts.map +1 -0
- package/dist/active-state.js +374 -0
- package/dist/active-state.js.map +1 -0
- package/dist/agent-profile.d.ts +1 -0
- package/dist/agent-profile.d.ts.map +1 -1
- package/dist/agent-profile.js +20 -14
- package/dist/agent-profile.js.map +1 -1
- package/dist/capabilities.d.ts +39 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +160 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/capability-anchors.d.ts +45 -0
- package/dist/capability-anchors.d.ts.map +1 -0
- package/dist/capability-anchors.js +263 -0
- package/dist/capability-anchors.js.map +1 -0
- package/dist/capability-command.d.ts +4 -0
- package/dist/capability-command.d.ts.map +1 -0
- package/dist/capability-command.js +164 -0
- package/dist/capability-command.js.map +1 -0
- package/dist/capability-events.d.ts +79 -0
- package/dist/capability-events.d.ts.map +1 -0
- package/dist/capability-events.js +478 -0
- package/dist/capability-events.js.map +1 -0
- package/dist/capability-projection.d.ts +22 -0
- package/dist/capability-projection.d.ts.map +1 -0
- package/dist/capability-projection.js +273 -0
- package/dist/capability-projection.js.map +1 -0
- package/dist/capability-protocol.d.ts +21 -0
- package/dist/capability-protocol.d.ts.map +1 -0
- package/dist/capability-protocol.js +15 -0
- package/dist/capability-protocol.js.map +1 -0
- package/dist/capability-state.d.ts +74 -0
- package/dist/capability-state.d.ts.map +1 -0
- package/dist/capability-state.js +43 -0
- package/dist/capability-state.js.map +1 -0
- package/dist/capability-tool.d.ts +11 -0
- package/dist/capability-tool.d.ts.map +1 -0
- package/dist/capability-tool.js +25 -0
- package/dist/capability-tool.js.map +1 -0
- package/dist/capability-web-host.d.ts +11 -0
- package/dist/capability-web-host.d.ts.map +1 -0
- package/dist/capability-web-host.js +105 -0
- package/dist/capability-web-host.js.map +1 -0
- package/dist/codecs/capability.d.ts +71 -0
- package/dist/codecs/capability.d.ts.map +1 -0
- package/dist/codecs/capability.js +363 -0
- package/dist/codecs/capability.js.map +1 -0
- package/dist/codecs/prompt-stack.d.ts +1 -1
- package/dist/codecs/prompt-stack.d.ts.map +1 -1
- package/dist/codecs/prompt-stack.js +140 -13
- package/dist/codecs/prompt-stack.js.map +1 -1
- package/dist/command-contribution/index.d.ts +21 -0
- package/dist/command-contribution/index.d.ts.map +1 -0
- package/dist/command-contribution/index.js +14 -0
- package/dist/command-contribution/index.js.map +1 -0
- package/dist/compile-cycle.d.ts +1 -0
- package/dist/compile-cycle.d.ts.map +1 -1
- package/dist/compile-cycle.js.map +1 -1
- package/dist/compiler.d.ts.map +1 -1
- package/dist/compiler.js +81 -17
- package/dist/compiler.js.map +1 -1
- package/dist/forge-command.d.ts +10 -0
- package/dist/forge-command.d.ts.map +1 -0
- package/dist/forge-command.js +106 -0
- package/dist/forge-command.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +58 -5
- package/dist/index.js.map +1 -1
- package/dist/json-fingerprint.d.ts +11 -0
- package/dist/json-fingerprint.d.ts.map +1 -0
- package/dist/json-fingerprint.js +66 -0
- package/dist/json-fingerprint.js.map +1 -0
- package/dist/lifecycle.d.ts +14 -0
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +167 -67
- package/dist/lifecycle.js.map +1 -1
- package/dist/payload-command.d.ts +2 -2
- package/dist/payload-command.d.ts.map +1 -1
- package/dist/payload-command.js +80 -26
- package/dist/payload-command.js.map +1 -1
- package/dist/payload-state.d.ts +1 -0
- package/dist/payload-state.d.ts.map +1 -1
- package/dist/payload-state.js +1 -0
- package/dist/payload-state.js.map +1 -1
- package/dist/policy.d.ts +2 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +3 -0
- package/dist/policy.js.map +1 -1
- package/dist/preset-command.d.ts +1 -0
- package/dist/preset-command.d.ts.map +1 -1
- package/dist/preset-command.js +94 -36
- package/dist/preset-command.js.map +1 -1
- package/dist/preview-text.d.ts +5 -0
- package/dist/preview-text.d.ts.map +1 -0
- package/dist/preview-text.js +27 -0
- package/dist/preview-text.js.map +1 -0
- package/dist/preview.d.ts +18 -1
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +132 -97
- package/dist/preview.js.map +1 -1
- package/dist/profile-command.js +68 -9
- package/dist/profile-command.js.map +1 -1
- package/dist/regex.d.ts.map +1 -1
- package/dist/regex.js +5 -0
- package/dist/regex.js.map +1 -1
- package/dist/render-helpers.d.ts.map +1 -1
- package/dist/render-helpers.js +2 -0
- package/dist/render-helpers.js.map +1 -1
- package/dist/repositories/capability.d.ts +53 -0
- package/dist/repositories/capability.d.ts.map +1 -0
- package/dist/repositories/capability.js +294 -0
- package/dist/repositories/capability.js.map +1 -0
- package/dist/runtime/capability-runtime.d.ts +93 -0
- package/dist/runtime/capability-runtime.d.ts.map +1 -0
- package/dist/runtime/capability-runtime.js +987 -0
- package/dist/runtime/capability-runtime.js.map +1 -0
- package/dist/runtime/profile-runtime.d.ts.map +1 -1
- package/dist/runtime/profile-runtime.js +10 -9
- package/dist/runtime/profile-runtime.js.map +1 -1
- package/dist/runtime/prompt-stack-runtime.d.ts +7 -4
- package/dist/runtime/prompt-stack-runtime.d.ts.map +1 -1
- package/dist/runtime/prompt-stack-runtime.js +47 -11
- package/dist/runtime/prompt-stack-runtime.js.map +1 -1
- package/dist/runtime/tool-policy-runtime.d.ts +10 -0
- package/dist/runtime/tool-policy-runtime.d.ts.map +1 -1
- package/dist/runtime/tool-policy-runtime.js +171 -30
- package/dist/runtime/tool-policy-runtime.js.map +1 -1
- package/dist/session-adapter.d.ts +13 -0
- package/dist/session-adapter.d.ts.map +1 -1
- package/dist/session-adapter.js +110 -0
- package/dist/session-adapter.js.map +1 -1
- package/dist/session-usage.d.ts +65 -0
- package/dist/session-usage.d.ts.map +1 -0
- package/dist/session-usage.js +134 -0
- package/dist/session-usage.js.map +1 -0
- package/dist/subagent/fingerprints.d.ts +3 -15
- package/dist/subagent/fingerprints.d.ts.map +1 -1
- package/dist/subagent/fingerprints.js +5 -69
- package/dist/subagent/fingerprints.js.map +1 -1
- package/dist/subagent/index.d.ts +2 -0
- package/dist/subagent/index.d.ts.map +1 -1
- package/dist/subagent/index.js +2 -0
- package/dist/subagent/index.js.map +1 -1
- package/dist/subagent-host.d.ts +2 -2
- package/dist/subagent-host.d.ts.map +1 -1
- package/dist/subagent-host.js +13 -1
- package/dist/subagent-host.js.map +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/web-editor/client-script.generated.d.ts.map +1 -1
- package/dist/web-editor/client-script.generated.js +1 -1
- package/dist/web-editor/client-script.generated.js.map +1 -1
- package/dist/web-editor/client-styles.generated.d.ts.map +1 -1
- package/dist/web-editor/client-styles.generated.js +1 -1
- package/dist/web-editor/client-styles.generated.js.map +1 -1
- package/dist/web-editor/server.d.ts.map +1 -1
- package/dist/web-editor/server.js +152 -4
- package/dist/web-editor/server.js.map +1 -1
- package/dist/web-editor/styles.d.ts.map +1 -1
- package/dist/web-editor/styles.js +573 -165
- package/dist/web-editor/styles.js.map +1 -1
- package/dist/web-editor/types.d.ts +81 -1
- package/dist/web-editor/types.d.ts.map +1 -1
- package/dist/web-host.d.ts +9 -0
- package/dist/web-host.d.ts.map +1 -1
- package/dist/web-host.js +210 -11
- package/dist/web-host.js.map +1 -1
- package/dist/workspace.d.ts +11 -0
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +63 -5
- package/dist/workspace.js.map +1 -1
- package/docs/README.md +4 -0
- package/docs/design/README.md +3 -1
- package/docs/design/architecture-0.5.md +22 -0
- package/docs/design/archive/2026-09-12-system-update-design.md +229 -0
- package/docs/design/pi-forge-system-update-design-notes.md +157 -229
- package/docs/development/release.md +20 -20
- package/docs/development/roadmap.md +21 -2
- package/docs/development/scoped-global-profiles-stacks.md +1 -1
- package/docs/development/setup.md +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/guides/delegation.md +22 -20
- package/docs/guides/migrating-to-0.5.md +29 -0
- package/docs/guides/use-cases.md +6 -2
- package/docs/guides/web-editor.md +74 -5
- package/docs/reference/active-state.md +77 -0
- package/docs/reference/capabilities.md +259 -0
- package/docs/reference/commands.md +52 -24
- package/docs/reference/configuration.md +4 -2
- package/docs/reference/features.md +70 -4
- package/docs/reference/provider-support.md +67 -0
- package/docs/reference/public-api.md +49 -3
- package/docs/reference/session-cache.md +112 -0
- package/docs/reference/stack-schema.md +18 -4
- package/docs/reference/subagent-host-port.md +8 -0
- package/docs/zh-CN/README.md +3 -0
- package/docs/zh-CN/getting-started.md +1 -1
- package/docs/zh-CN/guides/delegation.md +22 -10
- package/docs/zh-CN/guides/migrating-to-0.5.md +29 -0
- package/docs/zh-CN/guides/web-editor.md +75 -7
- package/docs/zh-CN/reference/capabilities.md +259 -0
- package/docs/zh-CN/reference/commands.md +61 -33
- package/docs/zh-CN/reference/provider-support.md +67 -0
- package/docs/zh-CN/reference/session-cache.md +112 -0
- package/examples/capabilities/review.json +12 -0
- package/examples/capabilities/write-tools.json +15 -0
- package/examples/read-first-worker-prompt-stack.json +49 -0
- package/package.json +16 -9
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# pi-forge `system_update` Design Notes
|
|
2
|
+
|
|
3
|
+
**Status:** Current plan (revised 2026-09-12). Supersedes the 2026-09-10
|
|
4
|
+
exploration draft, which assumed pi-forge would implement the full
|
|
5
|
+
persistence/projection/transport stack itself. Upstream Pi has since started
|
|
6
|
+
building the primitive natively, so pi-forge's scope shrinks to the
|
|
7
|
+
workflow layer.
|
|
8
|
+
|
|
9
|
+
**Target:** 0.5.5+, blocked on an upstream Pi redo (see §2).
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. TL;DR — Current Plan
|
|
14
|
+
|
|
15
|
+
`system_update` is a **session-timeline event**, not a mutation of the
|
|
16
|
+
top-level system prompt. That core decision from the original draft survives.
|
|
17
|
+
What changed is who builds what:
|
|
18
|
+
|
|
19
|
+
- **Upstream Pi is building the primitive**: a first-class `SystemMessage`
|
|
20
|
+
(`role: "system"`) appended to the transcript, rendered natively on models
|
|
21
|
+
that support mid-conversation system messages and as a tagged user turn
|
|
22
|
+
elsewhere. Persistence, resume, compaction, and provider rendering are all
|
|
23
|
+
owned by the harness.
|
|
24
|
+
- **pi-forge builds only the workflow layer**: an append-only event log, a
|
|
25
|
+
reducer over it, the `/system-update` command family, preset-declared
|
|
26
|
+
dormant instruction blocks, and a permission-gated agent tool.
|
|
27
|
+
- **Integration is declarative**: pi-forge renders its active update set into
|
|
28
|
+
`systemPromptOptions.sections` and lets the harness diff engine emit the
|
|
29
|
+
deltas. pi-forge no longer returns a fully-compiled replacement string for
|
|
30
|
+
this path.
|
|
31
|
+
|
|
32
|
+
Discarded from the original draft: the custom-entry + self-written projector
|
|
33
|
+
design, the `custom_message` transport, the provider transport matrix, and
|
|
34
|
+
the six-phase rollout. See §5 for why.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 2. Upstream Landscape (snapshot 2026-09-12)
|
|
39
|
+
|
|
40
|
+
### 2.1 The PRs
|
|
41
|
+
|
|
42
|
+
- **PR #9116** (`system-role` branch, pi-ai layer): adds `SystemMessage` to
|
|
43
|
+
the `Message` union. Appended to the transcript, never folded into
|
|
44
|
+
`Context.systemPrompt`. Persisted as ordinary message entries; compaction
|
|
45
|
+
cut points and summaries understand them (rendered as `[System]:` in
|
|
46
|
+
summaries); interactive mode hides them.
|
|
47
|
+
- **PR #9117** (`system-tool-deltas` branch, stacked, coding-agent layer):
|
|
48
|
+
the first rendered prompt of a session becomes a stored **baseline**;
|
|
49
|
+
anything that changes afterwards is appended as a provider-neutral system
|
|
50
|
+
message delta. On resume/tree navigation the stored baseline is reinstated
|
|
51
|
+
so a resumed session sends byte-identical cached prefixes. After
|
|
52
|
+
compaction, the effective prompt folds into a fresh baseline at no extra
|
|
53
|
+
cost.
|
|
54
|
+
|
|
55
|
+
**Both PRs were closed by the author on 2026-09-11 with "I will redo this."**
|
|
56
|
+
Direction is alive; implementation is being redone; timeline unknown.
|
|
57
|
+
Community testing (13-scenario harness, all green) flagged two design
|
|
58
|
+
issues likely motivating the redo: ~10 KB per-prompt-entry session bloat
|
|
59
|
+
from storing rendered baselines, and silent tool disappearance on
|
|
60
|
+
non-supporting models across resume.
|
|
61
|
+
|
|
62
|
+
### 2.2 Verified behavior of the PR branch (local clone: `~/programming/pi-pr9117`)
|
|
63
|
+
|
|
64
|
+
Measured against the actual `system-tool-deltas` build:
|
|
65
|
+
|
|
66
|
+
- `sections: Record<string, string>` on `systemPromptOptions` renders as
|
|
67
|
+
XML-wrapped blocks (`<name>\n...\n</name>`), diff-keyed as `section:name`.
|
|
68
|
+
- `diffSystemPrompts` behavior matrix:
|
|
69
|
+
- identical pieces → `unchanged` (no cost)
|
|
70
|
+
- section added → update delta: "The following `<name>` system guidance
|
|
71
|
+
now applies: ..."
|
|
72
|
+
- section removed → retraction: "The previous `<name>` system guidance no
|
|
73
|
+
longer applies."
|
|
74
|
+
- section content changed → "The `<name>` system guidance has changed. The
|
|
75
|
+
following supersedes..."
|
|
76
|
+
- literals changed or `forceSystemPrompt` changed → `replace`
|
|
77
|
+
(deliberate full cache miss)
|
|
78
|
+
- **`forceSystemPrompt` short-circuits everything**: when set, pieces are
|
|
79
|
+
only the forced prompt; sections are not rendered at all. Any extension
|
|
80
|
+
returning a full replacement string from `before_agent_start` gets this
|
|
81
|
+
path, and every content change is a full prefix miss.
|
|
82
|
+
- **`customPrompt` is a value piece** (keyed `customPrompt`, diff-friendly)
|
|
83
|
+
and does NOT short-circuit sections. This is pi-forge's integration point
|
|
84
|
+
for `mode = replace` stacks.
|
|
85
|
+
- Mid-run timing: the diff runs before every LLM request
|
|
86
|
+
(`agent-loop.ts`), including mid-tool-loop, so an agent tool that mutates
|
|
87
|
+
sections gets its delta delivered after the tool batch and before the next
|
|
88
|
+
inference. The tool-call adjacency problem from the original draft is
|
|
89
|
+
handled by the harness.
|
|
90
|
+
- Fallback rendering for unsupported providers:
|
|
91
|
+
`<system_update>\n{text}\n</system_update>` as a user-role message
|
|
92
|
+
(`pi-ai/utils/system-messages.ts`); Gemini confirmed user-role.
|
|
93
|
+
- Native support matrix (upstream compat flags): Anthropic Opus 4.8/5,
|
|
94
|
+
Fable 5/5.1, Mythos 5/5.1 get real system messages (Anthropic requires a
|
|
95
|
+
system message to directly precede an assistant turn; pending messages are
|
|
96
|
+
held). OpenAI transports get `developer`/`system` items. Everything else
|
|
97
|
+
gets the tagged user turn.
|
|
98
|
+
- `BeforeAgentStartEventResult.message` only accepts `CustomMessage`
|
|
99
|
+
(customType/content/display/details) — there is **no imperative
|
|
100
|
+
append-SystemMessage extension API** in the PR as written. The declarative
|
|
101
|
+
sections path is the intended extension surface.
|
|
102
|
+
- The PR branch itself had two TypeScript errors (`openrouter.ts`,
|
|
103
|
+
`xai.ts`) when we built it; dist artifacts were still produced.
|
|
104
|
+
|
|
105
|
+
### 2.3 Trigger to resume this work
|
|
106
|
+
|
|
107
|
+
When the redone PR appears: verify the sections/diff semantics survived the
|
|
108
|
+
redo (re-run the §2.2 matrix), then wire pi-forge's workflow layer to it.
|
|
109
|
+
If the redo removes the declarative sections surface, reassess; the escape
|
|
110
|
+
hatch is splicing `SystemMessage` in the context hook (see §5).
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 3. pi-forge Design (workflow layer)
|
|
115
|
+
|
|
116
|
+
These decisions survive from the original draft and remain the plan.
|
|
117
|
+
|
|
118
|
+
### 3.1 Event model
|
|
119
|
+
|
|
120
|
+
- Updates are **append-only custom session entries**
|
|
121
|
+
(`pi-forge-system-update`, schemaVersion 1), written via the existing
|
|
122
|
+
`session-adapter.ts` pattern (`pi.appendEntry` / `getCurrentBranchEntries`).
|
|
123
|
+
Branch semantics come for free.
|
|
124
|
+
- Entry payload: `{ updateId, op: "apply" | "revoke" | "reset", source,
|
|
125
|
+
presetId?, contentSnapshot, createdAt }`.
|
|
126
|
+
- **Snapshot content, not file paths**: file-backed presets are rendered at
|
|
127
|
+
activation time and the rendered text is persisted. Editing a preset file
|
|
128
|
+
tomorrow must not alter yesterday's session.
|
|
129
|
+
- Logical state is a **reducer view** over the branch's events, never
|
|
130
|
+
canonical mutable state. Powers `/system-update status`, badges, and
|
|
131
|
+
section rendering.
|
|
132
|
+
- Revoke/reset are new events, never history rewrites. In practice the
|
|
133
|
+
harness retraction wording ("no longer applies") is generated for us once
|
|
134
|
+
the section disappears; the event log only records intent.
|
|
135
|
+
|
|
136
|
+
### 3.2 Rendering (the declarative bridge)
|
|
137
|
+
|
|
138
|
+
- The reducer's active set is rendered into
|
|
139
|
+
`systemPromptOptions.sections["pi-forge-update-<id>"]` during
|
|
140
|
+
`before_agent_start` (and picked up mid-run by the harness's per-request
|
|
141
|
+
diff).
|
|
142
|
+
- pi-forge's stack compilation moves off the legacy "return one big string"
|
|
143
|
+
path: `mode = replace` stacks go into `systemPromptOptions.customPrompt`,
|
|
144
|
+
additive content into keyed `sections`. This is a prerequisite refactor,
|
|
145
|
+
and it upgrades cache behavior for the whole stack system, not just
|
|
146
|
+
updates.
|
|
147
|
+
- Transport is not pi-forge's concern: native vs fallback rendering is the
|
|
148
|
+
harness's compatibility layer.
|
|
149
|
+
|
|
150
|
+
### 3.3 Commands
|
|
151
|
+
|
|
152
|
+
- `/system-update <text>` — apply a freeform update (auto-id `update-N`).
|
|
153
|
+
- `/system-update status` — reducer view of active updates.
|
|
154
|
+
- `/system-update reset` — deactivate all (new event, append-only).
|
|
155
|
+
- 0.5.5+ with presets: `/system-update list|use <id>|off <id>`.
|
|
156
|
+
- No command deletes history. None of these trigger an agent turn.
|
|
157
|
+
|
|
158
|
+
### 3.4 Presets and the agent tool
|
|
159
|
+
|
|
160
|
+
- Presets declare dormant runtime blocks:
|
|
161
|
+
`{ "systemUpdates": [{ "id", "name", "description", "modelCallable",
|
|
162
|
+
"content" | "file" }] }`.
|
|
163
|
+
- The base system prompt carries only a compact inventory; full blocks load
|
|
164
|
+
on activation (lazy privileged prompt loading).
|
|
165
|
+
- Agent-facing tool `forge_system_update({action, id})` references declared
|
|
166
|
+
preset IDs only. **No arbitrary file elevation, no arbitrary agent-provided
|
|
167
|
+
privileged text.** Repository content is untrusted; elevation requires an
|
|
168
|
+
explicit preset declaration.
|
|
169
|
+
- Source-aware deactivation: the agent may only deactivate agent-activated
|
|
170
|
+
modes; the user may deactivate anything.
|
|
171
|
+
- Mid-turn activation rides the harness's per-request diff — no
|
|
172
|
+
pending-commit machinery on our side.
|
|
173
|
+
|
|
174
|
+
### 3.5 Compaction, resume, branching
|
|
175
|
+
|
|
176
|
+
All owned by the harness under the new architecture: update sections are part
|
|
177
|
+
of the effective prompt, folded into the post-compaction baseline; stored
|
|
178
|
+
baseline is reinstated on resume; events live on the branch. pi-forge's only
|
|
179
|
+
job is to re-derive the active set from the branch's event log on session
|
|
180
|
+
start/branch switch (same restore pattern as the active-stack state today).
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 4. Version Plan
|
|
185
|
+
|
|
186
|
+
- **0.5.4 (done, pushed):** web editor fixes and visual work; prompt-cache
|
|
187
|
+
features — cache-impact warning on `/preset use` / `/profile use`
|
|
188
|
+
(common-prefix estimate + last-request cacheRead), and compile-time
|
|
189
|
+
diagnostics for cache-sensitive content (`{{time}}`, date slots with
|
|
190
|
+
`includeTime`, `{{date}}` info).
|
|
191
|
+
- **0.5.5:** system update workflow layer per §3, gated on the upstream redo
|
|
192
|
+
landing in a released Pi. Build the upstream-touching code behind a small
|
|
193
|
+
isolated module so a redo API change rewrites one file, not the feature.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 5. Discarded Designs (recorded so we don't re-litigate)
|
|
198
|
+
|
|
199
|
+
- **Custom entry + self-written projector** (original draft's main design):
|
|
200
|
+
required replicating Pi's session-entry→context translation rules
|
|
201
|
+
(compaction truncation, deferred-message filtering) to compute splice
|
|
202
|
+
positions, plus a compaction checkpoint synthesizer. Real maintenance
|
|
203
|
+
coupling to Pi internals. Killed by the upstream `SystemMessage`.
|
|
204
|
+
- **`pi.sendMessage` custom_message transport**: zero projection code, but
|
|
205
|
+
`custom_message` entries evaporate at compaction (the compaction path
|
|
206
|
+
doesn't recognize them) and render only as user-role. Viable fallback if
|
|
207
|
+
the upstream redo dies entirely; otherwise obsolete.
|
|
208
|
+
- **Provider transport matrix / native lowering in pi-forge**: the wire role
|
|
209
|
+
is the harness's compatibility layer. pi-forge stores semantics
|
|
210
|
+
(`op`, `presetId`) so a future transport change needs no data migration.
|
|
211
|
+
- **Context-hook SystemMessage splicing**: possible once upstream keeps
|
|
212
|
+
`role: "system"` messages, but brings back per-request projection, position
|
|
213
|
+
mapping, and Anthropic placement-rule handling. Escape hatch only.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 6. Open Questions for the Redo
|
|
218
|
+
|
|
219
|
+
1. Did sections survive the redo, and did their diff semantics change?
|
|
220
|
+
2. Is there an imperative append path for extensions after all, or is
|
|
221
|
+
declarative sections still the only surface?
|
|
222
|
+
3. How does the redo store baselines (the session-bloat feedback)?
|
|
223
|
+
4. Does `customPrompt` remain a non-short-circuiting value piece?
|
|
224
|
+
5. Timing: which Pi release carries it, and what's our minimum-version
|
|
225
|
+
dependency story for the feature?
|
|
226
|
+
|
|
227
|
+
Community posture: when the redo PR opens, comment as a downstream consumer
|
|
228
|
+
with the runtime-instruction-modes use case (do not file a new issue;
|
|
229
|
+
feature-request issues get auto-closed while a PR is in flight).
|