@jmfederico/pi-web 1.202610.1 → 1.202610.2

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.
Files changed (144) hide show
  1. package/README.md +23 -134
  2. package/dist/cli.js +4 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/client/assets/index-DUsqiytv.js +4408 -0
  5. package/dist/client/assets/vendor-editor-core-C2PJX3uW.js +10 -0
  6. package/dist/client/assets/{vendor-editor-languages-DOCw3vc9.js → vendor-editor-languages-CS6n1J8n.js} +1 -1
  7. package/dist/client/index.html +4 -48
  8. package/dist/config.js +8 -0
  9. package/dist/config.js.map +1 -1
  10. package/dist/pi-packages/captains-log/dist/browser/index.js +30 -32
  11. package/dist/pi-packages/captains-log/package.json +4 -4
  12. package/dist/pi-packages/relays/extensions/index.js +60 -0
  13. package/dist/pi-packages/relays/package.json +10 -1
  14. package/dist/pi-packages/relays/pi-web-plugin.js +31 -1
  15. package/dist/pi-packages/relays/prompts/relay-worktree.md +6 -16
  16. package/dist/pi-packages/relays/prompts/relay.md +6 -33
  17. package/dist/pi-packages/relays/relayDispatch.js +67 -0
  18. package/dist/pi-packages/relays/relayIdentity.js +37 -0
  19. package/dist/pi-packages/relays/relaysPanelElement.js +37 -12
  20. package/dist/pi-packages/relays/skills/relay/SKILL.md +24 -68
  21. package/dist/pi-packages/relays/skills/relay-runner/SKILL.md +40 -219
  22. package/dist/pi-packages/workflows/browser/pi-web-plugin.js +33 -0
  23. package/dist/pi-packages/workflows/package.json +22 -0
  24. package/dist/pi-packages/workflows/prompts/worktree.md +12 -0
  25. package/dist/pi-web-plugins/files/browser/pi-web-plugin.js +49 -51
  26. package/dist/pi-web-plugins/git/browser/git-panel.js +0 -1
  27. package/dist/pi-web-plugins/git/server-plugin.js +11 -0
  28. package/dist/pi-web-plugins/git/workspace-discovery-notify.cjs +14 -0
  29. package/dist/pi-web-plugins/git/workspaceDiscoveryHooks.js +180 -0
  30. package/dist/pi-web-plugins/info/infoInternals.js +3 -3
  31. package/dist/pi-web-plugins/info/pi-web-plugin.js +1 -1
  32. package/dist/pi-web-plugins/mermaid/browser/mermaid-engine.js +1077 -414
  33. package/dist/pi-web-plugins/terminal/browser/pi-web-plugin.js +30 -30
  34. package/dist/pi-web-plugins/updates/pi-web-plugin.js +1 -1
  35. package/dist/piWebUpdate.js +2 -2
  36. package/dist/piWebUpdate.js.map +1 -1
  37. package/dist/plugin-api.d.ts +229 -8
  38. package/dist/server/activity/workspaceActivityService.js +4 -1
  39. package/dist/server/activity/workspaceActivityService.js.map +1 -1
  40. package/dist/server/app.js +5 -0
  41. package/dist/server/app.js.map +1 -1
  42. package/dist/server/configRoutes.js +6 -0
  43. package/dist/server/configRoutes.js.map +1 -1
  44. package/dist/server/knownAutoInstallPiPackages.js +6 -0
  45. package/dist/server/knownAutoInstallPiPackages.js.map +1 -1
  46. package/dist/server/navigationPreferenceRoutes.js +39 -0
  47. package/dist/server/navigationPreferenceRoutes.js.map +1 -0
  48. package/dist/server/plugins/projectPluginSettings.js +95 -0
  49. package/dist/server/plugins/projectPluginSettings.js.map +1 -0
  50. package/dist/server/plugins/serverPluginRuntime.js +26 -3
  51. package/dist/server/plugins/serverPluginRuntime.js.map +1 -1
  52. package/dist/server/sessiond/autoInstallPiPackages.js +3 -3
  53. package/dist/server/sessiond/workspaceCatalogRoutes.js +3 -1
  54. package/dist/server/sessiond/workspaceCatalogRoutes.js.map +1 -1
  55. package/dist/server/sessiond/workspaceNotificationRoutes.js +41 -0
  56. package/dist/server/sessiond/workspaceNotificationRoutes.js.map +1 -0
  57. package/dist/server/sessiond.js +40 -7
  58. package/dist/server/sessiond.js.map +1 -1
  59. package/dist/server/sessions/askUserDomain.js +232 -0
  60. package/dist/server/sessions/askUserDomain.js.map +1 -0
  61. package/dist/server/sessions/askUserTool.js +15 -17
  62. package/dist/server/sessions/askUserTool.js.map +1 -1
  63. package/dist/server/sessions/dockerEnvironmentFacts.js +8 -0
  64. package/dist/server/sessions/dockerEnvironmentFacts.js.map +1 -1
  65. package/dist/server/sessions/extensionSessionDispatch.js +76 -0
  66. package/dist/server/sessions/extensionSessionDispatch.js.map +1 -0
  67. package/dist/server/sessions/globalProviderPolicy.js +71 -16
  68. package/dist/server/sessions/globalProviderPolicy.js.map +1 -1
  69. package/dist/server/sessions/messageHistoryTarget.js +61 -0
  70. package/dist/server/sessions/messageHistoryTarget.js.map +1 -0
  71. package/dist/server/sessions/piSessionManagerGateway.js +23 -24
  72. package/dist/server/sessions/piSessionManagerGateway.js.map +1 -1
  73. package/dist/server/sessions/piSessionService.js +581 -262
  74. package/dist/server/sessions/piSessionService.js.map +1 -1
  75. package/dist/server/sessions/sessionArchiveStore.js +5 -1
  76. package/dist/server/sessions/sessionArchiveStore.js.map +1 -1
  77. package/dist/server/sessions/sessionArchiveTree.js +2 -2
  78. package/dist/server/sessions/sessionArchiveTree.js.map +1 -1
  79. package/dist/server/sessions/sessionCommandService.js +9 -3
  80. package/dist/server/sessions/sessionCommandService.js.map +1 -1
  81. package/dist/server/sessions/sessionImageDimensions.js +31 -0
  82. package/dist/server/sessions/sessionImageDimensions.js.map +1 -0
  83. package/dist/server/sessions/sessionMediaIndex.js +7 -1
  84. package/dist/server/sessions/sessionMediaIndex.js.map +1 -1
  85. package/dist/server/sessions/sessionMetadata.js +51 -0
  86. package/dist/server/sessions/sessionMetadata.js.map +1 -0
  87. package/dist/server/sessions/sessionNameGenerator.js +8 -28
  88. package/dist/server/sessions/sessionNameGenerator.js.map +1 -1
  89. package/dist/server/sessions/sessionRoutes.js +10 -2
  90. package/dist/server/sessions/sessionRoutes.js.map +1 -1
  91. package/dist/server/sessions/sessionSummaryScanner.js +62 -5
  92. package/dist/server/sessions/sessionSummaryScanner.js.map +1 -1
  93. package/dist/server/sessions/spawnSessionTool.js +3 -1
  94. package/dist/server/sessions/spawnSessionTool.js.map +1 -1
  95. package/dist/server/sessions/spawnSubsessionTool.js +25 -17
  96. package/dist/server/sessions/spawnSubsessionTool.js.map +1 -1
  97. package/dist/server/sessions/subsessionCompletionDelivery.js +15 -0
  98. package/dist/server/sessions/subsessionCompletionDelivery.js.map +1 -0
  99. package/dist/server/sessions/subsessionCompletionInbox.js +134 -0
  100. package/dist/server/sessions/subsessionCompletionInbox.js.map +1 -0
  101. package/dist/server/sessions/subsessionProvenance.js +27 -0
  102. package/dist/server/sessions/subsessionProvenance.js.map +1 -0
  103. package/dist/server/status/machineStatusService.js +17 -5
  104. package/dist/server/status/machineStatusService.js.map +1 -1
  105. package/dist/server/storage/navigationPreferenceStore.js +137 -0
  106. package/dist/server/storage/navigationPreferenceStore.js.map +1 -0
  107. package/dist/server/workspaces/projectPiWebConfig.js +88 -6
  108. package/dist/server/workspaces/projectPiWebConfig.js.map +1 -1
  109. package/dist/server/workspaces/workspaceChangeNotifier.js +12 -0
  110. package/dist/server/workspaces/workspaceChangeNotifier.js.map +1 -0
  111. package/dist/server/workspaces/workspaceNotificationCommand.js +64 -0
  112. package/dist/server/workspaces/workspaceNotificationCommand.js.map +1 -0
  113. package/dist/server/workspaces/workspaceProviderRegistry.js +55 -0
  114. package/dist/server/workspaces/workspaceProviderRegistry.js.map +1 -1
  115. package/dist/server-plugin-api.d.ts +18 -0
  116. package/dist/server-plugin-api.js.map +1 -1
  117. package/dist/sessiond/sessionDaemonClient.js +3 -3
  118. package/dist/sessiond/sessionDaemonClient.js.map +1 -1
  119. package/dist/shared/apiTypes.js +2 -2
  120. package/dist/shared/apiTypes.js.map +1 -1
  121. package/dist/shared/federatedRoutes.js +5 -0
  122. package/dist/shared/federatedRoutes.js.map +1 -1
  123. package/dist/shared/machineStatus.js +11 -2
  124. package/dist/shared/machineStatus.js.map +1 -1
  125. package/dist/shared/navigationPreferences.js +6 -0
  126. package/dist/shared/navigationPreferences.js.map +1 -0
  127. package/dist/shared/pluginApiTypes.d.ts +2 -0
  128. package/dist/shared/sessionMedia.js +6 -0
  129. package/dist/shared/sessionMedia.js.map +1 -1
  130. package/dist/shared/streamingBehavior.js +7 -0
  131. package/dist/shared/streamingBehavior.js.map +1 -0
  132. package/dist/shared/themePreference.js +23 -0
  133. package/dist/shared/themePreference.js.map +1 -0
  134. package/dist/workspaceNotificationCli.js +95 -0
  135. package/dist/workspaceNotificationCli.js.map +1 -0
  136. package/docs/config.md +99 -86
  137. package/docs/plugins.md +103 -30
  138. package/examples/session-bridge-plugin/package.json +2 -2
  139. package/examples/workspace-provider-plugin/package.json +1 -1
  140. package/package.json +33 -33
  141. package/dist/client/assets/index-CBjDnBIN.js +0 -4178
  142. package/dist/client/assets/vendor-editor-core-YWog6mAR.js +0 -10
  143. package/dist/server/sessions/pendingAskStore.js +0 -275
  144. package/dist/server/sessions/pendingAskStore.js.map +0 -1
