taskplane 0.27.0 → 0.28.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.
@@ -125,6 +125,11 @@ export interface ParsedTask {
125
125
  * Null when no segment is active.
126
126
  */
127
127
  activeSegmentId?: string | null;
128
+ /**
129
+ * Step-to-segment checkbox mapping parsed from PROMPT.md `#### Segment:` markers.
130
+ * Populated by discovery (Phase A, TP-173). Undefined if not yet parsed.
131
+ */
132
+ stepSegmentMap?: StepSegmentMapping[];
128
133
  }
129
134
 
130
135
  /** Build a stable segment ID from task + repo identity (`<taskId>::<repoId>[::N]`). */
@@ -152,6 +157,21 @@ export function buildExpansionRequestId(timestamp = Date.now()): string {
152
157
  return `exp-${ts}-${random5}`;
153
158
  }
154
159
 
160
+ // ── Step-Segment Mapping (Phase A: segment-scoped worker visibility) ────
161
+
162
+ /** A group of checkboxes scoped to a single repo within a step. */
163
+ export interface SegmentCheckboxGroup {
164
+ repoId: string;
165
+ checkboxes: string[];
166
+ }
167
+
168
+ /** Maps a step to its repo-scoped checkbox groups. */
169
+ export interface StepSegmentMapping {
170
+ stepNumber: number;
171
+ stepName: string;
172
+ segments: SegmentCheckboxGroup[];
173
+ }
174
+
155
175
  /** One repo-scoped segment node for a task. */
