co-agent-coder 0.1.0__py3-none-any.whl

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 (51) hide show
  1. co_agent_coder-0.1.0.dist-info/METADATA +396 -0
  2. co_agent_coder-0.1.0.dist-info/RECORD +51 -0
  3. co_agent_coder-0.1.0.dist-info/WHEEL +5 -0
  4. co_agent_coder-0.1.0.dist-info/entry_points.txt +5 -0
  5. co_agent_coder-0.1.0.dist-info/licenses/LICENSE +201 -0
  6. co_agent_coder-0.1.0.dist-info/top_level.txt +1 -0
  7. coagent/__init__.py +84 -0
  8. coagent/__main__.py +6 -0
  9. coagent/agent/__init__.py +27 -0
  10. coagent/agent/budget.py +220 -0
  11. coagent/agent/loop.py +1102 -0
  12. coagent/agent/prompts.py +228 -0
  13. coagent/agent/state.py +181 -0
  14. coagent/cli.py +351 -0
  15. coagent/config.py +307 -0
  16. coagent/context/__init__.py +26 -0
  17. coagent/context/artifacts.py +431 -0
  18. coagent/context/repo_map.py +590 -0
  19. coagent/context/retrieval.py +375 -0
  20. coagent/context/tokens.py +93 -0
  21. coagent/evals/__init__.py +0 -0
  22. coagent/gitx/__init__.py +52 -0
  23. coagent/gitx/commit.py +91 -0
  24. coagent/gitx/durable.py +147 -0
  25. coagent/gitx/git.py +351 -0
  26. coagent/gitx/lock.py +157 -0
  27. coagent/gitx/log.py +85 -0
  28. coagent/gitx/resume.py +199 -0
  29. coagent/gitx/session.py +233 -0
  30. coagent/llm/__init__.py +83 -0
  31. coagent/llm/base.py +235 -0
  32. coagent/llm/grammar.py +306 -0
  33. coagent/llm/registry.py +147 -0
  34. coagent/llm/transformers_backend.py +326 -0
  35. coagent/py.typed +0 -0
  36. coagent/safety/__init__.py +24 -0
  37. coagent/safety/denylist.py +146 -0
  38. coagent/safety/policy.py +219 -0
  39. coagent/safety/redact.py +146 -0
  40. coagent/templates/config.toml +104 -0
  41. coagent/tools/__init__.py +155 -0
  42. coagent/tools/artifacts.py +307 -0
  43. coagent/tools/base.py +226 -0
  44. coagent/tools/fs.py +507 -0
  45. coagent/tools/notebooks.py +875 -0
  46. coagent/tools/pyt.py +240 -0
  47. coagent/tools/shell.py +558 -0
  48. coagent/ui/__init__.py +50 -0
  49. coagent/ui/gradio_app.py +353 -0
  50. coagent/ui/notebook.py +342 -0
  51. coagent/ui/render.py +422 -0
