@dpeek/codeless 0.1.3 → 0.1.4

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 CHANGED
@@ -103,13 +103,14 @@ Required prompts and directions must exist for stream creation and opening.
103
103
  The package-owned planner extension activates every planner session. Before its
104
104
  first project prompt, it requires the exact `<slug>-planner` Pi name and verifies
105
105
  the `<slug>_planner` Herdr identity, managed interactive readiness, foreground
106
- worktree, and matching native session reference from Herdr's Pi lifecycle
107
- integration. It confirms `approve_stream_change`,
108
- `dispatch_stream_implementer`, `rework_stream_implementer`, `finish_stream_implementer`, and `next_stream_change` are active. Missing or
109
- incompatible activation, identity mismatch, or inactive tools stops before
110
- `/change`. During session replacement, activation allows a brief bounded wait for
111
- an otherwise-valid Herdr identity to publish the current native Pi reference;
112
- it never waits on a wrong name, process, lifecycle source, or worktree. Global
106
+ worktree, and Herdr's official Pi lifecycle authority and session reporter. It confirms
107
+ `approve_stream_change`, `dispatch_stream_implementer`,
108
+ `rework_stream_implementer`, `finish_stream_implementer`, and
109
+ `next_stream_change` are active. Missing or incompatible activation, identity
110
+ mismatch, or inactive tools stops before `/change`. Pi's active command context
111
+ owns the live conversation identity. Codeless requires Herdr's official reporter
112
+ but treats its native session-reference value as asynchronous restore metadata,
113
+ not an activation prerequisite. Global
113
114
  installation of Codeless's extension is unnecessary.
114
115
  The approval tool has no arguments. Its extension derives the active
115
116
  `<slug>-planner` Pi session and passes it to the backing CLI, which requires it
@@ -131,7 +132,13 @@ replaces the Pi session in the same pane. It preserves the planner name, applies
131
132
  the planner selection read and validated after the stream fast-forwards to the
132
133
  captured integration commit, then activates and verifies the replacement before
133
134
  sending `/change` after resources reload. The previous conversation is not copied; the
134
- journal and project files carry context.
135
+ journal and project files carry context. The fresh planner reads repository guidance,
136
+ its journal, and current direction first. It stops on wholly gated work, uses the
137
+ latest numbered change only for active or ambiguous recovery, and reads older changes
138
+ only for journal-linked unresolved decisions. After selecting an ungated candidate it
139
+ reads relevant contracts and implementation; after a fast-forward it also rereads
140
+ current direction and files affected by incoming commits, without mining deleted or
141
+ historical documents for work.
135
142
 
136
143
  This uses Pi's `newSession({ setup, withSession })` command API, verified with
137
144
  Pi 0.85.1. Only the replacement context activates the selection and sends the
@@ -228,8 +235,10 @@ only when absent, and uses `herdr agent start` for named, readiness-checked Pi
228
235
  startup. It verifies the result before sending activation. An occupied or
229
236
  mismatched pane, unmanaged agent, ambiguous layout, or failed startup stops;
230
237
  Codeless never takes over an existing agent. Pi's display name is separate from
231
- Herdr's managed agent name. Activation verifies names and native session binding;
232
- it never renames an unmanaged process. There is no direct `planner` command.
238
+ Herdr's managed agent name. Activation verifies the names, process, lifecycle
239
+ authority, and worktree without correlating Herdr's asynchronous restore
240
+ reference to Pi's live session; it never renames an unmanaged process. There is
241
+ no direct `planner` command.
233
242
 
234
243
  Dispatch validates the implementer selection before touching the planner's
235
244
  right-hand pane, starts a fresh ephemeral implementer with Codeless's reporting
@@ -276,10 +285,11 @@ the integration checkout. Success releases the lock. Other branches and
276
285
  checkouts are untouched; no push is performed.
277
286
 
278
287
  Another lock owner causes a stop, without queuing or polling. Rebase conflicts
279
- or failed checks retain ownership. Resolve the existing failure, then rerun
280
- `land`; it verifies the recorded integration commit has not changed. To abandon
281
- a landing, inspect the owner/base and Git state before manually removing the
282
- lock. There is no automatic stale-lock removal or retry.
288
+ or failed checks retain ownership. During conflict resolution, run focused checks
289
+ when useful; rerun `land` for the configured full check, which it alone owns.
290
+ It verifies the recorded integration commit has not changed. To abandon a landing,
291
+ inspect the owner/base and Git state before manually removing the lock. There is
292
+ no automatic stale-lock removal or retry.
283
293
 
