subfleet 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.
Files changed (56) hide show
  1. subfleet-0.0.1/.gitignore +7 -0
  2. subfleet-0.0.1/LICENSE +202 -0
  3. subfleet-0.0.1/PKG-INFO +424 -0
  4. subfleet-0.0.1/README.md +206 -0
  5. subfleet-0.0.1/accounts.example.json +21 -0
  6. subfleet-0.0.1/bin/codex +38 -0
  7. subfleet-0.0.1/bin/subfleet +21 -0
  8. subfleet-0.0.1/bin/subfleet-claude +527 -0
  9. subfleet-0.0.1/bin/subfleet-codex +277 -0
  10. subfleet-0.0.1/bin/subfleet-guard +433 -0
  11. subfleet-0.0.1/bin/subfleet-guard-hook +340 -0
  12. subfleet-0.0.1/bin/subfleet-login-watch +21 -0
  13. subfleet-0.0.1/bin/subfleet-mirror +561 -0
  14. subfleet-0.0.1/docs/guard.md +111 -0
  15. subfleet-0.0.1/pyproject.toml +37 -0
  16. subfleet-0.0.1/subfleet/__init__.py +15 -0
  17. subfleet-0.0.1/subfleet/capacity.py +1081 -0
  18. subfleet-0.0.1/subfleet/claude.py +502 -0
  19. subfleet-0.0.1/subfleet/cli.py +712 -0
  20. subfleet-0.0.1/subfleet/codex.py +619 -0
  21. subfleet-0.0.1/subfleet/config.py +160 -0
  22. subfleet-0.0.1/subfleet/delegate.py +605 -0
  23. subfleet-0.0.1/subfleet/login.py +510 -0
  24. subfleet-0.0.1/subfleet/notify.py +42 -0
  25. subfleet-0.0.1/subfleet/paths.py +135 -0
  26. subfleet-0.0.1/subfleet/render.py +312 -0
  27. subfleet-0.0.1/subfleet/run_ledger.py +479 -0
  28. subfleet-0.0.1/subfleet/secret_store.py +69 -0
  29. subfleet-0.0.1/subfleet/snapshot.py +377 -0
  30. subfleet-0.0.1/subfleet/util.py +124 -0
  31. subfleet-0.0.1/subfleet/watchdog.py +724 -0
  32. subfleet-0.0.1/tests/conftest.py +143 -0
  33. subfleet-0.0.1/tests/test_app_home.py +369 -0
  34. subfleet-0.0.1/tests/test_brief.py +141 -0
  35. subfleet-0.0.1/tests/test_capacity.py +739 -0
  36. subfleet-0.0.1/tests/test_carpool_claude.py +478 -0
  37. subfleet-0.0.1/tests/test_carpool_codex.py +344 -0
  38. subfleet-0.0.1/tests/test_claude.py +193 -0
  39. subfleet-0.0.1/tests/test_claude_pick.py +476 -0
  40. subfleet-0.0.1/tests/test_cli.py +168 -0
  41. subfleet-0.0.1/tests/test_cli_surface.py +107 -0
  42. subfleet-0.0.1/tests/test_codex.py +286 -0
  43. subfleet-0.0.1/tests/test_config.py +242 -0
  44. subfleet-0.0.1/tests/test_delegate.py +352 -0
  45. subfleet-0.0.1/tests/test_dispatch_discovery.py +150 -0
  46. subfleet-0.0.1/tests/test_guard.py +495 -0
  47. subfleet-0.0.1/tests/test_login.py +252 -0
  48. subfleet-0.0.1/tests/test_mirror_script.py +30 -0
  49. subfleet-0.0.1/tests/test_notify.py +76 -0
  50. subfleet-0.0.1/tests/test_pick.py +118 -0
  51. subfleet-0.0.1/tests/test_run_ledger.py +359 -0
  52. subfleet-0.0.1/tests/test_session_mirror.py +230 -0
  53. subfleet-0.0.1/tests/test_watchdog.py +200 -0
  54. subfleet-0.0.1/tests/test_watchdog_heal.py +401 -0
  55. subfleet-0.0.1/tests/test_wrappers.py +603 -0
  56. subfleet-0.0.1/uv.lock +79 -0
