pi-dev-flow 0.61.0 → 0.62.0
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 +16 -0
- package/README.md +9 -2
- package/docs/concurrency.md +3 -1
- package/docs/development.md +8 -4
- package/extensions/dev-flow.ts +49 -10
- package/package.json +1 -1
- package/skills/dev-flow/SKILL.md +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.62.0] - 2026-10-24
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **A bound session wears its feature's name.** `flow start` and `flow use` now rename the pi session to the flow slug (pi's public `setSessionName` API), so the session picker always says which feature each session holds — the missing surface of one-session-one-feature: the footer, the branch and the worktree already named the feature, the picker named nothing. A previous name (pi's auto-title or a hand-set `/rename`) is overwritten — under the flow's model the slug *is* the session's identity; unbind (`abort`/`finish`) keeps the name as the trace of what the session held. The rename rides the binding seam and stays a courtesy: a host without the naming API degrades to a silent no-op and cannot fail a gate, and re-binding the slug a session already carries writes nothing.
|
|
12
|
+
|
|
13
|
+
## [0.61.1] - 2026-10-23
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **The newest dev-flow copy judges the guards alone.** When one process runs several copies (the documented two-sources situation — a checkout's own `pi.extensions` manifest beside the npm install is the common one), every copy's event hooks now run an election first: a copy with a lower registered version answers nothing — no guard vetoes, no context injection, no footer, no compaction takeover. Stale code judging alongside fresh was the real hazard the two-sources warning hinted at: on a 22-hour-old pi-web server a 0.57.0-era copy blocked tool calls beside the current one, and nobody could say which copy answered. Node cannot unload a loaded module and pi cannot unregister its hooks, so silence is the most in-package removal can be — only a host restart drops the stale code, and the warnings now say so. Equal versions both judge; a copy whose version cannot be read is never outranked; gate tool handlers stay live on every copy (the host dispatches those per session, and the stale-build warnings already cover them).
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- **The duplicate-copy warning names its speaker** — `this call served by <dir> (v); this copy is the newest and judges the guards` (or admits it is the older one and stays silent) — and the stale-build notes across `start`, `status` and `version` tell the truth about what fixes skew: `/reload` re-binds session state, but in a shared-process host (pi-web) only restarting the host swaps loaded code; docs/development.md and the README's two-sources section now say the same. Proven on the live server: a working-tree stamp frozen at 0.57.0 survived a day of reloads while the checkout shipped two versions.
|
|
22
|
+
|
|
7
23
|
## [0.61.0] - 2026-10-23
|
|
8
24
|
|
|
9
25
|
### Fixed
|
package/README.md
CHANGED
|
@@ -15,6 +15,9 @@ touch, test strategy, risks — plus rendered screenshots for anything user-visi
|
|
|
15
15
|
it, the agent cannot edit code anywhere else in the repo. That is the whole "does it actually plan?"
|
|
16
16
|
question, answered by the harness instead of by trust.
|
|
17
17
|
|
|
18
|
+
**A bound session is self-identifying.** `flow start` (and `flow use`) renames the Pi session after
|
|
19
|
+
the flow slug, so the session picker always tells you which feature each session holds.
|
|
20
|
+
|
|
18
21
|
**Stages end in gates, not vibes.** Each stage has one exit gate that refuses until its criteria
|
|
19
22
|
hold: your plan file exists; every command your playbook names as a check passes; the app really
|
|
20
23
|
starts, with real data, and answers a health probe **after** a real deploy; changelog and version
|
|
@@ -52,8 +55,12 @@ pi install ./pi-dev-flow # or a local checkout
|
|
|
52
55
|
Later releases arrive with `pi update --extensions` (an npm install reconciles to the newest version);
|
|
53
56
|
then `/reload` — a running session keeps the code it loaded at startup. Two sources at once (a project
|
|
54
57
|
`git:` pin beside the global `npm:` package) load two copies — pi dedupes extensions by path, not by
|
|
55
|
-
package — so keep the one you actually update from
|
|
56
|
-
|
|
58
|
+
package — so keep the one you actually update from. **The newest copy judges alone:** every copy's
|
|
59
|
+
guard hooks check which registered version is highest, and a stale duplicate answers nothing — the
|
|
60
|
+
most in-package removal can be, because Node cannot unload a loaded module and pi cannot unregister
|
|
61
|
+
its hooks. Only a host restart drops stale code; `/reload` re-binds session state, it never swaps
|
|
62
|
+
code. `flow version` lists every dev-flow copy registered in the process and names the copy serving
|
|
63
|
+
the call, and the on-disk session claim keeps the guard of a copy that never served
|
|
57
64
|
a flow call attributing your commands correctly.
|
|
58
65
|
|
|
59
66
|
Until `flow init` writes the playbook (`.dev-flow/project.md`), dev-flow says nothing in a repo — no
|
package/docs/concurrency.md
CHANGED
|
@@ -5,7 +5,9 @@ How several agents work one repo at the same time without stepping on each other
|
|
|
5
5
|
**One pi session = one feature** (flow + branch + worktree). A repo can host any number of
|
|
6
6
|
features, worked by separate sessions in parallel — that is the supported shape, not an edge
|
|
7
7
|
case. The binding lives with the session (persisted via session entries, restored on
|
|
8
|
-
resume/fork), so nothing is repo-global
|
|
8
|
+
resume/fork), so nothing is repo-global — and the session carries its feature's name: `flow start`
|
|
9
|
+
and `flow use` rename the pi session to the slug (overwriting any previous name), so the session
|
|
10
|
+
picker always says which feature a session holds. A session binds **explicitly, never automatically**:
|
|
9
11
|
`flow start` binds its own feature, `flow use <slug>` takes one over — even the lone unfinished
|
|
10
12
|
feature waits to be claimed. Every bind leaves a claim (`claim.json`, session + pid),
|
|
11
13
|
and the gates honor the claim too — `flow abort` included, so the verb that erases a feature cannot
|
package/docs/development.md
CHANGED
|
@@ -8,14 +8,18 @@ pi -e . run /flow status # try it against any repo
|
|
|
8
8
|
```
|
|
9
9
|
|
|
10
10
|
Sessions in this checkout load the **single global dev-flow install** (`pi update --extensions`
|
|
11
|
-
reconciles it after a release
|
|
11
|
+
reconciles it after a release; loaded code swaps only when the process re-imports — `/reload` in a
|
|
12
|
+
per-session host, a host restart in a shared-process host like pi-web) — there is deliberately no
|
|
12
13
|
`.pi/extensions/` pointer here: a committed shim beside the global package loads two copies of the
|
|
13
14
|
extension in one process (pi dedupes by path, not by package — see the README's two-sources
|
|
14
|
-
warning), which is what the shim used to cause.
|
|
15
|
-
|
|
15
|
+
warning), which is what the shim used to cause. The package's own `pi.extensions` manifest remains a
|
|
16
|
+
second source for any session opened in this checkout — deliberate dogfooding, made safe by the guard
|
|
17
|
+
election: the newest registered copy judges, older loaded copies answer nothing. To dogfood the
|
|
18
|
+
working tree instead of the installed copy, point pi at it explicitly for that run: `pi -e .`.
|
|
16
19
|
|
|
17
20
|
A release cannot update a session that is already running — pi keeps the code it loaded at startup.
|
|
18
|
-
After merging and tagging, `/reload` in every session that must carry the new behavior
|
|
21
|
+
After merging and tagging, `/reload` in every session that must carry the new behavior; shared-process
|
|
22
|
+
hosts (pi-web) keep stale code until restarted, so reload there re-binds state but does not swap code.
|
|
19
23
|
|
|
20
24
|
## The skill: an injected core, plus references a stage reads
|
|
21
25
|
|
package/extensions/dev-flow.ts
CHANGED
|
@@ -167,11 +167,24 @@ function registerCopy(): void {
|
|
|
167
167
|
function otherCopies(): CopyEntry[] {
|
|
168
168
|
return COPIES.filter((r) => r.pid === process.pid && r.dir !== SELF_BUILD.dir);
|
|
169
169
|
}
|
|
170
|
+
/** Election: when one process runs several dev-flow copies (the documented two-sources hazard, or a
|
|
171
|
+
* copy whose loaded code predates an update), only the highest-version copy may judge — stale code
|
|
172
|
+
* must not veto tool calls with a build nobody reviewed. Node cannot unload a loaded module and pi
|
|
173
|
+
* cannot unregister its hooks, so silence is the most removal can be from inside the package; only
|
|
174
|
+
* a host restart truly drops stale code. Equal versions both judge (same code, same verdicts); a
|
|
175
|
+
* copy whose version cannot be read is never outranked. Gate tool/command handlers stay live on
|
|
176
|
+
* every copy: the host dispatches a session's flow calls to whichever copy loaded that session,
|
|
177
|
+
* and staleness there is what the /reload warnings address. */
|
|
178
|
+
function guardsAreMine(): boolean {
|
|
179
|
+
const mine = SELF_BUILD.version;
|
|
180
|
+
if (!mine) return true; // an unreadable version is never outranked
|
|
181
|
+
return !otherCopies().some((r) => r.version && cmpVersions(r.version, mine) > 0);
|
|
182
|
+
}
|
|
170
183
|
function copyWarning(): string | null {
|
|
171
184
|
const dup = otherCopies();
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
185
|
+
if (!dup.length) return null;
|
|
186
|
+
const verdict = guardsAreMine() ? "this copy is the newest and judges the guards" : "this copy is older and stays silent \u2014 the newest copy judges";
|
|
187
|
+
return `warning: ${dup.length} other dev-flow cop${dup.length === 1 ? "y" : "ies"} registered in this process: ${dup.map((d) => `${d.dir} (${d.version ?? "?"})`).join(", ")} \u2014 this call served by ${SELF_BUILD.dir} (${SELF_BUILD.version ?? "?"}); ${verdict}. Keep only one source you intend; a host restart drops stale code (README: two sources at once)`;
|
|
175
188
|
}
|
|
176
189
|
/** Test seam: the smoke suite cannot load a second copy of this module, so it plants registry
|
|
177
190
|
* entries and asserts the warnings the real duplicate would print. */
|
|
@@ -642,6 +655,8 @@ interface Session {
|
|
|
642
655
|
slug: string | null;
|
|
643
656
|
key: string;
|
|
644
657
|
bind: (slug: string | null) => void;
|
|
658
|
+
/** Name the pi session after a slug (one session = one feature: the picker shows the feature). */
|
|
659
|
+
rename: (slug: string) => void;
|
|
645
660
|
}
|
|
646
661
|
|
|
647
662
|
/** Is this checkout the dev-flow repo itself? Plugin reflections are fixable in-repo only here. */
|
|
@@ -856,7 +871,7 @@ ${mdDigest(draftRefresh)}`))
|
|
|
856
871
|
const notes: string[] = [];
|
|
857
872
|
const disk = checkoutBuild(root);
|
|
858
873
|
const behind = sessionRunsOlderBuild(loadedVersion(), disk.version);
|
|
859
|
-
if (behind) notes.push(`warning: this session runs dev-flow ${behind}, ${disk.label} ships ${disk.version} — /reload
|
|
874
|
+
if (behind) notes.push(`warning: this session runs dev-flow ${behind}, ${disk.label} ships ${disk.version} — /reload rebinds session state; only restarting the host swaps the code it runs`);
|
|
860
875
|
const dupStart = copyWarning();
|
|
861
876
|
if (dupStart) notes.push(dupStart);
|
|
862
877
|
if (flag("check-upstream")) {
|
|
@@ -900,7 +915,8 @@ ${mdDigest(draftRefresh)}`))
|
|
|
900
915
|
mkdirSync(path.join(featDir(root, slugArg), "plan"), { recursive: true });
|
|
901
916
|
writeState(root, state);
|
|
902
917
|
sess.bind(slugArg);
|
|
903
|
-
|
|
918
|
+
sess.rename(slugArg);
|
|
919
|
+
return { text: `feature ${slugArg} started at stage plan (ui=${state.ui}${state.patch ? ", patch" : state.docs ? ", docs" : ""}${state.flowVersion ? `, dev-flow ${state.flowVersion}` : ""}); session renamed to ${slugArg}.${notes.length ? `\n${notes.join("\n")}` : ""}\n${nextHint(state, cfg)}` };
|
|
904
920
|
}
|
|
905
921
|
|
|
906
922
|
case "status": {
|
|
@@ -912,7 +928,7 @@ ${mdDigest(draftRefresh)}`))
|
|
|
912
928
|
// gate proof printed since the drift began belongs to the older code.
|
|
913
929
|
const disk = checkoutBuild(root);
|
|
914
930
|
const staleBuild = sessionRunsOlderBuild(loadedVersion(), disk.version);
|
|
915
|
-
const warn = [...(findings.length ? [`⚠ doctor: ${findings.length} finding(s) — run flow doctor`] : []), ...(staleBuild ? [`⚠ this session runs dev-flow ${staleBuild}, ${disk.label} ships ${disk.version} — /reload`] : []), ...(copyWarning() ? [copyWarning()!] : [])];
|
|
931
|
+
const warn = [...(findings.length ? [`⚠ doctor: ${findings.length} finding(s) — run flow doctor`] : []), ...(staleBuild ? [`⚠ this session runs dev-flow ${staleBuild}, ${disk.label} ships ${disk.version} — /reload rebinds; restart swaps code`] : []), ...(copyWarning() ? [copyWarning()!] : [])];
|
|
916
932
|
// the backlog nudge belongs to the no-features answer too — that is when a pick is most useful
|
|
917
933
|
const rmap = roadmapOpenCount(readRoadmap(root));
|
|
918
934
|
const rmapLine = rmap ? [`◇ ${rmap} roadmap item(s) open — flow roadmap`] : [];
|
|
@@ -1030,7 +1046,7 @@ ${mdDigest(draftRefresh)}`))
|
|
|
1030
1046
|
const newest = pub.ok ? pub.out.trim().split("\n").pop() : "";
|
|
1031
1047
|
return { text: newest ? `${head} — published: ${newest}${self.version && newest !== self.version ? " (update available)" : ""}` : `${head} — could not read the published version (offline?)` };
|
|
1032
1048
|
}
|
|
1033
|
-
return { text: `${behind ? `${head} — but this session runs ${behind}${from}; /reload to run ${self.version}` : head}${dupNote ? `\n${dupNote}` : ""}` };
|
|
1049
|
+
return { text: `${behind ? `${head} — but this session runs ${behind}${from}; /reload to run ${self.version} \u2014 in a shared-process host (pi-web) reload cannot swap loaded code: only a host restart does` : head}${dupNote ? `\n${dupNote}` : ""}` };
|
|
1034
1050
|
}
|
|
1035
1051
|
|
|
1036
1052
|
case "approve": {
|
|
@@ -1595,7 +1611,8 @@ ${mdDigest(draftRefresh)}`))
|
|
|
1595
1611
|
const prior = readClaim(root, slugArg);
|
|
1596
1612
|
const takeover = claimBlocks(prior, sess.key) ? ` — taken over from live session (pid ${prior!.pid})` : "";
|
|
1597
1613
|
sess.bind(slugArg);
|
|
1598
|
-
|
|
1614
|
+
sess.rename(slugArg);
|
|
1615
|
+
return { text: `this session is now bound to ${slugArg} (stage ${st.stage})${st.worktree ? ` — work in its worktree: ${st.worktree} (branch ${st.branch})` : ""}; session renamed to ${slugArg}${takeover}` };
|
|
1599
1616
|
}
|
|
1600
1617
|
|
|
1601
1618
|
case "abort": {
|
|
@@ -1706,6 +1723,15 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1706
1723
|
if (prev && prev !== slug && readClaim(ctx.cwd, prev)?.key === key) rmSync(claimFile(ctx.cwd, prev), { force: true });
|
|
1707
1724
|
if (slug) writeClaim(ctx.cwd, slug, key);
|
|
1708
1725
|
},
|
|
1726
|
+
rename: (slug) => {
|
|
1727
|
+
// pi's public session-name API, kept defensive: an older host without it must not fail a gate.
|
|
1728
|
+
// Skip the no-op re-bind of the current name — session_info entries would pile up per bind.
|
|
1729
|
+
try {
|
|
1730
|
+
if (pi.getSessionName?.() !== slug) pi.setSessionName?.(slug);
|
|
1731
|
+
} catch {
|
|
1732
|
+
/* naming is a courtesy, never a gate precondition */
|
|
1733
|
+
}
|
|
1734
|
+
},
|
|
1709
1735
|
};
|
|
1710
1736
|
};
|
|
1711
1737
|
|
|
@@ -1784,23 +1810,32 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1784
1810
|
|
|
1785
1811
|
// Agent-run gates refresh at turn_end (tool ctx lacks setStatus; turn_end catches them).
|
|
1786
1812
|
pi.on("session_start", async (_event, ctx) => {
|
|
1813
|
+
if (!guardsAreMine()) return;
|
|
1787
1814
|
rebuildSession(ctx);
|
|
1788
1815
|
refreshStatus(ctx);
|
|
1789
1816
|
});
|
|
1790
|
-
pi.on("session_tree", async (_event, ctx) =>
|
|
1817
|
+
pi.on("session_tree", async (_event, ctx) => {
|
|
1818
|
+
if (!guardsAreMine()) return;
|
|
1819
|
+
rebuildSession(ctx);
|
|
1820
|
+
});
|
|
1791
1821
|
// The session, not the process, owns the binding and the claim: pi-web keeps serving other sessions
|
|
1792
1822
|
// after one ends, and a stale claim there is a permanent lock (its pid is the server's, always alive).
|
|
1793
1823
|
pi.on("session_shutdown", async (_event, ctx) => {
|
|
1824
|
+
if (!guardsAreMine()) return;
|
|
1794
1825
|
if (!existsSync(dfDir(ctx.cwd))) return;
|
|
1795
1826
|
releaseSession(ctx.cwd, sessionKey(ctx));
|
|
1796
1827
|
});
|
|
1797
1828
|
pi.on("turn_end", async (_event, ctx) => {
|
|
1829
|
+
if (!guardsAreMine()) return;
|
|
1798
1830
|
refreshStatus(ctx);
|
|
1799
1831
|
// pi checks its compaction threshold between every turn; our safe points must be as frequent.
|
|
1800
1832
|
maybeCompactNow(ctx);
|
|
1801
1833
|
});
|
|
1802
1834
|
// Idle backstop: long between-gate runs compact here instead of letting pi hit the threshold mid-work.
|
|
1803
|
-
pi.on("agent_settled", async (_event, ctx) =>
|
|
1835
|
+
pi.on("agent_settled", async (_event, ctx) => {
|
|
1836
|
+
if (!guardsAreMine()) return;
|
|
1837
|
+
maybeCompactNow(ctx);
|
|
1838
|
+
});
|
|
1804
1839
|
// pi forcing a threshold compaction while a flow is bound means our safe-point pacing missed — rebuild the
|
|
1805
1840
|
// summary here with flow-aware instructions and hand it back through the event's custom-compaction channel.
|
|
1806
1841
|
// Never ctx.compact() from this hook: AgentSession.compact() opens with abort() + waitForIdle(), and the run
|
|
@@ -1808,6 +1843,7 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1808
1843
|
// reaches the provider). If our summary fails we return undefined and pi's own compaction proceeds.
|
|
1809
1844
|
// overflow is never taken over (cancelling it would drop pi's compact-and-retry); manual is the operator's or ours.
|
|
1810
1845
|
pi.on("session_before_compact", async (event, ctx) => {
|
|
1846
|
+
if (!guardsAreMine()) return undefined;
|
|
1811
1847
|
if (!initiated(ctx.cwd)) return undefined;
|
|
1812
1848
|
const key = sessionKey(ctx);
|
|
1813
1849
|
const st = boundFeature(ctx.cwd, key);
|
|
@@ -1831,6 +1867,7 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1831
1867
|
});
|
|
1832
1868
|
// pi forcing its own compaction while a flow is bound means the pacing was wrong — park a note for the operator.
|
|
1833
1869
|
pi.on("session_compact", async (event, ctx) => {
|
|
1870
|
+
if (!guardsAreMine()) return;
|
|
1834
1871
|
if (!initiated(ctx.cwd)) return;
|
|
1835
1872
|
// Whatever the reason, the summary replaced the transcript — the core the first run injected is
|
|
1836
1873
|
// gone from context, so the next run pays it once more (manual compactions included: our own
|
|
@@ -1849,6 +1886,7 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1849
1886
|
});
|
|
1850
1887
|
|
|
1851
1888
|
pi.on("tool_call", async (event, ctx) => {
|
|
1889
|
+
if (!guardsAreMine()) return undefined; // election: only the newest loaded copy judges
|
|
1852
1890
|
// pi kills a shell call only when a timeout was passed, and the model omits it in ~75% of
|
|
1853
1891
|
// calls (observed hangs: hours). Deterministic class defaults, clamped ceilings — runs for
|
|
1854
1892
|
// every session that loads this package, flow-bound or not.
|
|
@@ -1977,6 +2015,7 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
1977
2015
|
});
|
|
1978
2016
|
|
|
1979
2017
|
pi.on("before_agent_start", async (_event, ctx) => {
|
|
2018
|
+
if (!guardsAreMine()) return undefined;
|
|
1980
2019
|
// One [dev-flow] line per run, whatever number of copies of this package are installed.
|
|
1981
2020
|
// The same package reaches one runtime twice all the time (a project pin beside the npm install,
|
|
1982
2021
|
// or this checkout's .pi/extensions pointer beside it) and pi dedupes extensions by file path
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-dev-flow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.62.0",
|
|
4
4
|
"description": "Enforced feature workflow for Pi: plan → implement → pre-release → release, gated checkpoints, self-improvement reflections, one git worktree per feature, changelog + publish as part of the release",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
package/skills/dev-flow/SKILL.md
CHANGED
|
@@ -47,7 +47,8 @@ Ground rules:
|
|
|
47
47
|
sessions, one feature each, are the model. A session binds **explicitly and
|
|
48
48
|
only**: `flow start <slug>` binds its own feature (main checkout must be on
|
|
49
49
|
the default branch); `flow use <slug>` takes one over. Nothing auto-binds.
|
|
50
|
-
|
|
50
|
+
Both bind commands rename the Pi session to the slug, so the picker names each
|
|
51
|
+
session after its feature. Unbound: gates demand an explicit slug and main-checkout writes stay
|
|
51
52
|
blocked — there is no bypass, an unbound session cannot edit source.
|
|
52
53
|
- **Project `flow-guard` rules** (`deny`/`confirm`/`protect`/`forbid` in
|
|
53
54
|
project.md `## global`) apply at **every** stage and are judged ahead of
|