@gonrocca/zero-pi 0.1.60 → 0.1.61
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/README.md +17 -2
- package/extensions/sdd-agents.ts +18 -3
- package/extensions/zero-models.ts +15 -0
- package/package.json +1 -1
- package/prompts/orchestrator.md +8 -5
- package/prompts/phases/build.md +2 -0
- package/prompts/phases/explore.md +11 -2
package/README.md
CHANGED
|
@@ -207,8 +207,11 @@ strong analyze):
|
|
|
207
207
|
```
|
|
208
208
|
|
|
209
209
|
The `thinking` map sets each phase's pi effort level — one of `off`, `minimal`,
|
|
210
|
-
`low`, `medium`, `high`, `xhigh`.
|
|
211
|
-
|
|
210
|
+
`low`, `medium`, `high`, `xhigh`. An explicit entry always wins; a phase with no
|
|
211
|
+
entry (or an invalid level) falls back to the package default — `clarify:
|
|
212
|
+
medium`, `explore: high`, `plan: high`, `analyze: high`, `build: high`,
|
|
213
|
+
`veredicto: xhigh` — so no phase inherits your session-wide
|
|
214
|
+
`defaultThinkingLevel`. `autotuneBudget` is optional:
|
|
212
215
|
when `maxPhaseCostUsd` is set, autotune will not step a blamed phase up to a more
|
|
213
216
|
expensive tier if that phase/model is already at or above the average USD
|
|
214
217
|
ceiling with enough cost samples (`minSamples`, default 3). Set thinking from
|
|
@@ -233,6 +236,18 @@ audits the TDD evidence) and accepts `"off"` to disable the discipline.
|
|
|
233
236
|
`tdd.testCommand` overrides the auto-detected test runner the TDD cycle invokes;
|
|
234
237
|
leave it empty to let the build/veredicto phases detect it from the project.
|
|
235
238
|
|
|
239
|
+
### Token efficiency
|
|
240
|
+
|
|
241
|
+
The phase sub-agents run **without** your global project context
|
|
242
|
+
(`inheritProjectContext: false`): a global `AGENTS.md` is heavy and may carry
|
|
243
|
+
personal data or credentials no phase needs — project conventions still reach
|
|
244
|
+
the phases, because explore/build skim the repo's own `AGENTS.md`/`CLAUDE.md`.
|
|
245
|
+
Every phase runs at an explicit `thinking:` level (your `zero.json` entry wins;
|
|
246
|
+
gaps take the package defaults above), and explore works under a numeric
|
|
247
|
+
tool-call budget with a mid-budget stop check. The heavy lifting happens inside
|
|
248
|
+
the sub-agents on their own models — leave the session that runs `/forge` on
|
|
249
|
+
your cheap default model.
|
|
250
|
+
|
|
236
251
|
## Continuous integration
|
|
237
252
|
|
|
238
253
|
The `.github/workflows/zero-pi-ci.yml` workflow runs on every push to `main` and
|
package/extensions/sdd-agents.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { homedir } from "node:os";
|
|
|
17
17
|
import { dirname, join } from "node:path";
|
|
18
18
|
import { fileURLToPath } from "node:url";
|
|
19
19
|
|
|
20
|
-
import { isThinkingLevel } from "./zero-models.ts";
|
|
20
|
+
import { DEFAULT_THINKING, isThinkingLevel } from "./zero-models.ts";
|
|
21
21
|
import type { ThinkingLevel } from "./zero-models.ts";
|
|
22
22
|
|
|
23
23
|
/** The six SDD phases, in pipeline order, each backed by a
|
|
@@ -115,9 +115,13 @@ export function buildAgentFile(
|
|
|
115
115
|
if (thinking && isThinkingLevel(thinking)) front.push(`thinking: ${thinking}`);
|
|
116
116
|
front.push(`tools: ${PHASE_TOOLS[phase].join(", ")}`);
|
|
117
117
|
if (!PHASE_COMPLETION_GUARD[phase]) front.push("completionGuard: false");
|
|
118
|
+
// `inheritProjectContext: false` keeps the user's global AGENTS.md out of
|
|
119
|
+
// every phase sub-agent: it is heavy (re-sent to each phase) and may carry
|
|
120
|
+
// personal data or credentials no phase needs. Project conventions still
|
|
121
|
+
// reach the phases — explore/build skim the repo's own AGENTS.md/CLAUDE.md.
|
|
118
122
|
front.push(
|
|
119
123
|
"systemPromptMode: replace",
|
|
120
|
-
"inheritProjectContext:
|
|
124
|
+
"inheritProjectContext: false",
|
|
121
125
|
"inheritSkills: false",
|
|
122
126
|
"---",
|
|
123
127
|
);
|
|
@@ -176,6 +180,17 @@ export function phaseThinking(data: unknown, phase: Phase): ThinkingLevel | unde
|
|
|
176
180
|
return undefined;
|
|
177
181
|
}
|
|
178
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Resolve the effective `thinking:` level for a phase: the user's valid
|
|
185
|
+
* `zero.json` entry (or recoverable legacy suffix) wins; a missing or invalid
|
|
186
|
+
* entry falls back to the package default, so no generated agent ever inherits
|
|
187
|
+
* the session-wide `defaultThinkingLevel` from the user's settings. Exported
|
|
188
|
+
* for tests.
|
|
189
|
+
*/
|
|
190
|
+
export function resolvePhaseThinking(data: unknown, phase: Phase): ThinkingLevel {
|
|
191
|
+
return phaseThinking(data, phase) ?? DEFAULT_THINKING[phase];
|
|
192
|
+
}
|
|
193
|
+
|
|
179
194
|
/** Read the per-phase model from `~/.pi/zero.json`; `undefined` when absent. */
|
|
180
195
|
function readPhaseModel(phase: Phase): string | undefined {
|
|
181
196
|
try {
|
|
@@ -224,7 +239,7 @@ export default function register(_pi?: unknown): void {
|
|
|
224
239
|
body,
|
|
225
240
|
description,
|
|
226
241
|
readPhaseModel(phase),
|
|
227
|
-
readPhaseThinking(phase),
|
|
242
|
+
readPhaseThinking(phase) ?? DEFAULT_THINKING[phase],
|
|
228
243
|
);
|
|
229
244
|
writeFileSync(join(agentsDir, `zero-${phase}.md`), file, "utf8");
|
|
230
245
|
} catch {
|
|
@@ -88,6 +88,21 @@ const DEFAULT_MODELS: PhaseModels = {
|
|
|
88
88
|
veredicto: "claude-opus-4-8",
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
+
/** Package default thinking level per phase, used to fill any gap in the
|
|
92
|
+
* user's `zero.json` when the agent files are generated — so no phase ever
|
|
93
|
+
* inherits the session-wide `defaultThinkingLevel` from the user's settings.
|
|
94
|
+
* An explicit valid `zero.json` entry always wins. The gates get a level
|
|
95
|
+
* proportional to their job (clarify records assumptions, analyze reviews
|
|
96
|
+
* artifacts); veredicto keeps `xhigh` as the pipeline's adversarial guard. */
|
|
97
|
+
export const DEFAULT_THINKING: Record<Phase, ThinkingLevel> = {
|
|
98
|
+
clarify: "medium",
|
|
99
|
+
explore: "high",
|
|
100
|
+
plan: "high",
|
|
101
|
+
analyze: "high",
|
|
102
|
+
build: "high",
|
|
103
|
+
veredicto: "xhigh",
|
|
104
|
+
};
|
|
105
|
+
|
|
91
106
|
/** Model list used only when pi's model registry is unavailable. */
|
|
92
107
|
const FALLBACK_MODELS = [
|
|
93
108
|
"claude-opus-4-8",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gonrocca/zero-pi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.61",
|
|
4
4
|
"description": "zero-pi — an installable layer for pi (pi.dev): the zero spec-driven development workflow (clarify → explore → plan → analyze → build → veredicto) with automatic clarify/analyze gates, per-phase model autotune, and token-efficient batched builds. Adds capability to pi without modifying pi.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
package/prompts/orchestrator.md
CHANGED
|
@@ -260,11 +260,14 @@ and lists only the original four phases stays valid, and `clarify`/`analyze`
|
|
|
260
260
|
fall back to their defaults (`clarify` cheap/fast, `analyze` strong). Configure
|
|
261
261
|
all six through `/zero-models`.
|
|
262
262
|
|
|
263
|
-
The `thinking` map is optional and partial:
|
|
264
|
-
|
|
265
|
-
default
|
|
266
|
-
|
|
267
|
-
|
|
263
|
+
The `thinking` map is optional and partial: an explicit valid entry always
|
|
264
|
+
wins, and a phase with no entry (or an invalid level) falls back to the package
|
|
265
|
+
default — `clarify: medium`, `explore: high`, `plan: high`, `analyze: high`,
|
|
266
|
+
`build: high`, `veredicto: xhigh` — so no phase silently inherits the
|
|
267
|
+
session-wide `defaultThinkingLevel` from the user's settings. Every generated
|
|
268
|
+
`zero-<phase>.md` therefore carries a `thinking: <level>` line in its
|
|
269
|
+
frontmatter (placed after `model:` and before `systemPromptMode:`), so the
|
|
270
|
+
sub-agent runs at that effort level.
|
|
268
271
|
|
|
269
272
|
## Language Boundary
|
|
270
273
|
|
package/prompts/phases/build.md
CHANGED
|
@@ -22,6 +22,8 @@ re-read a file you already read this run unless you have changed it since —
|
|
|
22
22
|
re-reading the same large file repeatedly is the main avoidable token cost. If
|
|
23
23
|
the code roots are missing or wrong, run a single targeted search to fix them,
|
|
24
24
|
then proceed — never fall back to scanning the whole tree.
|
|
25
|
+
If the project root carries an `AGENTS.md` or `CLAUDE.md`, skim it once for
|
|
26
|
+
project conventions — you receive no global user context.
|
|
25
27
|
|
|
26
28
|
Implement the planned tasks in dependency order, test-first where practical. `tasks.md` is a dependency-aware graph: every task has a `depends:` line. Before starting a task, verify each listed dependency is already `[x]`; if a dependency is unchecked, complete that dependency first (when it is in your assigned batch) or stop and report the blocked task (when it is outside the assigned batch). Never skip ahead just because a later task looks easier. Keep every change within the plan's scope — do not expand it on your own initiative.
|
|
27
29
|
|
|
@@ -13,6 +13,8 @@ is normal; do not treat the missing directory as an error.
|
|
|
13
13
|
Investigate the codebase and the feature request read-only. Do not modify any
|
|
14
14
|
files. Map the relevant modules, the existing patterns and conventions, the
|
|
15
15
|
integration points, and the constraints. Identify the risks and the unknowns.
|
|
16
|
+
If the project root carries an `AGENTS.md` or `CLAUDE.md`, skim it once for
|
|
17
|
+
project conventions — you receive no global user context.
|
|
16
18
|
|
|
17
19
|
**Size exploration to the request.** Match breadth to what the change actually
|
|
18
20
|
needs. A localized change — copy/text, one component, a config value, a single
|
|
@@ -21,8 +23,15 @@ wiring; do not map the full permission/billing model or unrelated subsystems
|
|
|
21
23
|
unless the request touches them. A cross-cutting or architectural change earns
|
|
22
24
|
full breadth. Stop once you can name the exact files to change and their
|
|
23
25
|
constraints — reading past that point burns tokens without improving the plan.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
|
|
27
|
+
**Exploration budget.** Classify the request from `request.md` before the first
|
|
28
|
+
tool call: a localized change gets a budget of **20 tool calls**; a
|
|
29
|
+
cross-cutting or architectural change gets **40**. At half budget, checkpoint:
|
|
30
|
+
if you can already name the exact files to change and their constraints, STOP
|
|
31
|
+
and write the findings. Exceeding the budget requires a
|
|
32
|
+
`Budget exceeded: <concrete reason>` line inside `findings.md`, and whatever you
|
|
33
|
+
did not get to goes into a `## Unknowns` section of the findings instead of more
|
|
34
|
+
reading.
|
|
26
35
|
|
|
27
36
|
**Scope every search to the project, never the filesystem root.** Search inside
|
|
28
37
|
the repo/code directory you are working in. A `find`, `grep -r`, or `rg` rooted
|