@@ -1,253 +1,74 @@
1
1
  ---
2
2
  name: relay-runner
3
- description: "Opinionated full-lifecycle software-delivery profile for Relay chains in Git repositories. Load when preparing or running every leg of a Relay created by /relay or /relay-worktree, whenever a preparation or handoff prompt names relay-runner, or when an active Relay operations record declares this profile. Governs scope, adaptive leg sizing, checkpoints, verification, commits, review/remediation, delivery, and handoff. Do not load for generic Relay questions or Relays that declare another operational profile."
3
+ description: "Prepare and run Relay legs in Pi: keep the goal, baton, and log durable, then hand off to one fresh session or stop visibly. Use with relay for /relay, /relay-worktree, or a handoff naming relay-runner. Supplies continuity and a bounded fresh-context final review without prescribing the development route."
4
4
  ---
5
5
 
6
6
  # Relay runner
7
7
 
8
- Use this skill as the opinionated software-delivery profile layered on the project-neutral `relay` method. It assumes a Git repository and optimizes for small, durable, independently reviewable progress from initial dispatch through delivery.
8
+ This skill binds the `relay` method to Pi sessions and a small file packet. It supplies continuity and one completion gate: a fresh-context final review. The development route remains adaptive. Each agent discovers applicable project instructions and skills through the repository and harness; do not copy them into the packet or preselect them for future legs.
9
9
 
