coding-agents 0.0.1.dev0__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.
@@ -0,0 +1,96 @@
1
+ """5-Stage progressive verification pipeline."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ import subprocess
7
+ from dataclasses import dataclass, field
8
+ from typing import List, Optional
9
+
10
+
11
+ @dataclass
12
+ class StageResult:
13
+ stage_name: str
14
+ passed: bool
15
+ output: str
16
+ duration_seconds: float = 0.0
17
+ error_message: Optional[str] = None
18
+
19
+
20
+ @dataclass
21
+ class VerificationManifest:
22
+ all_passed: bool
23
+ stages: List[StageResult] = field(default_factory=list)
24
+ failed_stage: Optional[str] = None
25
+
26
+ @property
27
+ def summary(self) -> str:
28
+ status = "PASSED" if self.all_passed else f"FAILED at {self.failed_stage}"
29
+ return f"Verification {status} ({len(self.stages)} stages evaluated)"
30
+
31
+
32
+ class VerificationPipeline:
33
+ """Progressive verification pipeline enforcing fast-fail semantics."""
34
+
35
+ def __init__(self, working_dir: str = ".") -> None:
36
+ self.working_dir = os.path.abspath(working_dir)
37
+
38
+ def run_stage_command(self, stage_name: str, cmd: str) -> StageResult:
39
+ try:
40
+ proc = subprocess.run(
41
+ cmd,
42
+ shell=True,
43
+ cwd=self.working_dir,
44
+ stdout=subprocess.PIPE,
45
+ stderr=subprocess.STDOUT,
46
+ text=True,
47
+ timeout=120,
48
+ )
49
+ passed = (proc.returncode == 0)
50
+ return StageResult(
51
+ stage_name=stage_name,
52
+ passed=passed,
53
+ output=proc.stdout,
54
+ error_message=None if passed else f"Exit code {proc.returncode}",
55
+ )
56
+ except Exception as e:
57
+ return StageResult(
58
+ stage_name=stage_name,
59
+ passed=False,
60
+ output="",
61
+ error_message=str(e),
62
+ )
63
+
64
+ def verify_syntax(self, target_dir: str = ".") -> StageResult:
65
+ """Stage 1: Fast AST syntax compilation (<1s)."""
66
+ cmd = f"python -m compileall -q {target_dir}"
67
+ return self.run_stage_command("Stage 1: Syntax / Compilation", cmd)
68
+
69
+ def verify_tests(self, test_path: str = "tests/") -> StageResult:
70
+ """Stage 2: Unit test suite."""
71
+ cmd = f"pytest -q {test_path}"
72
+ return self.run_stage_command("Stage 2: Unit Tests", cmd)
73
+
74
+ def run_all(self, target_dir: str = ".", test_path: str = "tests/") -> VerificationManifest:
75
+ """Run all stages in progressive order, stopping on the first failure."""
76
+ manifest = VerificationManifest(all_passed=True)
77
+
78
+ # Stage 1: Syntax
79
+ s1 = self.verify_syntax(target_dir)
80
+ manifest.stages.append(s1)
81
+ if not s1.passed:
82
+ manifest.all_passed = False
83
+ manifest.failed_stage = s1.stage_name
84
+ return manifest
85
+
86
+ # Stage 2: Unit tests
87
+ if os.path.exists(os.path.join(self.working_dir, test_path)):
88
+ s2 = self.verify_tests(test_path)
89
+ manifest.stages.append(s2)
90
+ if not s2.passed:
91
+ manifest.all_passed = False
92
+ manifest.failed_stage = s2.stage_name
93
+ return manifest
94
+
95
+ return manifest
96
+
@@ -0,0 +1,267 @@
1
+ Metadata-Version: 2.4
2
+ Name: coding-agents
3
+ Version: 0.0.1.dev0
4
+ Summary: The reference software engineering harness and runtime for autonomous coding agents.
5
+ Author-email: Coding Agents Authors <authors@example.com>
6
+ License: MIT
7
+ Keywords: coding-agents,llm-agents,software-engineering,harness,autonomous-coding,swe-bench
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Topic :: Software Development :: Code Generators
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Operating System :: MacOS
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ Requires-Dist: pydantic>=2.0.0
21
+ Requires-Dist: rich>=13.0.0
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
24
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
25
+ Provides-Extra: llm
26
+ Requires-Dist: anthropic>=0.20.0; extra == "llm"
27
+ Requires-Dist: openai>=1.0.0; extra == "llm"
28
+
29
+ # Coding Agents: Foundations, Architecture, Harnesses, and Enterprise Practice
30
+
31
+ *Building, Orchestrating, Evaluating, and Scaling AI Software Engineers*
32
+
33
+ A Peanutbook manuscript. Build it with `bubble-build`; read the source in
34
+ `chapter*/`.
35
+
36
+ ---
37
+
38
+ ## What this book argues
39
+
40
+ One claim, stated in Chapter 1 and earned over the following eleven:
41
+
42
+ > **A coding agent is not a language model with a code prompt. It is a software
43
+ > engineering system built around a model.**
44
+
45
+ The question it answers is not whether AI can write code. That is settled, and
46
+ settling it mattered less than everyone expected. The question is:
47
+
48
+ > **How do we engineer software-development systems in which humans and coding
49
+ > agents work together reliably on large production codebases?**
50
+
51
+ Roughly seventy percent of the text is architecture, large-codebase practice,
52
+ verification, evaluation, security, and multi-agent engineering. The other
53
+ thirty percent uses specific systems as concrete implementations, because
54
+ abstract discussion of agents is unfalsifiable and boring. That ratio is
55
+ deliberate: the named products will be replaced, some of them before this is in
56
+ print. The questions in the other seventy percent will not.
57
+
58
+ ---
59
+
60
+ ## Register
61
+
62
+ The voice is already set by the first three chapters. Match it. These are
63
+ descriptions of what the existing prose does, not aspirations.
64
+
65
+ **Address the reader as "you." Never "we."** Across the written chapters: 89
66
+ instances of *you*, one of *we*. The reader is an engineer doing this work, not
67
+ a co-author being carried along.
68
+
69
+ **First person singular is rationed, and only ever for first-hand experience.**
70
+ Four instances in fifteen thousand words, all of the form *"in notes I wrote in
71
+ March 2024."* Use it to introduce evidence you personally hold. Never for
72
+ opinion — the argument should stand without the byline.
73
+
74
+ **State the claim, then earn it.** The paragraph shape is: assertion,
75
+ mechanism, consequence. Not: build-up, build-up, reveal.
76
+
77
+ **Prefer the corrective construction.** *X is not Y. It is Z.* — "The context
78
+ window is not storage. It is a working set." "File context is not repository
79
+ context." This is the book's most characteristic sentence, because most of what
80
+ it has to teach is a correction to a reasonable-sounding wrong model.
81
+
82
+ **End on the consequence, not the hedge.** A sentence that trails off into
83
+ *"...but of course this depends on your situation"* has wasted the reader's
84
+ attention. If it depends, say what it depends on.
85
+
86
+ **No hype vocabulary.** No *revolutionary*, *seamless*, *game-changing*,
87
+ *paradigm shift*, *cutting-edge*. The existing chapters contain none. Enthusiasm
88
+ is conveyed by precision, not adjectives.
89
+
90
+ **Concrete over abstract, always.** A number with a date beats a
91
+ characterization. A named failure beats "challenges." A worked example beats a
92
+ principle.
93
+
94
+ **Date every number, or state only the shape.** The field moves fast enough that
95
+ an undated figure is worse than none, and a book that quotes a leaderboard
96
+ without saying when looks careless within a year. Where a figure carries an
97
+ argument, cite the paper and the date. Where only the trend matters, describe
98
+ the trend.
99
+
100
+ **Name few products, and never rank them.** A book that ranks models has a shelf
101
+ life measured in months.
102
+
103
+ **Say what did not work.** Anyone can write "here are the best practices." The
104
+ material worth reading is *"we thought the bottleneck was X and it was Y."* The
105
+ author's own failed work is the strongest evidence in the book; use it.
106
+
107
+ **Admit uncertainty in the text, not in a hedge.** "This is model-specific and
108
+ worth measuring on your own workload" is honest. "This may or may not apply" is
109
+ noise.
110
+
111
+ ### Structural habits
112
+
113
+ | Element | Convention |
114
+ | :--- | :--- |
115
+ | `>IMPORS:` box | One claim, stated once. About six per chapter. |
116
+ | `>NOTES:` box | An aside the reader can skip. About two per chapter. |
117
+ | Cross-references | Constant — roughly one per 230 words. Every chapter says which chapter takes a thread further. |
118
+ | Figure captions | 20 words maximum, stating the claim. Longer explanation goes in the paragraph that introduces the figure. |
119
+ | `<!-- -->` comments | Author notes, verification lists, publication gates. Dropped from the PDF. |
120
+ | Chapter ending | A named handoff to the next chapter. |
121
+
122
+ ### Two things that are not register, but read like it
123
+
124
+ **`>NOTES:` blocks print.** They are for the reader. Notes to yourself go in
125
+ HTML comments, which pandoc drops.
126
+
127
+ **Every chapter opens with a real, attributed epigraph.** Brooks (Ch 1), Parnas
128
+ (Ch 2), Pike (Ch 3). Do not invent quotes, and do not attribute the book's own
129
+ theses to anyone — those belong in `>IMPORS:` boxes.
130
+
131
+ ---
132
+
133
+ ## Shelf life
134
+
135
+ The book is written for a **5–10 year spine and a 2–3 year surface**, and the
136
+ two need to stay physically separable.
137
+
138
+ What is being bet on lasting: the verification principle, context as a working
139
+ set with an allocator, file context against repository context, benchmarks
140
+ scoring a harness rather than a model, paired evaluation, the prefill/decode
141
+ asymmetry, and the seven-component decomposition — which survives on Parnas's
142
+ test, not on fashion, because each component is a decision that changes
143
+ independently of the others.
144
+
145
+ What will rot on schedule: model names, context sizes, prices, benchmark
146
+ numbers, API shapes, and the current claim that frontier general models beat
147
+ code-only models. All of it is real and all of it belongs in the book.
148
+
149
+ This ships on KDP, where a revised interior is a re-upload rather than a print
150
+ run, so the cost of carrying perishable material is low and the book can afford
151
+ more of it than a traditionally published one. But **the thing that does not get
152
+ revised is the reviews.** A one-star "already out of date" from the first
153
+ edition sits on the same product page as the fourth, and no amount of iteration
154
+ removes it. So perishable content is still quarantined into clearly dated
155
+ sections — not to make revision cheap, but because a reader forgives datedness
156
+ they were warned about and punishes datedness that presented itself as current.
157
+
158
+ Handled that way the perishable sections invert from liability to asset: a
159
+ section titled *The Frontier, as of <month year>* is a reason to buy the new
160
+ edition. Put the edition and its date on the title page, and keep a short
161
+ revision record in the back matter.
162
+
163
+ The genuine risk is not that details age. It is that the **harness framing
164
+ itself** gets absorbed — models that do multi-hour repository work with no
165
+ scaffold would turn Part II into a historical chapter. The hedge is to write the
166
+ harness chapters around *why* a harness exists — verification, budget, policy,
167
+ accountability — rather than *how to build one*. Those four survive the
168
+ absorption, because someone still has to verify the diff, pay for it, constrain
169
+ it, and answer for it.
170
+
171
+ The lifespan is therefore mostly decided by whether the book's own concepts get
172
+ adopted: the Coding Agent Stack, the Evolution Ladder, the Agent-Ready
173
+ Repository, Harness Engineering. A book that is cited for its framework outlives
174
+ its examples. A book that only summarizes today's tools does not, however well
175
+ written.
176
+
177
+ ---
178
+
179
+ ## Structure
180
+
181
+ Four parts, twelve chapters, following one line of development:
182
+
183
+ ```text
184
+ Static Agent -> Stateful -> Persistent -> Multi-Agent -> Self-Evolving
185
+ ```
186
+
187
+ | # | Chapter | Words | State |
188
+ | ---: | :--- | ---: | :--- |
189
+ | | **Part I — Foundations** | | |
190
+ | 1 | Code Language Models | 4,300 | drafted |
191
+ | 2 | Anatomy of a Coding Agent | 6,200 | drafted |
192
+ | 3 | Context and Repository Understanding | 4,100 | drafted |
193
+ | | **Part II — The Agent Harness** | | |
194
+ | 4 | Tools, Skills, and Agent Harnesses | 4,700 | drafted |
195
+ | 5 | Planning and Spec-Driven Development | 4,600 | drafted |
196
+ | 6 | Coding, Debugging, and Refactoring | 4,500 | drafted |
197
+ | 7 | Verification and Repair | | outline |
198
+ | | **Part III — Coding Agents in Production** | | |
199
+ | 8 | Coding Agents at Scale | | outline |
200
+ | 9 | Long-Running and Multi-Agent Systems | | outline |
201
+ | 10 | Evaluation, Observability, and Economics | | outline |
202
+ | 11 | Security and Enterprise Deployment | | outline |
203
+ | | **Part IV — The Next Generation** | | |
204
+ | 12 | Self-Evolving Coding Agents | | outline |
205
+
206
+ Front matter is in `chapterx/` — the preface is outlined, not written, and it
207
+ owns the author-credibility argument and the book-structure walkthrough.
208
+ `chapter2/_draft-from-ch1.md` is the original Chapter 1, kept because its
209
+ forty-line agent and enterprise retrospective still have somewhere to go.
210
+
211
+ The concepts the book has to deliver, not merely name: the **Coding Agent
212
+ Stack**, the **Agentic Software Engineering Loop**, the **Agent-Ready
213
+ Repository** and its readiness score, **Harness Engineering**, and the **Coding
214
+ Agent Evolution Ladder**.
215
+
216
+ ---
217
+
218
+ ## Building
219
+
220
+ ```bash
221
+ conda activate usao
222
+
223
+ bubble-convert 3 # one chapter, while drafting
224
+ bubble-build --style square # the whole book -> book_square.pdf
225
+ bubble-single-star # style lint
226
+ ```
227
+
228
+ `bubble-convert` does **not** run figure scripts; only `bubble-build` does. When
229
+ you change a figure while drafting, run it yourself first:
230
+
231
+ ```bash
232
+ cd chapter3-*/img && python myfig.py && cd ../..
233
+ ```
234
+
235
+ Check captions before building:
236
+
237
+ ```bash
238
+ grep -rn '^!\[' chapter*/*.md | sed 's/^\(.*\):!\[\(.*\)\](.*/\1|\2/' \
239
+ | awk -F'|' '{n=split($2,a," "); if (n>20) printf "%d words: %s\n", n, $1}'
240
+ ```
241
+
242
+ Figures are generated by Python scripts in each chapter's `img/`, never
243
+ committed as hand-made images. The conventions are in
244
+ `.claude/skills/peanutbook-figures/`; mindmaps need `mathicon`.
245
+
246
+ ---
247
+
248
+ ## Source material, and the gate on it
249
+
250
+ `raw/` holds the author's Oracle talk and design notes from 2023–2024. Read
251
+ `raw/README.md` before using any of it.
252
+
253
+ The short version: the model rankings in those notes are dead, and the methods
254
+ are not. The recitation probe, paired evaluation, and the generate–verify–repair
255
+ loop all come from there and all still hold. Cite the papers with dates, never
256
+ the slides. Abstract employer-internal specifics into general lessons, strip
257
+ colleague names and email addresses, and confirm publication clearance.
258
+
259
+ ---
260
+
261
+ ## Before this ships
262
+
263
+ - [ ] Preface written — it owns the author's position and the book's structure
264
+ - [ ] Every date, benchmark size, and figure verified against its source
265
+ - [ ] The frontier claims in Chapter 1 re-checked and stamped
266
+ - [ ] `author` set in `peanut.config`; covers replaced
267
+ - [ ] Every `@fig:` resolves, no caption over 20 words, `bubble-single-star` clean
@@ -0,0 +1,27 @@
1
+ coding_agents/__init__.py,sha256=rkRB23fBxpF6dLbT8QynQ9KpL1q86i5vW-4E8ENpykY,1262
2
+ coding_agents/cli.py,sha256=MJbXXtYfG4Yvghcmp82w95VsexEf3UXe7SG4AqdQqZg,3766
3
+ coding_agents/py.typed,sha256=vx7tBj6kTigcpvoMSNBQg7evqJ8tdCbVHEFiPbiFOKo,40
4
+ coding_agents/core/__init__.py,sha256=KHgAhEpxujSl_Vq3G3C_vf2GSbtDzugL8_qMwmqkHqs,576
5
+ coding_agents/core/agent.py,sha256=IsMhz01q1GGho23AmHtKUwvYIyoeX8MIOhzFJwwUmI8,5962
6
+ coding_agents/core/budget.py,sha256=zfoFvH_dk1js69NdmdQJ6LqQl0Rrzcw2qBnsBTjltbU,2587
7
+ coding_agents/core/loop.py,sha256=1fQTrzweQyBcMLatHil3HOL3z3YCU2TxnD6JW8aqfdk,2731
8
+ coding_agents/core/models.py,sha256=MK89CnnojkdnAGfUzGmf-l4xIWYImNtTA4YBYAwH2tI,2983
9
+ coding_agents/evolution/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ coding_agents/evolution/parallel_planner.py,sha256=6Qmz90GPK1sSxwxKTojNzkBd8t8_KFFyP8mBA82waUQ,2213
11
+ coding_agents/evolution/skill_miner.py,sha256=UZTftp0VPIXdRon3Xhn3ugKuxNWiTTDaUTTMZFBWk4Y,3692
12
+ coding_agents/sandbox/__init__.py,sha256=Rwb67i2jRrQA_dzO1GJJaRAckRxgyVNg-l5x6oSpOEU,203
13
+ coding_agents/sandbox/policy.py,sha256=pbKnnFJZLba8ZKC1iHAcU6rK0cs_Xe21Gd7cQo0YeUs,2154
14
+ coding_agents/sandbox/worktree.py,sha256=FpyQ3nbCmJUDvJhXQl6J-vAJN9WTvZK3RBH0zc4acQA,2058
15
+ coding_agents/tools/__init__.py,sha256=HVTEcclExEzMlKdB1u6MRbTTn6dzooB7697dzi-tRRU,260
16
+ coding_agents/tools/base.py,sha256=IUeqViFkNPWug_28igsqPVhyqXp6btbY_YdvOSGMPyU,1510
17
+ coding_agents/tools/bash_tool.py,sha256=3J_pvAaGDT2zNzD-NL9_ErPaq7m3Pb7pxVlvuVH6IuY,3332
18
+ coding_agents/tools/patch_editor.py,sha256=jQdHOUI82qKOCqbUxTmlcqakSH4wu00aFKaAKF8aPzg,3673
19
+ coding_agents/verification/__init__.py,sha256=zgYClSkvPKtJ6o3FntNFSaqypFuJbKMaaRqTzMpW67Y,497
20
+ coding_agents/verification/fault_localizer.py,sha256=nH-mKI4YLluu4McKxIJxRxl6CzXs_bztv1-JOffHWeo,1902
21
+ coding_agents/verification/oscillation.py,sha256=5cCrtZgUoHhJNzyLzJRJ061UlJqEm-DWCYWWsa9_1mU,1694
22
+ coding_agents/verification/pipeline.py,sha256=17_VR204Va5diNaXlBX8kcYcLSkL33W-Wa9zxvBKVjA,3116
23
+ coding_agents-0.0.1.dev0.dist-info/METADATA,sha256=qiGGxsRnV1yrqGgGmzFVyiPTjvQLXuljudhdwnMdXu8,11675
24
+ coding_agents-0.0.1.dev0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
25
+ coding_agents-0.0.1.dev0.dist-info/entry_points.txt,sha256=WXzy8PQRVJ7WOEHo1DDzVGUO9g7_5EzdTGTDmzPlFTA,56
26
+ coding_agents-0.0.1.dev0.dist-info/top_level.txt,sha256=HYiwX7hSgCfcr9Kq0w3fvRPuvlXKTVskapcum5ChibM,14
27
+ coding_agents-0.0.1.dev0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ coding-agent = coding_agents.cli:main
@@ -0,0 +1 @@
1
+ coding_agents