cadre-ai 1.0.0__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 (39) hide show
  1. cadre_ai-1.0.0/LICENSE +202 -0
  2. cadre_ai-1.0.0/PKG-INFO +385 -0
  3. cadre_ai-1.0.0/README.md +349 -0
  4. cadre_ai-1.0.0/pyproject.toml +96 -0
  5. cadre_ai-1.0.0/pyproject.toml.orig +77 -0
  6. cadre_ai-1.0.0/src/cadre/__init__.py +3 -0
  7. cadre_ai-1.0.0/src/cadre/agent.py +255 -0
  8. cadre_ai-1.0.0/src/cadre/api.py +531 -0
  9. cadre_ai-1.0.0/src/cadre/cli.py +997 -0
  10. cadre_ai-1.0.0/src/cadre/clocks.py +107 -0
  11. cadre_ai-1.0.0/src/cadre/config.py +305 -0
  12. cadre_ai-1.0.0/src/cadre/demo.py +138 -0
  13. cadre_ai-1.0.0/src/cadre/engine.py +1123 -0
  14. cadre_ai-1.0.0/src/cadre/forecast.py +332 -0
  15. cadre_ai-1.0.0/src/cadre/mcp_server.py +271 -0
  16. cadre_ai-1.0.0/src/cadre/org.py +351 -0
  17. cadre_ai-1.0.0/src/cadre/presets.py +263 -0
  18. cadre_ai-1.0.0/src/cadre/project.py +163 -0
  19. cadre_ai-1.0.0/src/cadre/providers.py +530 -0
  20. cadre_ai-1.0.0/src/cadre/quota.py +321 -0
  21. cadre_ai-1.0.0/src/cadre/repomap.py +80 -0
  22. cadre_ai-1.0.0/src/cadre/router.py +296 -0
  23. cadre_ai-1.0.0/src/cadre/runs.py +351 -0
  24. cadre_ai-1.0.0/src/cadre/scheduled.py +50 -0
  25. cadre_ai-1.0.0/src/cadre/scheduler.py +188 -0
  26. cadre_ai-1.0.0/src/cadre/secrets.py +134 -0
  27. cadre_ai-1.0.0/src/cadre/store.py +302 -0
  28. cadre_ai-1.0.0/src/cadre/templates/decision-board.yaml +36 -0
  29. cadre_ai-1.0.0/src/cadre/templates/project-finisher.yaml +50 -0
  30. cadre_ai-1.0.0/src/cadre/templates/research-desk.yaml +50 -0
  31. cadre_ai-1.0.0/src/cadre/templates/software-team.yaml +73 -0
  32. cadre_ai-1.0.0/src/cadre/templates/startup-company.yaml +50 -0
  33. cadre_ai-1.0.0/src/cadre/tools.py +265 -0
  34. cadre_ai-1.0.0/src/cadre/types.py +69 -0
  35. cadre_ai-1.0.0/src/cadre/web/app.js +621 -0
  36. cadre_ai-1.0.0/src/cadre/web/favicon.svg +1 -0
  37. cadre_ai-1.0.0/src/cadre/web/index.html +26 -0
  38. cadre_ai-1.0.0/src/cadre/web/style.css +194 -0
  39. cadre_ai-1.0.0/src/cadre/workspace.py +235 -0