10
- This profile binds the base `relay` method's tool-agnostic principle, durable-state roles, context containment, and invariants to Pi's session tools and an opinionated Git/software-delivery workflow. Dispatch and handoff prompts are responsible for selecting both skills before a runner begins; skill bodies do not bootstrap other skills.
10
+ ## Packet
11
11
 
12
- ## Profile contract
12
+ Use `.pi-web/relays/<name>/` in the working checkout unless the user selects another location inside the target workspace. Start with three files:
13
13
 
14
- For a Relay using this profile:
14
+ - **`charter.md` — goal.** The agreed outcome and recognizable finish line, relay-specific scope boundaries and clarifications, and any explicit human requirements. Reference an existing specification when useful. Do not add project rules, implementation plans, or generic quality or delivery procedures; include such details only when the human explicitly asks.
15
+ - **`status.md` — baton.** State (`Draft — awaiting approval; not dispatched`, `Active`, `Complete`, or `Needs help`), last completed leg and next leg number, working location, current progress, remaining gaps to the goal, relevant checks, current review state, targeted pointers, and blockers. Include only what is useful now. Avoid suggesting the next slice; record remaining gaps and concrete dependencies instead.
16
+ - **`log.md` — history.** Append a short entry per leg: what changed or was learned, important decisions and why, artifact or commit references, checks and actual results, and the next leg or stop. Record human approval and scope changes here too.
15
17
 
16
- - Have the preparation prompt select `relay-runner` before drafting the packet. Record it immediately in draft `operations.md` and retain it as required for every active leg, including implementation, review, remediation, and delivery.
17
- - Name both `relay` and `relay-runner` in every handoff prompt. Fresh sessions cannot inherit a prior runner's loaded skills.
18
- - Keep every Relay handoff on the current runner's model by omitting the `model` argument, unless instructed to use a specific model or to choose an appropriate one. Record any Relay-wide model instruction in `operations.md` so it remains available to later runners.
19
- - Treat the charter as destination and scope edges, `operations.md` as this profile's repository and execution bindings, `status.md` as current position and next work, and repository instructions as the quality and implementation authority.
20
- - Follow canonical repository policy when it conflicts with a profile default. Record a material operational adaptation in `operations.md`, not the charter. Stop for human intervention when reconciling the conflict would change the finish line or an edge, weaken a protected invariant, or require a product or business decision.
18
+ Charter = agreement; status = position; decisions = durable reasoning; log = history. Keep revisions in the log, not a separate revisions document; no decision template is required. Status, decisions, and the log cannot silently change the agreement. Keep relay-specific decisions durable without adding documents merely to satisfy a template. The packet is not a second home for project policy or this skill's instructions.
21
19
 
22
- This profile is intentionally strong. A project that wants another way of working should use the base `relay` skill with a different profile rather than quietly diluting this one leg by leg.
20
+ Add **`decisions.md` only when useful**: a compact, living record of consequential decisions and their reasons, including rejected approaches or review concerns worth remembering. Keep current conclusions there and record revisions in the log. Link it from status and consult relevant entries rather than duplicating the reasoning in the baton. It is not a plan, task list, or another home for project rules. Human changes to the goal or scope still belong in the charter. Do not create an empty register or impose a decision template.
23
21
 
24
- ## Pi execution and packet
22
+ ## Preparation and dispatch
25
23
 
26
- `spawn_session` is fire-and-forget: the current runner does not receive the successor's output and cannot steer it. The packet is the only thread across the chain. Complete all work and durable-state updates before handoff, then call `spawn_session` at most once as the leg's final operational action. After it returns, provide only a user-facing handoff summary; do not use more tools, mutate state, perform more Relay work, or try to steer the successor. Do not use a tracked subsession for the Relay handoff; tracked subsessions are allowed only as bounded helpers inside a leg when this profile explicitly permits them.
24
+ The preparation prompt owns discussion and approval. Drafting is allowed before approval; `dispatch_relay` is not. After the human reviews the goal and boundaries, require an explicit **Approve and dispatch** response. If the approved goal, scope, or working target changes materially, obtain fresh approval.
27
25
 
28
- Default the packet root to `.pi-web/relays/<name>/` unless the preparer selects another location. During preflight, create a reviewable draft packet in the checkout where the preparation session is running and mark it not dispatched. For fresh-worktree mode, move the complete packet into the target worktree before handoff and remove the stale drafting copy. Use the base method's three durable-state files plus one profile-owned operational record:
26
+ Use the current checkout for `/relay` unless the user chooses another. For `/relay-worktree`, create a fresh branch and worktree after approval, following project conventions; use current HEAD as the starting point unless another base is agreed. Ask about a material target ambiguity rather than guessing. Move the draft packet into the target checkout before dispatch, update its location, and remove the stale drafting copy.
29
27
 
30
- - **`charter.md` — goal and edges.** Record Relay identity, the plain-language goal and observable finish line, minimum outcome acceptance, in-scope boundaries, explicit non-goals, material assumptions or human decisions. Keep it free of implementation plans, technical route definitions, quality bars, verification commands, review heuristics, and copied project guidance. Include a technical contract only when the user made that contract part of the desired outcome or a necessary scope edge. Changing the goal or an edge requires explicit human agreement, a charter update, and a log entry.
31
- - **`operations.md` — runner bindings.** Record the packet and profile identity, canonical project instruction pointers, working location and Git facts, verification commands, packet isolation, commit and checkpoint policy, review budget and delivery mechanism, intervention signal, and any explicit profile adaptation. These are operating facts and policies, not product scope; maintain them without rewriting the charter.
32
- - **`status.md` — compact baton.** Record current position, last completed leg, next leg identifier, current or next task, targeted context pointers, progress-documentation expectations, blockers, and active transition or review-decision pointers. Status selects the route; it cannot redefine the charter. Compress history out of it.
33
- - **`log.md` — append-only history.** Append one concise entry per leg covering work and decisions, durable artifacts, verification, packet updates, and handoff or stop. Read only targeted entries referenced by charter, operations, or status; never read it end-to-end defensively.
28
+ Record the actual checkout and, in Git, branch and starting commit in status. Keep packet files out of delivery commits using an existing ignore rule or a local Git exclusion. Leave unrelated existing work untouched. Bootstrap the target as needed under project conventions; setup does not automatically require a separate leg.
34
29
 
