bareloop 0.9.0 → 0.11.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.
package/README.md CHANGED
@@ -13,144 +13,136 @@
13
13
  <p align="center">
14
14
  <img src="https://img.shields.io/github/package-json/v/hamr0/bareloop?label=version&color=2a4f8c" alt="version (auto from package.json)">
15
15
  <img src="https://img.shields.io/badge/license-Apache%202.0-2a4f8c" alt="license: Apache 2.0">
16
- <img src="https://img.shields.io/badge/status-Layer%202%20%C2%B7%20accepted-2a6d3a" alt="status: Layer 2, accepted">
16
+ <img src="https://img.shields.io/badge/status-WIP-orange" alt="status: WIP">
17
17
  </p>
18
18
 
19
- **"Automate this job — I don't know the best workflow."** For tasks that are **repeated,
20
- long, and verifiable**: an agent authors the workflow scaffolding (a constrained,
21
- validated config — never freeform code); runs execute under an un-gameable outer gate;
22
- and the scaffolding *improves across runs* through verdict-gated, run-as-executed
23
- inheritance with ledger-counted attribution.
24
-
25
- The pitch in one line: **workflows that earn their own design, with receipts** — every
26
- inherited rule carries the green that minted it and the contrast that attributed it.
27
-
28
- **What you keep is the workflow, not the session.** An agent figures your recurring,
29
- verifiable job out once; what survives is a verified, self-healing workflow you can run
30
- again — with bounded spend under an envelope *you* sign, deterministic verification you
31
- don't author, and cost and time reported honestly (an unknown is reported unknown, never
32
- rounded to zero). *Direction, not yet shipped:* a local workbench where you experiment with
33
- a job, graduate a workflow once it greens, and **export** it — signed spec, workflow, close
34
- scripts and a thin runner that depends on bareloop, so the whole self-healing library
35
- (bare-agent · bareguard · litectx) comes along as npm dependencies. That bundle runs
36
- headless as an enclosed CLI and asks you the same signing questions at the prompt that the
37
- workbench would. It is a dependency, never generated standalone code: the gate travels with
38
- it and never disappears.
39
-
40
- > **Status: Layer 2 — accepted.** The agent now authors its own workflow: `runJob()`
41
- > takes a signed job spec, surveys the repo, **drafts a validated plan of bounded steps**
42
- > (each with an operator-signed self-check it may reference but never author), and runs it
43
- > under an un-gameable outer close and one budget it can only tighten. On the real-model
44
- > acceptance battery (F47) the emergent flow converted a job the same worker failed 4/4
45
- > before — 3/3 runs, clearing the owned bar every time, composing its own check exits. The
46
- > within-run ratchet (Layer R) ships armed-and-inert by measurement (F41). **Then N3 —
47
- > executed inheritance**, where a workflow that greened is kept, offered to the next
48
- > similar job, and improved as executed instead of drafted from scratch (the ladder's
49
- > kill-switch question). As of 0.7.0 N3's machinery **ships** — the bridge registry, the
50
- > operator-signed reuse envelope, the selection call and step-level resume are all in the
51
- > public API — but shipping is not acceptance: one execution green proves reuse safe and
52
- > legal, never *beneficial*. The contrast that was to prove the lift is now retired (F88): a
53
- > validation rule hands every cold run the plan shape a bridge was carrying, so the gap it
54
- > would have measured is gone. Treat reuse as available and unproven — what a bridge should
55
- > carry instead is open. **The rung in flight is close authoring** — the last layer where a
56
- > human still wrote code. You answer a short interview about what *done* means; an LLM then
57
- > composes a close **declaration** over a catalogue of stage kinds bareloop implements — never
58
- > code, never prose parsed back — which is validated, run once against your untouched repo so
59
- > every ruler is seen measuring something real, and gated before you sign its hash. It is
60
- > proven live on both a JavaScript and a Python patient, and its designed failure mode is an
61
- > honest refusal: a close that would grade nothing, or a stage whose population does not exist
62
- > in your tree, comes back decision-ready instead of green.
63
-
64
- ## Quick start
19
+ **"Automate this job — I don't know the best workflow."**
65
20
 
