@gonrocca/zero-pi 0.1.40 → 0.1.42

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.
@@ -98,7 +98,7 @@ export function composeStatusline(p: StatuslineParts): string {
98
98
 
99
99
  if (p.branch) parts.push(fg(STEEL, p.branch));
100
100
 
101
- if (p.brand) parts.push(fg(AMBER, p.brand));
101
+ if (p.brand) parts.push(fg(VIOLET, p.brand));
102
102
 
103
103
  return parts.join(SEP);
104
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gonrocca/zero-pi",
3
- "version": "0.1.40",
3
+ "version": "0.1.42",
4
4
  "description": "zero-pi — an installable layer for pi (pi.dev): the zero spec-driven development workflow, per-phase model autotune, and skill auto-learning. Adds capability to pi without modifying pi.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -103,6 +103,46 @@ and the adversarial veredicto. Delegate each phase to its sub-agent and wait
103
103
  for its result. The orchestrator keeps control of phase order and the round
104
104
  count — the sub-agents only carry out their own phase.
105
105
 
106
+ ## Build batching
107
+
108
+ The **build** phase is not one monolithic sub-agent that implements every
109
+ remaining task in a single growing context — that is what drove a real run to
110
+ 463k tokens, 39 minutes, and a dropped connection. Run build as a loop of
111
+ bounded batches, each a fresh `zero-build` sub-agent.
112
+
113
+ Before delegating build — a fresh build phase, or a `corregir`/`replantear`
114
+ re-run — drive this loop:
115
+
116
+ 1. Read the unchecked (`[ ]`) tasks from `tasks.md` in listed order and their
117
+ `review: ~N changed lines` estimates from the `## Review Workload` section.
118
+ 2. Group the unchecked tasks into ordered batches with this exact, deterministic
119
+ rule:
120
+ - Walk the unchecked tasks in order, accumulating into the current batch.
121
+ - Start a new batch when adding the next task would push the batch's summed
122
+ estimate over **800 changed lines**, or when the current batch already
123
+ holds **4 tasks** — whichever comes first.
124
+ - A single task whose own estimate exceeds 800 is its own batch.
125
+ - If estimates are missing or unparseable, group by the 4-task cap alone.
126
+ 3. Invoke `zero-build` once per batch, in listed order. Each brief is a fresh
127
+ sub-agent (no carried conversation) and names the batch's task numbers
128
+ explicitly (for example, "implement tasks 4–6 only, then return"). Emit the
129
+ build phase-start line for each batch, noting the batch as `lote <i>/<n>`, so
130
+ the loop stays visible. Wait for each batch to return before starting the
131
+ next.
132
+ 4. Repeat until `tasks.md` has no `[ ]` task left, then run **veredicto** once.
133
+ Never run veredicto between batches.
134
+
135
+ **Single-batch features behave exactly like before:** when every unchecked task
136
+ fits one batch, build is invoked exactly once.
137
+
138
+ **Batches are not rounds.** An entire batched build — however many batches it
139
+ took — is one build phase and counts as one build/veredicto round. Batch count
140
+ never touches the iteration cap. A `corregir` verdict re-runs the whole build
141
+ phase (re-batching whatever tasks its defects reopened) as the next round.
142
+
143
+ **Resume is unaffected.** Each batch marks its tasks `[x]` as they land, so an
144
+ interrupted batched build resumes from the first `[ ]` task with no new state.
145
+
106
146
  ## Model configuration
107
147
 
108
148
  The per-phase model assignments live in `~/.pi/zero.json`: `models` maps each
@@ -13,11 +13,32 @@ resume sees the progress. Sanity-check that `tasks.md` parses as a checklist
13
13
  before trusting it. If `tasks.md` is missing, report the missing prerequisite
14
14
  and stop — do **not** fabricate a plan.
15
15
 
16
+ **Locating the code — read, do not search.** Before editing, read the
17
+ `## Code roots` section in `design.md` (or the explore findings) to get the
18
+ absolute paths of the code this feature touches, and read each task's `files:`
19
+ bullet for the exact files. Go straight to those paths. Do **not** run a
20
+ filesystem-wide `find`/`grep` to discover where the code lives, and do **not**
21
+ re-read a file you already read this run unless you have changed it since —
22
+ re-reading the same large file repeatedly is the main avoidable token cost. If
23
+ the code roots are missing or wrong, run a single targeted search to fix them,
24
+ then proceed — never fall back to scanning the whole tree.
25
+
16
26
  Implement the planned tasks in order, test-first where practical. Keep every
17
27
  change within the plan's scope — do not expand it on your own initiative.
18
28
 
19
- Run the test suite and make it pass before reporting the phase complete. Report
20
- what you changed so the veredicto phase has something concrete to review.
29
+ **Scope to your batch.** When the brief names a batch a set or contiguous
30
+ range of task numbers implement exactly those tasks, mark each `[x]`, and
31
+ **return**; do not continue into later unchecked tasks (the orchestrator drives
32
+ the next batch). When the brief names no batch, implement all remaining `[ ]`
33
+ tasks. A task that depends on code an earlier batch already wrote reads the
34
+ current file via its `files:` touch-list and the design's code roots — never
35
+ assume an earlier batch's context is still present.
36
+
37
+ Make the test suite pass before reporting the phase complete, but **batch the
38
+ verification**: run the suite or boot a smoke-test server at meaningful
39
+ checkpoints — once per task group and once at the end — not after every single
40
+ edit. Report what you changed so the veredicto phase has something concrete to
41
+ review.
21
42
 
22
43
  **Return contract.** Return a concise result envelope to the orchestrator: your
23
44
  phase's outcome (findings, plan, build result, or verdict with its concrete
@@ -17,6 +17,15 @@ integration points, and the constraints. Identify the risks and the unknowns.
17
17
  Produce a concise findings report the **plan** phase can build on: what exists,
18
18
  what is relevant to the request, and what to watch out for.
19
19
 
20
+ **Record the code roots.** The findings must open with a `## Code roots` section
21
+ listing the absolute path of every code directory relevant to this feature (for
22
+ example `E:\proj\api`, `E:\proj\web`) — the actual roots where you found the
23
+ relevant modules, never the `.sdd/` directory. When the spec lives on a
24
+ different drive or path than the code, say so explicitly. The build phase reads
25
+ this section to go straight to the code instead of searching the filesystem, so
26
+ it must be accurate and absolute. If you genuinely cannot locate the code,
27
+ record that the code root is unknown rather than guessing.
28
+
20
29
  If the orchestrator includes prior-run memory in your brief, use it: past runs
21
30
  record what already broke in this code and which plans were sent back. Fold the
22
31
  relevant points into the findings under a "Prior runs" heading.
@@ -54,9 +54,13 @@ Write all four into `.sdd/<slug>/`:
54
54
  `### REQ:` name line. Any section may be empty or absent; a block name must be
55
55
  unique within and across the delta's sections and not collide with an existing
56
56
  store name unless it is the target of MODIFIED/REMOVED.
57
- - **`design.md`** — how it is built (unchanged from before).
57
+ - **`design.md`** — how it is built. It must carry forward the `## Code roots`
58
+ section from the explore findings — the absolute paths of the code directories
59
+ this feature touches — so the build phase never has to search for the code.
58
60
  - **`tasks.md`** — the ordered task list, keeping its `## Review Workload`
59
- section (see below).
61
+ section (see below). Every task entry must carry a `files:` bullet naming the
62
+ absolute (or code-root-relative) paths it creates or edits, marking new files
63
+ `(new)`, so the build phase edits them directly instead of rediscovering them.
60
64
 
61
65
  Honour the prior-run lessons carried in the explore findings: when a past run
62
66
  was sent back with `replantear`, do not repeat the plan mistake it recorded.
@@ -42,7 +42,7 @@
42
42
  "mdLink": "cyan",
43
43
  "mdLinkUrl": "dimSteel",
44
44
  "mdCode": "mint",
45
- "mdCodeBlock": "",
45
+ "mdCodeBlock": "mint",
46
46
  "mdCodeBlockBorder": "blue",
47
47
  "mdQuote": "steel",
48
48
  "mdQuoteBorder": "dimSteel",