35
- Do not add `plan.md`, a roadmap, or generic planning/design documents to the packet. The only optional packet files in this profile are a targeted `transition.md` while a transitional checkpoint is active and a targeted `review-decisions.md` while unresolved whole-work findings require continuity. Status must link each active optional file; when that need ends, record its conclusion in the log and remove both the pointer and optional file. Put any task- or project-specific durable artifact in its canonical project or delivery location and link it through a targeted status pointer instead of expanding the packet format. If status is insufficient, repair it with targeted inspection. Intervene rather than reconstructing broad history or guessing what “done” means.
30
+ Record approval in status/log, mark status `Active`, and seed leg 1. The first runner chooses its own slice; preparation need not prescribe one. Dispatch with the same handoff mechanics used by later legs.
36
31
 
37
- Authority follows role, not recency: charter owns destination and edges, operations owns this profile's execution bindings, status owns current position and next work, and log preserves history. Canonical repository instructions own project quality and implementation policy. None of the operational surfaces can override the charter.
32
+ ## Run a leg
38
33
 
39
- ## Goal and scope
34
+ 1. Read the charter and status, then inspect relevant project guidance and work. Consult only the history or supporting material needed to understand the current state. Repair small record gaps with targeted inspection; ask for help if the goal or ownership is unclear.
35
+ 2. Compare reality with the finish line and completion requirements, including the final review below. If all are satisfied, record completion and stop. Otherwise choose one useful, context-sized slice that closes a remaining gap. Briefly state in the session which slice you chose and how it advances the goal.
36
+ 3. Do the work and the checks appropriate to it under project conventions. Record failed, skipped, or incomplete checks honestly.
37
+ 4. Make the result durable before handoff. In Git, commit the leg's changes when project policy and human instructions permit, without including unrelated changes or the packet. Otherwise record the exact saved work and why it is uncommitted. Finish any helpers before handing off.
38
+ 5. Refresh the compact status and append the log entry. Record progress against the goal, important evidence and decisions, remaining gaps, and any limitations the successor needs to know. Then complete, ask for help, or hand off once.
40
39
 
41
- Under this profile, Relay completion means the chartered outcome has been reached and every completion gate required by `operations.md`—including whole-work review, approval, and delivery—has completed. Keep those operating gates in `operations.md` rather than adding them to the charter.
40
+ Other reviews, delivery steps, and gates apply only when the human or project requires them. Keep this skill's review procedure here, not copied into the packet.
42
41
 
43
- Translate source material into a plain-language, observable finish line without adding outcomes. Understanding intent does not authorize extra behavior. Treat the current repository as the baseline and include only:
42
+ ## Final review
44
43
 
45
- - work explicitly requested;
46
- - work necessary to reach the finish line; and
47
- - directly coupled work needed to prevent this Relay's changes from causing regressions.
44
+ When a leg finishes substantive work and believes implementation is done, record that final review is pending and hand off to a fresh leg. A fresh runner finding implementation complete with review pending performs the review instead of passing it on again. Leave substantive corrections to another leg so the review stays independent.
48
45
 
49
- Record only the minimum observable outcome acceptance and scope edges needed to recognize completion: what is in, what is explicitly out, any directly affected behavior the goal must preserve, and material assumptions or decisions. Prefer product language. Do not add technical definitions, quality criteria, speculative failure cases, or implementation constraints merely to make the charter look complete; project instructions govern quality directly. Leave optional cleanup, hardening, refactoring, and features outside the Relay unless the user approves them.
46
+ Review the whole relay result, not just the last slice, against the charter and applicable project guidance. Approve when no concrete, evidence-backed in-scope blocker remains. Optional improvements, speculative concerns, and unrelated pre-existing shortcomings do not block completion. Record consequential finding dispositions in `decisions.md` when useful.
50
47
 
51
- ## Adaptive legs without an upfront plan
48
+ Allow **at most three review attempts total**: the initial review and up to two post-correction reviews, not three mandatory passes. Keep the attempt count, latest result, and reviewed work reference in status; put evidence and findings in the log or link to decisions. Subsequent attempts happen only after concrete corrections and focus on those corrections and changed evidence, carrying supported prior decisions forward rather than restarting an expanding audit.
52
49
 
53
- Relay intentionally does not predict the chain. Before dispatch, establish the destination and edges and select only the first bounded leg. Do not create work packages, an exhaustive stage sequence, a file/layer map, or a promised leg count. Future runners choose the next slice from current reality and the finish line.
50
+ If the third attempt still has blockers, or a required further review would exceed the budget, mark `Needs help`, record what remains, and stop without dispatching another review or correction leg. A valid approval satisfies the gate; a new context or packet-only update does not reopen it. Material changes to the reviewed result require re-review within the same budget.
54
51
 
55
- Expected files, subsystems, dependencies, architecture, and sequencing are route assumptions. Keep only what the current or next leg needs in status or a targeted temporary artifact; do not turn route assumptions into stable agreement.
52
+ ## Stop or hand off
56
53
 
57
- A leg is one context-contained, reviewable slice that advances the finish line. Development legs implement and verify by default: optimize for the smallest useful behaviour, not the smallest independently testable artifact. A functional checkpoint makes an observable charter outcome available and verifies it through the relevant application boundary. A tested but unused module is a prerequisite, not a functional outcome. Setup, required verification, review and delivery remain legitimate lifecycle legs.
54
+ Mark `Complete` and report the result and evidence when no required work remains and final review has passed for the current result. Do not spawn a successor to search for extra work.
58
55
 