@@ -0,0 +1,7 @@
1
+ state/
2
+ *.local.json
3
+ __pycache__/
4
+ .venv/
5
+ .pytest_cache/
6
+ *.py[cod]
7
+
subfleet-0.0.1/LICENSE ADDED
@@ -0,0 +1,202 @@
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 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 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 those 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
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Max Ghenis
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
@@ -0,0 +1,424 @@
1
+ Metadata-Version: 2.5
2
+ Name: subfleet
3
+ Version: 0.0.1
4
+ Summary: A fleet of subs: run agentic AI work across every Claude Code and Codex subscription you own, without rotating logins
5
+ Project-URL: Homepage, https://maxghenis.com/subfleet
6
+ Project-URL: Repository, https://github.com/MaxGhenis/subfleet
7
+ Author: Max Ghenis
8
+ License: Apache License
9
+ Version 2.0, January 2004
10
+ http://www.apache.org/licenses/
11
+
12
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
13
+
14
+ 1. Definitions.
15
+
16
+ "License" shall mean the terms and conditions for use, reproduction,
17
+ and distribution as defined by Sections 1 through 9 of this document.
18
+
19
+ "Licensor" shall mean the copyright owner or entity authorized by
20
+ the copyright owner that is granting the License.
21
+
22
+ "Legal Entity" shall mean the union of the acting entity and all
23
+ other entities that control, are controlled by, or are under common
24
+ control with that entity. For the purposes of this definition,
25
+ "control" means (i) the power, direct or indirect, to cause the
26
+ direction or management of such entity, whether by contract or
27
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
28
+ outstanding shares, or (iii) beneficial ownership of such entity.
29
+
30
+ "You" (or "Your") shall mean an individual or Legal Entity
31
+ exercising permissions granted by this License.
32
+
33
+ "Source" form shall mean the preferred form for making modifications,
34
+ including but not limited to software source code, documentation
35
+ source, and configuration files.
36
+
37
+ "Object" form shall mean any form resulting from mechanical
38
+ transformation or translation of a Source form, including but
39
+ not limited to compiled object code, generated documentation,
40
+ and conversions to other media types.
41
+
42
+ "Work" shall mean the work of authorship, whether in Source or
43
+ Object form, made available under the License, as indicated by a
44
+ copyright notice that is included in or attached to the work
45
+ (an example is provided in the Appendix below).
46
+
47
+ "Derivative Works" shall mean any work, whether in Source or Object
48
+ form, that is based on (or derived from) the Work and for which the
49
+ editorial revisions, annotations, elaborations, or other modifications
50
+ represent, as a whole, an original work of authorship. For the purposes
51
+ of this License, Derivative Works shall not include works that remain
52
+ separable from, or merely link (or bind by name) to the interfaces of,
53
+ the Work and Derivative Works thereof.
54
+
55
+ "Contribution" shall mean any work of authorship, including
56
+ the original version of the Work and any modifications or additions
57
+ to that Work or Derivative Works thereof, that is intentionally
58
+ submitted to Licensor for inclusion in the Work by the copyright owner
59
+ or by an individual or Legal Entity authorized to submit on behalf of
60
+ the copyright owner. For the purposes of this definition, "submitted"
61
+ means any form of electronic, verbal, or written communication sent
62
+ to the Licensor or its representatives, including but not limited to
63
+ communication on electronic mailing lists, source code control systems,
64
+ and issue tracking systems that are managed by, or on behalf of, the
65
+ Licensor for the purpose of discussing and improving the Work, but
66
+ excluding communication that is conspicuously marked or otherwise
67
+ designated in writing by the copyright owner as "Not a Contribution."
68
+
69
+ "Contributor" shall mean Licensor and any individual or Legal Entity
70
+ on behalf of whom a Contribution has been received by Licensor and
71
+ subsequently incorporated within the Work.
72
+
73
+ 2. Grant of Copyright 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
+ copyright license to reproduce, prepare Derivative Works of,
77
+ publicly display, publicly perform, sublicense, and distribute the
78
+ Work and such Derivative Works in Source or Object form.
79
+
80
+ 3. Grant of Patent License. Subject to the terms and conditions of
81
+ this License, each Contributor hereby grants to You a perpetual,
82
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
83
+ (except as stated in this section) patent license to make, have made,
84
+ use, offer to sell, sell, import, and otherwise transfer the Work,
85
+ where such license applies only to those patent claims licensable
86
+ by such Contributor that are necessarily infringed by their
87
+ Contribution(s) alone or by combination of their Contribution(s)
88
+ with the Work to which such Contribution(s) was submitted. If You
89
+ institute patent litigation against any entity (including a
90
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
91
+ or a Contribution incorporated within the Work constitutes direct
92
+ or contributory patent infringement, then any patent licenses
93
+ granted to You under this License for that Work shall terminate
94
+ as of the date such litigation is filed.
95
+
96
+ 4. Redistribution. You may reproduce and distribute copies of the
97
+ Work or Derivative Works thereof in any medium, with or without
98
+ modifications, and in Source or Object form, provided that You
99
+ meet the following conditions:
100
+
101
+ (a) You must give any other recipients of the Work or
102
+ Derivative Works a copy of this License; and
103
+
104
+ (b) You must cause any modified files to carry prominent notices
105
+ stating that You changed the files; and
106
+
107
+ (c) You must retain, in the Source form of any Derivative Works
108
+ that You distribute, all copyright, patent, trademark, and
109
+ attribution notices from the Source form of the Work,
110
+ excluding those notices that do not pertain to any part of
111
+ the Derivative Works; and
112
+
113
+ (d) If the Work includes a "NOTICE" text file as part of its
114
+ distribution, then any Derivative Works that You distribute must
115
+ include a readable copy of the attribution notices contained
116
+ within such NOTICE file, excluding those notices that do not
117
+ pertain to any part of the Derivative Works, in at least one
118
+ of the following places: within a NOTICE text file distributed
119
+ as part of the Derivative Works; within the Source form or
120
+ documentation, if provided along with the Derivative Works; or,
121
+ within a display generated by the Derivative Works, if and
122
+ wherever such third-party notices normally appear. The contents
123
+ of the NOTICE file are for informational purposes only and
124
+ do not modify the License. You may add Your own attribution
125
+ notices within Derivative Works that You distribute, alongside
126
+ or as an addendum to the NOTICE text from the Work, provided
127
+ that such additional attribution notices cannot be construed
128
+ as modifying the License.
129
+
130
+ You may add Your own copyright statement to Your modifications and
131
+ may provide additional or different license terms and conditions
132
+ for use, reproduction, or distribution of Your modifications, or
133
+ for any such Derivative Works as a whole, provided Your use,
134
+ reproduction, and distribution of the Work otherwise complies with
135
+ the conditions stated in this License.
136
+
137
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
138
+ any Contribution intentionally submitted for inclusion in the Work
139
+ by You to the Licensor shall be under the terms and conditions of
140
+ this License, without any additional terms or conditions.
141
+ Notwithstanding the above, nothing herein shall supersede or modify
142
+ the terms of any separate license agreement you may have executed
143
+ with Licensor regarding such Contributions.
144
+
145
+ 6. Trademarks. This License does not grant permission to use the trade
146
+ names, trademarks, service marks, or product names of the Licensor,
147
+ except as required for reasonable and customary use in describing the
148
+ origin of the Work and reproducing the content of the NOTICE file.
149
+
150
+ 7. Disclaimer of Warranty. Unless required by applicable law or
151
+ agreed to in writing, Licensor provides the Work (and each
152
+ Contributor provides its Contributions) on an "AS IS" BASIS,
153
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
154
+ implied, including, without limitation, any warranties or conditions
155
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
156
+ PARTICULAR PURPOSE. You are solely responsible for determining the
157
+ appropriateness of using or redistributing the Work and assume any
158
+ risks associated with Your exercise of permissions under this License.
159
+
160
+ 8. Limitation of Liability. In no event and under no legal theory,
161
+ whether in tort (including negligence), contract, or otherwise,
162
+ unless required by applicable law (such as deliberate and grossly
163
+ negligent acts) or agreed to in writing, shall any Contributor be
164
+ liable to You for damages, including any direct, indirect, special,
165
+ incidental, or consequential damages of any character arising as a
166
+ result of this License or out of the use or inability to use the
167
+ Work (including but not limited to damages for loss of goodwill,
168
+ work stoppage, computer failure or malfunction, or any and all
169
+ other commercial damages or losses), even if such Contributor
170
+ has been advised of the possibility of such damages.
171
+
172
+ 9. Accepting Warranty or Additional Liability. While redistributing
173
+ the Work or Derivative Works thereof, You may choose to offer,
174
+ and charge a fee for, acceptance of support, warranty, indemnity,
175
+ or other liability obligations and/or rights consistent with this
176
+ License. However, in accepting such obligations, You may act only
177
+ on Your own behalf and on Your sole responsibility, not on behalf
178
+ of any other Contributor, and only if You agree to indemnify,
179
+ defend, and hold each Contributor harmless for any liability
180
+ incurred by, or claims asserted against, such Contributor by reason
181
+ of your accepting any such warranty or additional liability.
182
+
183
+ END OF TERMS AND CONDITIONS
184
+
185
+ APPENDIX: How to apply the Apache License to your work.
186
+
187
+ To apply the Apache License to your work, attach the following
188
+ boilerplate notice, with the fields enclosed by brackets "[]"
189
+ replaced with your own identifying information. (Don't include
190
+ the brackets!) The text should be enclosed in the appropriate
191
+ comment syntax for the file format. We also recommend that a
192
+ file or class name and description of purpose be included on the
193
+ same "printed page" as the copyright notice for easier
194
+ identification within third-party archives.
195
+
196
+ Copyright 2026 Max Ghenis
197
+
198
+ Licensed under the Apache License, Version 2.0 (the "License");
199
+ you may not use this file except in compliance with the License.
200
+ You may obtain a copy of the License at
201
+
202
+ http://www.apache.org/licenses/LICENSE-2.0
203
+
204
+ Unless required by applicable law or agreed to in writing, software
205
+ distributed under the License is distributed on an "AS IS" BASIS,
206
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
207
+ See the License for the specific language governing permissions and
208
+ limitations under the License.
209
+
210
+ License-File: LICENSE
211
+ Keywords: agents,claude-code,codex,dispatch,quota,subscriptions
212
+ Classifier: Development Status :: 3 - Alpha
213
+ Classifier: Environment :: Console
214
+ Classifier: Operating System :: MacOS
215
+ Classifier: Programming Language :: Python :: 3
216
+ Requires-Python: >=3.12
217
+ Description-Content-Type: text/markdown
218
+
219
+ # subfleet
220
+
221
+ A fleet of subs. Formerly `ai-lanes`, then `carpool` (renamed 2026-08-23;
222
+ `CARPOOL_*` environment variables are still honoured).
223
+
224
+ subfleet runs agentic work across several Claude Code and Codex subscriptions
225
+ without repeatedly replacing one login — the subs operate under the surface. Each subscription gets a lane, the
226
+ router selects a lane with usable capacity, and the hardened runners can move
227
+ to another lane when a provider reports a limit.
228
+
229
+ The Python package has no runtime dependencies outside the standard library.
230
+ The shell runners expect Python 3.12 or newer; the Claude runner also uses
231
+ `jq` and `uuidgen`. The default secret store is the macOS keychain, but a
232
+ portable secret-store command can be configured.
233
+
234
+ ## Quick start
235
+
236
+ ```bash
237
+ uv sync
238
+ mkdir -p ~/.config/subfleet
239
+ cp accounts.example.json ~/.config/subfleet/accounts.json
240
+ export PATH="$PWD/bin:$PATH"
241
+ subfleet status
242
+ ```
243
+
244
+ Edit `~/.config/subfleet/accounts.json` before enrolling or dispatching. The
245
+ committed [accounts.example.json](accounts.example.json) contains only reserved
246
+ example addresses and documents the supported public settings.
247
+
248
+ ## Lanes
249
+
250
+ Codex keeps one login per home directory:
251
+
252
+ - `~/.codex` is the desktop app's home. subfleet observes its account and live
253
+ capacity, but never treats it as a dispatch lane.
254
+ - `~/.codex-1`, `~/.codex-2`, and so on are dispatch lanes. They are discovered
255
+ automatically unless `codex_homes` or `SUBFLEET_CODEX_HOMES` supplies an
256
+ explicit list.
257
+ - A numbered lane bound to the desktop app's current account is *shadowed*.
258
+ It remains visible but receives a dispatch handicap, and the watchdog warns
259
+ only when the shadow state changes.
260
+ - A Codex account reporting the free plan is excluded from dispatch.
261
+
262
+ Log into a numbered lane or the separately observed app home with:
263
+
264
+ ```bash
265
+ subfleet login codex 1
266
+ subfleet login codex app
267
+ ```
268
+
269
+ The command starts the vendor login server in that home, opens its authorization
270
+ URL, and arms a detached watcher. On completion, the watcher checks that
271
+ numbered lanes contain distinct accounts, reports app shadows, refreshes the
272
+ snapshot, and uses the configured notification hook. `--no-open` prints the
273
+ URL; `--no-watch` skips the completion watcher.
274
+
275
+ Claude lanes are the addresses in `accounts`, mapped to secret-store items by
276
+ `enrolled`. Create and store a setup token without placing it in argv or an
277
+ environment variable:
278
+
279
+ ```bash
280
+ claude setup-token | subfleet enroll user1@example.com
281
+ ```
282
+
283
+ Enrollment makes a one-time validation request and accepts the authorization
284
+ responses expected from an inference-only setup token. Routine status and
285
+ dispatch never use stored setup tokens as quota-observation credentials.
286
+ Instead, the Claude runner records transcript token totals in a private local
287
+ ledger and learns cooldowns from actual hard-limit responses.
288
+
289
+ ## Commands
290
+
291
+ | Command | Purpose |
292
+ | --- | --- |
293
+ | `subfleet status [--json] [--cached]` | Show account identity, quota, authentication, shadow, and health state. With no subcommand, `status` is the default. |
294
+ | `subfleet capacity [--json]` | Normalize five-hour and weekly headroom across both providers. |
295
+ | `subfleet pick codex` | Print the best dispatchable Codex home. |
296
+ | `subfleet pick claude` | Print the best enrolled Claude address. |
297
+ | `subfleet run` | Classify a task, select a provider and lane, and invoke a hardened runner. |
298
+ | `subfleet codex` | Run hardened `codex exec`; `-H` is optional and omitted lanes are selected automatically. |
299
+ | `subfleet claude` | Run hardened headless Claude Code with `-A` auto-selection or `-a EMAIL` pinning. |
300
+ | `subfleet login codex N\|app` | Perform the Codex re-login ritual for one numbered lane or the app home. |
301
+ | `subfleet enroll EMAIL` | Read a Claude setup token from stdin and store it through the secret-store abstraction. |
302
+ | `subfleet mirror` | Run one Claude desktop-session mirror pass; accepts `--list`, `--dry-run`, `--prune`, and the mirror's other options. |
303
+ | `subfleet errors` | Show recently observed provider limit and authentication errors. |
304
+ | `subfleet watch [--dry-run]` | Take one snapshot, evaluate health transitions, and send or print alerts. |
305
+ | `subfleet brief` | Print a compact Markdown capacity section. |
306
+ | `subfleet runs` | Inspect the durable prompt/output/error ledger; `runs show ID` displays one run. |
307
+
308
+ Use `subfleet COMMAND --help` for monitor and router options. The pass-through
309
+ runners intentionally retain their concise shell usage strings.
310
+
311
+ ## Dispatch
312
+
313
+ The router accepts prompt text or `-p PROMPTFILE` and can explain its decision:
314
+
315
+ ```bash
316
+ subfleet run --why -C /path/to/project -o result.md "Fix the failing retry test"
317
+ subfleet run --dry-run -p task.md
318
+ ```
319
+
320
+ Its transparent pattern rules classify prose and final-judgment work, reviews,
321
+ mechanical sweeps, and general build work. It chooses a model family, consults
322
+ the shared capacity view, records the decision, and can cross from Codex to
323
+ Claude when the default family has no dispatchable lane. Explicit `-H` and
324
+ `-a` options pin a resource. `-m`, `-t`, `-s`, `-d`, and `-b` provide model,
325
+ task-class, sandbox, detached-run, and salvage-branch overrides.
326
+
327
+ The provider runners are also available directly:
328
+
329
+ ```bash
330
+ subfleet codex -m MODEL_NAME -C "$PWD" -p task.md -o result.md
331
+ subfleet claude -A -m MODEL_NAME -C "$PWD" -p task.md -o result.md
332
+ subfleet claude -a user1@example.com -m MODEL_NAME -C "$PWD" -p task.md -o result.md
333
+ ```
334
+
335
+ An unpinned Codex run auto-picks a home and re-picks after a mid-run usage
336
+ limit. An auto-selected Claude run does the same after a hard limit; lanes with
337
+ a missing stored token are excluded before launch. Both runners retry transient
338
+ failures, record each attempt, and can
339
+ snapshot dirty Git state to dedicated salvage refs without moving `HEAD` or
340
+ the real index. Claude additionally records lane usage and writes a
341
+ `MODEL-DOWNGRADE` marker when the transcript shows silent model substitution.
342
+
343
+ Adding this repository's `bin` directory before the vendor Codex binary also
344
+ enables the `bin/codex` shim. It selects a lane for headless `exec`, `e`, and
345
+ `review` calls when `CODEX_HOME` is unset. Set `SUBFLEET_NO_AUTOPICK=1` to opt
346
+ out; interactive commands and explicit homes pass through unchanged. subfleet
347
+ resolves the real Codex executable without depending on scheduler `PATH`.
348
+
349
+ ## Monitoring and repair
350
+
351
+ `subfleet watch` is a single pass suitable for cron or another scheduler. It
352
+ persists snapshots and transition state under `~/.local/state/subfleet` by
353
+ default. Alerts cover exhausted or unauthenticated lanes, free-plan accounts,
354
+ new app shadows, fleet exhaustion, and mirror health without repeating an
355
+ unchanged condition every pass.
356
+
357
+ The session mirror writes its per-pass result to the configured heartbeat
358
+ sidecar. The watchdog tolerates a currently running pass, distinguishes a
359
+ stale heartbeat from an in-flight run, and treats a run older than 30 minutes
360
+ as hung. When configured, `mirror_restart_cmd` is included in the alert's
361
+ recovery guidance.
362
+
363
+ For a Codex lane whose live quota request returns the narrow expired-token
364
+ signature, the watchdog may ask the vendor CLI to refresh its own credentials
365
+ and then re-probe. Repair is guarded by a renewable lock lease, bounded by a
366
+ timeout, disabled during dry runs, and latched after definitive revocation
367
+ until a new login changes the authentication file. subfleet never writes a
368
+ Codex access token itself.
369
+
370
+ ## Configuration
371
+
372
+ The default configuration file is `~/.config/subfleet/accounts.json`. Important
373
+ keys are:
374
+
375
+ - `accounts` and `enrolled`: the Claude roster and its secret item names.
376
+ - `codex_homes`: `null` for numeric-home discovery, or an explicit list.
377
+ - `codex_app_home`: the observed desktop-app home.
378
+ - `protected_account`: an optional identity fallback used only when the app
379
+ home cannot provide its current account.
380
+ - `secret_store_cmd`: an argv prefix implementing `get NAME`, `set NAME` with
381
+ the value on stdin, and `del NAME`. When unset, subfleet uses macOS `security`.
382
+ - `notify_cmd`: an argv prefix receiving `SUBJECT BODY`; the complete message
383
+ is also sent on stdin. When unset, alerts go to stderr.
384
+ - `mirror_heartbeat`, `mirror_job_label`, and
385
+ `mirror_restart_cmd`: optional mirror and scheduler integration.
386
+ - `login_browser_cmd`: a browser argv prefix. A `{url}` placeholder is
387
+ replaced; otherwise the URL is appended.
388
+ - `login_refresh_cmd`: a snapshot-refresh argv command run after login.
389
+
390
+ Command settings may be JSON argv arrays or shell-like strings parsed into
391
+ argv; they are never executed as shell expressions.
392
+
393
+ Common environment overrides are `SUBFLEET_CONFIG_DIR`, `SUBFLEET_STATE_DIR`,
394
+ `SUBFLEET_CODEX_HOMES` (colon-separated on macOS/Linux),
395
+ `SUBFLEET_CODEX_APP_HOME`, `SUBFLEET_CODEX_BIN`, `SUBFLEET_CLAUDE_DIR`,
396
+ `SUBFLEET_CLAUDE_JSON`, `SUBFLEET_SECRET_NAME_PREFIX`,
397
+ `SUBFLEET_SECRET_STORE_CMD`, `SUBFLEET_NOTIFY_CMD`,
398
+ `SUBFLEET_MIRROR_HEARTBEAT`,
399
+ `SUBFLEET_MIRROR_JOB_LABEL`, `SUBFLEET_MIRROR_RESTART_CMD`,
400
+ `SUBFLEET_LOGIN_BROWSER_CMD`, `SUBFLEET_LOGIN_REFRESH_CMD`, and
401
+ `SUBFLEET_CODEX_GUARD=off` for an explicit one-run guard bypass.
402
+
403
+ subfleet does not embed secrets or local account identifiers in repository
404
+ files. Runtime ledgers are created in the configured state directory with
405
+ private permissions; runner output is written only to the path you request.
406
+
407
+ ## Codex command guard
408
+
409
+ `subfleet codex` preflights a portable Codex `PreToolUse` hook before launch.
410
+ The hook covers four generic local-machine and Git hazards: unscoped root
411
+ searches, decrypted keychain dumps, stash mutation in shared worktrees, and
412
+ new local branches made from a stale local main branch. See
413
+ [docs/guard.md](docs/guard.md) for the exact policies, trust checks, and the
414
+ explicit one-run bypass.
415
+
416
+ ## Development
417
+
418
+ ```bash
419
+ uv run pytest -q
420
+ ```
421
+
422
+ ## License
423
+
424
+ Apache-2.0. See [LICENSE](LICENSE).