cadre_ai-1.0.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,385 @@
1
+ Metadata-Version: 2.4
2
+ Name: cadre-ai
3
+ Version: 1.0.0
4
+ Summary: A team of AI agents that builds or finishes a project on free model keys, staying inside every provider's limits.
5
+ Keywords: ai-agents,multi-agent,llm,free-tier,rate-limit,groq,gemini,mcp
6
+ Author: Rithik Krishna
7
+ Author-email: Rithik Krishna <317035893+Daemon-VI@users.noreply.github.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Dist: fastapi>=0.115
20
+ Requires-Dist: httpx>=0.27
21
+ Requires-Dist: keyring>=25
22
+ Requires-Dist: pydantic>=2.8
23
+ Requires-Dist: pyyaml>=6
24
+ Requires-Dist: rich>=13
25
+ Requires-Dist: typer>=0.12
26
+ Requires-Dist: tzdata>=2024.1
27
+ Requires-Dist: uvicorn>=0.30
28
+ Requires-Dist: mcp>=2.2,<3 ; extra == 'mcp'
29
+ Requires-Python: >=3.12
30
+ Project-URL: Homepage, https://github.com/Daemon-VI/cadre
31
+ Project-URL: Source, https://github.com/Daemon-VI/cadre
32
+ Project-URL: Issues, https://github.com/Daemon-VI/cadre/issues
33
+ Project-URL: Changelog, https://github.com/Daemon-VI/cadre/blob/main/CHANGELOG.md
34
+ Provides-Extra: mcp
35
+ Description-Content-Type: text/markdown
36
+
37
+ # Cadre
38
+
39
+ **Cadre runs a team of AI agents that builds a new project or finishes an existing one, using
40
+ only free model API keys.** It spreads the work across every provider you add, stays inside each
41
+ one's rate limits, and when a day's quota runs out it parks the run and picks it up after the reset.
42
+
43
+ You describe the team as one YAML file: who the agents are, which tools they may use, which
44
+ checks decide "done", and how they work together. Reviewers are routed to a *different* model
45
+ family from the builder. Programs such as tests and linters decide whether work passes, not model
46
+ opinions, and votes are counted by code.
47
+
48
+ ## Quick start
49
+
50
+ Cadre needs Python 3.12 or newer. Install it with `pipx install cadre-ai` or
51
+ `uv tool install cadre-ai`, or run it without installing through
52
+ [uv](https://docs.astral.sh/uv/getting-started/installation/) as `uvx --from cadre-ai cadre …`.
53
+ The command is `cadre`.
54
+
55
+ ```bash
56
+ cadre provider add groq # 1. a free key from console.groq.com, typed at a hidden prompt
57
+ cadre forecast project-finisher "Make the failing tests pass" # 2. will it fit today?
58
+ cadre run project-finisher "Make the failing tests pass" --project ./my-repo --allow-exec # 3.
59
+ git -C my-repo log --stat cadre/<run-id> # 4. review the branch; Cadre never merges
60
+ ```
61
+
62
+ With no key at all, `cadre run decision-board "Should we open a second office?" --demo` runs an
63
+ offline scripted team.
64
+
65
+ ## Measured, not claimed
66
+
67
+ Every number here was observed on free Groq and Google AI Studio keys on 2026-09-17/18 and is
68
+ recorded with its run id in [`docs/PROJECT_STATE.md`](https://github.com/Daemon-VI/cadre/blob/main/docs/PROJECT_STATE.md) (the M5 and M11
69
+ tables).
70
+
71
+ | What | Result |
72
+ |---|---|
73
+ | `decision-board` (a five-member council votes, then a memo is written) | succeeded · 15 calls · 21.5k tokens · 125 s |
74
+ | `software-team --allow-exec` (spec → build → independent review → tests gate) | succeeded · 27 calls · 94.0k tokens · 466 s |
75
+ | `project-finisher` on a half-built fixture repository | succeeded · 14 calls · 16.8k tokens · 123 s · owner's tree unchanged |
76
+ | Capstone 1: build a unit-converter CLI | succeeded · `Ran 9 tests … OK` when re-run by hand |
77
+ | Capstone 2: finish a half-built package | succeeded · `Ran 8 tests … OK` on the delivered branch; owner's HEAD, branch and working tree unchanged |
78
+ | Defects that only real models exposed | 10, each fixed with a regression test built from the live response |
79
+ | One-line change: rewrite the file vs `edit_file` | 7,056 vs 134 tokens (Cadre's 4-characters-a-token estimate) |
80
+ | Server memory while a live run streamed | 64.5 MB idle, 72.9 MB peak |
81
+
82
+ ## Limitations
83
+
84
+ - **Checks are not sandboxed.** A check runs code the agents wrote, as you, on your machine. The
85
+ model can only name a check declared in the org file, never supply a command, and checks need
86
+ `--allow-exec` or your approval. Don't give an untrusted goal to an org with checks. A
87
+ container runner is roadmap item M12.
88
+ - **No run has parked live yet.** Parking on a daily limit and resuming after the reset is
89
+ verified with a fake clock. A real interrupted run did resume the next day without re-billing.
90
+ - **Review quality is not measured.** Only the routing of reviewers to another model family is.
91
+ - **Forecasts are rough.** They were off by up to 4.4× before recalibration, and 2.3× on a later
92
+ run, because history is kept per org and not per project size.
93
+ - **Tested by hand on Windows only.** CI covers Linux and macOS.
94
+ - **Free tiers change without notice.** Preset limits are dated starting values, corrected at
95
+ run time by each provider's rate-limit headers.
96
+
97
+ ## Install from source
98
+
99
+ Python 3.12+ and [uv](https://docs.astral.sh/uv/).
100
+
101
+ ```bash
102
+ git clone https://github.com/Daemon-VI/cadre && cd cadre
103
+ uv sync
104
+ uv run cadre init # creates ~/.cadre (set CADRE_HOME to put it elsewhere)
105
+ ```
106
+
107
+ ## Try it with no key
108
+
109
+ The demo mode swaps in a scripted, offline model that exercises every workflow end to end. It
110
+ is plumbing, not intelligence: every answer it writes is marked `[demo]`.
111
+
112
+ ```bash
113
+ uv run cadre run decision-board "Should we open a second office?" --demo
114
+ uv run cadre run software-team "a word counter" --demo --allow-exec
115
+ ```
116
+
117
+ ## Front ends
118
+
119
+ Cadre is one engine (`cadre serve`, a local API at `/api/v1`), and each of these is a thin client
120
+ of it (ADR-024):
121
+
122
+ - **AI editors (MCP):** `uvx --from "cadre-ai[mcp]" cadre mcp` gives Claude Code, VS Code, Cursor,
123
+ Windsurf and Antigravity five tools: forecast, start a run, run status, usage and list orgs.
124
+ They can't approve anything. There's a config snippet for each host in
125
+ [`docs/MCP_HOSTS.md`](https://github.com/Daemon-VI/cadre/blob/main/docs/MCP_HOSTS.md).
126
+ - **GitHub Action:** label an issue `cadre` or comment `/cadre <goal>`. Cadre runs
127
+ `project-finisher` on the checkout and opens a pull request with its report and usage table.
128
+ Only the owner, members and collaborators can trigger it. Copy
129
+ [`examples/github-action/cadre.yml`](https://github.com/Daemon-VI/cadre/blob/main/examples/github-action/cadre.yml) and add a free key as a
130
+ repository secret.
131
+ - **VS Code extension** (Marketplace and Open VSX, so also Antigravity, Cursor and Windsurf): see
132
+ [`editors/vscode`](https://github.com/Daemon-VI/cadre/tree/main/editors/vscode).
133
+ - **Container:** `ghcr.io/daemon-vi/cadre`, non-root, state in `/data`, keys from environment
134
+ variables. See [`compose.yaml`](compose.yaml).
135
+ - **Standalone downloads** for Windows, macOS and Linux are attached to each GitHub Release. They
136
+ are unsigned, so SmartScreen and Gatekeeper will warn. Checks that use `{python}` need a Python
137
+ on PATH.
138
+
139
+ On a server, in CI or in a container with no keychain, set `CADRE_NO_KEYRING=1`, put keys in
140
+ environment variables, and run `cadre provider add-from-env` to register every free provider
141
+ whose key is present.
142
+
143
+ ## Add a free model
144
+
145
+ ```bash
146
+ uv run cadre presets # every provider Cadre knows, with free-tier notes
147
+ uv run cadre provider add groq # prompts for the key with input hidden
148
+ uv run cadre provider list
149
+ uv run cadre provider test groq
150
+ uv run cadre provider key groq # replace a stored key, e.g. after rotating it
151
+ ```
152
+
153
+ The key goes to the OS credential store (Windows Credential Manager, macOS Keychain, Secret
154
+ Service), never to a file. Environment variables work too, checked first:
155
+ `CADRE_KEY_GROQ`, then the provider's usual name (`GROQ_API_KEY`). On a headless machine with no
156
+ keychain (a server, a container, CI), set `CADRE_NO_KEYRING=1` and pass keys only as environment
157
+ variables.
158
+
159
+ Add as many providers as you have keys. More providers means more parallel capacity and real
160
+ reviewer independence.
161
+
162
+ ```bash
163
+ uv run cadre provider add gemini
164
+ uv run cadre provider add openrouter # discovers the current :free models
165
+ uv run cadre provider models openrouter # what the endpoint serves today
166
+ uv run cadre provider set-model groq openai/gpt-oss-20b --tier fast --tpm 8000
167
+ ```
168
+
169
+ ## Run a team
170
+
171
+ ```bash
172
+ uv run cadre run software-team "a CSV to Markdown table converter" --allow-exec
173
+ uv run cadre run startup-company "Launch a flashcard app for engineering students"
174
+ uv run cadre runs
175
+ uv run cadre show <run-id> --events
176
+ uv run cadre resume <run-id> # finished steps are reused, not re-billed
177
+ uv run cadre cancel <run-id>
178
+ ```
179
+
180
+ Without `--allow-exec`, the first check asks you before running anything. Approval gates and
181
+ agent questions are asked in the terminal; add `--yes` to auto-approve gates, or
182
+ `--approve-elsewhere` to answer from the dashboard or `cadre approve <id>`.
183
+
184
+ Every run gets a workspace at `~/.cadre/runs/<run-id>/workspace/`, with every file version kept
185
+ under `versions/`.
186
+
187
+ ## Finish an existing project
188
+
189
+ ```bash
190
+ uv run cadre run project-finisher "Make the failing tests pass" --project C:\path\to\repo --allow-exec
191
+ ```
192
+
193
+ Cadre works in a git worktree on a new branch `cadre/<run-id>` and commits each finished step
194
+ there with your repository's own identity. Your working tree, current branch and uncommitted
195
+ changes are never touched (a dirty tree is refused unless you pass `--allow-dirty`), and Cadre
196
+ never merges or pushes. Checks come from the org file and from `.cadre/checks.yaml` as committed
197
+ at the base commit, for example:
198
+
199
+ ```yaml
200
+ checks:
201
+ - name: tests
202
+ command: ["{python}", "-m", "pytest", "-q"]
203
+ ```
204
+
205
+ The run ends by printing the branch's commits, `git diff --stat`, and the commands to review or
206
+ discard it. `cadre runs cleanup` removes finished worktrees and keeps their branches.
207
+
208
+ ## Will it fit? Usage and forecasts
209
+
210
+ ```bash
211
+ uv run cadre forecast software-team "a CSV to Markdown table converter"
212
+ uv run cadre usage --days 7
213
+ ```
214
+
215
+ The forecast answers *fits now*, *fits today after ~N min of waits*, *needs ~N days* or *cannot
216
+ run*, and always says its basis: `measured, n = …` once an org has finished runs, or `no history,
217
+ estimated from template size` before that. `cadre run` prints it before starting. The usage
218
+ ledger shows requests, tokens and the share of each daily cap per day, provider and model, with
219
+ the next reset in IST.
220
+
221
+ ## Long jobs: parking and resuming
222
+
223
+ When every model a run can use has hit its *daily* limit, the run is **parked** instead of
224
+ failing, with the time it can continue (each provider's own reset clock). Nothing already finished
225
+ is repeated or billed again when it resumes.
226
+
227
+ ```bash
228
+ uv run cadre serve # resumes parked runs by itself while it is running
229
+ uv run cadre resume --due # or resume every run whose reset has passed, once
230
+ uv run cadre scheduler install # or check every 30 minutes from the OS scheduler (asks first)
231
+ ```
232
+
233
+ Budgets count everything a run has used across days. `max_days` (default 7) stops a run that has
234
+ gone on too long; `max_tokens_per_day` spreads a job over several days; `cadre resume <id>
235
+ --add-calls 20` raises a stopped run's allowance.
236
+
237
+ ## Dashboard
238
+
239
+ ```bash
240
+ uv run cadre serve # http://127.0.0.1:8765, loopback only
241
+ uv run cadre ui # opens the browser with the access token in the URL fragment
242
+ ```
243
+
244
+ To reach it through a Tailscale name or from a container, add `--allowed-host NAME` (repeatable,
245
+ exact names only); anything else is still refused. The API is versioned at `/api/v1`.
246
+
247
+ Runs with a live timeline, files, per-agent token usage and results; organisations with a YAML
248
+ editor and validator; models and keys with live quota bars; pending approvals.
249
+
250
+ ## Templates
251
+
252
+ | Template | Pattern | What it does |
253
+ |---|---|---|
254
+ | `software-team` | sequence → review loop → docs | PM writes a spec, engineer builds and tests, an independent reviewer checks it, `compile` and `tests` checks gate it, a writer documents it |
255
+ | `decision-board` | council | CFO, CTO, CMO and a risk officer propose, critique, and vote; the CEO chairs, breaks ties and writes the memo |
256
+ | `startup-company` | manager | A founder plans a task graph for researcher, engineer, designer and marketer; a QA lead reviews each deliverable |
257
+ | `project-finisher` | manager (repo checks, reviewer) | Finishes work in an existing repository (`--project`): the lead plans, the engineer edits, the repo's own checks gate, a reviewer on another family advises, a branch is delivered |
258
+ | `research-desk` | parallel → review loop → approval | Three analysts in parallel, an editor merges, a fact-checker reviews, a human approves |
259
+
260
+ Copy one to edit: `uv run cadre org new my-team --from software-team`, then
261
+ `uv run cadre org validate my-team`.
262
+
263
+ ## The organisation file
264
+
265
+ ```yaml
266
+ name: tiny-team
267
+ agents:
268
+ - id: builder
269
+ role: Python engineer
270
+ tools: [list_files, read_file, write_file, run_check]
271
+ - id: reviewer
272
+ role: Code reviewer
273
+ diverse_from: builder # prefer a different model family
274
+ tools: [list_files, read_file]
275
+ checks:
276
+ - name: tests
277
+ command: ["{python}", "-m", "unittest", "discover", "-p", "test_*.py"]
278
+ budget: {max_calls: 40, max_tokens: 150000, max_minutes: 20, max_parallel: 2}
279
+ workflow:
280
+ - builder: builder
281
+ reviewers: [reviewer]
282
+ checks: [tests]
283
+ max_rounds: 3
284
+ task: "Build {goal} in app.py with tests in test_app.py."
285
+ ```
286
+
287
+ Step types (`type:` may be omitted when the keys make it obvious):
288
+
289
+ | Type | Does |
290
+ |---|---|
291
+ | `agent` | one agent, one task, bounded tool turns |
292
+ | `sequence` | steps in order (a bare list is a sequence); `{prev}` is the last output |
293
+ | `parallel` | steps at once, optionally combined by a `join` agent |
294
+ | `review_loop` | builder → checks → reviewers (JSON verdicts) → feedback, up to `max_rounds` |
295
+ | `council` | proposals → critique rounds → options → votes → tally (`majority`, `supermajority`, `unanimous`, `plurality`) → memo |
296
+ | `manager` | manager plans a task graph, workers run it in dependency order, optional reviewer, final report |
297
+ | `approval` | wait for a human |
298
+
299
+ Templates can use `{goal}`, `{prev}` and `{out.<step id>}`. Tools: `list_files`, `read_file`,
300
+ `search`, `write_file`, `edit_file`, `post_note`, `run_check`, `ask_human` (see *Agent tools*).
301
+ Everything is validated before the first
302
+ model call, and errors name their path in the file.
303
+
304
+ ## Free providers (checked 2026-09-17)
305
+
306
+ Every free chat model a key reaches is its own quota bucket. Each provider also has its own
307
+ daily clock and a recorded answer to "does the free tier train on my prompts?".
308
+
309
+ | Preset | Models and limits Cadre starts from | Day resets | Trains on free prompts |
310
+ |---|---|---|---|
311
+ | `groq` | `openai/gpt-oss-120b`, `gpt-oss-20b`, `qwen/qwen3.8-27b`: 30 RPM, 1,000 RPD, 8,000 TPM, 200k TPD each (docs). Two model families on one key | rolling (no clock published; headers override) | no |
312
+ | `gemini` | Seven chat models, each its own bucket: Gemini 3.8/3.7/3.6/3.5 Flash, 3 Flash preview, 3.5/3.1 Flash-Lite (the 2.5 models answered 404 to a new key on 2026-09-17). Google publishes no per-model numbers; Flash 20 RPD and Flash-Lite 500 RPD are third-party reports, the rest are guesses; a daily-quota 429 teaches Cadre the real limit | midnight Pacific (docs) | **yes** |
313
+ | `openrouter` | `:free` models, discovered: 20 RPM, 50/day (1,000/day once 10 credits were ever bought) (docs) | UTC day (docs) | unknown — depends on the model's host |
314
+ | `mistral` | medium/small: 2 RPM (reported) | not stated | **yes** unless you opt out |
315
+ | `cohere` | `command-a-03-2025`: 20 RPM, 1,000 calls/month, non-commercial (docs) | not stated | yes unless you opt out |
316
+ | `nvidia` | `meta/llama-3.3-70b-instruct`: 40 RPM (reported); trial credits | not stated | **yes** (trial terms) |
317
+ | `cloudflare` | Llama 3.3 70B, gpt-oss-120b: 10,000 neurons/day, 300 RPM; needs `--param account_id=…` | 00:00 UTC (docs) | no |
318
+ | `zai` | `glm-4.7-flash`, `glm-4.5-flash` (free per docs; limits guessed) | not stated | unknown |
319
+ | `huggingface` | ~$0.10 credit/month | counted per UTC day (the credit itself is monthly) | unknown — depends on the upstream provider |
320
+ | `ollama`, `llamacpp`, `lmstudio` | local, no key, no limits — slow on an 8 GB laptop | — | no |
321
+ | `deepseek`, `openai`, `anthropic`, `custom` | **paid**, opt-in, same adapter. DeepSeek has no free tier, and OpenRouter listed no free DeepSeek model on 2026-09-17 | — | — |
322
+
323
+ Free catalogues change without notice: Cerebras became a card-required trial and GitHub Models
324
+ was retired in July 2026. These numbers are only starting values. Cadre overrides them with each
325
+ provider's own rate-limit headers, `cadre provider refresh` shows what each endpoint serves today
326
+ (`--apply` adds new models and disables vanished ones, never touching limits you set), and any
327
+ number can be changed with `cadre provider set-model`. Cadre keeps 10% of every daily cap unused
328
+ (`reserve_pct`) for other programs that share the key.
329
+
330
+ Use **one account per provider.** Capacity grows by adding *different* providers; several
331
+ accounts or projects at one provider to multiply a free limit breaks their terms.
332
+
333
+ ### Private runs
334
+
335
+ `cadre run … --private` (or `privacy: private` in the org file) only uses providers that say they
336
+ do not train on prompts — today Groq, Cloudflare and local models. The run records which models it
337
+ excluded, and fails before its first call if none are left.
338
+
339
+ ## Agent tools
340
+
341
+ `list_files`, `read_file` (optionally a line range), `search` (regex, capped), `write_file`,
342
+ `edit_file` (replace one exact, unique match — far cheaper than rewriting a file), `post_note`,
343
+ `run_check` (a check *named* in the org file) and `ask_human`. An agent only gets the tools its
344
+ entry lists. Agents with file tools also see a capped repo map: paths, line counts and top-level
345
+ Python classes and functions.
346
+
347
+ ## Safety
348
+
349
+ - **Checks run code the agents wrote, as you, on your machine. This is not a sandbox.** The
350
+ model can only name a check declared in the org file; it never supplies a command. Checks run
351
+ in the run's workspace with a timeout, capped output, and an environment stripped of anything
352
+ that looks like a key, token or password. They need `--allow-exec` or your approval. Don't
353
+ give an untrusted goal to an org with checks; a container runner is on the roadmap.
354
+ - File tools cannot leave the run workspace (absolute paths, `..`, symlinks, drive letters,
355
+ device names and alternate data streams are refused).
356
+ - The API listens on 127.0.0.1, requires a bearer token (`~/.cadre/token`) on every call,
357
+ rejects non-loopback `Host` headers, sends no CORS headers, and serves a strict CSP.
358
+ - Keys live in the OS credential store or your environment — never in `config.yaml`, the
359
+ database, events, API responses or logs. Loaded keys are redacted from everything stored.
360
+ - Respect each provider's terms. Cadre spreads work across *different* providers; it does not
361
+ create accounts or rotate several keys of one provider to get around a limit.
362
+
363
+ ## Development
364
+
365
+ ```bash
366
+ uv run pytest -q
367
+ uv run ruff check src tests
368
+ ```
369
+
370
+ The tests need no network and no key: HTTP is mocked and models are scripted. See
371
+ [`CONTRIBUTING.md`](https://github.com/Daemon-VI/cadre/blob/main/CONTRIBUTING.md); report security problems privately as described in
372
+ [`SECURITY.md`](https://github.com/Daemon-VI/cadre/blob/main/SECURITY.md).
373
+
374
+ ## Licence
375
+
376
+ Apache-2.0. See [`LICENSE`](https://github.com/Daemon-VI/cadre/blob/main/LICENSE).
377
+
378
+ ## Documentation
379
+
380
+ - [`docs/SRS.md`](https://github.com/Daemon-VI/cadre/blob/main/docs/SRS.md) — requirements (the refined idea, FR/NFR list)
381
+ - [`docs/ARCHITECTURE.md`](https://github.com/Daemon-VI/cadre/blob/main/docs/ARCHITECTURE.md) — design and decision records
382
+ - [`docs/OBJECTIVES.md`](https://github.com/Daemon-VI/cadre/blob/main/docs/OBJECTIVES.md) — objectives, how each is met, evidence
383
+ - [`docs/TEST_PLAN.md`](https://github.com/Daemon-VI/cadre/blob/main/docs/TEST_PLAN.md) — test strategy and requirement traceability
384
+ - [`docs/ROADMAP.md`](https://github.com/Daemon-VI/cadre/blob/main/docs/ROADMAP.md) — what comes next, and what was deferred and why
385
+ - [`docs/PROJECT_STATE.md`](https://github.com/Daemon-VI/cadre/blob/main/docs/PROJECT_STATE.md) — where the project actually stands