bareloop 0.8.0 → 0.10.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,137 +13,126 @@
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). **In flight:
47
- > N3 — 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.
56
-
57
- ## Quick start
19
+ **"Automate this job — I don't know the best workflow."**
58
20
 
59
- ```bash
60
- npm install bareloop
61
- ```
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.
62
25
 
63
- **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.
64
30
 
65
- ```
66
- Read bareloop.context.md from node_modules/bareloop/bareloop.context.md
67
- ```
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
+ ## Three kinds of done
36
+
37
+ Jobs differ by who or what decides the result is good. That difference is the product's
38
+ spine, so you choose it when you create the job.
68
39
 
69
- That single file is the complete adopter contract — the boundary, the architecture, the
70
- refusals, the constraints — and it grows API sections as rungs land. (Suite-wide pattern:
71
- every bare package ships its `*.context.md`.)
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."*
72
43
 
73
- ---
44
+ **softgreen** — an assessment decides against a rubric.
45
+ > *"Reserve a ticket from SF to LA under $400."*
74
46
 
75
- ## How it works
47
+ **hitl** — a human makes the final call.
48
+ > *"Improve my resume."*
76
49
 
77
- Three layers; nothing inside negotiates with the layer above it.
50
+ ## Why the agent authors the workflow
78
51
 
79
- | Layer | What it is | Emergent? |
80
- |---|---|---|
81
- | **Outer shell** | Per-run budget cap (bareguard), retry cap, verdict collection, escalation routing. Stateless across runs | never — permanent, dumb, un-gameable |
82
- | **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 |
83
- | **Floor** | Append-only JSONL spine (single source for every UI), litectx store per job, per-run ledger | never — the record |
52
+ The bare suite gave us forty-plus primitives, and there are at least as many opinions about
53
+ how context engineering should be broken into steps. Instead of picking one opinion and
54
+ shipping it as the recipe, bareloop makes the agent the author. It chooses its own path
55
+ through the primitives and then has to survive verification it cannot edit, widen, or
56
+ disable.
84
57
 
85
- Every job declares a **verdict class**, and the class decides what the run's learning is
86
- worth. Today exactly one is built:
58
+ The lessons from ralph, RLMs, and code machine MCP are in here, applied to the small parts
59
+ rather than adopted whole. None of them is the workflow; each one is available to the agent
60
+ building it.
87
61
 
88
- | Verdict | Truth source | Mints inheritance? | Status |
89
- |---|---|---|---|
90
- | **Hard green** | predicate / exit-code (tests, build, lint) | automatically | **built** |
91
- | **Soft green** | rubric / assessment | only with HITL confirm or N consistent repeats | declared, not built (rung N4) |
92
- | **HITL green** | a human is the close (PR merge, "publish") | yes — and merge stays human, forever | declared, not built (rung N4) |
62
+ ## Install
93
63
 
94
- The full bare-suite surface is *disclosed* to the authoring agent; only *admitted* verbs
95
- are callable per job. A request against a locked primitive is a structured red — real
96
- diagnostic signal, and the admission path when it's justified.
64
+ ```bash
65
+ npm install bareloop
66
+ ```
97
67
 
98
- ## Security posture — honest about the boundary
68
+ ## Usage
69
+
70
+ A signed job spec goes in. A verdict comes out.
71
+
72
+ ```js
73
+ import { runJob, jobSpecHash, makeSpine } from 'bareloop';
74
+ import { AnthropicProvider } from 'bare-agent';
75
+
76
+ const spec = {
77
+ schema: 'job-v1',
78
+ job: 'my-maintainer',
79
+ description: 'fix src until the suite greens',
80
+ goal: 'Fix any failure in src/ so the suite passes.',
81
+ verdictType: 'green',
82
+ close: [{ name: 'suite-green', cmd: 'npm test', expect: 0 }],
83
+ provider: 'anthropic-api',
84
+ cadence: { unit: 'day', every: 1 },
85
+ budgetUsd: 1.5,
86
+ writeScope: ['src/**'],
87
+ tools: ['read', 'grep', 'write', 'edit'],
88
+ escalation: { mode: 'decision-ready' },
89
+ };
90
+
91
+ // you sign the spec; an edited spec is unsigned by construction
92
+ const approvals = [
93
+ { specHash: jobSpecHash(spec), signer: 'you', ts: new Date().toISOString() },
94
+ ];
95
+
96
+ const outcome = await runJob(spec, {
97
+ approvals,
98
+ workdir: '/path/to/checkout',
99
+ provider: new AnthropicProvider({ model: 'claude-sonnet-5' }), // key from env
100
+ emit: makeSpine('/path/to/checkout/run.jsonl'),
101
+ });
102
+ // 'green' means your close passed. Anything else is a named, decision-ready stop.
103
+ ```
99
104
 