@@ -0,0 +1,396 @@
1
+ Metadata-Version: 2.4
2
+ Name: co-agent-coder
3
+ Version: 0.1.0
4
+ Summary: A private AI coding agent for the free Google Colab T4: local 7B model, git-backed memory, reviewable branches.
5
+ Author: Lyle Okoth
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/lyle-mlengineer/coagent
8
+ Project-URL: Documentation, https://github.com/lyle-mlengineer/coagent/blob/main/README.md
9
+ Project-URL: Source, https://github.com/lyle-mlengineer/coagent
10
+ Project-URL: Issues, https://github.com/lyle-mlengineer/coagent/issues
11
+ Project-URL: Changelog, https://github.com/lyle-mlengineer/coagent/blob/main/CHANGELOG.md
12
+ Keywords: coding-agent,colab,llm,transformers,git,qwen
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Operating System :: POSIX :: Linux
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: Topic :: Software Development :: Code Generators
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: tomli>=2.0.1; python_version < "3.11"
27
+ Provides-Extra: llm
28
+ Requires-Dist: torch<2.7,>=2.4; extra == "llm"
29
+ Requires-Dist: transformers<4.49,>=4.45; extra == "llm"
30
+ Requires-Dist: accelerate<1.2,>=0.34; extra == "llm"
31
+ Requires-Dist: bitsandbytes<0.47,>=0.43; extra == "llm"
32
+ Requires-Dist: safetensors>=0.4.3; extra == "llm"
33
+ Provides-Extra: ui
34
+ Requires-Dist: ipywidgets>=8.1; extra == "ui"
35
+ Requires-Dist: ipython>=8.18; extra == "ui"
36
+ Requires-Dist: nbformat>=5.10; extra == "ui"
37
+ Requires-Dist: nbconvert>=7.16; extra == "ui"
38
+ Provides-Extra: gradio
39
+ Requires-Dist: gradio<6,>=4.44; extra == "gradio"
40
+ Provides-Extra: context
41
+ Requires-Dist: tree-sitter<0.25,>=0.23; extra == "context"
42
+ Requires-Dist: tree-sitter-python>=0.23; extra == "context"
43
+ Requires-Dist: tree-sitter-javascript>=0.23; extra == "context"
44
+ Requires-Dist: json5>=0.9.25; extra == "context"
45
+ Provides-Extra: dev
46
+ Requires-Dist: pytest>=8.2; extra == "dev"
47
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
48
+ Requires-Dist: ruff>=0.6; extra == "dev"
49
+ Requires-Dist: nbformat>=5.10; extra == "dev"
50
+ Requires-Dist: nbconvert>=7.16; extra == "dev"
51
+ Requires-Dist: ipykernel>=6.29; extra == "dev"
52
+ Provides-Extra: colab
53
+ Requires-Dist: coagent[context,llm,ui]; extra == "colab"
54
+ Provides-Extra: all
55
+ Requires-Dist: coagent[context,dev,gradio,llm,ui]; extra == "all"
56
+ Dynamic: license-file
57
+
58
+ # coAgent
59
+
60
+ <p align="center">
61
+ <img src="./assets/cover.png" alt="coAgent — a private coding agent for the free Google Colab T4 that commits every checkpoint back to git" width="100%" />
62
+ </p>
63
+
64
+ <p align="center">
65
+ <img src="https://img.shields.io/badge/Status-design%20v1.0-FFC24B?style=for-the-badge&logoColor=black" alt="Design v1.0"/>
66
+ <img src="https://img.shields.io/badge/Target-free%20Colab%20T4-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white" alt="Free Colab T4"/>
67
+ <img src="https://img.shields.io/badge/Model-7B%20NF4%20%C2%B7%2012k-7EF0C0?style=for-the-badge&logoColor=black" alt="7B NF4, 12k context"/>
68
+ <img src="https://img.shields.io/badge/Python-3.11-3776AB?style=for-the-badge&logo=python&logoColor=white" alt="Python 3.11"/>
69
+ <a href="https://github.com/lyle-mlengineer/coagent-web"><img src="https://img.shields.io/badge/Web-coagent--web-E05785?style=for-the-badge&logo=github&logoColor=white" alt="Web front door"/></a>
70
+ <a href="https://colab.research.google.com/github/lyle-mlengineer/coagent/blob/main/notebooks/bootstrap.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"/></a>
71
+ <img src="https://img.shields.io/badge/License-Apache%202.0-D22128?style=for-the-badge&logo=apache&logoColor=white" alt="Apache 2.0"/>
72
+ </p>
73
+
74
+ **[Open in Colab](https://colab.research.google.com/github/lyle-mlengineer/coagent/blob/main/notebooks/bootstrap.ipynb) · [Design](./DESIGN.md) · [PRD](./PRD.md) · [Web front door](https://github.com/lyle-mlengineer/coagent-web)**
75
+
76
+ > **Design stage.** This repository holds the full architecture (`DESIGN.md`) and product requirements (`PRD.md`); implementation starts at v0.1 in the build plan below. Every interface shown here — the cell, the commands, the config — is the target v0.1 surface, not a shipped package yet.
77
+
78
+ ### Run it
79
+
80
+ Open the bootstrap notebook in Colab — **Runtime → Change runtime type → T4 GPU** — and run the cells. The whole install story is three lines:
81
+
82
+ ```python
83
+ from coagent import coAgent
84
+ agent = coAgent(repo="https://github.com/you/project.git")
85
+ agent.chat("add a chunked CSV loader and test that dtypes are preserved")
86
+ ```
87
+
88
+ The notebook checks your hardware before loading weights and refuses with a reason if the runtime cannot host the model. Everything after that — the plan, each edit, the test result, the commit — appears in the cell, and every checkpoint lands on a `coagent/<session>` branch you can review.
89
+
90
+ **coAgent is an AI coding agent that lives inside a Google Colab notebook.** It clones your repo into the free T4, plans inside your own files, edits with a locally loaded 7B model, runs your tests on CPU, and commits every checkpoint back to git — on a branch you can review. The runtime is disposable; the repository is the memory.
91
+
92
+ No API keys. No per-token cost. Nothing sent to a third-party model API — your code only travels to the repo you already own.
93
+
94
+ The public landing page, waitlist, and GitHub sign-in live in [coagent-web](https://github.com/lyle-mlengineer/coagent-web). This repo is the agent itself.
95
+
96
+ ## What it does
97
+
98
+ **Cloud coding agents assume a credit card and that you will send them your code.** Colab gives students, researchers, and independent engineers a free GPU but none of the workflow: no durable disk, no inbound ports, and a runtime that disappears without warning. coAgent is designed backwards from that constraint.
99
+
100
+ - 🔒 **Private by construction** — the 7B model runs in your Colab VM. Your code is never sent to a third-party API, and there is no account beyond GitHub.
101
+ - 💸 **Zero keys, zero marginal cost** — 7B at NF4 fits the free T4 (4.2–4.6 GB of weights, ≤10 GB peak VRAM), so exploration is never metered.
102
+ - 🧠 **Git is the state store** — one commit per verified step, pushed or bundled off the VM before the next turn. A dead runtime costs at most one step.
103
+ - ✅ **Tests are the critic** — a 7B model cannot hold a system in its head, so deterministic checks decide what counts as done: parse, lint, then your suite.
104
+ - 🧯 **Honest about failure** — a VRAM OOM ladder, step/wall-clock/token budgets, loop detection, and a written report instead of a silent stop.
105
+ - 📓 **Notebook-native** — plots render inline, artifacts persist to the repo or Drive with a manifest, and the UI works without hosting anything.
106
+
107
+ ## Who it's for
108
+
109
+ | If you are… | coAgent gives you… |
110
+ | --- | --- |
111
+ | **A solo ML engineer** *(primary)* | Repo changes and test runs without leaving Colab or paying per token — with your code staying private. |
112
+ | **A data analyst** | A cell edited, executed, and a figure rendered and saved with a manifest, not just source files. |
113
+ | **A student or learner** | A real coding agent at zero marginal cost, on hardware you already have. |
114
+ | **Not for:** teams needing concurrent users, monorepos over ~50k LOC, or fully autonomous long-running agents. | Those needs would compromise the T4-only, single-user design. |
115
+
116
+ ## How it works
117
+
118
+ ```mermaid
119
+ flowchart TB
120
+ subgraph U["You · browser tab"]
121
+ NB["Notebook cell · chat, plan approval, artifacts"]
122
+ end
123
+ subgraph V["Colab VM · disposable"]
124
+ K["IPython kernel"]
125
+ A["agent loop · survey → plan → act → verify"]
126
+ M["Qwen2.5-Coder-7B · NF4 · 12k ctx"]
127
+ T["tool runtime · subprocess · git"]
128
+ W["/content/repo"]
129
+ end
130
+ subgraph D["Durable"]
131
+ GH["GitHub · branch coagent/2026-11-12-a1b2c3"]
132
+ DR["Drive · bundles, artifacts, HF cache"]
133
+ end
134
+ NB --> K --> A
135
+ A <--> M
136
+ A --> T --> W
137
+ W -->|"checkpoint: commit + push"| GH
138
+ W -.->|"bundle when push is unavailable"| DR
139
+ V -.->|"eviction"| D
140
+ ```
141
+
142
+ The loop is split into five phases with **different prompts and different tool sets**, because a small model does one job well:
143
+
144
+ | Phase | Sees | Can do | Sampling |
145
+ | --- | --- | --- | --- |
146
+ | **SURVEY** | repo map, task, plan | read tools only | T=0.2 |
147
+ | **PLAN** | task + retrieved files | nothing — writes a plan file | T=0.7 |
148
+ | **ACT** | plan, excerpts, last 3 observations | one write or exec | T=0.2 |
149
+ | **VERIFY** | diff, test output | run tests/lint only | deterministic |
150
+ | **REPORT** | plan, log | nothing | T=0.5 |
151
+
152
+ **PLAN cannot write.** A model that can act while planning will start editing before it has read the file. For anything beyond a single-file change, the plan is shown and must be approved before ACT — the human supplies intent, the model executes.
153
+
154
+ ### A worked turn
155
+
156
+ ```text
157
+ user: add a chunked CSV loader to src/loader.py and test dtype preservation
158
+
159
+ SURVEY read src/loader.py, src/frame.py; repo map shows Frame.from_rows exists
160
+ PLAN .coagent/plans/chunked-csv.md written [approved]
161
+ ACT edit_file src/loader.py (+18 -3) [syntax ok]
162
+ VERIFY pytest tests/test_loader.py -q → 1 failed [assert dtype]
163
+ ACT edit_file src/loader.py:31 [fix cast]
164
+ VERIFY pytest -q → 12 passed
165
+ CHECKPOINT commit a1b2c3d "coagent: add chunked CSV loader" (Coagent-Step: 7) + push
166
+ REPORT branch coagent/2026-11-12-a1b2c3 ready; 1 file, +18 -3, 12 tests green
167
+ ```
168
+
169
+ ## Designed backwards from a free T4
170
+
171
+ Every design decision is a response to a Colab constraint.
172
+
173
+ | Colab reality | What coAgent does about it |
174
+ | --- | --- |
175
+ | **Ephemeral VM**, ~12 h cap, ~90 min idle disconnect | Commit per verified step, sync off the VM before the next turn, and resume from the last checkpoint on any new VM. |
176
+ | **One free T4**, 16 GB, compute capability 7.5 | 7B at NF4, 12,288-token hard cap, fp16 + SDPA. Model resident ~6.5–8 GB, leaving ≥7 GB for your own work. |
177
+ | **~25 tokens/s decode** | Repo map instead of exploration, diffs instead of rewrites, tests instead of self-critique. Turns-to-done is the metric. |
178
+ | **2 vCPU, ~12.7 GB RAM** | No vector database. BM25 over function-sized chunks plus a symbol graph. |
179
+ | **No inbound ports** | The UI lives in the notebook; no daemon, no tunnel, no hosted service. |
180
+ | **Root-ish shell, no containers** | Approval matrix, command denylist, path jail on reads *and* writes. The denylist is a seatbelt, not a sandbox — the real control is the human click. |
181
+
182
+ Preflight prints the GPU, VRAM, RAM, cache state, and chosen context budget before loading weights, then refuses anything that is not a T4 (compute capability 7.5, ≥14 GB VRAM) unless `--allow-unsupported` is passed. If the 7B cannot fit after the OOM ladder, the fallback is the 3B at 8k — never a larger model, never CPU-only, never a paid tier.
183
+
184
+ ## Safety and trust
185
+
186
+ | Action | Default |
187
+ | --- | --- |
188
+ | read / grep / repo map, inside the jail | allow |
189
+ | read outside the jail | deny unless explicitly allowed |
190
+ | write inside the repo, on the session branch | allow |
191
+ | run tests, lint, syntax check | allow |
192
+ | arbitrary shell command, network, install | ask |
193
+ | delete / move / chmod, write outside the repo | ask |
194
+ | `git push` to `coagent/*` on a configured remote | allow at checkpoint |
195
+ | push to `main`, `--force`, `reset --hard` | deny |
196
+
197
+ - **Branch isolation** — coAgent works on `coagent/<date>-<id>` and never pushes to `main`. `git log --author=coagent` is the audit trail.
198
+ - **Secrets** — read from Colab `userdata` into memory, injected only into the git child process, never into the repo or a log. Clone through a `GIT_ASKPASS` helper instead of putting a token in the remote URL.
199
+ - **Redaction** — GitHub, Hugging Face, OpenAI, AWS, Google, and JWT-shaped tokens are scrubbed before any log or display write.
200
+ - **Prompt injection** — observations are wrapped as data, side effects require approval, and the agent branch cannot reach `main`. The second layer is the real guarantee; the docs say so plainly.
201
+
202
+ ## How to use it
203
+
204
+ The target flow is one Colab notebook, one repo URL, and a task. Everything below ships with v0.1.
205
+
206
+ 1. **Open the bootstrap notebook in Colab** and select a T4 runtime. Preflight reports the hardware and the context budget before a single weight is loaded.
207
+ 2. **Add a fine-grained GitHub PAT** to Colab secrets as `GH_TOKEN`, scoped to the one repo. It never enters the notebook source.
208
+ 3. **Run the cell.** Install, construct, chat — at most three lines of user code. Cold start targets ≤10 minutes; the weights are cached locally for the next session.
209
+ 4. **Describe the task.** coAgent surveys, proposes a plan, and waits for your approval before it writes anything.
210
+ 5. **Review the branch.** Every verified step is a commit with `Coagent-Session`, `Coagent-Step`, and `Coagent-Verify` trailers; `coagent push` opens the PR path.
211
+ 6. **Recover.** If the runtime dies, run `coagent resume` on a fresh VM and it replays from the last checkpoint, losing at most one step.
212
+
213
+ ```python
214
+ !pip -q install co-agent-coder # or: git+https://github.com/lyle-mlengineer/coagent
215
+
216
+ from coagent import coAgent
217
+
218
+ agent = coAgent(repo="https://github.com/you/my-project.git")
219
+ agent.chat("add a chunked CSV loader and test dtype preservation")
220
+ ```
221
+
222
+ ### Commands
223
+
224
+ | Command | What happens |
225
+ | --- | --- |
226
+ | `coagent chat` | Opens the notebook chat loop in the current kernel. |
227
+ | `coagent run "<task>"` | One-shot: survey → plan → act → verify → checkpoint → report. |
228
+ | `coagent resume` | Rebuilds session state from branch + plan + log on any VM. |
229
+ | `coagent doctor` | Versions, GPU, cache, git auth, and a one-line verdict. |
230
+ | `coagent report` | Session summary generated from `.coagent/sessions/*.jsonl`. |
231
+ | `coagent eval` | Runs the task suite and reports turns-to-done. |
232
+ | `coagent push` | Pushes `coagent/*` and optionally opens a PR. |
233
+
234
+ ## Configuration
235
+
236
+ Per-repo settings are committed so a session is reproducible on any machine:
237
+
238
+ | Key | Default | Notes |
239
+ | --- | --- | --- |
240
+ | `model.name` | `Qwen/Qwen2.5-Coder-7B-Instruct` | 3B is the validated fallback. |
241
+ | `model.quant` | `nf4` | bitsandbytes NF4; fp16 compute on T4. |
242
+ | `model.max_context` | `12288` | Hard cap, counted with the model's tokenizer. |
243
+ | `verify.commands` | `["ruff check .", "pytest -q"]` | CPU-only by default. |
244
+ | `verify.gpu_commands` | `[]` | Explicit opt-in; the model yields VRAM first. |
245
+ | `verify.timeout_s` | `300` | Per command; process group is killed. |
246
+ | `verify.require_tests` | `true` | A feature without a test is not done. |
247
+ | `durability.mode` | `push` | `push` to git, or `bundle` to Drive when offline. |
248
+ | `durability.remote` | `origin` | Push target; `main` is denied. |
249
+ | `safety.deny` | force-push, `main` | Enforced in code, not in the prompt. |
250
+ | `safety.require_approval` | network, install, delete, outside-repo writes | Default flips to deny when non-interactive. |
251
+
252
+ Bootstrap sets the git identity, installs the credential helper, and warns — never silently edits — when `.gitignore` is missing `.env` or `.coagent/secrets*`.
253
+
254
+ ```toml
255
+ # .coagent/config.toml
256
+ [model]
257
+ name = "Qwen/Qwen2.5-Coder-7B-Instruct"
258
+ quant = "nf4"
259
+ max_context = 12288
260
+
261
+ [verify]
262
+ commands = ["ruff check .", "pytest -q"] # CPU-only by default
263
+ gpu_commands = [] # run once, after the model yields VRAM
264
+ timeout_s = 300
265
+ require_tests = true
266
+
267
+ [durability]
268
+ mode = "push" # push | bundle (Drive)
269
+ remote = "origin"
270
+
271
+ [safety]
272
+ deny = ["git push --force", "git push origin main"]
273
+ ```
274
+
275
+ ## Tech stack
276
+
277
+ <p align="center">
278
+ <img src="https://img.shields.io/badge/Python%203.11-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python 3.11"/>
279
+ <img src="https://img.shields.io/badge/PyTorch-EE4C2C?style=flat-square&logo=pytorch&logoColor=white" alt="PyTorch"/>
280
+ <img src="https://img.shields.io/badge/Transformers-FFD21E?style=flat-square&logo=huggingface&logoColor=black" alt="Transformers"/>
281
+ <img src="https://img.shields.io/badge/bitsandbytes%20NF4-4B8BBE?style=flat-square" alt="bitsandbytes"/>
282
+ <img src="https://img.shields.io/badge/Qwen2.5--Coder-615CED?style=flat-square" alt="Qwen2.5-Coder"/>
283
+ </p>
284
+ <p align="center">
285
+ <img src="https://img.shields.io/badge/tree--sitter-2F6F44?style=flat-square" alt="tree-sitter"/>
286
+ <img src="https://img.shields.io/badge/outlines-111111?style=flat-square" alt="outlines"/>
287
+ <img src="https://img.shields.io/badge/nbformat-F37626?style=flat-square&logo=jupyter&logoColor=white" alt="nbformat"/>
288
+ <img src="https://img.shields.io/badge/pytest-0A9EDC?style=flat-square&logo=pytest&logoColor=white" alt="pytest"/>
289
+ <img src="https://img.shields.io/badge/Ruff-D7FF64?style=flat-square&logoColor=black" alt="Ruff"/>
290
+ </p>
291
+ <p align="center">
292
+ <img src="https://img.shields.io/badge/Google%20Colab-F9AB00?style=flat-square&logo=googlecolab&logoColor=white" alt="Google Colab"/>
293
+ <img src="https://img.shields.io/badge/Git-F05032?style=flat-square&logo=git&logoColor=white" alt="Git"/>
294
+ <img src="https://img.shields.io/badge/Drive-4285F4?style=flat-square&logo=googledrive&logoColor=white" alt="Google Drive"/>
295
+ <img src="https://img.shields.io/badge/Apache%202.0-D22128?style=flat-square&logo=apache&logoColor=white" alt="Apache 2.0"/>
296
+ </p>
297
+
298
+ - **Runtime** — PyTorch, Hugging Face Transformers, bitsandbytes NF4, accelerate. fp16 + SDPA on Turing; bf16 and FlashAttention-2 are never assumed.
299
+ - **Context and editing** — tree-sitter repo map, BM25 retrieval, JSONL session logs, and SEARCH/REPLACE edits with a unique-match requirement. `outlines` is the optional constrained-decoding path.
300
+ - **Verification** — pytest and Ruff as the reference commands, run CPU-only with `CUDA_VISIBLE_DEVICES=""`; `nbformat` + `nbconvert` for notebooks.
301
+ - **Delivery** — `pip install` from git and one bootstrap notebook. No daemon, no tunnel, no client framework.
302
+
303
+ ## Project structure
304
+
305
+ ```text
306
+ coagent/
307
+ ├─ DESIGN.md architecture and rationale — the why
308
+ ├─ PRD.md product requirements, personas, acceptance tests
309
+ ├─ assets/ cover art used by this README
310
+ ├─ notebooks/ bootstrap notebook (planned)
311
+ ├─ src/coagent/
312
+ │ ├─ cli.py chat | run | resume | doctor | report | eval | push
313
+ │ ├─ agent/ loop, prompts, budget, state
314
+ │ ├─ llm/ transformers backend, registry, grammar
315
+ │ ├─ context/ repo map, retrieval, compression, tokens
316
+ │ ├─ tools/ fs, shell, python, git, notebooks, artifacts
317
+ │ ├─ gitx/ session, commit, durable sync, resume, lock
318
+ │ ├─ ui/ notebook render, optional Gradio
319
+ │ ├─ safety/ policy, denylist, redaction
320
+ │ └─ evals/ harness + task suite
321
+ └─ tests/
322
+ ```
323
+
324
+ ## Build plan
325
+
326
+ | Release | Week | Scope | Exit criterion |
327
+ | --- | --- | --- | --- |
328
+ | **v0.1** | 1 | loop, six tools, transformers backend, notebook chat | fixes a failing test in a toy repo, end to end |
329
+ | **v0.2** | 2 | repo map, SEARCH/REPLACE reliability, verify loop, durable checkpoints, resume | a killed runtime resumes losing ≤1 step |
330
+ | **v0.3** | 3 | plan approval, artifacts, approvals UI, Drive cache, OOM ladder | 5-task eval ≥60%; injection and rejected-plan tests pass |
331
+ | **v1.0** | 4 | constrained decoding, evals, docs, demo, T4 matrix | 20-task eval ≥70%; all acceptance tests green |
332
+
333
+ > **Definition of shipped:** a stranger with a free Colab account and a repo URL can install, run a task, review the branch, and recover from a disconnect using only this README.
334
+
335
+ ## What it deliberately isn't
336
+
337
+ | Option | Why not |
338
+ | --- | --- |
339
+ | LangChain / LangGraph | Hidden prompt layers and token overhead make a weak model harder to debug. The loop is ~600 lines of explicit Python. |
340
+ | Whole-file rewrites | Catastrophic diffs above ~200 lines. SEARCH/REPLACE, with a unique-match requirement, is safer. |
341
+ | Vector database over the repo | A CPU and memory tax beside the GPU; BM25 plus a symbol graph covers a repo of this size. |
342
+ | Multi-agent fan-out | One GPU serializes inference; extra agents are just turns with less shared context. |
343
+ | Hosted API (OpenAI, Anthropic) | Defeats the privacy and zero-cost guarantees. The `llm/` interface exists, but v1 ships local-only. |
344
+ | Pro GPUs, TPUs, CPU-only, multi-GPU | The product is defined by the free tier. Preflight refuses unsupported hardware rather than pretending. |
345
+ | `share=True` Gradio / ngrok | Tunnel flakiness, rate limits, and a public exposure surface. Colab's port proxy is enough. |
346
+
347
+ ## How to contribute
348
+
349
+ **This is a design-led repo.** The documents are the product until the code exists, and they are expected to change with evidence.
350
+
351
+ 1. Open an issue before a large PR. Reference the section (`DESIGN.md §4.5`) or requirement (`PRD FR-BOOT-2`) you are changing.
352
+ 2. If a decision changes, update **both** `DESIGN.md` (rationale) and `PRD.md` (requirements) in the same PR. A design change without a rationale is a regression.
353
+ 3. Keep the constraints honest: free T4 only, 12,288-token cap, ≤10 GB peak VRAM, no hidden framework.
354
+ 4. Implementation PRs: add or update a task in `src/coagent/evals/tasks/`, run the suite CPU-only, and report turns-to-done rather than "it feels better".
355
+ 5. Conventional commits (`feat:`, `fix:`, `docs:`, `test:`) and a PR body that explains the **why**.
356
+
357
+ Good first contributions: a DESIGN/PRD consistency pass, an eval task with a deterministic pass criterion, a failure-mode repro from §10, or a threat-model review of §9.
358
+
359
+ Please **do not** open a public issue for a security problem. Email [lyleokoth.mlengineer@gmail.com](mailto:lyleokoth.mlengineer@gmail.com) with steps to reproduce and I will respond privately.
360
+
361
+ ## Author
362
+
363
+ <p align="center">
364
+ <a href="https://lyle-mlengineer.github.io"><img src="https://img.shields.io/badge/Portfolio-Live-E05785?style=for-the-badge&logo=googlechrome&logoColor=white" alt="Portfolio"/></a>
365
+ <a href="https://www.linkedin.com/in/lyle-okoth/"><img src="https://img.shields.io/badge/LinkedIn-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white" alt="LinkedIn"/></a>
366
+ <a href="https://medium.com/@lyle-okoth"><img src="https://img.shields.io/badge/Medium-12100E?style=for-the-badge&logo=medium&logoColor=white" alt="Medium"/></a>
367
+ <a href="https://x.com/LyleOkoth"><img src="https://img.shields.io/badge/X-000000?style=for-the-badge&logo=x&logoColor=white" alt="X"/></a>
368
+ <a href="mailto:lyleokoth.mlengineer@gmail.com"><img src="https://img.shields.io/badge/Email-D14836?style=for-the-badge&logo=gmail&logoColor=white" alt="Email"/></a>
369
+ </p>
370
+
371
+ | | |
372
+ | --- | --- |
373
+ | **Name** | Lyle Okoth |
374
+ | **Email** | [lyleokoth.mlengineer@gmail.com](mailto:lyleokoth.mlengineer@gmail.com) |
375
+ | **GitHub** | [@lyle-mlengineer](https://github.com/lyle-mlengineer) |
376
+ | **Portfolio** | [lyle-mlengineer.github.io](https://lyle-mlengineer.github.io) |
377
+
378
+ Machine learning engineer working on speech and voice AI by day, and building coAgent to make a free Colab GPU behave like a dependable teammate the rest of the time.
379
+
380
+ ## Attribution
381
+
382
+ - **Model** — [Qwen2.5-Coder-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct) by Alibaba, with [Qwen2.5-Coder-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-3B-Instruct) as the validated fallback.
383
+ - **Inference** — [Hugging Face Transformers](https://huggingface.co/docs/transformers), [bitsandbytes](https://github.com/bitsandbytes-foundation/bitsandbytes) for NF4, and [outlines](https://github.com/dottxt-ai/outlines) as an optional constrained-decoding path.
384
+ - **Context** — [tree-sitter](https://tree-sitter.github.io/tree-sitter/) for the repo map, BM25 for retrieval, and [nbformat](https://nbformat.readthedocs.io/) for notebook handling.
385
+ - **Editing format** — SEARCH/REPLACE blocks follow the format proven by [Aider](https://aider.chat/); the multi-phase loop and tool protocol are coAgent's own.
386
+ - **Quality** — [pytest](https://pytest.org/) and [ruff](https://docs.astral.sh/ruff/) are the reference verifier commands in the eval suite.
387
+ - **Platform** — [Google Colab](https://colab.research.google.com/) free tier; notebooks and Drive are the runtime and the artifact store.
388
+ - **Artwork** — the cover was composed for this project by Lyle Okoth; badges come from [shields.io](https://shields.io/) and brand marks from [Simple Icons](https://simpleicons.org/).
389
+ - **License** — released under the [Apache License 2.0](./LICENSE).
390
+
391
+ ---
392
+
393
+ <p align="center">
394
+ <i>The runtime is cattle. The repo is the pet. Every step leaves a commit.</i><br/>
395
+ <a href="https://lyle-mlengineer.github.io">lyle-mlengineer.github.io</a> · <a href="mailto:lyleokoth.mlengineer@gmail.com">lyleokoth.mlengineer@gmail.com</a>
396
+ </p>
@@ -0,0 +1,51 @@
1
+ co_agent_coder-0.1.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
2
+ coagent/__init__.py,sha256=_b7mtofLHlkkCXPDvzRcYDdMUhyhSgJFVvOeQ9kB8LQ,3022
3
+ coagent/__main__.py,sha256=EEOfn5gpJDQLJJC9H8-HFjez5tXMGS34M2S-B69weXo,141
4
+ coagent/cli.py,sha256=JKhXBTyiYL6hFqAMCBPyTKjtlzfpFWklFPR4xIiYxO4,13670
5
+ coagent/config.py,sha256=0g0D9FkF0sXh4aO5_0AFjj-UGGCKP6a8yvx0kdWWGAY,10093
6
+ coagent/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ coagent/agent/__init__.py,sha256=cNEFSCsmlF0yfASE0sg88wwYgsvzdZaMIKgjumTrvZ8,687
8
+ coagent/agent/budget.py,sha256=iY02BcCQT3TrJfsh9H6i6ze4er8GuLnhVPXl0j0l6o4,7408
9
+ coagent/agent/loop.py,sha256=drU4VIvTJhM_6g3eEwfjL0y5WvSZ2AIPYhqaHigDpXA,45517
10
+ coagent/agent/prompts.py,sha256=6SYPbo6R6Sw3R4D2p-o1Z49n7chJPUwm8Mbp4KEu-FQ,7133
11
+ coagent/agent/state.py,sha256=oBdlCifRM0gRys2A0wyzfyimgqxXUlRqbpjd09nfn0s,6036
12
+ coagent/context/__init__.py,sha256=aXiSZxI0xKM8iSCM8vzZcrNRlLzXcU-tfJn5GLqGsQE,684
13
+ coagent/context/artifacts.py,sha256=tMnDjT4vMmKQKEd2XxP--FYBuZApRKqvaj5NbxMrlGA,16127
14
+ coagent/context/repo_map.py,sha256=d6W0AMXrINy0hEhpHzegDbrlsq275NL1roiOmCwtpig,23158
15
+ coagent/context/retrieval.py,sha256=eHs6UVTb9drJyGmKXnNbqkGcZRv2aL0myjiYsorkcIs,13693
16
+ coagent/context/tokens.py,sha256=LseaowPXv8C0l6voBSjJIdpqOM69L1V50KQhOV_-QhE,3485
17
+ coagent/evals/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ coagent/gitx/__init__.py,sha256=pp90SV0dr0Fv6wClRr78RCPTndUm0tQp9LgjrgaO3zs,1201
19
+ coagent/gitx/commit.py,sha256=cvwTco_XUZz0lXtB8KocwpYHn5C1Ij5Zl3mUxVltxuE,3107
20
+ coagent/gitx/durable.py,sha256=7UHXneYTwTdXmtnwthUJH1Z59niFuziMH0w3SjlXF6g,4756
21
+ coagent/gitx/git.py,sha256=a-_Di5spgfhWlVCxgrzZgMHah29HeT_JInloPbw8dw8,14166
22
+ coagent/gitx/lock.py,sha256=eetFXKSfihDgHVXIpG9o67l-74xHzSVJpbIN1EYVRyU,5235
23
+ coagent/gitx/log.py,sha256=9NKrOOCNzpMwKqhzXeoNPKmJ1n9fV4mCJURjv8pjVjU,2695
24
+ coagent/gitx/resume.py,sha256=-MfRyjxjXKTpg563w5X2RbDm0I8fyBCS7g6sxcAYnfA,7709
25
+ coagent/gitx/session.py,sha256=buo04E1BeSGQiO2azBaNYYMdu1VjY2UyxAhpLtUabCc,7887
26
+ coagent/llm/__init__.py,sha256=mmE_Ogsz1C5ODZ9aKeFyi4pDZcb8WAQKdT4_ZM4onqA,1866
27
+ coagent/llm/base.py,sha256=QSbofGBFWQ9KOYie5VW0PGEN17kiOnUZbFQMyqYvvGg,7475
28
+ coagent/llm/grammar.py,sha256=7XLs5wHVVb9uEN7hr4HUHay3R7-kJ4kkRJqoTxNMFv0,10652
29
+ coagent/llm/registry.py,sha256=ykMgpV_yoEQGdplIpXOCNuK0n7JlAJ0Xib7KZNo7Z4U,4286
30
+ coagent/llm/transformers_backend.py,sha256=6JxETIVWbs7SyoyGZCaxHo15GN8Nr-xVXyvYhvDWLew,11062
31
+ coagent/safety/__init__.py,sha256=0EthXjEoNes1efsfl6lynWnfcfQrxpR8uG--AYcPL9c,572
32
+ coagent/safety/denylist.py,sha256=--YH_ERy-afNGRM8saZ-f6Y5iM7WeJ_GYRrWis9irSk,5750
33
+ coagent/safety/policy.py,sha256=K4WH-6bSkOL-kgR_Q9VQ6GHlNJwpgfJG5giFzEhOM9E,7664
34
+ coagent/safety/redact.py,sha256=MMVub3MT1SPvYkHF5LIXpyMGNRsjAjyeCeubZRcDuGQ,5312
35
+ coagent/templates/config.toml,sha256=eFvc6dHnKGucqDxBLntBhzWn_cxlvjcMC_LvICBhdl4,3485
36
+ coagent/tools/__init__.py,sha256=MvLH2FV3Le2toUGalFMfPfSn6N7koriT4hjCSguzKMk,5139
37
+ coagent/tools/artifacts.py,sha256=14TLC8lWp-P0wXjpSrN-HaTrIgqMxgDSGIzPhNSC_b4,11839
38
+ coagent/tools/base.py,sha256=FUDuLtbywYOyCY_UaXKtOVWZz658-BDWzU5sVe9mgnM,7953
39
+ coagent/tools/fs.py,sha256=uCxmsvR9z6R4_eU7ZigGdHidrKl6iSyneatJvN2egRU,20026
40
+ coagent/tools/notebooks.py,sha256=XHa7CCfOMo4UB_j2NCbXrSPbdILIzhiidLdWA3MjljE,34308
41
+ coagent/tools/pyt.py,sha256=xTllc6bPMIn2EcNjQykMjn80A5bXCJKHl_09-BbaLiY,8852
42
+ coagent/tools/shell.py,sha256=Juvqd5kv9jRfLJBngQ7lU7C4I7KnQyn0UWLFcrX4EfE,20186
43
+ coagent/ui/__init__.py,sha256=fxd_Al3t220lTmS-7mwvNKEVvrWf6gCiuWcg2SxRU7I,1323
44
+ coagent/ui/gradio_app.py,sha256=Od16fWGVLcgvOcqA668o4VnFJZcxdT5CawJ1SH6R4rM,13916
45
+ coagent/ui/notebook.py,sha256=GPOmZgnsq3M6uKs6zpfAlP_WXa4VoXQH447DzaPkXdY,12535
46
+ coagent/ui/render.py,sha256=S6zUfghey8L9C0yCra3MpFPjaUGW4ykKonZ0t3-Krjc,15379
47
+ co_agent_coder-0.1.0.dist-info/METADATA,sha256=qYz_UydmxPhWny7CHMjA1rzL0XUm-U9mWP_qP-qT1GE,25515
48
+ co_agent_coder-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
49
+ co_agent_coder-0.1.0.dist-info/entry_points.txt,sha256=laA86SHKnwDygrhPCy9ngNY6sa0UgMnfxZVsmhwgiM4,133
50
+ co_agent_coder-0.1.0.dist-info/top_level.txt,sha256=TBagh83PxN48jm4UttI1iaEcHpKrqsv3V5kJGbC0-mk,8
51
+ co_agent_coder-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,5 @@
1
+ [coagent.backends]
2
+ transformers = coagent.llm.transformers_backend:TransformersBackend
3
+
4
+ [console_scripts]
5
+ coagent = coagent.cli:main