rate-limit-handoff 0.2.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.
@@ -0,0 +1,20 @@
1
+ # Operating system metadata
2
+ .DS_Store
3
+
4
+ # Python bytecode and tool caches
5
+ __pycache__/
6
+ *.py[cod]
7
+ .pytest_cache/
8
+ .mypy_cache/
9
+ .ruff_cache/
10
+
11
+ # Environments and local configuration
12
+ .venv/
13
+ venv/
14
+ .env
15
+ .env.*
16
+
17
+ # Distribution artifacts
18
+ build/
19
+ dist/
20
+ *.egg-info/
@@ -0,0 +1,55 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.1] - 2026-07-13
11
+
12
+ v0.1 began as a same-model scheduler and evolved overnight into the v0.2 multi-model
13
+ continuity design. v0.2.1 makes that design truthful, executable behavior.
14
+
15
+ ### Added
16
+ - Three explicit continuity routes: same-model wait, immediate cross-model handoff,
17
+ and a temporary switch with planned return.
18
+ - Optional local auto-run for user-supplied destination and return commands.
19
+ - `--handoff`, `--from`, `--to`, `--return-to`, `--return-at`, `--prefer`,
20
+ `--auto-run`, `--command`, and `--return-command`.
21
+ - One canonical Active Handoff Chain with durable state, transition history, private
22
+ job records, and result logs.
23
+ - Optional `--second-brain-root` routing for existing Obsidian vaults using `00 Inbox/`
24
+ and `10 Projects/`.
25
+ - CI coverage for tests, Ruff, mypy, and package builds on Python 3.10 and 3.13.
26
+
27
+ ### Fixed
28
+ - Source, runtime, package, and skill version metadata now agree on `0.2.1`.
29
+ - The shipped CLI now matches the multi-model interface described by v0.2.0.
30
+ - `--update-only` now records an active checkpoint instead of falsely marking it scheduled.
31
+ - `at` jobs are submitted without invoking a parent shell, with notification text quoted.
32
+
33
+ ### Changed
34
+ - Commands are parsed into argument vectors and executed with `shell=False`; provider
35
+ commands are never inferred.
36
+ - The supplied reset time is the availability proxy. Local detached jobs remain
37
+ best-effort across machine uptime and are not represented as reboot durable.
38
+ - Installation remains GitHub-first because the first PyPI release is pending.
39
+
40
+ ## [0.1.0] - 2026-07-12
41
+
42
+ ### Added
43
+ - Initial public release
44
+ - Core CLI: `--schedule`, `--resume`, `--status`, `--update-only`, `--parse-usage`, `--codex-status`, `--init`
45
+ - Multi-tool support: Claude Code, OpenAI Codex, Grok Build, Antigravity (agy), Cursor, Hermes
46
+ - Living `handoff.md` + automatic Second Brain inbox notes
47
+ - Ready-to-copy skills for Codex, Grok Build, Antigravity, and general auto-detect
48
+ - Best-effort local job scheduling (`at` / resume scripts / notify-send)
49
+ - Pure stdlib, zero runtime dependencies
50
+ - MIT license
51
+
52
+ ### Design
53
+ - Prefer schedule over silent fallback to weaker models
54
+ - Always write both handoff.md and a permanent Second Brain note
55
+ - Model-agnostic single source of truth
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Purple Orange AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,327 @@
1
+ Metadata-Version: 2.4
2
+ Name: rate-limit-handoff
3
+ Version: 0.2.1
4
+ Summary: Turn AI rate limits into high-quality checkpoints. Schedule work across Claude Code, Codex, Grok Build, Antigravity & more. Auto-update your Second Brain + handoff.md.
5
+ Project-URL: Homepage, https://github.com/PurpleOrangeAI/rate-limit-handoff
6
+ Project-URL: Repository, https://github.com/PurpleOrangeAI/rate-limit-handoff
7
+ Project-URL: Issues, https://github.com/PurpleOrangeAI/rate-limit-handoff/issues
8
+ Project-URL: Documentation, https://github.com/PurpleOrangeAI/rate-limit-handoff#readme
9
+ Author: Purple Orange AI
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: ai,antigravity,claude,claude-code,codex,cursor,grok,handoff,productivity,rate-limit,scheduler,second-brain
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Topic :: Utilities
25
+ Requires-Python: >=3.10
26
+ Provides-Extra: dev
27
+ Requires-Dist: build>=1.2; extra == 'dev'
28
+ Requires-Dist: mypy>=1.8; extra == 'dev'
29
+ Requires-Dist: pytest>=8.0; extra == 'dev'
30
+ Requires-Dist: ruff>=0.4; extra == 'dev'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # rate-limit-handoff
34
+
35
+ <p align="center">
36
+ <img src="assets/banner.png" alt="rate-limit-handoff banner" width="100%">
37
+ </p>
38
+
39
+ <p align="center">
40
+ <strong>Rate limits are a continuity problem.</strong><br>
41
+ Wait for the same model, continue now in another model, or switch and return later.<br>
42
+ Preserve the exact next action in a living <code>handoff.md</code> so context never evaporates.
43
+ </p>
44
+
45
+ <p align="center">
46
+ <img src="https://img.shields.io/badge/PyPI-pending-lightgrey.svg" alt="PyPI pending">
47
+ <a href="https://github.com/PurpleOrangeAI/rate-limit-handoff/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT"></a>
48
+ <a href="https://github.com/PurpleOrangeAI/rate-limit-handoff"><img src="https://img.shields.io/badge/python-3.10%2B-blue.svg" alt="Python"></a>
49
+ <img src="https://img.shields.io/badge/status-beta-yellow.svg" alt="Status">
50
+ </p>
51
+
52
+ ---
53
+
54
+ ## Why this exists
55
+
56
+ A serious AI session accumulates decisions, rejected paths, repository state, test
57
+ evidence, constraints, and one exact next action. When the current model hits a limit,
58
+ chat history alone is not a reliable operating state.
59
+
60
+ **rate-limit-handoff** gives you three explicit continuity routes:
61
+
62
+ 1. **Same-model wait** — preserve the work and wait for the supplied reset time, with
63
+ optional explicit auto-run when the same model is expected to be available.
64
+ 2. **Cross-model handoff** — preserve the context and continue immediately in another
65
+ provider or model.
66
+ 3. **Return later** — switch temporarily, then schedule a return to the original model.
67
+
68
+ Every route writes the durable context first. Context stops evaporating; knowledge
69
+ compounds.
70
+
71
+ ---
72
+
73
+ ## Features
74
+
75
+ - **Multi-tool by design** — Claude Code, OpenAI Codex, Grok Build, Antigravity (agy), Cursor, Hermes
76
+ - **Proactive offer** — skills/rules that present the three continuity routes when capacity is low
77
+ - **One living handoff.md** — single source of truth that works across tools and machines
78
+ - **Second Brain integration** — every schedule automatically writes a dated note so knowledge compounds
79
+ - **Usage parsers** — paste `/status` or dashboard text; extracts remaining % and reset hint
80
+ - **Explicit local auto-run** — executes only user-supplied commands, parsed into arguments with `shell=False`
81
+ - **Best-effort local jobs** — detached runners and reminder artifacts are local, not reboot-durable services
82
+ - **Zero heavy deps** — pure Python stdlib, works offline
83
+ - **MIT licensed** — use it, fork it, ship it inside your company
84
+
85
+ ---
86
+
87
+ ## Quick Start
88
+
89
+ ```bash
90
+ # Install from GitHub
91
+ pip install git+https://github.com/PurpleOrangeAI/rate-limit-handoff.git
92
+
93
+ # Or install from source for development
94
+ git clone https://github.com/PurpleOrangeAI/rate-limit-handoff.git
95
+ cd rate-limit-handoff
96
+ pip install -e .
97
+ ```
98
+
99
+ The first PyPI release is pending. There is no PyPI installation command yet.
100
+
101
+ ### 1. Bootstrap a workspace (once)
102
+ ```bash
103
+ cd /path/to/your/project-or-second-brain
104
+ rate-limit-handoff --init
105
+ ```
106
+
107
+ This creates:
108
+ - `handoff.md` (living session state)
109
+ - `second_brain/` skeleton with skills + project notes
110
+
111
+ To write checkpoint notes into an existing Obsidian vault while keeping `handoff.md`
112
+ in the project root:
113
+
114
+ ```bash
115
+ rate-limit-handoff --workspace /path/to/project \
116
+ --second-brain-root /path/to/MySecondBrain \
117
+ --init
118
+ ```
119
+
120
+ When the supplied root already contains `00 Inbox/` and `10 Projects/`, the CLI writes
121
+ notes to `00 Inbox/` and uses `10 Projects/ai-rate-limit-handoff/` for the project entry.
122
+ Otherwise it preserves the portable `inbox/` and `projects/` layout.
123
+
124
+ ### 2. Choose a continuity route
125
+
126
+ #### Same-model wait
127
+
128
+ ```bash
129
+ rate-limit-handoff --schedule \
130
+ --model claude \
131
+ --reset-at "16:00" \
132
+ --summary "Continue the verified release work" \
133
+ --auto-run \
134
+ --command 'claude -p "Read handoff.md and continue the exact next action"'
135
+ ```
136
+
137
+ Omit `--auto-run` and `--command` to create the durable handoff and best-effort local
138
+ reminder/resume artifact without executing a model command.
139
+
140
+ #### Immediate cross-model handoff
141
+
142
+ ```bash
143
+ rate-limit-handoff --handoff \
144
+ --from claude \
145
+ --to codex \
146
+ --summary "Continue from the active handoff chain" \
147
+ --auto-run \
148
+ --command 'codex exec "Read handoff.md and continue the exact next action"'
149
+ ```
150
+
151
+ #### Temporary switch with planned return
152
+
153
+ ```bash
154
+ rate-limit-handoff --handoff \
155
+ --from claude \
156
+ --to codex \
157
+ --return-to claude \
158
+ --return-at "16:00" \
159
+ --summary "Use Codex now, then return for the final review" \
160
+ --auto-run \
161
+ --command 'codex exec "Read handoff.md and continue"' \
162
+ --return-command 'claude -p "Read handoff.md and perform the planned return"'
163
+ ```
164
+
165
+ #### Resume with a preference
166
+
167
+ ```bash
168
+ rate-limit-handoff --resume --prefer claude
169
+ ```
170
+
171
+ `--prefer` changes the continuation instruction. It does not launch that model.
172
+
173
+ ### Auto-run truth boundary
174
+
175
+ Auto-run is opt-in. rate-limit-handoff executes only the explicit command you supply,
176
+ parses it into arguments, and launches it with shell=False.
177
+
178
+ The supplied reset time is the availability signal. v0.2.1 does not query provider
179
+ APIs to confirm that capacity has returned, does not guess provider CLI syntax, and
180
+ does not guarantee that a detached local job survives a machine reboot. This means
181
+ there is no live provider-availability detection.
182
+
183
+ Without --auto-run, scheduling remains a durable handoff plus a best-effort local
184
+ reminder/resume artifact.
185
+
186
+ ### Extra power
187
+
188
+ ```bash
189
+ # Parse Codex /status or any dashboard paste
190
+ rate-limit-handoff --parse-usage "5h limit: 12% left (resets 04:00)"
191
+
192
+ # Local Codex hints
193
+ rate-limit-handoff --codex-status
194
+
195
+ # Status + model info
196
+ rate-limit-handoff --status --model antigravity
197
+ ```
198
+
199
+ ---
200
+
201
+ ## Supported Tools
202
+
203
+ | Tool | Window style | Operator-supplied capacity signal | Possible destination |
204
+ |------|--------------|-----------------------------------|----------------------|
205
+ | **Claude Code** | 5h + weekly | UI countdown / % | lighter Claude / Haiku |
206
+ | **OpenAI Codex** | 5h + weekly (reasoning heavy) | `/status`, Settings → Usage | GPT-5.4 / mini |
207
+ | **Grok Build** | Usage % + API | CLI / console | lighter Grok |
208
+ | **Antigravity (agy)** | 5h refresh + weekly | `/context`, "Resets in Xh" | Gemini Flash |
209
+ | **Cursor** | Backend-model dependent | Model switcher | cheaper model |
210
+ | **Hermes + Grok** | SuperGrok weekly + RPS/TPM | Hermes /usage | Grok-3 / mini |
211
+
212
+ The single `handoff.md` is the universal bridge. Start in Claude Code, hit limit, schedule, resume in Codex (or vice-versa). Your Second Brain stays coherent.
213
+
214
+ ---
215
+
216
+ ## Skills & Instructions (copy these)
217
+
218
+ After `--init` you get ready-to-use skills in `second_brain/system/skills/`:
219
+
220
+ - `codex-skill-rate-limit-handoff.md`
221
+ - `grok-build-rule-rate-limit-handoff.md`
222
+ - `antigravity-agy-skill-rate-limit-handoff.md`
223
+ - `auto-detect-limits-general.md`
224
+
225
+ **Copy the relevant skill** into:
226
+ - Claude Project custom instructions / Claude Code
227
+ - Codex skills or system prompt
228
+ - Grok Build / Hermes system prompt
229
+ - Antigravity (agy) rules
230
+ - Cursor Rules (`.cursor/rules`)
231
+ - Continue.dev / any multi-model frontend
232
+
233
+ They make the AI respond to low-capacity signals by offering the three continuity
234
+ routes. They do not add live provider-availability detection.
235
+
236
+ ---
237
+
238
+ ## Architecture (mental model)
239
+
240
+ ```
241
+ ┌─────────────────┐ low capacity ┌──────────────────────┐
242
+ │ Any AI Session │ ───────────────────► │ Wait / hand off / │
243
+ │ Claude / Codex │ │ switch and return │
244
+ │ Grok / agy / │ └──────────┬───────────┘
245
+ │ Cursor / etc │ │ yes
246
+ └─────────────────┘ ▼
247
+ ┌─────────────────┐ update ┌──────────────────────┐
248
+ │ handoff.md │ ◄──────────────────── │ rate-limit-handoff │
249
+ │ (living state) │ │ + Second Brain note │
250
+ └─────────────────┘ └──────────┬───────────┘
251
+
252
+ │ explicit command
253
+
254
+ ┌──────────────────────┐
255
+ │ best-effort local job│
256
+ │ or reminder artifact │
257
+ └──────────────────────┘
258
+ ```
259
+
260
+ ---
261
+
262
+ ## Design Philosophy
263
+
264
+ 1. **Prefer schedule / handoff over silent fallback** — make the routing decision explicit.
265
+ 2. **Always write to both** handoff.md **and** a dated Second Brain note — knowledge compounds.
266
+ 3. **Model-agnostic** — the same workflow works whether you live in Claude Code, Codex, or rotate between them.
267
+ 4. **Zero magic, full control** — pure Python, no telemetry, no cloud, no accounts.
268
+ 5. **Forced checkpoints are a feature** — every time you schedule you leave a clean, resumable trail.
269
+
270
+ ---
271
+
272
+ ## Development
273
+
274
+ ```bash
275
+ git clone https://github.com/PurpleOrangeAI/rate-limit-handoff.git
276
+ cd rate-limit-handoff
277
+ pip install -e ".[dev]"
278
+ ruff check .
279
+ pytest
280
+ mypy src
281
+ python -m build
282
+ ```
283
+
284
+ ---
285
+
286
+ ## Roadmap (community welcome)
287
+
288
+ - [ ] Pure rolling-window estimator that does not require user-provided reset time
289
+ - [ ] Hermes / xAI header watcher that auto-triggers schedule
290
+ - [ ] Telegram / Discord / desktop toast on schedule fire
291
+ - [ ] Obsidian / Logseq plugin for richer Second Brain integration
292
+ - [ ] More tools (Kilo, Cline, Roo, etc.) as they mature
293
+
294
+ ---
295
+
296
+ ## Contributing
297
+
298
+ PRs welcome. Especially:
299
+ - New model/tool definitions
300
+ - Better usage parsers
301
+ - Skills for additional frontends
302
+ - Documentation & examples
303
+
304
+ Please keep the spirit: **simple, offline-first, opinionated toward quality continuity**.
305
+
306
+ ---
307
+
308
+ ## License
309
+
310
+ MIT © 2026 Purple Orange AI
311
+
312
+ ---
313
+
314
+ ## Inspiration & Related Work
315
+
316
+ - Community `HANDOFF.md` patterns that many of us already use manually
317
+ - Cross-tool handoff tools such as `cli-continues`
318
+ - The daily reality of 5-hour windows on Claude Code and Codex
319
+
320
+ This project exists because the best solution is the one that also grows your Second Brain.
321
+
322
+ ---
323
+
324
+ <p align="center">
325
+ Made with ❤️ for builders who refuse to lose flow.<br>
326
+ <a href="https://github.com/PurpleOrangeAI">@PurpleOrangeAI</a>
327
+ </p>