59
- Slice by supported cases across the necessary layers. When a journey is too large, choose a narrower case or a safe partial capability with explicit limitations, keeping the full charter outstanding. Keep directly coupled implementation, checks, contracts, generated outputs, documentation and integration together.
56
+ Mark `Needs help` when a decision, permission, environment problem, or lack of progress prevents responsible continuation. Record the concrete blocker, attempts and evidence, and the smallest question or action needed from the human. Surface it clearly in the user-facing response; use `ask_user` when an answer is needed. Do not hand a human-dependent blocker to another context hoping it will disappear.
60
57
 
61
- Before substantial work, state the leg's:
58
+ Before continuing, check that concrete required work remains, including any pending final review; leave slice selection to the successor.
62
59
 
63
- - observable outcome and application boundary;
64
- - bounded change surface and coupled verification;
65
- - remaining connection to usable behaviour, if any; and
66
- - checkpoint type: functional, necessary prerequisite or profile-authorized transitional.
60
+ For handoff, finish work and all packet writes first. The charter supplies the goal and saved `status.md` is the actual baton: save progress, remaining gaps, decisions, checks and blockers there, with targeted pointers to supporting records as needed. Do not put missing continuity into a separate handover prompt.
67
61
 
68
- An unconnected prerequisite must name the behaviour it enables and why a connected slice cannot reasonably fit. Its successor prioritizes that connection. Before adding another prerequisite-only leg, reassess the slice and simplify the route; continue only when a concrete dependency still prevents connection.
62
+ Call the dedicated `dispatch_relay` tool at most once with the saved directory as `packet`, the next leg identity as `leg`, and the target checkout as `cwd`. A relative `packet` resolves inside that `cwd`; custom packet locations must also stay inside the target workspace. Pass `leg` as a string: the next leg number written as `"2"`, or an explicitly chosen identifier of 1–32 letters, digits, dots, underscores or hyphens, starting with a letter or digit. Non-string values are rejected rather than converted. For example, substitute the actual paths and next leg:
69
63
 
