@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 +24 -14
- package/extension/planner.js +22 -43
- package/package.json +1 -1
- package/prompts/change.md +3 -3
- package/prompts/commit.md +1 -1
- package/spec/workflow.md +26 -21
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
|
|
107
|
-
|
|
108
|
-
`
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
|
232
|
-
|
|
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.
|
|
280
|
-
`land
|
|
281
|
-
|
|
282
|
-
|
|
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
|
package/extension/planner.js
CHANGED
|
@@ -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
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
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
|
-
|
|
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,
|
|
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
|
|
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,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
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.
|
|
271
|
-
|
|
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
|