pi-delegation-policy 0.1.0 → 0.1.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.1.2 - 2026-08-26
6
+
7
+ ### Fixed
8
+
9
+ - Restored the canonical role-selection guidance for bounded execution, planning and ambiguity, repetitive volume, and exceptional blockers.
10
+ - Made the `normal` and `aggressive` thresholds and the three Small/Medium preference biases operational at their boundaries.
11
+ - Corrected session-branch guidance: a session without policy state starts at `off`, while a fork inherits the latest valid entry in its active history.
12
+
13
+ ## 0.1.1 - 2026-08-26
14
+
15
+ ### Added
16
+
17
+ - Added a public task-oriented documentation site on GitHub Pages.
18
+
19
+ ### Fixed
20
+
21
+ - Clarified that the selector reset action changes the draft until you apply it.
22
+
23
+ ### Security
24
+
25
+ - Restricted documentation deployments to `main`, isolated pull request cancellation, and pinned privileged workflow actions.
26
+
5
27
  ## 0.1.0 - 2026-08-25
6
28
 
7
29
  ### Added
package/README.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  A local Pi extension that lets you choose delegation intensity and exact model references for Small, Medium, Large, and an optional UI Design role. It guides the main agent; it does not run, route, or enforce delegated work.
4
4
 
5
- > **Status:** Version 0.1.0 is available from npm. Every new session starts at `off`.
5
+ > **Status:** Version 0.1.2 is available from npm. Every new session starts at `off`.
6
+ >
7
+ > **Documentation:** Read the [documentation site](https://yivas.github.io/pi-delegation-policy/).
6
8
 
7
9
  ## What it does
8
10
 
@@ -37,7 +39,9 @@ It supports Pi `0.84.1`. Restart Pi or run `/reload` after installation. To inst
37
39
  /delegate reset Reset this session branch to off
38
40
  ```
39
41
 
40
- `Ctrl+Shift+D` opens the selector when the shortcut is available. The footer shows `D:OFF`, `D:NORM`, `D:AGG`, or `D:ERR` without replacing Pi's own status.
42
+ `Ctrl+Shift+D` opens the selector when the shortcut is available. There is no separate off shortcut; use `/delegate off` or choose `off` in the selector. Changes apply to the next agent run. An agent already running keeps the system prompt it started with.
43
+
44
+ The footer shows `D:OFF`, `D:NORM`, `D:AGG`, or `D:ERR` without replacing Pi's own status.
41
45
 
42
46
  ## Configuration
43
47
 
@@ -78,29 +82,36 @@ Schema version 1 is inactive and is not migrated automatically. Open `/delegate`
78
82
 
79
83
  ### Global defaults and session branches
80
84
 
81
- A new session or branch always starts at `off`. It inherits global model references and preference until `/delegate` changes a field in that branch. Session fields override only their matching global values. Selecting **Save effective configuration as defaults** copies the current roles, preference, and UI Design setting to the global file without copying intensity.
85
+ A new session with no delegation entry starts at `off`. A branch restores the latest valid delegation entry in its active history, so a fork created after `normal`, `aggressive`, or `off` inherits that state until the branch records another change. Global model references and preference apply until the session branch overrides their matching fields. Selecting **Save effective configuration as defaults** copies the current roles, preference, and UI Design setting to the global file without copying intensity.
82
86
 
83
87
  `/delegate reset` writes a session state with `off` and returns non-intensity fields to their global defaults.
84
88
 
85
89
  ### Intensity
86
90
 
87
- - `off` injects nothing. Invalid or incomplete defaults still show `D:OFF`.
88
- - `normal` delegates substantial, bounded, independent work when doing so saves effort without losing essential context.
89
- - `aggressive` favors delegating that work when its objective and acceptance criteria are clear.
91
+ - `off` injects nothing into the next agent run. Pi rebuilds the system prompt for each run, so a policy injected into an earlier run is absent; an agent already running is not rewritten. Invalid or incomplete defaults still show `D:OFF`.
92
+ - `normal` delegates substantial, separable work only when the expected benefit clearly outweighs briefing, supervision, review, and integration. It keeps borderline work with the main agent.
93
+ - `aggressive` delegates substantial, separable, independently checkable work by default when it has a clear objective and acceptance criteria. A plausible benefit can be enough, but tightly coupled work or clearly prohibitive overhead stays with the main agent.
90
94
 
91
- The main agent keeps global decisions, coordination, integration, and final review in every mode.
95
+ The main agent keeps global strategy, coordination, integration, final review, and work whose essential context is too costly or risky to transfer in every mode.
92
96
 
93
97
  ### Model roles and preference
94
98
 
95
99
  Active modes require exact `provider` and `model` references for Small, Medium, and Large. Pi must expose each reference in the current scope or available model catalog, and its provider must be authenticated. A missing, out-of-scope, unavailable, or unauthenticated role produces `D:ERR` and injects no policy. The extension never substitutes another model or role.
96
100
 
97
- The preference only changes the policy's selection bias:
101
+ The policy chooses a role and thinking together from task demand, difficulty, and quantity. No single factor decides the role:
102
+
103
+ - Small is habitual for bounded, planned, and verifiable execution. Difficult but well-defined work can remain Small with higher thinking.
104
+ - Medium can be selected directly when the combined demands materially require planning, ambiguity reduction, broad synthesis, several-module tracing, comparison, context coordination, or difficult decisions. Small does not need to fail first.
105
+ - Large is exceptional and only unblocks genuinely stuck work, such as persistent failures, severe framework conflicts, or contradictory hypotheses. Reliable prior evidence can justify it without ceremonial failed attempts.
106
+ - Large quantities of repetitive, independent work favor multiple Small delegations. Agent type does not determine the model role.
107
+
108
+ Preference shifts credible Small/Medium choices; a clearly better task fit overrides it:
98
109
 
99
- - `efficient` favors Small.
100
- - `standard` uses Small for routine work, Medium for planning, ambiguity, or broad synthesis, and Large for exceptional blockers.
101
- - `intensive` favors Medium.
110
+ - `efficient` favors Small more strongly and uses Medium when it provides a material advantage.
111
+ - `standard` reproduces the canonical policy and chooses Small on a genuine Small/Medium tie.
112
+ - `intensive` normally favors Medium for non-trivial bounded work when both roles are credible, while retaining Small for clearly narrow, routine, mechanical, or especially clear Small work.
102
113
 
103
- All three ordinary roles remain available in every preference. The main agent chooses thinking for each delegated task from the task, difficulty, volume, and model capabilities. Thinking is not configured or persisted by this extension.
114
+ All three ordinary roles remain available in every preference. The main agent chooses thinking for each delegated task from task demand, difficulty, quantity, and model capabilities. Thinking is not configured or persisted by this extension.
104
115
 
105
116
  UI Design is optional. When configured, it is limited to visual design direction, exploration, and review. It must not implement an interface, write code, or run tests. When it is off, ordinary roles handle design-related work.
106
117
 
package/SECURITY.md CHANGED
@@ -14,4 +14,4 @@ Include the affected version or commit, operating system, Pi version, reproducti
14
14
 
15
15
  ## Supported versions
16
16
 
17
- Only the latest published version is supported. Version 0.1.0 is the first supported release.
17
+ Only the latest published version is supported. Version 0.1.2 is the current supported release.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "pi-delegation-policy",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "private": false,
5
5
  "description": "A Pi extension for configurable delegation intensity and exact subagent role model references.",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "repository": "https://github.com/Yivas/pi-delegation-policy",
9
9
  "bugs": "https://github.com/Yivas/pi-delegation-policy/issues",
10
- "homepage": "https://github.com/Yivas/pi-delegation-policy",
10
+ "homepage": "https://yivas.github.io/pi-delegation-policy/",
11
11
  "keywords": [
12
12
  "pi-package",
13
13
  "pi-extension",
package/src/prompt.ts CHANGED
@@ -2,18 +2,34 @@ import { hasRuntimeError, type RuntimeState } from "./runtime.ts";
2
2
  import type { ModelRef, Preference } from "./types.ts";
3
3
 
4
4
  const NORMAL_POLICY =
5
- "Delegate substantial, bounded, and independent work when doing so reduces effort without losing essential context. Keep architecture, global strategy, coordination, integration, final review, and work whose context is costly or risky to transfer in the main agent.";
5
+ "Delegate substantial, separable work only when the expected benefit clearly outweighs briefing, supervision, review, and integration cost. Count parallelism as a benefit only when valuable work can advance now or elapsed time matters. A merely possible fresh perspective is not enough by itself. Keep borderline work with the main agent.";
6
6
  const AGGRESSIVE_POLICY =
7
- "Default to delegating substantial work with a clear objective and acceptance criteria. Keep global decisions, coordination, integration, final review, and work whose context is costly or risky to transfer in the main agent.";
7
+ "Default to delegating substantial, separable, independently checkable work with a clear objective and acceptance criteria. Delegate when the benefit is plausible even if not proven, including a useful independent perspective. Keep work with the main agent when it is poorly bounded, tightly coupled, dominated by integration or final accountability, or has clearly prohibitive delegation overhead.";
8
+
9
+ const ROLE_SELECTION_POLICY = `Choose the role and thinking together from the combination of:
10
+ - task demand: execute, search, plan, decide, or unblock;
11
+ - difficulty: clarity, ambiguity, dependencies, risk, and competing hypotheses;
12
+ - quantity: files, modules, systems, sources, and context volume.
13
+ No single factor decides the role.
14
+
15
+ Use Small habitually for bounded, planned, and verifiable work: concrete searches, scoped exploration, defined implementation, focused documentation, tests, reviews, mechanical changes, evident bugs, and bounded UI implementation whose design and stack are decided. Difficult but well-defined execution can remain Small with higher thinking.
16
+
17
+ Use Medium directly when the combined demands materially require defining a plan, reducing meaningful ambiguity, broad synthesis, tracing several modules, comparing sources or options, coordinating substantial context, or making difficult decisions. These are evidence, not automatic triggers. Small does not need to fail first.
18
+
19
+ Use Large only to unblock genuinely stuck work: persistent failures, severe framework conflicts, contradictory hypotheses, or reliable prior evidence that ordinary roles have not produced a trustworthy answer. Do not require ceremonial failed attempts. Large remains exceptional.
20
+
21
+ Large quantities of repetitive, independent work favor multiple Small delegations; volume alone does not justify Medium or Large. Agent type does not determine the model role. A clearly better task fit overrides preference; preference only shifts credible Small/Medium choices.
22
+
23
+ In every intensity, keep global strategy, coordination, integration, final review, and work whose essential context is too costly or risky to transfer with the main agent.`;
8
24
 
9
25
  function preferenceGuidance(preference: Preference): string {
10
26
  if (preference === "efficient") {
11
- return "Favor Small for routine delegated work. Medium and Large remain available when the task warrants them.";
27
+ return "Favor Small more strongly than standard. When Small can safely satisfy the acceptance criteria, choose it unless Medium provides a material advantage.";
12
28
  }
13
29
  if (preference === "intensive") {
14
- return "Favor Medium for substantial delegated work. Small and Large remain available when the task warrants them.";
30
+ return "When Small and Medium are both credible, normally prefer Medium. Keep Small for work that is clearly narrow, routine, mechanical, or an especially clear Small fit.";
15
31
  }
16
- return "Use Small for routine delegated work, Medium for planning, ambiguity, or broad synthesis, and Large only for exceptional blockers.";
32
+ return "Choose Small on a genuine Small/Medium tie; otherwise follow the role-selection policy above.";
17
33
  }
18
34
 
19
35
  function promptString(value: string): string {
@@ -42,9 +58,11 @@ export function buildDelegationPolicy(state: RuntimeState): string | undefined {
42
58
  Intensity: ${effective.intensity}.
43
59
  ${intensityPolicy}
44
60
 
61
+ ${ROLE_SELECTION_POLICY}
62
+
45
63
  Model preference: ${effective.preference}. ${preferenceGuidance(effective.preference)}
46
64
 
47
- Use the exact provider and model for the selected role. The references below use JSON string syntax; interpret escaped characters as JSON before use. Do not invent a fallback model or role. Choose thinking dynamically for each delegation from the task, difficulty, volume, and the selected model's capabilities. Do not treat thinking as persisted configuration.
65
+ Use the exact provider and model for the selected role. The references below use JSON string syntax; interpret escaped characters as JSON before use. Do not invent a fallback model or role. Choose thinking dynamically for each delegation from task demand, difficulty, quantity, and the selected model's capabilities. Do not treat thinking as persisted configuration.
48
66
 
49
67
  Roles:
50
68
  - Small: ${formatReference(effective.small)}
package/src/ui.ts CHANGED
@@ -30,7 +30,7 @@ const USE_GLOBAL_DEFAULT = "Use global default";
30
30
  const DISABLE_FOR_SESSION = "Disable for this session";
31
31
  const APPLY_TO_SESSION = "Apply changes to this session";
32
32
  const SAVE_AS_DEFAULTS = "Save effective configuration as defaults";
33
- const RESET_SESSION = "Reset session to off";
33
+ const RESET_SESSION = "Reset draft to off";
34
34
  const CANCEL = "Cancel";
35
35
 
36
36
  type ModelSelection =