66
- ```bash
67
- npm install bareloop
68
- ```
21
+ For work that is repeated, long, and verifiable: an agent authors the workflow scaffolding
22
+ itself, as a constrained and validated config rather than freeform code. Every run executes
23
+ under an outer gate the agent cannot reach or argue with. And the workflow gets better across
24
+ runs, because what actually worked is kept with receipts and carried into the next run.
69
25
 
70
- **Give your AI assistant the integration guide**
26
+ Agents got good at doing the work. The open problem is knowing when the work is actually
27
+ done. Three of the strongest results in long-running agent work landed on the same answer
28
+ independently: the ralph loop, code machine MCP, and recursive language models all trust the
29
+ agent to do the work and verify it with something the agent cannot reach. Trust, but verify.
71
30
 
72
- ```
73
- Read bareloop.context.md from node_modules/bareloop/bareloop.context.md
74
- ```
31
+ bareloop takes that principle and makes it the product. You describe a repeated, verifiable
32
+ job and what *done* means for it. The agent handles the rest, under verification it never
33
+ gets to touch.
34
+
35
+ ## Two kinds of done
36
+
37
+ Jobs differ by what decides the result is good. That difference is the product's spine, so you
38
+ choose it when you create the job.
39
+
40
+ **green** — a predicate decides. Tests pass, the build exits clean, the type checker is
41
+ quiet.
42
+ > *"Fix the failing suite."* · *"Migrate this package to strict types."*
75
43
 
76
- That single file is the complete adopter contract — the boundary, the architecture, the
77
- refusals, the constraints — and it grows API sections as rungs land. (Suite-wide pattern:
78
- every bare package ships its `*.context.md`.)
44
+ **softgreen** — an assessment decides, against a rubric you wrote and signed. You say what
45
+ separates a pass from a fail, and give one example of each; the judge only quotes back what it
46
+ finds in the real work, and fixed rules — not the judge — render the verdict.
47
+ > *"Reserve a ticket from SF to LA under $400."* · *"Improve my resume."*
79
48
 
80
- ---
49
+ ## You have the last word
81
50
 
82
- ## How it works
51
+ Every run ends at a **review door**: here is what changed, here is what every check said, here
52
+ is what I'm asking you. **Accept** it, **rerun** it — what you type is the feedback the next
53
+ attempt works from, funded fresh — or **pause** it and decide another day. A pause costs
54
+ nothing, keeps everything, and picks up from the start of the last step whenever you come back.
55
+ Never come back, and it quietly expires on its own.
83
56
 
84
- Three layers; nothing inside negotiates with the layer above it.
57
+ The door never rewrites the run's own verdict. A green stays green in the record whatever you
58
+ decide about it; your answer says what happens to the work, not what the work scored.
85
59
 
86
- | Layer | What it is | Emergent? |
87
- |---|---|---|
88
- | **Outer shell** | Per-run budget cap (bareguard), retry cap, verdict collection, escalation routing. Stateless across runs | never — permanent, dumb, un-gameable |
89
- | **Emergent middle** | The authored plan: bounded steps, each with its granted verbs, its own round cap, its write scope and its form-checkable exits — schema-validated, red before tokens burn. A step keeps iterating while it is making progress; when it stops, the shell ends it and the planner re-allocates | yes — authored and improved by the agent |
90
- | **Floor** | Append-only JSONL spine (single source for every UI), litectx store per job, per-run ledger | never — the record |
60
+ ## Why the agent authors the workflow
91
61
 
92
- Every job declares a **verdict class**, and the class decides what the run's learning is
93
- worth. Today exactly one is built:
62
+ The bare suite gave us forty-plus primitives, and there are at least as many opinions about
63
+ how context engineering should be broken into steps. Instead of picking one opinion and
64
+ shipping it as the recipe, bareloop makes the agent the author. It chooses its own path
65
+ through the primitives and then has to survive verification it cannot edit, widen, or
66
+ disable.
94
67
 
95
- | Verdict | Truth source | Mints inheritance? | Status |
96
- |---|---|---|---|
97
- | **Hard green** | predicate / exit-code (tests, build, lint) | automatically | **built** |
98
- | **Soft green** | rubric / assessment | only with HITL confirm or N consistent repeats | declared, not built (rung N4) |
99
- | **HITL green** | a human is the close (PR merge, "publish") | yes — and merge stays human, forever | declared, not built (rung N4) |
68
+ The lessons from ralph, RLMs, and code machine MCP are in here, applied to the small parts
69
+ rather than adopted whole. None of them is the workflow; each one is available to the agent
70
+ building it.
100
71
 