156
176
  export interface TaskSegmentNode {
157
177
  segmentId: SegmentId;
@@ -569,7 +589,10 @@ export interface DiscoveryError {
569
589
  | "TASK_REPO_UNKNOWN"
570
590
  | "TASK_ROUTING_STRICT"
571
591
  | "SEGMENT_DAG_INVALID"
572
- | "SEGMENT_REPO_UNKNOWN";
592
+ | "SEGMENT_REPO_UNKNOWN"
593
+ | "SEGMENT_STEP_DUPLICATE_REPO"
594
+ | "SEGMENT_STEP_EMPTY"
595
+ | "SEGMENT_STEP_REPO_INVALID";
573
596
  message: string;
574
597
  taskPath?: string;
575
598
  taskId?: string;
@@ -593,6 +616,7 @@ export const FATAL_DISCOVERY_CODES: ReadonlyArray<DiscoveryError["code"]> = [
593
616
  "TASK_ROUTING_STRICT",
594
617
  "SEGMENT_DAG_INVALID",
595
618
  "SEGMENT_REPO_UNKNOWN",
619
+ "SEGMENT_STEP_DUPLICATE_REPO",
596
620
  ] as const;
597
621
 
598
622
  /** Result of the full discovery pipeline */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskplane",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "AI agent orchestration for pi — parallel task execution with checkpoint discipline",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -369,6 +369,64 @@ files and make sure their file scopes reflect that.
369
369
 
370
370
  ---
371
371
 
372
+ ## Multi-Repo Segment Markers
373
+
374
+ When a task spans multiple repos (e.g., shared-libs + web-client), the skill
375
+ must generate **segment markers** inside each step so the orchestrator can
376
+ route checkboxes to the correct repo's worker.
377
+
378
+ ### Workflow
379
+
380
+ 1. Read workspace config to identify available repos and their roles
381
+ 2. Analyze the task description and file scope — determine which repos are involved
382
+ 3. Group work into steps by logical goal, with segments per repo within each step
383
+ 4. Write PROMPT.md with `#### Segment: <repoId>` markers in every step
384
+ 5. Write STATUS.md with matching structure
385
+
386
+ ### Marker Format
387
+
388
+ Within each step, use level-4 headings to separate work by repo:
389
+
390
+ ```markdown
391
+ ### Step 1: Create utilities and API client
392
+
393
+ #### Segment: shared-libs
394
+
395
+ - [ ] Create string utility module
396
+ - [ ] Export from package index
397
+
398
+ #### Segment: web-client
399
+
400
+ - [ ] Add API client wrapper
401
+ - [ ] Wire into app initialization
402
+ ```
403
+
404
+ ### Ordering Rules
405
+
406
+ Order steps so that dependencies flow correctly:
407
+
408
+ 1. **Shared/common work** → early steps (e.g., shared libraries, schemas)
409
+ 2. **Per-repo implementation** → middle steps (consumers of shared work)
410
+ 3. **Integration/documentation** → final steps (always in the packet repo)
411
+
412
+ The final documentation/delivery step always uses `#### Segment: <packet-repo>`
413
+ where `<packet-repo>` is the repo that contains the task's PROMPT.md.
414
+
415
+ ### Guidelines
416
+
417
+ - **Always write explicit markers.** Never rely on the engine's single-segment
418
+ fallback for multi-repo tasks. Every step must have at least one
419
+ `#### Segment: <repoId>` marker.
420
+ - **Max 10 segments per task.** Tasks spanning more repos should be split into
421
+ separate tasks with dependencies.
422
+ - **Single-repo tasks do not need segment markers.** The engine's fallback
423
+ handles them correctly. Only add markers when file scope spans multiple repos.
424
+ - **When pre-decomposition isn't possible** (e.g., the worker must discover
425
+ which repos are affected), include guidance about using
426
+ `request_segment_expansion` for dynamic expansion at runtime.
427
+
428
+ ---
429
+
372
430
  ## Preventing Empty Completions
373
431
 
374
432
  Workers can shortcut tasks by observing that existing code "already satisfies"
@@ -88,6 +88,37 @@ Review Level 0 is ONLY for trivial changes. Most M+ tasks need Level ≥1.
88
88
  **Artifacts:**
89
89
  - `path/to/file` (new | modified)
90
90
 
91
+ > **Multi-repo variant:** When file scope spans multiple repos, use
92
+ > `#### Segment: <repoId>` markers within each step instead of flat checkboxes.
93
+ > Replace the single-repo Step 1 above with segment-annotated steps like:
94
+ >
95
+ > ```markdown
96
+ > ### Step 1: [Name]
97
+ >
98
+ > #### Segment: shared-libs
99
+ >
100
+ > - [ ] Create string utility module
101
+ > - [ ] Export from package index
102
+ >
103
+ > #### Segment: web-client
104
+ >
105
+ > - [ ] Add API client wrapper
106
+ > - [ ] Wire into app initialization
107
+ >
108
+ > ### Step [N]: Documentation & Delivery
109
+ >
110
+ > #### Segment: [packet-repo]
111
+ >
112
+ > - [ ] "Must Update" docs modified
113
+ > - [ ] Discoveries logged in STATUS.md
114
+ > ```
115
+ >
116
+ > Rules:
117
+ > - Always use explicit `#### Segment: <repoId>` markers (never rely on fallback)
118
+ > - Order: shared/common repos → per-repo impl → integration/docs (packet repo)
119
+ > - Final documentation/delivery step always uses the packet repo
120
+ > - Max 10 segments per task; split larger tasks with dependencies
121
+
91
122
  ### Step [N-1]: Testing & Verification
92
123
 
93
124
  > ZERO test failures allowed. This step runs the FULL test suite as a quality gate.
@@ -191,6 +222,14 @@ this from PROMPT.md.
191
222
 
192
223
  - [ ] [High-level placeholder — worker will expand]
193
224
 
225
+ [Multi-repo variant — use segment markers matching PROMPT.md:]
226
+
227
+ #### Segment: [repo-a]
228
+ - [ ] [Item in repo-a]
229
+
230
+ #### Segment: [repo-b]
231
+ - [ ] [Item in repo-b]
232
+
194
233
  ---
195
234
 
196
235
  ### Step [N-1]: Testing & Verification
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: task-worker-segment
3
+ description: Segment-scoped worker for multi-repo polyrepo tasks — works only on assigned segment checkboxes
4
+ tools: read,write,edit,bash,grep,find,ls
5
+ # model:
6
+ ---
7
+ ## Segment-Scoped Execution Rules
8
+
9
+ You are executing ONE SEGMENT of a multi-segment polyrepo task. Your iteration
10
+ prompt lists which checkboxes are yours under "Your checkboxes for this step:".
11
+
12
+ **YOUR RULES (these override any conflicting general rules):**
13
+
14
+ 1. **Only work on YOUR checkboxes** — the ones listed under "Your checkboxes
15
+ for this step:" in your iteration prompt. Do NOT work on checkboxes listed
16
+ under "Other segments in this step (NOT yours)."
17
+
18
+ 2. **When all YOUR checkboxes are checked, your segment is done — exit.**
19
+ Do not continue to other steps. Do not look for more work. Your segment
20
+ is complete.
21
+
22
+ 3. **Do NOT modify files in repos not available in your worktree.** You are
23
+ in a specific repo's worktree. Files in other repos are not accessible.
24
+
25
+ 4. **If you discover work needed in another repo**, use `request_segment_expansion`
26
+ with step definitions describing what the next segment's worker should do.
27
+ Include a `context` field explaining what you built and what the next worker
28
+ needs to know.
29
+
30
+ 5. **If your assigned checkbox list is empty**, do NOT exit as complete. Log a
31
+ blocker in STATUS.md and escalate — something is wrong with the task setup.
32
+
33
+ ## Context from Prior Segments
34
+
35
+ If your prompt includes "Context from prior segment," this was written by a
36
+ worker who discovered the need for your work. Read it carefully — it contains
37
+ knowledge about what was built in a prior segment that you need to build on.
38
+
39
+ ## Checkpoint Discipline
40
+
41
+ Same as the base worker prompt: check off each checkbox IMMEDIATELY after
42
+ completing it. Commit at step boundaries. The only difference is that your
43
+ "step" may contain only a subset of the full step's checkboxes (your segment's
44
+ portion).