wakecycle 0.0.1__tar.gz
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.
- wakecycle-0.0.1/LICENSE +190 -0
- wakecycle-0.0.1/PKG-INFO +288 -0
- wakecycle-0.0.1/README.md +268 -0
- wakecycle-0.0.1/pyproject.toml +31 -0
- wakecycle-0.0.1/setup.cfg +4 -0
- wakecycle-0.0.1/tests/test_heartbeat.py +188 -0
- wakecycle-0.0.1/tests/test_schemas.py +66 -0
- wakecycle-0.0.1/tests/test_tick.py +659 -0
- wakecycle-0.0.1/tests/test_ticker.py +176 -0
- wakecycle-0.0.1/tests/test_windows_readiness.py +177 -0
- wakecycle-0.0.1/wakecycle/__init__.py +7 -0
- wakecycle-0.0.1/wakecycle/_reserve.py +19 -0
- wakecycle-0.0.1/wakecycle.egg-info/PKG-INFO +288 -0
- wakecycle-0.0.1/wakecycle.egg-info/SOURCES.txt +15 -0
- wakecycle-0.0.1/wakecycle.egg-info/dependency_links.txt +1 -0
- wakecycle-0.0.1/wakecycle.egg-info/entry_points.txt +2 -0
- wakecycle-0.0.1/wakecycle.egg-info/top_level.txt +1 -0
wakecycle-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025 Andrew Stellman
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
wakecycle-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wakecycle
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A batch orchestrator for AI coding agents that runs inside your existing agent session - no server, no daemon, no admin rights. (0.0.1 reserves the name; the harness ships here shortly.)
|
|
5
|
+
Author-email: Andrew Stellman <andrew@stellman.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/andrewstellman/wakecycle
|
|
8
|
+
Project-URL: Repository, https://github.com/andrewstellman/wakecycle
|
|
9
|
+
Keywords: agent,orchestration,ai,harness,batch,claude
|
|
10
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# Wakecycle
|
|
22
|
+
|
|
23
|
+
**A batch orchestrator for AI coding agents that runs inside the agent
|
|
24
|
+
session you already have — no server, no daemon, no framework, no API keys
|
|
25
|
+
beyond your session, no admin rights.**
|
|
26
|
+
|
|
27
|
+
Point it at a list of jobs (audit these ten repos, run this benchmark across
|
|
28
|
+
these branches) and it runs them in a pool, watches their progress, and
|
|
29
|
+
leaves a complete record on disk — driven entirely by your existing agent
|
|
30
|
+
session waking itself on a timer, or, on a locked-down machine, by one plain
|
|
31
|
+
Python script in a terminal window.
|
|
32
|
+
|
|
33
|
+
## The thesis (30 seconds)
|
|
34
|
+
|
|
35
|
+
Most orchestration frameworks put the intelligence in external
|
|
36
|
+
infrastructure and treat the model as a worker. **The harness inverts that.**
|
|
37
|
+
|
|
38
|
+
- **All the determinism lives in one small stdlib Python script** — the tick
|
|
39
|
+
engine: a disk-truth state machine advanced one idempotent tick at a time.
|
|
40
|
+
- **The agent only relays and sleeps.** Each tick it runs the script, reads
|
|
41
|
+
the heartbeats of the workers it started, starts whatever the script tells
|
|
42
|
+
it to, prints a status table, and schedules the next tick. It never decides
|
|
43
|
+
anything.
|
|
44
|
+
- **Disk is the database.** Every run is a directory: the plan, the live
|
|
45
|
+
status, one heartbeat file per job, one result record per job.
|
|
46
|
+
- **Crash recovery is "run one tick."** Lost the session? Closed the window?
|
|
47
|
+
Machine slept? Run one command against the run directory and it picks up
|
|
48
|
+
exactly where it left off. Idempotency guarantees nothing double-runs.
|
|
49
|
+
|
|
50
|
+
Because the state machine is a few hundred lines of stdlib Python and the
|
|
51
|
+
agent's job is ~7 fixed steps, the orchestration runs on a small, cheap model
|
|
52
|
+
— you spend your capable-model budget on the *workers*. (Verified on Haiku
|
|
53
|
+
4.5; see the support table.)
|
|
54
|
+
|
|
55
|
+
## The worker contract (the whole of it)
|
|
56
|
+
|
|
57
|
+
> **A job is anything that appends JSON lines to a file.**
|
|
58
|
+
|
|
59
|
+
A line when it starts, a line every so often, a terminal line at the end —
|
|
60
|
+
single-line JSON, one writer per file. The `status` field is the only thing
|
|
61
|
+
the harness interprets; everything else (`label`, `message`, an opaque `data`
|
|
62
|
+
object) is decoration it displays but never reads. The worker doesn't have to
|
|
63
|
+
be an AI: a shell script, a `make` target, a CI job, or a human with
|
|
64
|
+
`echo >>` all qualify. A convenience helper ships for emitting the lines, but
|
|
65
|
+
it's optional.
|
|
66
|
+
|
|
67
|
+
The contract follows **Postel's law — conservative in what the harness
|
|
68
|
+
emits, liberal in what it accepts.** A worker that never writes, dies
|
|
69
|
+
mid-run, or writes garbage degrades to a visible `STALLED` / `failed` /
|
|
70
|
+
`LAUNCH-FAIL` row in the status table — never to a wedged state machine. A
|
|
71
|
+
malformed line is skipped with a warning, never fatal. (FR-18, FR-19)
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Quickstart — watch the whole architecture happen, zero API spend
|
|
76
|
+
|
|
77
|
+
Install at user level (no admin):
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pip install --user wakecycle # Python 3.10+
|
|
81
|
+
# or
|
|
82
|
+
npm install wakecycle
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
> **0.0.1 is a name reservation.** Installing today gives you the `wakecycle`
|
|
86
|
+
> placeholder command; the harness itself runs from this repo via
|
|
87
|
+
> `python3 bin/tick.py`, `python3 bin/ticker.py`, and `python3 bin/heartbeat.py`.
|
|
88
|
+
> The `wakecycle` / `wakecycle-ticker` / `wakecycle-heartbeat` console commands
|
|
89
|
+
> wire up at v0.1.0; the examples below use those names.
|
|
90
|
+
|
|
91
|
+
The package ships an **example plan with cross-platform Python stub
|
|
92
|
+
workers** — they do no real work and spend nothing; they just walk the
|
|
93
|
+
heartbeat lifecycle so you watch the architecture happen (pool-limited
|
|
94
|
+
dispatch, a genuine idle tick, staggered dispatch when the first stub
|
|
95
|
+
finishes, heartbeat-driven reaps, clean self-termination). (UC-8, FR-31)
|
|
96
|
+
|
|
97
|
+
You can run the demo two ways. **Pick the row that matches your setup** (see
|
|
98
|
+
the decision tree below for the full logic):
|
|
99
|
+
|
|
100
|
+
### Path A — inside a Claude Code session (cadence rung 1)
|
|
101
|
+
|
|
102
|
+
Open a fresh Claude Code session at the install and paste the bootstrap
|
|
103
|
+
prompt (`references/BOOTSTRAP_PROMPT.md`), pointing it at the example plan.
|
|
104
|
+
The session becomes the orchestrator and drives the run to completion on its
|
|
105
|
+
own `ScheduleWakeup` timer — one paste, no further interaction until it
|
|
106
|
+
reports `done` (or you drop a `STOP` file). This path uses **in-session
|
|
107
|
+
subagents** as workers.
|
|
108
|
+
|
|
109
|
+
### Path B — a plain terminal window (cadence rung 3, the no-admin floor)
|
|
110
|
+
|
|
111
|
+
No agent session, no scheduler, no admin rights — just Python:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
wakecycle-ticker path/to/demo-plan.json # loop: tick -> spawn -> sleep -> repeat
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The ticker replaces the agent: each tick it runs the engine, spawns the
|
|
118
|
+
listed workers detached, prints the table, sleeps the cadence, repeats —
|
|
119
|
+
until every job is terminal. This path uses **detached shell workers**
|
|
120
|
+
(`dispatch_mode: "shell"`). The ticker runs shell entries only (a subagent
|
|
121
|
+
entry is reported and skipped with the rung-1 instruction), so point it at a
|
|
122
|
+
shell-dispatch plan — adapt the example by switching `dispatch_mode` to
|
|
123
|
+
`"shell"` and adding a `worker_cmd`, or use the shell demo plan shipped with
|
|
124
|
+
v0.1.0. (UC-5, FR-24)
|
|
125
|
+
|
|
126
|
+
> The demo runs in **~20 minutes** with the shipped example plan (UC-8); its
|
|
127
|
+
> pace is set by the plan's `tick_interval_minutes` and the stub's `--steps`
|
|
128
|
+
> / `--sleep`, so tune those down for a faster run. Both paths produce the
|
|
129
|
+
> **same** run directory — the artifacts are tier-invariant.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Which entry point do I use? (the capability ladder)
|
|
134
|
+
|
|
135
|
+
The harness degrades along two independent axes; the disk state machine is
|
|
136
|
+
**identical at every rung**. At startup an orchestrating agent probes its own
|
|
137
|
+
tooling and announces the rungs it selected (FR-22). As an operator, walk
|
|
138
|
+
this tree:
|
|
139
|
+
|
|
140
|
+
**1. Do you have an agent session with a scheduling primitive (e.g. Claude
|
|
141
|
+
Code with `ScheduleWakeup`)?**
|
|
142
|
+
→ **Yes:** paste the bootstrap. **Cadence rung 1 + dispatch rung 1**
|
|
143
|
+
(in-session subagents). The headline workflow — zero infrastructure, one
|
|
144
|
+
paste. Your session must stay open for the run's duration. *(Pair it with a
|
|
145
|
+
safety tick — see below.)*
|
|
146
|
+
|
|
147
|
+
**2. No agent session, but you can install a scheduler entry (cron / Task
|
|
148
|
+
Scheduler / launchd / host Automations)?**
|
|
149
|
+
→ Install the printed one-line schedule running `--once` at the plan cadence.
|
|
150
|
+
**Cadence rung 2 + dispatch rung 2** (detached shell workers). No window
|
|
151
|
+
needs to stay open; survives logout. (UC-6)
|
|
152
|
+
|
|
153
|
+
**3. No scheduler rights (locked-down corporate machine)?**
|
|
154
|
+
→ Run the foreground ticker in a terminal window. **Cadence rung 3 + dispatch
|
|
155
|
+
rung 2** — the no-admin floor that must work everywhere. The window stays
|
|
156
|
+
open for the run's duration. (UC-5)
|
|
157
|
+
|
|
158
|
+
**4. Can't even keep a window open?**
|
|
159
|
+
→ Advance the run by hand, one printed command at a time
|
|
160
|
+
(`wakecycle-ticker --once <run-dir>`). **Cadence rung 4.** The harness never
|
|
161
|
+
strands a run: every failure path prints the exact next command. (UC-7,
|
|
162
|
+
FR-25)
|
|
163
|
+
|
|
164
|
+
Rungs 2–4 require `dispatch_mode: "shell"` entries (an externally-ticked
|
|
165
|
+
context can't launch in-session subagents — C-2).
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Host support — what's verified vs designed (honest)
|
|
170
|
+
|
|
171
|
+
Per NFR-12, every claim is labeled **VERIFIED** (evidence behind it) or
|
|
172
|
+
**DESIGNED** (built and unit-tested, but no end-to-end host run yet). Don't
|
|
173
|
+
trust a DESIGNED cell as if it were proven.
|
|
174
|
+
|
|
175
|
+
| Host / rung | Dispatch | Status | Evidence |
|
|
176
|
+
|---|---|---|---|
|
|
177
|
+
| Claude Code, cadence 1 (in-session timer) | subagent | **VERIFIED** | 3 Sonnet validation passes + Haiku 4.5 (one clean autonomous-loop pass + one observed failure path — the low-reasoning-model bet), 2026-06-11; multi-entry pool run with staggered dispatch, agent-honored STOP, detached workers outliving the dispatch turn (pgrep-verified) |
|
|
178
|
+
| Foreground ticker, cadence 3 (no-admin floor), macOS | shell | **VERIFIED** | Live end-to-end demo in-repo, 2026-06-12: pool gating, real detached PIDs, idle tick, staggered dispatch on reap, clean DONE — independently reproduced |
|
|
179
|
+
| Idempotency / idle-tick survival / STOP / resume | both | **VERIFIED** | Unit suite (mutation-verified) + spike passes; double-tick is cycle-only by construction |
|
|
180
|
+
| Encoding safety (cp1252 / utf-8) | both | **VERIFIED** | AST sweep tests with mutation-verified pins |
|
|
181
|
+
| OS scheduler, cadence 2 (cron / Task Scheduler / launchd) | shell | **DESIGNED** | `--once` is the cron target and unit-tested; no cross-host scheduled-run matrix yet |
|
|
182
|
+
| Windows / Linux, foreground ticker | shell | **DESIGNED** | Platform branches are stdlib + unit-tested (detach flags, PID liveness, lockfile); verified live on macOS only |
|
|
183
|
+
| Codex / Copilot / Cursor CLIs as workers | shell | **DESIGNED** | `worker_cmd` is CLI-agnostic by design; per-host validation is v0.2 |
|
|
184
|
+
|
|
185
|
+
The in-session timer (rung 1) is reliable *as a timer* but the resumed turn
|
|
186
|
+
has a host-side fragility — see the safety tick.
|
|
187
|
+
|
|
188
|
+
## Deploy rung 1 with a safety tick (recommended)
|
|
189
|
+
|
|
190
|
+
Because ticks are idempotent and a per-run-dir lockfile serializes concurrent
|
|
191
|
+
ticks, **redundant ticking is safe by construction.** So pair a rung-1
|
|
192
|
+
(in-session timer) run with a low-frequency **external safety tick** —
|
|
193
|
+
cron/scheduler or a second terminal running `wakecycle-ticker --once <run-dir>`
|
|
194
|
+
at roughly 3× the plan cadence against the same run directory. While the
|
|
195
|
+
in-session timer is alive, safety ticks are cycle-only no-ops; if the timer's
|
|
196
|
+
turn dies, the safety tick rescues the run within one safety interval, with no
|
|
197
|
+
detection logic and no operator nudge. (FR-26a)
|
|
198
|
+
|
|
199
|
+
**Why this matters (the honest paragraph).** In-session autonomous loops have
|
|
200
|
+
a host-side failure mode we root-caused on 2026-06-12 (Claude Code 2.1.174,
|
|
201
|
+
4 observed drops). The wakeup timer itself is **reliable** — it fired 4/4. The
|
|
202
|
+
failure is in the resumed turn: it intermittently serializes its first tool
|
|
203
|
+
call into the *text* channel as literal `<invoke …>` markup instead of a real
|
|
204
|
+
tool call; when the turn ends cleanly on that, the host injects no retry and
|
|
205
|
+
the loop dies silently until a human nudges it. (When the host *does* flag the
|
|
206
|
+
malformed call, it injects a retry and the loop self-heals — 4/4 of those
|
|
207
|
+
survived.) Context compaction was **refuted** as the cause. The safety tick
|
|
208
|
+
sidesteps the whole class because an external `--once` tick is independent of
|
|
209
|
+
the in-session turn. Upstream issue: **anthropics/claude-code#67945**
|
|
210
|
+
(filed 2026-06-12).
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## A run is a directory
|
|
215
|
+
|
|
216
|
+
`--init` scaffolds a timestamped run directory; everything about the run
|
|
217
|
+
lives there (FR-4):
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
<run-dir>/
|
|
221
|
+
plan.json snapshot of the plan
|
|
222
|
+
harness_status.json the live state machine (cycle counter, per-run state, counts)
|
|
223
|
+
queue/ jobs not yet dispatched (+ per-job prompt files in shell mode)
|
|
224
|
+
claimed/ in-flight jobs (+ <job>.lock with PID for shell workers)
|
|
225
|
+
results/ one terminal result record per finished job
|
|
226
|
+
run-NN/ one per plan entry:
|
|
227
|
+
manifest.json task id, target, dispatch mode, (optional) heartbeat_path
|
|
228
|
+
heartbeat.ndjson the worker's append-only progress log
|
|
229
|
+
harness_tick.log per-tick diagnostics
|
|
230
|
+
.tick.lock concurrent-tick serialization (E1)
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
A completed run directory is a **self-sufficient audit record** — final
|
|
234
|
+
status, every heartbeat line, every result, the plan snapshot. No chat
|
|
235
|
+
scrollback required (NFR-9, FR-28).
|
|
236
|
+
|
|
237
|
+
### The status table (the UI)
|
|
238
|
+
|
|
239
|
+
Every tick prints a pure-ASCII table — per-run state, the worker's current
|
|
240
|
+
activity label, last heartbeat status and age, plus aggregate counts and the
|
|
241
|
+
next-tick time:
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
Run-Dir: 20260612T0500Z (cycle 4)
|
|
245
|
+
--------------------------------------------------------------------------------------
|
|
246
|
+
RUN REPO MODE STATE ACTIVITY LAST-HB HB-AGE
|
|
247
|
+
01 /repos/service-a shell completed - COMPLETED 1m12s
|
|
248
|
+
02 /repos/service-b shell running 2:generation IN_PROGRESS 0m18s
|
|
249
|
+
03 /repos/service-c shell LAUNCH-FAIL - - -
|
|
250
|
+
--------------------------------------------------------------------------------------
|
|
251
|
+
Queue: 0 Claimed: 0 Running: 1 Stalled: 0 Completed: 1 Failed: 1
|
|
252
|
+
LAUNCH-FAIL: no heartbeat received within launch grace - check worker-side launch: auth, helper availability, paths.
|
|
253
|
+
Next tick in 5 min
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
States: `queued → claimed → running → completed | failed`. `stalled` (a
|
|
257
|
+
heartbeat older than the threshold) is non-terminal and recoverable. A job
|
|
258
|
+
that's claimed but never heartbeats past the launch grace becomes
|
|
259
|
+
`LAUNCH-FAIL` (displayed; `auth_or_launch_failed` on disk) and carries a
|
|
260
|
+
diagnostic hint in both the result record and the table (FR-21b).
|
|
261
|
+
|
|
262
|
+
## Stop and resume
|
|
263
|
+
|
|
264
|
+
- **Stop:** drop a file named `STOP` in the run directory. The next tick sees
|
|
265
|
+
it, changes nothing, and exits cleanly — a race-free shutdown that never
|
|
266
|
+
interrupts the agent mid-action. In-flight detached workers run to their own
|
|
267
|
+
terminal states (documented orphan behavior; no kill in this release). (UC-3)
|
|
268
|
+
- **Resume:** point any fresh session at the existing run directory (skip
|
|
269
|
+
`--init`), or run `wakecycle-ticker --once <run-dir>` — or just delete the
|
|
270
|
+
`STOP`. Disk state resumes the loop; at most one cycle increment beyond the
|
|
271
|
+
interruption, zero duplicated work. (UC-4)
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Lineage
|
|
276
|
+
|
|
277
|
+
The harness was built as the **Quality Playbook's** test harness — replacing
|
|
278
|
+
a ~10,000-line Python subprocess harness, deleted 2026-06-11 — but its core
|
|
279
|
+
is payload-agnostic: the validated end-to-end runs orchestrated stub workers
|
|
280
|
+
with zero Quality-Playbook involvement. It's extracted here because *a job is
|
|
281
|
+
anything that appends JSON lines to a file* is a general contract, not a
|
|
282
|
+
quality-tooling one. The Quality Playbook keeps a vendored copy with a
|
|
283
|
+
lineage note. (See the [Quality Playbook](https://github.com/andrewstellman/quality-playbook).)
|
|
284
|
+
|
|
285
|
+
## License
|
|
286
|
+
|
|
287
|
+
Apache-2.0. No network calls of its own, no telemetry, no shell-out except
|
|
288
|
+
the `worker_cmd` templates you declare (NFR-11).
|