101
- The full bare-suite surface is *disclosed* to the authoring agent; only *admitted* verbs
102
- are callable per job. A request against a locked primitive is a structured red — real
103
- diagnostic signal, and the admission path when it's justified.
72
+ ## Install
104
73
 
105
- ## Security posture — honest about the boundary
74
+ ```bash
75
+ npm install bareloop
76
+ ```
106
77
 
107
- bareloop runs **locally**, as you. Secrets load from the environment and never enter the
108
- tree, the spine, the configs or the ledger — and the close child, which executes the code
109
- the worker just wrote, gets its environment **stripped of credential-shaped variables**
110
- (provider keys, `AWS_*`, anything named `*_TOKEN`/`*_SECRET`/`*_PASSWORD`/`*_API_KEY`):
111
- nothing that judges a tree needs them. That is exposure reduction, **not a sandbox** — the
112
- worker's code still runs with your OS permissions and network access, so treat a bareloop
113
- run as inside your trust boundary and give it a repo you'd let an agent touch.
78
+ ## Usage
79
+
80
+ A signed job spec goes in. A verdict comes out.
81
+
82
+ ```js
83
+ import { runJob, jobSpecHash, makeSpine } from 'bareloop';
84
+ import { AnthropicProvider } from 'bare-agent';
85
+
86
+ const spec = {
87
+ schema: 'job-v1',
88
+ job: 'my-maintainer',
89
+ description: 'fix src until the suite greens',
90
+ goal: 'Fix any failure in src/ so the suite passes.',
91
+ verdictType: 'green',
92
+ close: [{ name: 'suite-green', cmd: 'npm test', expect: 0 }],
93
+ provider: 'anthropic-api',
94
+ cadence: { unit: 'day', every: 1 },
95
+ budgetUsd: 1.5,
96
+ writeScope: ['src/**'],
97
+ tools: ['read', 'grep', 'write', 'edit'],
98
+ escalation: { mode: 'decision-ready' },
99
+ };
100
+
101
+ // you sign the spec; an edited spec is unsigned by construction
102
+ const approvals = [
103
+ { specHash: jobSpecHash(spec), signer: 'you', ts: new Date().toISOString() },
104
+ ];
105
+
106
+ const outcome = await runJob(spec, {
107
+ approvals,
108
+ workdir: '/path/to/checkout',
109
+ provider: new AnthropicProvider({ model: 'claude-sonnet-5' }), // key from env
110
+ emit: makeSpine('/path/to/checkout/run.jsonl'),
111
+ });
112
+ // 'green' means your close passed. Anything else is a named, decision-ready stop.
113
+ ```
114
114
 
115
- ## The science behind it
115
+ You do not have to hand-write that `close` yourself. bareloop can author it with you from a
116
+ short interview about what done means for the job, then hand you the result to sign.
116
117
 