100
- bareloop runs **locally**, as you. Secrets load from the environment and never enter the
101
- tree, the spine, the configs or the ledger — and the close child, which executes the code
102
- the worker just wrote, gets its environment **stripped of credential-shaped variables**
103
- (provider keys, `AWS_*`, anything named `*_TOKEN`/`*_SECRET`/`*_PASSWORD`/`*_API_KEY`):
104
- nothing that judges a tree needs them. That is exposure reduction, **not a sandbox** — the
105
- worker's code still runs with your OS permissions and network access, so treat a bareloop
106
- run as inside your trust boundary and give it a repo you'd let an agent touch.
105
+ You do not have to hand-write that `close` yourself. bareloop can author it with you from a
106
+ short interview about what done means for the job, then hand you the result to sign.
107
107
 
108
- ## The science behind it
108
+ **Integrating an agent?** Point it at the contract, not this file:
109
109
 
110
- bareloop is the productization of **[adaptlearn](https://github.com/hamr0/adaptlearn)**
111
- (archived at v0.11.1) — a closed experimental record, findings F1–F23. What it settled,
112
- bareloop consumes without re-proving:
110
+ ```
111
+ Read bareloop.context.md from node_modules/bareloop/bareloop.context.md
112
+ ```
113
113
 
114
- | Mechanism | Evidence |
115
- |---|---|
116
- | Agents author valid harness configs at hand-written parity | M4 (F10) |
117
- | Mid-run revision recovers stuck runs | M5 (F11: 3/3 vs 1/3) |
118
- | Verdict-gated inheritance beats ungated on pass/fail | F19: gated late 1.00 vs ungated 0.13 |
119
- | Run-as-executed inheritance transmits in-run learning | F20: 6/6 lineages, ~½ cost |
120
- | Which-knob attribution is countable from the ledger | V2: contrast bit 16/16 gens |
121
- | Where memory pays: regularities outside the worker's prior | F17/F18: ~8× under acquisition cost |
114
+ That single file is the complete adopter contract: the API, the boundary, the refusals, the
115
+ constraints. The README is the pitch. (Suite-wide pattern: every bare package ships its
116
+ `*.context.md`.)
122
117
 
123
- Full PRD with design laws and open questions: [`docs/01-product/PRD.md`](docs/01-product/PRD.md).
118
+ ## Build it once, keep it
124
119
 
125
- ## Roadmap — the build ladder
120
+ A simple localhost UI lets you build a job by talking about it and watch it run. When it
121
+ works, **export the whole workflow** — with its self-healing harness — and run it again
122
+ anywhere. The point is to stop trial-and-erroring your way to the workflow that fits a job.
123
+ Find it once, keep it, reuse it. It is a seed of something bigger over time.
126
124
 
127
- Each rung POCs its riskiest assumption; a rung that cannot meet its exit stops the
128
- ladder, and the stop is a result.
125
+ ## Running it
129
126
 
130
- | Rung | What lands |
131
- |---|---|
132
- | **N0** ✅ | Port + outer shell + spine (token-free) — v0.1.0 |
133
- | **N1** ✅ | Job/close schema + validator — v0.2.0 |
134
- | **N2** ✅ | Single-job headless loop — job #1 minimal (review→fix→PR, hard greens only) — v0.3.0 |
135
- | **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 |
136
- | **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) |
137
- | **N3** | Executed inheritance + contrast-bit extractor — **kill-switch: rules must transmit across non-identical runs** |
138
- | **N4** | Verdict classes complete (soft/HITL minting) |
139
- | **N5** | Scheduler + budget ops |
140
- | **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) |
127
+ bareloop runs locally, as you. Secrets load from the environment and never enter the tree or
128
+ the run's records. It reduces exposure but it is not a sandbox: the code your job writes runs
129
+ with your permissions, so give bareloop a repo you would let an agent touch.
141
130
 
142
131
  ## The bare ecosystem
143
132
 
144
- Local-first, composable agent infrastructure. Same API patterns throughout —
145
- mix and match, each module works standalone. bareloop is the suite's flagship consumer:
146
- it exercises every package and gaps get fixed upstream, never shimmed.
133
+ Local-first, composable agent infrastructure. Same API patterns throughout. Mix and match,
134
+ each module works standalone. bareloop is the suite's flagship consumer: it exercises every
135
+ package, and gaps get fixed upstream rather than shimmed.
147
136
 
148
137
  **Core** — the brain, the gate, the memory.
149
138
 
@@ -157,10 +146,12 @@ it exercises every package and gaps get fixed upstream, never shimmed.
157
146
  - **[baremobile](https://npmjs.com/package/baremobile)** — Android + iOS device control. *Screen in → pruned snapshot out.* Replaces Appium, Espresso, XCUITest.
158
147
  - **[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.
159
148
 
160
- **Why this exists:** most automation stacks make you design the workflow before you know
161
- what works. bareloop's bet — proven in adaptlearn — is that for repeated, verifiable
162
- jobs, selection under an honest gate designs a better workflow than you would, and shows
163
- its receipts.
149
+ ## Background
150
+
151
+ bareloop is the productization of **[adaptlearn](https://github.com/hamr0/adaptlearn)**, a
152
+ closed experimental record on whether agent-authored workflows improve under an honest gate.
153
+ The design laws it inherited, and the open questions it has not answered yet, are in
154
+ [`docs/01-product/PRD.md`](docs/01-product/PRD.md).
164
155
 
165
156
  ## License
166
157