284
294
  `next` is the session handoff's preparation command. It requires the stream's
285
295
  own clean worktree and latest numbered change, a full commit hash present in its
@@ -4,8 +4,6 @@ import { validAttempt } from "../src/attempt.ts";
4
4
 
5
5
  const codeless = fileURLToPath(new URL("../bin/codeless", import.meta.url));
6
6
  const thinkingLevels = new Set(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
7
- const nativeSessionAttempts = 20;
8
- const nativeSessionRetryDelayMs = 50;
9
7
  const requiredTools = [
10
8
  "approve_stream_change",
11
9
  "dispatch_stream_implementer",
@@ -96,47 +94,28 @@ export default function plannerExtension(pi) {
96
94
  throw new Error("Herdr returned an invalid planner identity response");
97
95
  }
98
96
  };
99
- const attempts = activation ? nativeSessionAttempts : 1;
100
- for (let attempt = 0; attempt < attempts; attempt += 1) {
101
- const agent = await plannerIdentity();
102
- if (agent?.name !== expectedPlanner) {
103
- throw new Error(
104
- `Codeless planner identity is ${agent?.name ?? "missing"}, expected ${expectedPlanner}; exit this agent and run codeless open ${match[1]} from another Herdr shell`,
105
- );
106
- }
107
- if (agent.agent !== "pi" || agent.interactive_ready !== true) {
108
- throw new Error("Codeless requires a Herdr-managed Pi planner started by codeless open");
109
- }
110
- if (
111
- typeof agent.foreground_cwd !== "string" ||
112
- resolve(agent.foreground_cwd) !== resolve(ctx.cwd)
113
- ) {
114
- throw new Error("Codeless planner worktree does not match Herdr's foreground cwd");
115
- }
116
- const session = agent.agent_session;
117
- const expectedSession =
118
- session?.kind === "path"
119
- ? ctx.sessionManager.getSessionFile()
120
- : session?.kind === "id"
121
- ? ctx.sessionManager.getSessionId()
122
- : undefined;
123
- if (
124
- agent.screen_detection_skipped !== true ||
125
- session?.source !== "herdr:pi" ||
126
- session.agent !== "pi" ||
127
- !expectedSession
128
- ) {
129
- throw new Error(
130
- "Codeless planner native session does not match Herdr's Pi lifecycle integration",
131
- );
132
- }
133
- if (session.value === expectedSession) break;
134
- if (attempt === attempts - 1) {
135
- throw new Error(
136
- "Codeless planner native session does not match Herdr's Pi lifecycle integration",
137
- );
138
- }
139
- await new Promise((resolveDelay) => setTimeout(resolveDelay, nativeSessionRetryDelayMs));
97
+ const agent = await plannerIdentity();
98
+ if (agent?.name !== expectedPlanner) {
99
+ throw new Error(
100
+ `Codeless planner identity is ${agent?.name ?? "missing"}, expected ${expectedPlanner}; exit this agent and run codeless open ${match[1]} from another Herdr shell`,
101
+ );
102
+ }
103
+ if (agent.agent !== "pi" || agent.interactive_ready !== true) {
104
+ throw new Error("Codeless requires a Herdr-managed Pi planner started by codeless open");
105
+ }
106
+ if (
107
+ typeof agent.foreground_cwd !== "string" ||
108
+ resolve(agent.foreground_cwd) !== resolve(ctx.cwd)
109
+ ) {
110
+ throw new Error("Codeless planner worktree does not match Herdr's foreground cwd");
111
+ }
112
+ const session = agent.agent_session;
113
+ if (
114
+ agent.screen_detection_skipped !== true ||
115
+ session?.source !== "herdr:pi" ||
116
+ session.agent !== "pi"
117
+ ) {
118
+ throw new Error("Codeless planner requires Herdr's Pi lifecycle integration");
140
119
  }
141
120
  const activeTools = ctx.getSystemPromptOptions().selectedTools ?? [];
142
121
  const missing = requiredTools.filter((tool) => !activeTools.includes(tool));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dpeek/codeless",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "An attended planner and implementer workflow for parallel capability development",
5
5
  "homepage": "https://github.com/dpeek/codeless#readme",
6
6
  "bugs": {
package/prompts/change.md CHANGED
@@ -5,11 +5,11 @@ argument-hint: "<stream-directory> <direction-file>"
5
5
 
6
6
  You are the planner for the stream at `$1`. The current working directory is the stream's repository worktree.
7
7
 
8
- Read the repository guidance, `.codeless/config.json`, `$1/planner.md`, every numbered Markdown file in `$1/changes/`, `$2`, its related contracts, and the current implementation relevant to the stream. Resolve the integration branch from that configuration.
8
+ First read the repository guidance, `$1/planner.md`, and `$2`. Read `.codeless/config.json` to resolve the integration branch. Current direction is authoritative for candidate discovery: do not mine deleted or historical documents for work when it is clear. If `planner.md` shows no active work and current direction has no ungated worthwhile candidate, stop rather than reading more context.
9
9
 
10
- Before proposing, inspect the branch, recent commits, and worktree. If changes are not explained as an active approved change in `planner.md`, stop and show the operator the evidence. Never discard work automatically.
10
+ Before proposing, inspect the branch, recent commits, and worktree. If changes are not explained as an active approved change in `planner.md`, stop and show the operator the evidence. Never discard work automatically. Read the latest numbered change only when active or ambiguous work needs recovery. Read an older numbered change only when `planner.md` identifies its unresolved decision as still relevant.
11
11
 
12
- If the latest numbered change is approved but uncommitted, resume it. If it is committed but unlanded on the configured integration branch, resume review or landing. Otherwise require a clean worktree with no commits outside the configured integration branch, fast-forward to that branch, and reread the direction and affected contracts. Stop on divergence. Once planning begins, keep that stream commit as the proposal's base; do not resynchronize merely because integration advances while the proposal awaits approval. Locked landing owns the later rebase.
12
+ If the latest numbered change is approved but uncommitted, resume it. If it is committed but unlanded on the configured integration branch, resume review or landing. Otherwise select an ungated candidate from current direction, require a clean worktree with no commits outside the configured integration branch, and fast-forward to that branch. After fast-forwarding, reread `$2`, every file affected by incoming commits, and the affected contracts and implementation; do not mine deleted or historical documents. Stop on divergence. Once planning begins, keep that stream commit as the proposal's base; do not resynchronize merely because integration advances while the proposal awaits approval. Locked landing owns the later rebase.
13
13
 
14
14
  Propose exactly one small, complete change and write it to `$1/change.md`:
15
15
 
package/prompts/commit.md CHANGED
@@ -32,6 +32,6 @@ The next planner proposes one change and waits for the operator's `go`; this han
32
32
  There are two expected landing stops:
33
33
 
34
34
  - If another stream owns the integration slot, leave this stream committed where it is, report the owner, and wait. Do not poll, queue, or retry automatically.
35
- - If this stream owns the slot and the rebase conflicts, keep the slot. Resolve the conflicts in this worktree so both the current configured integration branch and the approved change are preserved, stage the resolutions, and continue the rebase with `GIT_EDITOR=true git rebase --continue`. Repeat until the rebase completes, run the relevant checks, then run `codeless land <slug>` again to finish. The slot prevents another automated landing from moving the integration branch while you resolve it.
35
+ - If this stream owns the slot and the rebase conflicts, keep the slot. Resolve the conflicts in this worktree so both the current configured integration branch and the approved change are preserved, stage the resolutions, and continue the rebase with `GIT_EDITOR=true git rebase --continue`. Repeat until the rebase completes. Run focused checks when useful to validate a resolution, then run `codeless land <slug>` again to finish; `land` alone runs the configured full check. The slot prevents another automated landing from moving the integration branch while you resolve it.
36
36
 
37
37
  For any other failure while this stream owns the slot, report the exact state and wait for the operator. The slot remains held for deliberate recovery; never remove the workspace's landing lock automatically or on guesswork.
package/spec/workflow.md CHANGED
@@ -140,23 +140,23 @@ existing managed planner focuses it without installation or another prompt.
140
140
  The package-owned extension activates creation, reopening, and post-landing
141
141
  replacement. Before the first project prompt it requires the exact
142
142
  `<slug>-planner` Pi name, `<slug-with-hyphens-replaced>_planner` Herdr name,
143
- managed interactive readiness, matching foreground worktree, and the current
144
- native Pi session ID/file reported by Herdr's official Pi lifecycle integration.
145
- It verifies `approve_stream_change`, `dispatch_stream_implementer`,
146
- `rework_stream_implementer`, `finish_stream_implementer`, and `next_stream_change`
147
- are active. During replacement, an otherwise-valid previous native session
148
- reference receives a brief bounded synchronization wait; a wrong name, process,
149
- lifecycle source, or worktree fails immediately. Any binding that remains missing
150
- or incompatible stops visibly before `/change`. Activation never repairs names.
151
- The direct `planner` command is removed;
152
- recovery exits Pi deliberately and reopens from another Herdr shell.
143
+ managed interactive readiness, matching foreground worktree, Herdr's official Pi
144
+ lifecycle authority and reporter, and the active planner tools. A wrong name,
145
+ process, lifecycle source, worktree, or tool set stops visibly before `/change`.
146
+ Activation never repairs names. Pi's active command context owns the live
147
+ conversation identity. Codeless requires Herdr's official session reporter but
148
+ treats its native session-reference value as asynchronous restore metadata; it
149
+ does not correlate that value with the active Pi session or wait for a changed
150
+ value. The direct `planner` command is removed; recovery exits Pi
151
+ deliberately and reopens from another Herdr shell.
153
152
 
154
153
  Pi session replacement keeps the managed process and Herdr name while changing
155
- its native conversation reference. Codeless revalidates that new binding before
156
- prompting the replacement. Implementers use the corresponding `_impl` and
157
- `-impl` names. Codeless loads its own extension explicitly; Herdr's official Pi
158
- integration supplies lifecycle and native-session reporting. This boundary was
159
- verified against Herdr 0.8.2 and Pi 0.85.1.
154
+ its native conversation reference. Codeless revalidates the replacement's Pi
155
+ name, selection, tools, and Herdr process/lifecycle/worktree binding before
156
+ prompting it. Implementers use the corresponding `_impl` and `-impl` names.
157
+ Codeless loads its own extension explicitly; Herdr's official Pi integration
158
+ supplies lifecycle and native-session reporting. This boundary was verified
159
+ against Herdr 0.8.2 and Pi 0.85.1.
160
160
 
161
161
  ## Dispatch and review
162
162
 
@@ -213,7 +213,8 @@ integration commit.
213
213
  If the integration branch advanced, landing rebases the single stream commit. It then
214
214
  rereads and runs the configured project check in the stream worktree, requires checks to
215
215
  leave the worktree clean, and fast-forwards the dedicated integration checkout. Only
216
- successful completion releases the lock.
216
+ successful completion releases the lock. Conflict recovery may run focused checks to
217
+ validate resolutions, but only `land` runs the configured full check after rebase.
217
218
 
218
219
  A lock owned by another stream stops landing without polling. A rebase conflict, failed
219
220
  check, or other error after acquisition retains this stream's lock for deliberate
@@ -234,7 +235,13 @@ validates the updated direction, prompts, and planner selection, and returns the
234
235
  session name and `/change` prompt. The extension replaces the Pi session in the same
235
236
  pane, preserves its name, activates the validated selection and planner identity, and
236
237
  only then sends the project prompt. Conversation history is not copied; the journal and
237
- project files carry durable context.
238
+ project files carry durable context. The prompt first reads repository guidance, the
239
+ journal, and current direction; it stops when work is wholly gated. It reads the latest
240
+ numbered change only for active or ambiguous recovery and older changes only for
241
+ journal-identified unresolved decisions. Current direction selects candidates before
242
+ relevant contracts and implementation are inspected. After a baseline fast-forward, it
243
+ rereads current direction plus files affected by incoming commits, affected contracts,
244
+ and code, without mining deleted or historical documents for work.
238
245
 
239
246
  A cancelled or failed replacement stops for operator attention. Landing remains
240
247
  complete, and any successful preparation fast-forward remains applied. There is no
@@ -267,10 +274,8 @@ an approval source, or a recovery mechanism.
267
274
  ## Limits
268
275
 
269
276
  Codeless is attended and intentionally has no supervisor, project registry, queue,
270
- automatic landing retry, stale-lock recovery, or unattended approval. Planner startup
271
- reads every numbered change, and conflict recovery currently causes the configured
272
- landing check to run twice. Because the default state is ignored, `git clean -fdx` can
273
- delete it.
277
+ automatic landing retry, stale-lock recovery, or unattended approval. Because the
278
+ default state is ignored, `git clean -fdx` can delete it.
274
279
 
275
280
  The single-active-change rule and the requirement to dispatch only approved input still
276
281
  partly depend on planner instructions. Approval reconciles records and hashes but does