117
- bareloop is the productization of **[adaptlearn](https://github.com/hamr0/adaptlearn)**
118
- (archived at v0.11.1) — a closed experimental record, findings F1–F23. What it settled,
119
- bareloop consumes without re-proving:
118
+ **Integrating an agent?** Point it at the contract, not this file:
120
119
 
121
- | Mechanism | Evidence |
122
- |---|---|
123
- | Agents author valid harness configs at hand-written parity | M4 (F10) |
124
- | Mid-run revision recovers stuck runs | M5 (F11: 3/3 vs 1/3) |
125
- | Verdict-gated inheritance beats ungated on pass/fail | F19: gated late 1.00 vs ungated 0.13 |
126
- | Run-as-executed inheritance transmits in-run learning | F20: 6/6 lineages, ~½ cost |
127
- | Which-knob attribution is countable from the ledger | V2: contrast bit 16/16 gens |
128
- | Where memory pays: regularities outside the worker's prior | F17/F18: ~8× under acquisition cost |
120
+ ```
121
+ Read bareloop.context.md from node_modules/bareloop/bareloop.context.md
122
+ ```
129
123
 
130
- Full PRD with design laws and open questions: [`docs/01-product/PRD.md`](docs/01-product/PRD.md).
124
+ That single file is the complete adopter contract: the API, the boundary, the refusals, the
125
+ constraints. The README is the pitch. (Suite-wide pattern: every bare package ships its
126
+ `*.context.md`.)
131
127
 
132
- ## Roadmap — the build ladder
128
+ ## Build it once, keep it
133
129
 
134
- Each rung POCs its riskiest assumption; a rung that cannot meet its exit stops the
135
- ladder, and the stop is a result.
130
+ A simple localhost UI lets you build a job by talking about it and watch it run. When it
131
+ works, **export the whole workflow** — with its self-healing harness — and run it again
132
+ anywhere. The point is to stop trial-and-erroring your way to the workflow that fits a job.
133
+ Find it once, keep it, reuse it. It is a seed of something bigger over time.
136
134
 
137
- | Rung | What lands |
138
- |---|---|
139
- | **N0** ✅ | Port + outer shell + spine (token-free) — v0.1.0 |
140
- | **N1** ✅ | Job/close schema + validator — v0.2.0 |
141
- | **N2** ✅ | Single-job headless loop — job #1 minimal (review→fix→PR, hard greens only) — v0.3.0 |
142
- | **Layer R** ✅ | Within-run ratchet: shell-side fixation detector (intent) + rejected-edit feedback (outcome), **shipped OFF by default** (F41: fixation in remission, so ON has never won its A/B; F43 split the two axes; field read + default decision defer to Layer 2) — v0.4.0 |
143
- | **Layer 2** ✅ | plan-v1 micro-wheels — the road: bounded steps with in-run verifiable exits (the F39-measured semantic converter), accepted on the real-model battery (F47) — v0.5.0, then finished by T·A·P·U (a wall clock, variance-triggered replan, the 14-verb palette, user-mode e2e) |
144
- | **N3** | Executed inheritance + contrast-bit extractor — **kill-switch: rules must transmit across non-identical runs** |
145
- | **N4** | Verdict classes complete (soft/HITL minting) |
146
- | **N5** | Scheduler + budget ops |
147
- | **N6** | The panel ([spec](docs/01-product/PRD.md#appendix-a--panel-spec-provisional): left chat + command bar, right progress over results, context-graph reserved) |
135
+ ## Running it
136
+
137
+ bareloop runs locally, as you. Secrets load from the environment and never enter the tree or
138
+ the run's records. It reduces exposure but it is not a sandbox: the code your job writes runs
139
+ with your permissions, so give bareloop a repo you would let an agent touch.
148
140
 
149
141
  ## The bare ecosystem
150
142
 
151
- Local-first, composable agent infrastructure. Same API patterns throughout —
152
- mix and match, each module works standalone. bareloop is the suite's flagship consumer:
153
- it exercises every package and gaps get fixed upstream, never shimmed.
143
+ Local-first, composable agent infrastructure. Same API patterns throughout. Mix and match,
144
+ each module works standalone. bareloop is the suite's flagship consumer: it exercises every
145
+ package, and gaps get fixed upstream rather than shimmed.
154
146
 
155
147
  **Core** — the brain, the gate, the memory.
156
148
 
@@ -164,10 +156,12 @@ it exercises every package and gaps get fixed upstream, never shimmed.
164
156
  - **[baremobile](https://npmjs.com/package/baremobile)** — Android + iOS device control. *Screen in → pruned snapshot out.* Replaces Appium, Espresso, XCUITest.
165
157
  - **[beeperbox](https://github.com/hamr0/beeperbox)** — 50+ messaging networks via one MCP server. *Chat in → unified message stream out.* Replaces Twilio, per-platform bot APIs.
166
158
 
167
- **Why this exists:** most automation stacks make you design the workflow before you know
168
- what works. bareloop's bet — proven in adaptlearn — is that for repeated, verifiable
169
- jobs, selection under an honest gate designs a better workflow than you would, and shows
170
- its receipts.
159
+ ## Background
160
+
161
+ bareloop is the productization of **[adaptlearn](https://github.com/hamr0/adaptlearn)**, a
162
+ closed experimental record on whether agent-authored workflows improve under an honest gate.
163
+ The design laws it inherited, and the open questions it has not answered yet, are in
164
+ [`docs/01-product/PRD.md`](docs/01-product/PRD.md).
171
165
 
172
166
  ## License
173
167