barebox 0.0.0-stage → 0.1.0

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,291 @@
1
+ # AI Agent Collaboration Guide
2
+
3
+ ## Table of Contents
4
+ 1. [Operating Flow](#operating-flow)
5
+ 2. [Communication Protocol](#communication-protocol)
6
+ 3. [Development Standards](#development-standards)
7
+ 4. [Testing Standards](#testing-standards)
8
+ 5. [Security & Robustness Invariants](#security--robustness-invariants)
9
+ 6. [Environment](#environment)
10
+ 7. [Development Workflow](#development-workflow)
11
+ 8. [Twelve-Factor Checklist](#twelve-factor-checklist)
12
+ 9. [CLAUDE.md Stub](#claudemd-stub)
13
+
14
+ ---
15
+
16
+ ## Operating Flow
17
+
18
+ Every task runs through three layers. Do not skip ahead to code.
19
+
20
+ 1. **Spec — the interview must happen, and quality beats quantity.** Before touching anything, surface the *decision I'm actually making*, not the literal task I typed. Then interview in **rounds**:
21
+ - **Ask only the frontier** — the decisions whose prerequisites are already settled. A question whose answer depends on another question still open belongs to a later round, not this one.
22
+ - **One round = the whole frontier, batched.** Number each question and put your own recommended answer under it, so answering is a yes/no rather than an essay.
23
+ - **Facts are your job; decisions are mine.** Never ask me what you could read, grep, or run — go find it. A question that isn't a choice only I can make does not belong in a round.
24
+ - **Sharp near, loose far.** Question depth falls off with distance. Module 0 gets pinned down to the decision; later modules get sketched only as far as it takes to know they don't change module 0 — they get sharpened when their turn comes, and their own POC usually answers them better than I can today.
25
+ - **Scope is the exception — ask it wide.** "What is this *not* doing?" is worth asking about the whole build, not just module 0. Out of scope is the cheapest answer I can give you and the one that saves the most build.
26
+ - **Floor: one round is not an interview.** Never start building while a prerequisite of the go / no-go is still assumed. **Done** = the go / no-go and its 1–2 capabilities are settled and the scope boundary is drawn; everything still loose is an **Open question** in the PRD, never a silent assumption.
27
+
28
+ Restate what you heard and get my explicit sign-off on the load-bearing decisions *before* you execute. A wrong assumption caught here costs a sentence; caught after building costs the build.
29
+
30
+ Write the outcome down as a **PRD**. A PRD is a portal, not a deliverable — where the conversation starts and the doc every POC refines. Minimum content, whatever the form:
31
+ - **Problem & goal** — what we're solving and why now
32
+ - **Go / no-go** — the 1–2 capabilities the product stands or falls on; usually module 0's riskiest assumption (e.g. "can a phone camera read the ID?"). Fails → stop
33
+ - **Out of scope** — what we're explicitly not doing
34
+ - **Modules** — the pieces to build, in order (see [*One module at a time*](#validate-before-you-build))
35
+ - **Open questions** — unknowns that don't block; never silently assumed
36
+
37
+ Every POC result updates the PRD; one that flips the go/no-go or a module's assumption is a spec change, not a footnote.
38
+ 2. **Verify — define "good" up front, then prove it.** Write down what success looks like *before* changing code. Prove with measurement and tests, not assertion (see [*Prove, don't assert*](#validate-before-you-build)). When the work is done, first propose `/self-review` — everything since the last self-review, committed or not, checked by a separate mid-tier worker that tries to break the claims with real runs; it only surfaces, never fixes, and is not a gate (checkable: a self-review report naming the commands it ran and their totals exists before `/branch-review` is proposed) — then `/branch-review` — a general review plus a full `/security` audit, which reports findings and never fixes them — and then `/release`, the mechanical pre-release gate. You never merge or release on your own (see [Required Safeguards](#required-safeguards-always--ask--never)). External signal — a real test run, a real deploy, a gold-standard reference — beats a confident paragraph every time.
39
+ 3. **Environment — the standing context.** This file primes every session. Critical-path protections (secrets, auth, schema, CI) are stated as **Always / Ask / Never** below and bind you as written. Where your tool offers a permission allow/ask/deny list, mirror them there so they are enforced and not merely requested.
40
+
41
+ **Execution order — work the way a program runs, in this order, nothing skipped:**
42
+ 1. **Sequence** — do the PRD's modules in the order listed; never start module N+1 while module N is unproven.
43
+ 2. **Selection** — every POC is a branch: pass → next module, fail → back to the PRD as a spec change.
44
+ 3. **Iteration** — repeat POC → update PRD → next POC until the go/no-go is answered; the loop invariant is *everything built so far still works on its own*.
45
+ 4. **Verify** — assert before you move: a step is done when you ran the proof and saw it pass, not when you wrote that it did.
46
+
47
+ > The model is brilliant at execution and blind to intent. You can outsource the typing; you cannot outsource the understanding. Surface assumptions — don't bury them.
48
+
49
+ ---
50
+
51
+ ## Communication Protocol
52
+
53
+ ### Core Rules
54
+ - **Spec first, then checkpoint**: see [Operating Flow §1](#operating-flow). Never run ahead on an unverified assumption — flag it and stop
55
+ - **Fact-Based**: Base all recommendations on verified, current information. Prefer external signal (a real run, a real source) over a confident guess
56
+ - **Simplicity Advocate**: Call out overcomplications and suggest simpler alternatives
57
+
58
+ ### User Profile
59
+ - **Technical Level**: Non-coder but technically savvy
60
+ - **Learning Style**: Understands concepts, needs executable instructions
61
+ - **Expects**: Step-by-step guidance, ready-to-run commands, and the *why* behind each recommendation
62
+ - **Comfortable with**: Command-line operations and scripts
63
+ - **Builds a lot of web apps** — assume any UI work will be consumed on phones as well as desktop
64
+
65
+ ### Required Safeguards (Always / Ask / Never)
66
+
67
+ Not courtesies. These bind you as written, whether or not your tool enforces them.
68
+
69
+ - **Always** identify affected files before making changes, and explain what will change and why
70
+ - **Ask first** — stop and get explicit sign-off — before modifying authentication systems, database schema or migrations, CI workflows, or `.claude/settings.json`
71
+ - **Never** put secrets in the tree — see [Security & Robustness Invariants §1](#security--robustness-invariants)
72
+ - **Never** commit to `main`. Commit to a new branch (name doesn't matter), then propose `/self-review`, `/branch-review`, and `/release`, in that order; merging and releasing are my call, made by name — "approve", "good", or "go" on a draft is not that call
73
+
74
+ ---
75
+
76
+ ## Development Standards
77
+
78
+ ### Validate Before You Build
79
+
80
+ - **POC everything first.** Before committing to a design, build a quick proof-of-concept (~15 min) that validates the core logic. Keep it stupidly simple — manual steps are fine, hardcoded values are fine, no tests needed yet
81
+ - **Graduation criteria:** POC validates logic and covers most common scenarios → stop, design properly, then build with structure, tests, and error handling. Never ship the POC — rewrite it
82
+ - **Aim the POC at the load-bearing claim — not the easy part.** Cover the happy path and 2-3 common edges, but name the riskiest assumption first (does the cheap path actually run cheap? does the library really do X? does the perf hold?), then point the spike straight at *that*. A POC that confirms the happy-path shape while hand-waving the risky mechanism is theater. If you catch yourself writing "production would do X" instead of *doing* X in the spike, the POC has not validated X — go do X
83
+ - **Prove, don't assert — a POC's output is evidence you ran, not prose you wrote.** Every claim the design rests on must be something the spike actually exercised and you actually observed. **Measure anything you call "cheap," "fast," "constant," or "negligible"** — never state a cost you didn't time; a guessed number is a bug with a confident voice. State conclusions only at the confidence the evidence supports: if you didn't test it, say so plainly instead of rounding up to "it works." Better a small honest finding than a big-mouthed claim that measurement later falsifies
84
+ - **The test must be able to FAIL — pre-flight check, not an afterthought.** Before trusting a POC's numbers, confirm three things: **(1) Can the test produce the negative?** A fixture you authored to contain the phenomenon you're testing can only confirm it — prefer real, uncrafted data over synthetic inputs; if synthetic is unavoidable, construct it so it *could* show no effect. **(2) Is the harness free of confounds?** A surprising or degenerate result is often an artifact of the setup, not a real finding — when output looks wrong, debug the test before believing it. **(3) Did the test actually exercise the variable?** If two conditions that should differ produce identical output, the variable isn't wired in — that's a finding, not noise. Run this checklist every time, especially when a result confirms what you hoped
85
+ - **One module at a time.** Build the PRD's modules in order, never several at once. Each module gets its own POC aimed at *its* riskiest assumption (module 0's is the go/no-go). A module is done when **(1)** it works on its own and **(2)** it connects to what's already built and the whole still works — both proven, not assumed. Only then start the next
86
+ - **No fitting to pass.** Never narrow the input, move the threshold, or shrink the scope until a POC goes green. Report the failure and take it back to the PRD
87
+
88
+ ### Dependency Hierarchy
89
+
90
+ Always exhaust the simpler option before reaching for the next:
91
+
92
+ 1. **Vanilla language** — Write it yourself using only language primitives. If it's <50 lines and not security-critical, this is the answer
93
+ 2. **Standard library** — Use built-in modules (`os`, `json`, `pathlib`, `http`, `fs`, `crypto`). The stdlib is tested, maintained, and has zero supply chain risk
94
+ 3. **External library** — Only when both vanilla and stdlib are insufficient. Must pass the checklist below
95
+
96
+ ### External Dependency Checklist
97
+
98
+ Before adding any external dependency, all of these must be true:
99
+ - **Necessity:** Can't reasonably implement this with stdlib in <100 lines
100
+ - **Maintained:** Active commits in the last 6 months, responsive maintainer
101
+ - **Lightweight:** Few transitive dependencies (check the dep tree, not just the top-level)
102
+ - **Established:** Widely used, not a single-maintainer hobby project for production-critical code
103
+ - **Security-aware:** For security-critical domains (crypto, auth, sanitization, parsing untrusted input), a vetted library is *required* — never roll your own
104
+
105
+ ### Language Selection
106
+
107
+ - **Use widely-adopted languages only** — Python, JavaScript/TypeScript, Go, Rust. No niche languages unless the domain demands it
108
+ - **Pick the lightest language that fits the domain:** shell scripts for automation, Python for data/backend/CLI, TypeScript for web, Go for systems/infra, Rust for performance-critical
109
+ - **Minimize the polyglot tax.** Every language in the stack adds CI config, tooling, and onboarding friction. Do not add a new language for one microservice — use what's already in the stack unless there's a compelling reason
110
+ - **Vanilla over frameworks.** Express over NestJS, Flask over Django, unless the project genuinely needs the framework's structure. Structure can always be added later; removing a framework is painful
111
+
112
+ ### Build Rules
113
+
114
+ - **Open-source only.** Always use open-source solutions. No vendor lock-in
115
+ - **Lightweight over complex.** If two solutions solve the same problem, use the one with fewer moving parts, fewer dependencies, and less configuration
116
+ - **Every line earns its place.** If you can't say what breaks when it's deleted, delete it. No speculative code, no "might need this later", no abstractions for one use case. One function, one concern, one owner — small blocks beat spaghetti
117
+ - **Simple > clever.** Readable code that a junior can follow beats elegant code that requires a PhD to debug
118
+ - **One writer per piece of state.** One function assigns each field; everything else calls it. Grep who writes it before you write it. Ownership says *where*, not *when* — if a write can land from a callback, thread, or lifecycle, the reader must tell stale from fresh
119
+ - **Split the decision from the machinery.** A branch whose outcome matters, tangled with a framework, IO, or UI object, moves into a pure function; the framework class applies the result. Extract to pin a branch, not to raise coverage — a one-line delegation in its own file buys a test that cannot fail
120
+ - **Claims in comments must be checkable.** "The only place that writes X" is a claim — run the grep first, and expect the next reader to re-run it. A name search proves an edge exists, never that one doesn't
121
+ - **Read before you write; reuse before you add.** Before adding a function, class, file, or dependency, search for the one that already does it — and say in your report what you found and reused. If you add a near-duplicate anyway, name the existing one and say why it couldn't be extended. Reuse its **name** too: one thing, one name, repo-wide — a second name for the same concept is a duplicate nobody can grep for
122
+ - **Don't patch a patch.** A third fix landing on the same spot means the design is wrong, not the line — stop, say so, and propose the redesign instead of adding a fourth patch. The same test applies to a layer: a new file, wrapper, or abstraction must hide more complexity than its interface adds; if reading it costs as much as reading what it hides, inline it
123
+ - **Containerize only when necessary.** Start with a virtualenv or bare metal. Docker adds value for deployment parity and isolation — not for running a script
124
+ - **Responsive web UI is mandatory in dev projects.** Any web UI must be usable on mobile by default — fluid layouts, viewport meta tag, breakpoints for narrow screens, no horizontal scroll. Test in DevTools device emulation before declaring a UI task done. POCs are exempt (validate the idea first), but the moment a POC graduates to a real project this becomes a hard requirement
125
+ - **Surgical changes only.** Touch what the task requires; nothing else. Don't "improve" adjacent code, comments, or formatting. Match existing style even if you'd do it differently. Only clean up orphans your own change created. Dead code, nits, bugs you pass on the way: if it's inside or affects the code you're already changing, and the fix changes no behavior, fix it and say so. Otherwise report it — say what it costs to leave it. "It would be nicer" is not a cost. Every changed line traces to the request or to a fix you named
126
+ - **Meter the whole unit of work.** Usage and cost sum every call a unit of work makes; the last call's number is never the total, and one unpriced call makes the total unknown, not zero
127
+
128
+ ### Red Flags — Stop and Flag These
129
+ - Over-engineering simple problems
130
+ - Adding external dependencies for trivial operations
131
+ - Frameworks where a library or stdlib would suffice
132
+ - Vendor-specific implementations when open alternatives exist
133
+ - Writing a new function, class, or file without first searching for the one that already does it, or coining a second name for something the repo already names
134
+ - Stacking a third patch on the same spot instead of stopping and proposing a redesign
135
+ - Starting to build after one round of questions, or asking me something you could have looked up yourself
136
+ - Skipping POC validation for unproven ideas
137
+ - POC-ing only the easy part while hand-waving the risky mechanism, or claiming a cost ("cheap"/"fast"/"constant") you never measured
138
+ - Authoring a fixture/corpus that *guarantees* the result (a test that can't return the negative), or trusting a degenerate-looking number without auditing the harness for confounds — use real uncrafted data; the test must be able to fail
139
+ - Fitting a POC to pass (narrowed input, moved threshold, shrunk scope) instead of reporting the failure; starting module N+1 while module N is unproven
140
+
141
+ A problem you see and don't fix goes in the report, never in a comment. Comments are where findings go to be forgotten.
142
+
143
+ ---
144
+
145
+ ## Testing Standards
146
+
147
+ Principles, not a framework. Whatever the language, follow its ecosystem's conventions for
148
+ runner, layout and fixtures — these rules govern what a test must *do*, never how a
149
+ particular toolchain spells it.
150
+
151
+ ### What a test is for
152
+
153
+ **Test behavior, not implementation.** A suite must give you confidence to refactor freely. If changing internal code without changing behavior breaks tests, those tests are liabilities, not assets.
154
+
155
+ **Shape — the Testing Trophy, not the Pyramid:** static analysis catches the cheapest bugs; few unit tests, for pure logic and algorithms; many integration tests, the sweet spot, real components working together; some end-to-end tests over the critical journeys. Target roughly 20% unit, 60% integration, 15% E2E, 5% manual.
156
+
157
+ ### When to write them
158
+
159
+ - **After the design stabilizes, not during exploration.** Do not test a prototype — you will write tests for code you delete tomorrow. First make it work (POC), then make it right (tests), then make it fast
160
+ - **Tests first when you already know the contract.** Pure functions, algorithms, parsers, validators, data transformations — write the test, watch it fail, then implement. When you are still discovering the interface, that same discipline produces churn and false confidence
161
+ - **Write tests for bugs.** Every fix ships a regression test — the highest-value test there is
162
+ - **Write tests before refactoring.** Characterization tests lock in current behavior first, then change the code
163
+ - **Write tests when the code has users.** Called by other modules or exposed externally means it needs tests; a helper serving one caller does not need its own file
164
+ - **Do not test glue code.** Something that only wires A to B to C is covered at the integration level
165
+
166
+ ### What makes a good test
167
+
168
+ - **Tests real behavior.** Call the public interface, assert on observable output. Never reach into internals
169
+ - **Fails for the right reason — prove it.** It breaks when the feature breaks, not when the implementation moves. Revert the fix (or switch the check off), run the test, watch it go red, then restore it: a test you have never seen fail is unverified, however right it reads
170
+ - **Reads like a spec.** Someone new to the code should learn what the feature does by reading it
171
+ - **Self-contained.** Sets up its own state, runs, cleans up. No ordering dependencies, and no reliance on project directories, user config, or ambient environment
172
+ - **Deterministic.** Flaky tests erode trust. A dependency on timing, network, or global state is a defect in the test
173
+ - **Never sleep for a condition — poll for it.** Sleeping then asserting is wrong at every value: too short and it flakes under load, too long and the suite drags, and a real async bug looks identical to a guess that was too short. Wait on the condition itself, re-reading the state *inside* the loop, with a timeout that names what it was waiting for. A fixed delay is only correct once you have waited for the triggering condition, the delay comes from a documented interval rather than a guess, and a comment says why
174
+
175
+ ### Anti-patterns
176
+
177
+ - **Mocking most of the test.** If mock setup outweighs the logic, you are testing mocks. Prefer the real thing against a temporary directory, an in-memory store, or a disposable container
178
+ - **Partial mocks.** Mirror the complete structure the real thing returns, not only the fields this test reads. A mock missing a field downstream code consumes passes here and fails in production
179
+ - **Smoke tests.** Asserting a result merely exists proves nothing. Assert on specific values, structure, or side effects
180
+ - **Testing private internals.** If it needs its own test, it should be part of the public interface; otherwise the public tests should reach it
181
+ - **Mirroring implementation.** A test that restates the source line by line breaks on every refactor and catches nothing
182
+ - **Test-only production code.** Never add a method, flag, or branch to production solely for tests. Inject the dependency instead
183
+ - **Chasing a coverage number.** 80% of meaningless tests is worse than 40% of behavioural ones. Coverage tells you what is *not* tested, never that what is covered is correct. Cover the critical path first — data, auth, money, core logic — before helpers
184
+
185
+ ### Organization
186
+
187
+ - **Mirror the source structure**, at whatever level the ecosystem puts tests. One test file per module, not per function, and never a second file covering a module that already has one
188
+ - **Separate by cost so CI gets a fast signal.** Keep quick isolated tests apart from ones needing real IO or a full workflow, and let the slow ones — long runtimes, heavy optional dependencies, live external APIs — be excluded from the gate that runs on every push and included in the full run
189
+ - **Fixtures live near what uses them**, shared upward only when genuinely shared. Build test data with factories or builders, never a constructor taking fifteen positional arguments
190
+ - **Delete tests that never catch anything.** A test that has only ever failed during refactors is a maintenance cost, not a safety net
191
+
192
+ ---
193
+
194
+ ## Security & Robustness Invariants
195
+
196
+ These are the failure classes that show up in nearly every quickly-built app, regardless of stack or language. Treat them as **build-time invariants** — satisfy them as you write the code, not as a cleanup pass. Apply each where it fits the thing you're building (a library has no endpoints; a CLI has no tenant isolation) — skip what genuinely doesn't apply, never skip what does.
197
+
198
+ Throwaway POCs are exempt while you validate logic (per **POC first** above) — hardcoded values and missing error handling are fine in a 15-minute spike. The moment a POC graduates to a real build, every applicable invariant becomes mandatory. The one item that holds even for a POC: never commit a real secret.
199
+
200
+ 1. **No secrets in the repo.** Keys, tokens, and credentials load from the environment / a secret store at runtime — never hardcoded, never logged. `.env` is gitignored; only a value-less `.env.example` is committed. Scan history before trusting a repo. One leaked key is a breached database or a runaway bill.
201
+ 2. **Scope every data access to its owner.** Each record read or written is constrained to the requesting principal — via DB-level rules (RLS / row policies) and/or an application-layer ownership check. Never trust a client-supplied id without a gate. If the storage layer offers row-level policies, enabling them is not optional, and "on but too broad" still fails.
202
+ 3. **Bound every reachable endpoint.** Rate-limit public routes AND authenticated mutation/write routes AND abuse-prone inbound paths (mail, webhooks). An unbounded route is a free DoS and bill amplifier — a script in a loop should not be able to take the service down.
203
+ 4. **Handle the unhappy path.** Every IO / network / DB / third-party call has an explicit failure path. Nothing fails silently. Internal detail (stack traces, queries, secrets) never reaches the client. Async/background work carries its own catch. A warning nobody has to act on is not a check — either it halts / reds the run, or it is counted and surfaced where a human reads it. Record what you asked a dependency for and what you got back. Read and record the stop/finish reason of every external or model call — a cut-off answer (length/max_tokens) is never the same as no answer.
204
+ 5. **Authorization is not authentication.** "Logged in" never implies "allowed". Every state-changing or privileged action checks ownership AND role/permission. If swapping an id in a request would expose or mutate someone else's data, it's a bug — return 403.
205
+ 6. **Data access scales.** No queries inside loops, no per-render repeated round-trips, indexes on every filtered/joined column. Code that's fine at 10 users and collapses at 1,000 is a latent outage.
206
+
207
+ Also hold the line on:
208
+
209
+ - **Validate input at every trust boundary.** Untrusted uploads, inbound mail, webhooks, and spoofable headers like `X-Forwarded-For` — trust the latter only behind a vetted proxy.
210
+ - **Model output is untrusted input too.** Validate it against a schema and key every decision on a typed field — never regex-parse the model's prose for a number, id, or verdict.
211
+ - **Guard lookups keyed by an external string.** Look the key up only among the map's own entries, never inherited ones — an inherited member can otherwise answer for a key the map never had, so "not found → throw" is bypassed.
212
+ - **Parameterize every query.** Never string-build SQL.
213
+ - **Use vetted libraries for security-critical code** — see [External Dependency Checklist](#external-dependency-checklist).
214
+ - **Bind least-privilege.** Loopback, not `0.0.0.0`, unless the port is deliberately public.
215
+
216
+ **Verify at two moments, not one.**
217
+ - **While building** — this list shapes the code as it's written.
218
+ - **Before deploy/merge** — see [Operating Flow §2](#operating-flow). A Critical/High finding blocks the ship; lower-severity findings get logged and triaged, not silently shipped. Proactively remind the user to run `/branch-review` whenever a change touches auth, data access, endpoints, secrets, or untrusted input.
219
+
220
+ ---
221
+
222
+ ## Environment
223
+
224
+ - **OS**: Fedora Linux (use `dnf` for packages, `systemctl` for services)
225
+ - **Testing**: pytest (Python), Jest/Vitest (JS/TS), Playwright (browser automation)
226
+
227
+ ---
228
+
229
+ ## Development Workflow
230
+
231
+ ### Environments
232
+ - **Development**: Local machines
233
+ - **Staging**: VPS with isolated database
234
+ - **Production**: VPS with containerized setup
235
+
236
+ ### Deployment Strategy
237
+
238
+ **Simple Projects:** `Local → GitHub → VPS (direct deployment)`
239
+
240
+ **Complex Projects:** `Local → GitHub → GHCR → VPS (containerized)`
241
+
242
+ ---
243
+
244
+ ## Twelve-Factor Checklist
245
+
246
+ The [Twelve-Factor App](https://12factor.net) methodology for modern, scalable applications:
247
+
248
+ | # | Factor | Rule |
249
+ |---|--------|------|
250
+ | 1 | Codebase | One repo per app, multiple deploys from same codebase |
251
+ | 2 | Dependencies | Explicitly declare and isolate all dependencies |
252
+ | 3 | Config | Store config in environment variables, never in code |
253
+ | 4 | Backing Services | Treat databases, caches, queues as attached resources |
254
+ | 5 | Build, Release, Run | Strict separation between build, release, and run stages |
255
+ | 6 | Processes | Run as stateless processes, persist state externally |
256
+ | 7 | Port Binding | Apps are self-contained, export services via port binding |
257
+ | 8 | Concurrency | Scale out via the process model, not bigger instances |
258
+ | 9 | Disposability | Fast startup, graceful shutdown, idempotent operations |
259
+ | 10 | Dev/Prod Parity | Keep dev, staging, and production as similar as possible |
260
+ | 11 | Logs | Treat logs as event streams to stdout |
261
+ | 12 | Admin Processes | Run admin/maintenance tasks as one-off processes |
262
+
263
+ ---
264
+
265
+ ## CLAUDE.md Stub
266
+
267
+ Copy this to any project's CLAUDE.md. These are mandatory rules, not suggestions.
268
+
269
+ ```markdown
270
+ ## Dev Rules
271
+
272
+ **Spec first — quality of questions over quantity.** Interview to find the decision, not the task. Ask in batched rounds, only questions whose prerequisites are settled, each with your recommended answer under it; find facts yourself and ask me only the choices that are mine. Pin module 0 down to the decision, sketch later modules only enough to know they don't change it, and ask what's out of scope for the whole build. One round is not an interview; never build on an assumed prerequisite. Write a PRD with problem/goal, go/no-go, out-of-scope, modules, open questions. POCs refine it.
273
+
274
+ **Reuse before you add.** Search for the existing function, class, or name before writing a new one, and report what you reused; a near-duplicate needs a stated reason the original couldn't be extended. A third patch on the same spot means propose a redesign, not a fourth patch.
275
+
276
+ **POC first, one module at a time.** Each module's POC targets its riskiest assumption (module 0 = go/no-go); the test must be able to fail; prove, don't assert — measure anything you call cheap/fast/constant. No fitting to pass. A module works on its own, then connects to what's built, before the next starts. Never ship the POC.
277
+
278
+ **Dependency hierarchy — follow strictly:** vanilla language → standard library → external (only when stdlib can't do it in <100 lines). External deps must be maintained, lightweight, and widely adopted. Exception: always use vetted libraries for security-critical code (crypto, auth, sanitization).
279
+
280
+ **Lightweight over complex.** Fewer moving parts, fewer deps, less config. Express over NestJS, Flask over Django, unless the project genuinely needs the framework. Simple > clever. Readable > elegant.
281
+
282
+ **Open-source only.** No vendor lock-in. Every line of code earns its place — if you can't say what breaks when it's deleted, delete it. No speculative code, no premature abstractions.
283
+
284
+ **One writer per piece of state.** One function assigns each field; everything else calls it. Grep who writes it before you write it — and if a write can land from a callback, thread, or lifecycle, the reader must tell stale from fresh.
285
+
286
+ **Surgical changes only.** Touch what the task requires. Dead code, nits, bugs you pass: if it's inside or affects the code you're already changing and the fix changes no behavior, fix it and say so — otherwise report it and say what it costs to leave it. A problem you don't fix goes in the report, never in a comment.
287
+
288
+ **Responsive web UI is mandatory.** Any web UI must work on mobile by default — fluid layouts, viewport meta, breakpoints, no horizontal scroll. Verify in DevTools device emulation before claiming a UI task is done. POCs exempt; real projects are not.
289
+
290
+ For full development and testing standards, see `.claude/remember/AGENT_RULES.md`.
291
+ ```
package/LICENSE ADDED
@@ -0,0 +1,201 @@
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 hamr0
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
200
+ implied. See the License for the specific language governing
201
+ permissions and limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,10 @@
1
- # Temporary Holding Version
1
+ # barebox
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Lightweight local sandbox for AI agents: an agent runs on your machine with your
4
+ real tools, every write is undoable, and nothing leaves the machine without
5
+ passing a doorman. You're asked only when something irreversible is about to happen.
6
+
7
+ Status: M0 (walls + front door) proven and red-teamed, POC-grade. See
8
+ [the PRD](docs/product/agent-sandbox-prd.md) and [poc/m0](poc/m0).
9
+
10
+ `bin/sbx` and the test suite arrive with the graduation rewrite (after M2).