@dpeek/codeless 0.1.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.
- package/README.md +242 -0
- package/bin/codeless +10 -0
- package/extension/planner.js +336 -0
- package/package.json +47 -0
- package/spec/workflow.md +200 -0
- package/src/cli.ts +924 -0
- package/src/metrics.ts +155 -0
- package/src/pi.ts +174 -0
- package/src/project.ts +55 -0
package/spec/workflow.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Codeless workflow
|
|
2
|
+
|
|
3
|
+
Codeless is an attended workflow for delivering independent capability changes
|
|
4
|
+
through a project's integration branch. This contract owns the implemented
|
|
5
|
+
workflow; the [project guide](../README.md) explains installation, operation,
|
|
6
|
+
and reusable execution mechanics. Missing workflow behavior belongs in
|
|
7
|
+
[the workflow todo](../todo/workflow.md).
|
|
8
|
+
|
|
9
|
+
## Stream and change lifecycle
|
|
10
|
+
|
|
11
|
+
A stream has one lowercase kebab-case slug, one `stream/<slug>` branch and
|
|
12
|
+
worktree, one planner, one implementer pane, and at most one approved change in
|
|
13
|
+
progress. Work inside a stream is sequential:
|
|
14
|
+
|
|
15
|
+
1. create or reopen the stream from the configured integration branch;
|
|
16
|
+
2. propose one small change and wait for operator approval;
|
|
17
|
+
3. preserve the approved proposal as a numbered change;
|
|
18
|
+
4. dispatch a fresh implementer, review, and remediate in the same implementer
|
|
19
|
+
session when necessary;
|
|
20
|
+
5. create exactly one reviewed commit and land it through the shared integration
|
|
21
|
+
slot; and
|
|
22
|
+
6. replace the planner session before proposing another change.
|
|
23
|
+
|
|
24
|
+
Automated landing updates only the configured integration branch's dedicated
|
|
25
|
+
clean checkout. Other branches and checkouts are neither stream sources nor
|
|
26
|
+
landing targets. Codeless does not push.
|
|
27
|
+
|
|
28
|
+
Each project supplies `.codeless/config.json`, a direction at
|
|
29
|
+
`todo/<slug>.md`, and `change`, `implement`, `review`, and `commit` prompt
|
|
30
|
+
templates. Creation refuses a missing direction or prompt and an existing
|
|
31
|
+
stream. Opening requires the existing branch, worktree, journal, proposal file,
|
|
32
|
+
direction, and prompts. Both install dependencies before starting the planner.
|
|
33
|
+
|
|
34
|
+
## Shared local state
|
|
35
|
+
|
|
36
|
+
Codeless keeps workflow state outside tracked project documents in a shared
|
|
37
|
+
workspace selected by the local Git `codeless.workspaceRoot` setting or, by
|
|
38
|
+
default, at `.codeless/state/` in the primary checkout. The default directory is
|
|
39
|
+
Git-ignored, and every linked worktree resolves the same primary-checkout state:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
<primary-checkout>/.codeless/state/
|
|
43
|
+
stream/<slug>/
|
|
44
|
+
planner.md
|
|
45
|
+
change.md
|
|
46
|
+
changes/NNN.md
|
|
47
|
+
worktree/<slug>/
|
|
48
|
+
.land-lock/
|
|
49
|
+
metrics/<slug>/NNN.json
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
`planner.md` owns decisions, approvals, review outcomes, landing history, and
|
|
53
|
+
the context needed by a fresh planner. `change.md` is the editable current
|
|
54
|
+
proposal. `changes/NNN.md` is the immutable-by-policy approved input to one
|
|
55
|
+
implementation loop. These documents are local workflow state, not product
|
|
56
|
+
contracts, and are never copied into `spec/`.
|
|
57
|
+
|
|
58
|
+
After operator `go`, the argument-free planner-only `approve_stream_change` tool
|
|
59
|
+
promotes the current proposal before any dispatch. It derives the active planner
|
|
60
|
+
session and passes it to the backing CLI, which requires its `<slug>-planner`
|
|
61
|
+
identity to match the clean `stream/<slug>` worktree and branch exactly at the
|
|
62
|
+
current integration branch. The proposal needs one usable H1 title plus the `Why`, `Change`,
|
|
63
|
+
`Acceptance`, and `Decisions` headings; titles must be representable by the
|
|
64
|
+
canonical record. The CLI writes `changes/NNN.md` exclusively, where `NNN` is
|
|
65
|
+
the successor of the greatest existing three-digit number (and stops after
|
|
66
|
+
`999`), then appends a canonical journal approval containing the file, title,
|
|
67
|
+
and proposal hash. Repeated calls reconcile that exact file and entry, completing
|
|
68
|
+
one missing step without another number; conflicting or ambiguous partial state
|
|
69
|
+
stops unchanged. Rejection and ordinary feedback allocate nothing. Dispatch
|
|
70
|
+
remains a separate explicit tool call using the returned absolute path.
|
|
71
|
+
|
|
72
|
+
## Role sessions and configuration
|
|
73
|
+
|
|
74
|
+
Project configuration selects an exact Pi provider, model, and thinking level
|
|
75
|
+
independently for planner and implementer roles.
|
|
76
|
+
|
|
77
|
+
Before starting either role, Codeless uses Pi's machine-readable APIs to require
|
|
78
|
+
the configured model, authentication, supported thinking level, and effective
|
|
79
|
+
selection. It fails before agent work rather than accepting a fallback model or
|
|
80
|
+
clamped thinking level. The validated selection is displayed and passed to the
|
|
81
|
+
role process.
|
|
82
|
+
|
|
83
|
+
Configuration changes take effect only at a new role-session boundary. An
|
|
84
|
+
active review or remediation keeps its implementer setting. A successful
|
|
85
|
+
post-landing handoff rereads and validates planner configuration from the
|
|
86
|
+
fast-forwarded stream worktree before the replacement session receives its
|
|
87
|
+
first project prompt.
|
|
88
|
+
|
|
89
|
+
Every planner launch—creation, reopening, direct `planner` restart, and
|
|
90
|
+
post-landing replacement—uses the package-owned extension as its activation
|
|
91
|
+
boundary. Before its first project prompt, activation requires the exact
|
|
92
|
+
`<slug>-planner` Pi session name, establishes and verifies Herdr reports
|
|
93
|
+
`<slug-with-hyphens-replaced>_planner`, and verifies
|
|
94
|
+
`approve_stream_change`, `dispatch_stream_implementer`, and
|
|
95
|
+
`next_stream_change` are active. Missing or incompatible activation, identity
|
|
96
|
+
mismatch, or an incomplete tool set stops visibly before `/change`. A direct
|
|
97
|
+
restart may begin with Herdr's `pi` fallback identity; activation renames and
|
|
98
|
+
rereads only that fallback. Any other identity mismatch stops. Implementers use
|
|
99
|
+
the corresponding `_impl` and `-impl` forms. The package loads its planner
|
|
100
|
+
extension explicitly; global Pi extension installation is not required.
|
|
101
|
+
|
|
102
|
+
## Dispatch and review
|
|
103
|
+
|
|
104
|
+
The planner-only `dispatch_stream_implementer` tool accepts an absolute approved
|
|
105
|
+
`changes/NNN.md` path. Dispatch verifies the stream branch, clean worktree,
|
|
106
|
+
planner pane, prompts, and implementer selection. It creates or reuses the
|
|
107
|
+
right-hand Herdr pane only when that pane is an available shell or the expected
|
|
108
|
+
idle implementer, starts a fresh ephemeral Pi implementer in the stream
|
|
109
|
+
worktree, submits `/implement`, and waits for at most one hour.
|
|
110
|
+
|
|
111
|
+
Successful dispatch queues the expanded `/review` prompt back into the planner.
|
|
112
|
+
The planner inspects the full diff and relevant code, checks the approved
|
|
113
|
+
acceptance criteria, and runs focused checks when the implementation output is
|
|
114
|
+
insufficient. Remediation reuses the same implementer context. Once approved,
|
|
115
|
+
the planner records the review result, exits the implementer so its pane returns
|
|
116
|
+
to a shell, and follows the commit-and-land prompt without another approval
|
|
117
|
+
round.
|
|
118
|
+
|
|
119
|
+
Dispatch and remediation do not retry automatically. Dispatch currently exposes
|
|
120
|
+
Herdr command output rather than a normalized implementation result, and
|
|
121
|
+
remediation and implementer shutdown are still performed through prompt-owned
|
|
122
|
+
Herdr commands.
|
|
123
|
+
|
|
124
|
+
## Commit and landing
|
|
125
|
+
|
|
126
|
+
A reviewed change produces exactly one commit outside the merge base with the
|
|
127
|
+
configured integration branch. `codeless land <slug>` requires clean stream and integration worktrees,
|
|
128
|
+
then atomically acquires the shared `.land-lock` with its owner and captured
|
|
129
|
+
integration commit.
|
|
130
|
+
|
|
131
|
+
If the integration branch advanced, landing rebases the single stream commit. It then rereads and
|
|
132
|
+
runs the configured project check in the stream worktree, requires checks to
|
|
133
|
+
leave the worktree clean, and fast-forwards the dedicated `main` checkout. Only
|
|
134
|
+
successful completion releases the lock.
|
|
135
|
+
|
|
136
|
+
A lock owned by another stream stops landing without polling. A rebase conflict,
|
|
137
|
+
failed check, or other error after acquisition retains this stream's lock for
|
|
138
|
+
deliberate recovery. Rerunning landing for the same owner is allowed only while
|
|
139
|
+
the recorded integration commit still matches. Codeless never removes a stale or
|
|
140
|
+
ambiguous lock automatically.
|
|
141
|
+
|
|
142
|
+
## Fresh planner handoff
|
|
143
|
+
|
|
144
|
+
After landing, the planner records the full landed commit hash and calls the
|
|
145
|
+
planner-only `next_stream_change` tool exactly once. The handoff requires the
|
|
146
|
+
latest numbered change, its full hash in the journal and stream history, no
|
|
147
|
+
unlanded stream commit, a clean worktree, and no unresolved lock owned by this
|
|
148
|
+
stream or by an unknown owner.
|
|
149
|
+
|
|
150
|
+
Codeless captures the current integration branch, fast-forwards the stream worktree, validates
|
|
151
|
+
the updated direction, prompts, and planner selection, and returns the next
|
|
152
|
+
session name and `/change` prompt. The extension replaces the Pi session in the
|
|
153
|
+
same pane, preserves its name, activates the validated selection and planner
|
|
154
|
+
identity, and only then sends the project prompt. Conversation history is not copied; the journal and
|
|
155
|
+
project files carry durable context.
|
|
156
|
+
|
|
157
|
+
A cancelled or failed replacement stops for operator attention. Landing remains
|
|
158
|
+
complete, and any successful preparation fast-forward remains applied. There is
|
|
159
|
+
no background retry. The replacement planner still needs a new operator `go`
|
|
160
|
+
before another implementation.
|
|
161
|
+
|
|
162
|
+
## Local workflow metrics
|
|
163
|
+
|
|
164
|
+
The first dispatch for a stream and numbered change creates one atomic local
|
|
165
|
+
metric record. Retrying dispatch preserves the original timestamp. Successful
|
|
166
|
+
landing adds its timestamp and commit, or creates a landed record with
|
|
167
|
+
unavailable elapsed time when dispatch collection was unavailable. Collection
|
|
168
|
+
warnings do not change dispatch or landing outcomes.
|
|
169
|
+
|
|
170
|
+
`codeless metrics` reports every recorded stream and a project total with:
|
|
171
|
+
|
|
172
|
+
- landed and dispatched-but-unlanded change counts;
|
|
173
|
+
- measured versus unavailable elapsed coverage; and
|
|
174
|
+
- total and average dispatch-to-land wall-clock time.
|
|
175
|
+
|
|
176
|
+
The measurements are prospective, local observations. They are not journal
|
|
177
|
+
state, an approval source, or a recovery mechanism. Token usage, cost,
|
|
178
|
+
normalized attempt results, review rework, and failure breakdowns are not yet
|
|
179
|
+
collected.
|
|
180
|
+
|
|
181
|
+
## Limits
|
|
182
|
+
|
|
183
|
+
Codeless is attended and intentionally has no supervisor, project registry,
|
|
184
|
+
queue, automatic landing retry, stale-lock recovery, or unattended approval.
|
|
185
|
+
Planner startup reads every numbered change, and conflict recovery currently
|
|
186
|
+
causes the configured landing check to run twice. Because the default state is
|
|
187
|
+
ignored, `git clean -fdx` can delete it.
|
|
188
|
+
|
|
189
|
+
## References
|
|
190
|
+
|
|
191
|
+
- Configuration, commands, workspace, and recovery mechanics:
|
|
192
|
+
[project guide](../README.md)
|
|
193
|
+
- Runner and metrics implementation:
|
|
194
|
+
[cli.ts](../src/cli.ts) and [metrics.ts](../src/metrics.ts)
|
|
195
|
+
- Planner tools and session handoff:
|
|
196
|
+
[planner.js](../extension/planner.js)
|
|
197
|
+
- Integration and extension evidence:
|
|
198
|
+
[streams.test.ts](../test/streams.test.ts),
|
|
199
|
+
[metrics.test.ts](../test/metrics.test.ts), and
|
|
200
|
+
[planner.test.ts](../test/planner.test.ts)
|