70
- Routine reading, design, sizing and test investigation belong inside implementation. A research-only leg requires a specific unanswered question blocking responsible implementation: record the blocked behaviour, why available evidence is insufficient and the result needed to proceed. Answer that question and hand off to implementation; intervene if it remains unresolved. Size or complexity alone calls for a smaller implementation slice.
71
-
72
- Choose the simplest design satisfying the charter, canonical project rules and concrete risks introduced by the change. Justify additional safeguards against those obligations; keep speculative recovery systems and future-use abstractions outside the slice. Preserve safety when narrowing behaviour.
73
-
74
- Persist only conclusions useful to the next runner. Keep leg history in the packet log and project documentation focused on current behaviour and contracts.
75
-
76
- If a leg grows beyond its context-contained slice, stop broadening before context exhaustion. Finish or revert to a coherent functional or justified prerequisite checkpoint, or use an already authorized transition. Record the next bounded slice. Do not promise a fixed total leg count.
77
-
78
- When status does not name the next task, choose the smallest coherent slice that advances the critical path or unblocks an agreed outcome. Do not invent cleanup or speculative follow-up merely to fill a leg.
79
-
80
- ### Bounded transitional checkpoints
81
-
82
- Use a transitional checkpoint only when a functional split would make the leg unreasonably large or require disposable compatibility work, and repository policy permits it. Before making the repository non-functioning, record a breakage budget containing:
83
-
84
- - expected affected surfaces and failure classes;
85
- - the last known functional commit;
86
- - a recovery action if handoff fails;
87
- - a named restoration milestone; and
88
- - safety constraints.
89
-
90
- Keep the active summary in `status.md`. Put larger details in `transition.md`, link it from status, and preserve the pointer until restoration.
91
-
92
- A transitional leg may leave only failures inside that declared budget. The incomplete state must intentionally advance an agreed outcome, complete a coherent transformation step, and receive every focused check meaningful for that step. Every following leg while the transition is active must continue or restore it; do not start unrelated work. Never authorize a transition that creates an unsafe security, authorization, data-integrity, or irreversible external-effect state.
93
-
94
- Treat a failure outside the budget as unexpected; resolve it or intervene rather than relabeling it after the fact. Make the checkpoint durable under the operations record's commit policy and record exact verification, recovery, and next work before handoff. If the Relay must stop before restoration, execute the recovery action unless `operations.md` explicitly permits the isolated state to remain safely available for human recovery. Do not start whole-work review or delivery until the repository is functional and final verification requirements can pass.
95
-
96
- ## Support preflight and dispatch an approved Relay
97
-
98
- ### Discover only what the packet needs
99
-
100
- Read `AGENTS.md` and other canonical agent or contributor instructions, then follow only the references needed to establish:
101
-
102
- - applicable project skills or quality standards every runner must use;
103
- - focused and full verification commands, including manual checks when automation is absent;
104
- - integration base ref and immutable base commit;
105
- - review range and allowable pre-existing working-tree state;
106
- - commit conventions;
107
- - fresh-worktree bootstrap requirements, if applicable;
108
- - review and delivery mechanism, plus an achievable fallback when remote or review tooling is unavailable; and
109
- - packet isolation from delivery commits and the reviewed diff.
110
-
111
- Point `operations.md` at canonical instructions instead of copying them into the packet, especially the charter. Persist only operating facts that need clarification or reinforcement. Prefer documented commands over broad repository exploration and stop discovery once the packet is runnable. If the repository has no canonical quality guidance, record that fact; do not invent a project-wide quality bar for the charter or reviewer.
112
-
113
- If the base, existing-change ownership, target checkout, destructive-data choice, or delivery mechanism is materially ambiguous, ask rather than guess.
114
-
115
- ### Prepare the working location
116
-
117
- During preflight, inspect and propose the working mode, base, and location. Draft packet documents may be created and revised immediately for human review. Creating a branch or worktree is also preparation rather than dispatch, but avoid unnecessary setup before the target is understood. Apply the selected mode:
118
-
119
- - **In-place mode:** work in the invoked checkout and branch. Record checkout path, branch, integration base ref and commit, initial HEAD, pre-existing state, and exact review diff in `operations.md`. Keep unrelated existing changes out of Relay commits.
120
- - **Fresh-worktree mode:** create a new branch and worktree from the recorded base unless the task names another target. Follow the repository's existing worktree placement; otherwise use a clear sibling location. Draft the packet in the preparation session's checkout until the target exists, then move it intact into the worktree before dispatch and set every handoff's `cwd` to that worktree. Record the dispatching checkout's state as well as worktree path, branch, and initial HEAD in `operations.md`.
121
- - **Explicit existing location:** when the task names an existing checkout or worktree, use it and record the same operating facts as in-place mode.
122
-
123
- In fresh-worktree mode, make leg 1 setup-only when bootstrap is required: perform the recorded bootstrap, confirm success and allowable working-tree state, then hand off without inspecting or implementing the task. If no bootstrap is needed, dispatch the first substantive leg.
124
-
125
- Treat the Relay packet as operational state, not delivery work. Use `.pi-web/relays/<name>/` in the drafting checkout during preparation and in the selected target checkout before dispatch. Keep it outside delivery commits and the reviewed diff through an existing ignore rule, a local Git exclusion, or another non-delivery location.
126
-
127
- ### Write goal and operations separately
128
-
129
- Keep `charter.md` short and destination-focused. Record:
130
-
131
- - Relay identity;
132
- - the interpreted goal and observable finish line in plain language;
133
- - minimum outcome acceptance;
134
- - in-scope edges, explicit non-goals, directly affected behavior that must remain unchanged, and material assumptions or human decisions.
135
-
136
- Do **not** put a quality bar, technical design, expected files or subsystems, verification matrix, edge-case inventory, failure taxonomy, review checklist, or copied project standards in the charter. Reviewers apply the repository's current canonical skills and documentation directly, so the charter does not need to predict or paraphrase them.
137
-
138
- Write the profile's mechanics to `operations.md` instead:
139
-
140
- - packet identity and `relay-runner` as the profile required in every leg and handoff;
141
- - implementation-first leg sizing and outcome-led task selection under this profile, with route assumptions provisional and no fixed leg count;
142
- - pointers to canonical repository instructions and applicable project skills;
143
- - checkpoint and transition policy;
144
- - packet root, working location, branch, immutable base commit, initial HEAD, pre-existing state, packet isolation, and exact review range;
145
- - focused and full verification commands;
146
- - commit policy: every leg that changes delivery files commits all and only its changes, including intended new files, before handoff, while packet updates remain isolated;
147
- - the two-attempt normal whole-work review/remediation policy, exceptional third-attempt contingency, and review-decision continuity;
148
- - delivery mechanism; and
149
- - intervention signal and triggers supplied by this profile, the user, or repository.
150
-
151
- ### Require shared understanding and approval
152
-
153
- The preparation prompt owns the interactive preflight. Create and iteratively update goal-focused `charter.md`, profile-owned `operations.md`, compact `status.md`, and append-only `log.md` as reviewable drafts. Mark status **Draft — awaiting approval; not dispatched**. Use `ask_user` when an answer changes the goal, an edge, target, destructive-data choice, delivery mechanism, working location, or non-obvious base. Ask related questions together. This profile supplies routine mechanics, so the user approves the prepared Relay rather than designing the protocol.
154
-
155
- After pointing the user at the final drafts, summarize the goal/edges, operating setup, and first bounded leg, then explicitly ask **Approve and dispatch**, **Revise**, or **Do not dispatch**. Never infer dispatch approval from the initial request, permission to create drafts, or the absence of objections. A material change after approval invalidates it and requires another review. On revision, update and re-present the drafts. On refusal, mark status not dispatched, append the decision, and stop. Drafting and checkout setup may happen before approval; `spawn_session` may not.
156
-
157
- ### Approved-dispatch workflow
158
-
159
- After explicit approval, finalize all four documents, mark the packet approved, and record approval in status and log. Seed active leg tracking with last completed leg 0, the first leg identifier/task, targeted context, blockers, `review attempts: 0`, `third-attempt contingency: unused`, and any active pointers. In fresh-worktree mode, move the packet into the target worktree, update recorded paths and location facts, and remove the stale drafting copy before handoff.
160
-
161
- Dispatch exactly one first leg with `spawn_session`, after all state is durable in its final location. Use the selected checkout/worktree as `cwd`. After `spawn_session` returns, report the Relay name, packet path, location and branch, interpreted finish line and material non-goals, delivery target, first leg, and dispatch confirmation. Perform no further operational action and never promise a total leg count.
162
-
163
- ## Run every leg
164
-
165
- Use this loop:
166
-
167
- 1. Read `charter.md`, `operations.md`, `status.md`, and only targeted context they reference. Then load canonical project skills applicable to this leg.
168
- 2. Confirm that the prompt's leg identifier, status baton, working location, branch, and blockers are consistent. Resolve small baton defects with targeted inspection; intervene instead of broad archaeology or guessing about intent.
169
- 3. Use status's next outcome as the starting point. Revise inherited sequencing or design when a simpler connected slice better advances it. Safe implementation splits within the charter are runner decisions, not approval requests. If the intended outcome remains ambiguous or falls outside the finish line, intervene.
170
- 4. Re-anchor to the finish line and perform the containment check. Do exactly one bounded slice. Do not audit unrelated code, execute the next nominal leg too, or expand scope under the guise of quality.
171
- 5. Run every focused check meaningful for the slice and report exact results. Before whole review, run the full verification named by `operations.md`. Never describe failed, skipped, or incomplete verification as passing.
172
- 6. Make delivery changes durable under the operations record's commit policy without absorbing unrelated state. Keep packet-only writes out of delivery commits.
173
- 7. Update status with the observable progress, completed and next leg identifiers, next outcome, existing seam to connect, concrete constraints, remaining unconnected work, targeted context, verification state, blockers and active transition/review pointers. Keep route choices provisional. Append the concise leg entry to the log before stopping or handing off.
174
- 8. Stop without spawning when Relay completion is recorded, the leg is blocked, or an intervention trigger fires. When the chartered outcome is implemented but required review, approval, or delivery remains, name that lifecycle work as the next leg instead of stopping. Surface the intervention signal clearly. Otherwise hand off exactly once at the end with `spawn_session`.
175
-
176
- Use this handoff shape, substituting the actual paths and next identifier:
177
-
178
- ```text
179
- Relay "<name>" leg <identifier> begins now.
180
-
181
- Work under the Relay method with the `relay-runner` operational profile.
182
- Load the `relay` and `relay-runner` skills, then read:
183
- - .pi-web/relays/<name>/charter.md
184
- - .pi-web/relays/<name>/operations.md
185
- - .pi-web/relays/<name>/status.md
186
-
187
- Do not read log.md end-to-end. Use only targeted entries referenced by charter.md, operations.md, or status.md.
188
- Run exactly one outcome-led leg under the profile's implementation-first rules. Use status's next outcome and connection priority; adapt the route within the charter. Make work and packet updates durable, then either hand off once or stop with the recorded intervention signal.
64
+ ```json
65
+ {
66
+ "packet": ".pi-web/relays/<name>",
67
+ "leg": "2",
68
+ "cwd": "/absolute/path/to/checkout"
69
+ }
189
70
  ```
190
71
 
191
- ## Whole-work review and remediation
192
-
193
- Run whole-work review immediately before delivery and only after implementation and verification are believed complete and no transition remains active.
194
-
195
- Approval means the reviewed evidence reasonably demonstrates the chartered finish line under the repository's canonical quality guidance; it does not claim the work is perfect or free of every possible defect. Reviewers are not expected or rewarded to produce findings. A clean approval is the correct result when no concretely supported blocker is found.
196
-
197
- Use **two normal whole-work review attempts** from implementation-complete through delivery: the initial review and, only when needed, one post-remediation or pre-delivery re-review. A third review is an exceptional contingency, not routine capacity or a target. Invoke it only under the attempt 2 finding rule below or when delivery finds that materially changed review inputs made the prior approval stale. Record `review attempts: N` and `third-attempt contingency: unused` in status, changing the contingency field to `invoked — <reason>` before using it. Append each attempt, base, and HEAD to the log. Focused subreviews consolidated by one reviewer are part of one attempt, not separate attempts.
198
-
199
- Attempt 1 is the only broad, proportionate review pass. Report its concretely supported blockers together rather than serializing already-known concerns across later attempts; this calls for a proportionate pass, not an exhaustive search. Later reviews still judge the exact delivery diff as a whole, but carry prior decisions forward and focus on remediation, changed evidence, and regressions. Do not restart review from zero, expand the audit surface, or apply a newly stricter standard because another attempt is available.
200
-
201
- For each attempt:
202
-
203
- - Review the exact delivery diff recorded in `operations.md` against the charter's goal and edges and the repository's canonical quality instructions. Do not derive a technical bug-hunting checklist from incidental charter wording.
204
- - Keep the reviewer report-only for implementation and delivery artifacts. Its only writes are packet updates needed to record review and handoff.
205
- - Confirm the full verification required by `operations.md` at the reviewed HEAD and record exact results.
206
- - Approve when no blocking finding meets the evidence threshold below, even if non-blocking limitations or theoretical risks remain. Record exact reviewed base and HEAD, point status at the approval, and name delivery as next.
207
- - When attempt 1 has blocking findings, record them in risk order in the log, name one coherent remediation leg in status with a targeted pointer, and dispatch it. Remediation runners resolve the recorded blockers in bounded slices and dispatch attempt 2 only after the attempt 1 report has been addressed; do not spend another whole-work review merely to reveal the next already-known item.
208
- - When attempt 2 has a blocking finding, do not automatically consume attempt 3. Invoke the remediation contingency only when concrete evidence shows that an attempted remediation reasonably expected to resolve a blocker did not, remediation introduced an in-scope regression, or materially new evidence reveals a blocker that could not reasonably have been assessed earlier—and one bounded remediation is likely to resolve it. Record that justification, mark the contingency invoked, and dispatch one coherent remediation leg followed by attempt 3. Expanded scrutiny, a changed standard, deferred already-available evidence, or speculative possibility does not qualify. If a genuine blocker remains but the contingency is not justified or bounded, intervene.
209
- - When exceptional attempt 3 still has any blocking finding, stop the automatic loop. Record the unresolved findings and exact decision needed, raise the human intervention signal, and do **not** dispatch remediation or a fourth review. A human may accept an authorized risk, change the agreement, stop the Relay, or explicitly grant a bounded additional remediation/review attempt.
210
-
211
- The reviewer chooses proportionate independent review and records that decision. Independent subreviews are optional; use them only when a specific changed surface benefits from focused expertise, not to create review theater or increase the chance of finding something. The reviewer may use `spawn_subsession` for report-only focused reviews, then `yield_to_subsessions` and consolidate. Subreview prompts must identify repository, base and exact diff, the charter's goal and edges, canonical quality instructions, and the prohibition on all writes including packet changes. The consolidating reviewer is the sole packet writer. The Relay handoff still uses one `spawn_session` only at the end of the leg.
212
-
213
- A blocking finding needs concrete evidence of an in-scope defect: for example a reproduced failure, a failing relevant check, a specific execution path that violates the approved outcome, or a clear breach of a material contract, invariant, security, authorization, or data-integrity boundary. Mere possibility, stylistic preference, optional hardening, hypothetical future requirements, or “there could be an edge case” is not blocking. If proportionate targeted inspection cannot establish applicability and impact, classify the concern as non-blocking or omit it rather than forcing remediation.
214
-
215
- Review cannot over-specify the agreement. Decide materiality from the charter's goal and edges and the repository's canonical guidance, not from a reviewer-created standard. A concern outside those authorities is non-blocking or out of scope even when it describes a possible improvement. Non-blocking findings do not prevent approval or consume a remediation leg. Do not turn review into an audit of unrelated pre-existing shortcomings.
216
-
217
- ### Review-decision continuity
218
-
219
- Create `review-decisions.md` only when a finding disposition must survive into later reviews. Point to it from status continuously through remediation and delivery; later reviewers read it instead of reconstructing history from the log.
220
-
221
- Give recurring findings stable identifiers. Record concern, disposition, concise rationale, evidence, authority, applicability, and revisit conditions. A remediated decision cites the fixing commit and verification. Not-applicable cites concrete evidence. Accepted-risk or out-of-scope cites an exact charter edge, canonical project guidance, or explicit human direction. Do not create speculative risk analyses merely to populate the register.
222
-
223
- Do not duplicate an existing finding. Honor supported decisions while facts remain unchanged, but reopen for materially new evidence, changed applicability, or a demonstrable error or charter conflict. Record what supersedes the old decision. A reviewer cannot unilaterally waive an in-scope defect.
224
-
225
- Keep the register compact and current. It is subordinate to the charter: changing the goal, minimum outcome acceptance, or a scope edge requires human agreement, a charter update, and a log entry.
226
-
227
- ## Delivery finish
228
-
229
- The final leg performs only the delivery mechanism recorded in `operations.md`.
230
-
231
- 1. Read the targeted approval entry cited by status.
232
- 2. Verify that the integration base still resolves to the reviewed base commit, HEAD equals the reviewed HEAD, and the working tree matches the allowable state recorded in `operations.md`, normally clean apart from the packet.
233
- 3. If the base advanced or expected in-scope work changed, intervene when the mismatch is unrelated, unexpected, or of unclear ownership. Otherwise dispatch a fresh whole-work review when a normal attempt remains. After two attempts, invoke the exceptional third only when the changed inputs materially invalidate the prior approval and a targeted review can assess the new exact range; record that reason before dispatch. If neither condition applies, intervene.
234
- 4. Create or update the recorded pull/merge request, push the branch, produce the agreed patch, or leave the agreed clean committed local branch. Do not invent delivery infrastructure the repository does not use.
235
- 5. State what changed and why, behavioral or contract changes, migration or deployment ordering when applicable, and exact verification with results.
236
- 6. Record the delivery result—URL, pushed branch, patch path, or local commit/branch—in status and log before declaring completion. Required push, authentication, or review-tool failure is intervention, not completion.
237
-
238
- ## Intervention triggers
239
-
240
- Stop, update status, append the log, surface the intervention signal recorded in `operations.md`, and do not spawn when:
241
-
242
- - the finish line or a stable outcome must change without explicit human agreement;
243
- - the environment is unusable;
244
- - destructive-data behavior is ambiguous;
245
- - a product or business decision lies outside the charter;
246
- - proceeding would knowingly weaken a material invariant or security/authorization boundary;
247
- - unexpected unrelated branch changes make ownership or the review range unclear;
248
- - required delivery or authentication fails;
249
- - review remains blocked after the normal attempts and the third-attempt contingency is unavailable or exhausted;
250
- - the finish line is infeasible; or
251
- - another user-, repository-, charter-, or operations-defined trigger fires.
72
+ The tool validates the saved packet, generates the handover instructions, and records explicit Relay identity and a predictable session name. It accepts no free-form prompt and starts an independent session; do not substitute a generic session tool or tracked subsession. Omit `model` and `thinkingLevel` to inherit them unless the human instructed otherwise; keep any relay-wide instruction in the packet.
252
73
 
253
- Ordinary implementation defects stay within the agreed route and review findings go through remediation. Neither justifies changing scope, ignoring canonical project guidance, or relabeling unexpected breakage as transitional.
74
+ `dispatch_relay` is the final operational action. After it returns, give only a brief handoff summary: no further tool use, packet writes, work, or downstream supervision. If the tool is unavailable or dispatch fails, report the failure rather than claiming the next leg started.
@@ -0,0 +1,33 @@
1
+ // Generated from pi-packages/workflows/browser/pi-web-plugin.ts. Do not edit directly.
2
+ function canPrepareWorktreePrompt({ state, prompt }) {
3
+ const session = state.selectedSession;
4
+ return state.mainView === "chat"
5
+ && state.selectedWorkspace !== undefined
6
+ && session !== undefined
7
+ && !session.archived
8
+ && !session.pending
9
+ && prompt.getText() === "";
10
+ }
11
+ const plugin = {
12
+ apiVersion: 4,
13
+ name: "Workflows",
14
+ activate: () => ({
15
+ contributions: {
16
+ actions: [{
17
+ id: "worktree.create",
18
+ title: "Create Worktree",
19
+ description: "Prepare /worktree; describe its purpose and/or base branch before sending",
20
+ group: "Workflows",
21
+ enabled: canPrepareWorktreePrompt,
22
+ disabledReason: () => "Select an active conversation in Chat with an empty prompt first.",
23
+ run: (context) => {
24
+ if (!canPrepareWorktreePrompt(context))
25
+ return;
26
+ context.focusPrompt();
27
+ context.prompt.insertText("/worktree ");
28
+ },
29
+ }],
30
+ },
31
+ }),
32
+ };
33
+ export default plugin;
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@jmfederico/pi-web-workflows",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "description": "Opinionated PI WEB workflow prompts and shortcuts, starting with named Git worktree creation.",
7
+ "keywords": ["pi-package"],
8
+ "pi": {
9
+ "prompts": ["./prompts"]
10
+ },
11
+ "piWeb": {
12
+ "plugins": [
13
+ {
14
+ "id": "workflows",
15
+ "defaultEnabled": true,
16
+ "browserRoot": "browser",
17
+ "module": "browser/pi-web-plugin.js",
18
+ "machineSpecific": true
19
+ }
20
+ ]
21
+ }
22
+ }
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: Create a Git worktree named for its purpose
3
+ argument-hint: "Purpose and/or base branch"
4
+ ---
5
+
6
+ Create a Git worktree named for the user's purpose. Use the user-requested base, otherwise the current worktree's HEAD. If no purpose or description is provided, ask for one.
7
+
8
+ The user's input is within the `<worktree_request>` tags below.
9
+
10
+ <worktree_request>
11
+ $ARGUMENTS
12
+ </worktree_request>