bareloop 0.0.1 → 0.2.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/CHANGELOG.md ADDED
@@ -0,0 +1,204 @@
1
+ # Changelog
2
+
3
+ All notable changes to bareloop are documented here. Format:
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versioning:
5
+ [SemVer](https://semver.org/spec/v2.0.0.html). Pre-1.0: **minor** = a ladder rung or
6
+ feature lands, **patch** = docs, fixes, scaffolding.
7
+
8
+ ## [0.2.0] — 2026-07-12
9
+
10
+ ### Added
11
+ - **N1 — the job/close schema (rung 2 of the ladder).** `validateJob` (`src/job.js`):
12
+ the operator-owned `job-v1` spec — the arbiter's rulebook as pure declarative data
13
+ (close chain, budget, outer write fence, environment label, escalation), validated
14
+ reds-before-tokens with pinned `code:path` reds. The arbiter split is guarded from
15
+ both sides by inexpressibility (workflow config can't say `close`/`provider`; job spec
16
+ can't say `hooks`/`loop`/`memory`, minting claims, or the shell-owned retry cap).
17
+ Close-authoring hierarchy (PRD §7) enforced as a class menu keyed by close type —
18
+ verdict-class laundering (`rubric` claiming `hard`) is a named red `close-hierarchy`.
19
+ `jobSpecHash` + `checkApproval`: the pure half of human-signs-always (sha256 over
20
+ canonical JSON; an edited spec is unapproved by construction; the N2 runner enforces).
21
+ Design record: `docs/plans/2026-07-12-n1-job-close-schema-design.md`; POC verdict: F4.
22
+ - **Two-layer write fence.** `validateConfig` accepts `jobWriteScope` (the job spec's
23
+ operator-owned outer fence); every workflow scope must fit inside it — path-boundary
24
+ aware (`src2` is not inside `src`) — or it reds `scope-escape`. Same containment law,
25
+ same code, both layers (the F9 lesson).
26
+ - **Reserved spine vocabulary: `coordination-red`** (V7, PRD v1.7 #1) — documented in
27
+ `bareloop.context.md`; no machinery until job #1 surfaces one.
28
+
29
+ ### Changed
30
+ - **`validateConfig` returns `{ ok, reds, config }`** — the parsed config on ok, `null`
31
+ on any red; kills the interpreter's double-parse (N2+ queue item absorbed). Additive
32
+ for callers reading `ok`/`reds`.
33
+
34
+ ### Fixed
35
+ - **Review hardening (post-build /code-review, 8 findings fixed + 6 sub-cap cleanups;
36
+ all fixes negative-tested and mutation-checked, zero feature regressions):**
37
+ cadence/escalation red unknown keys (the last smuggling level in a signed spec is
38
+ closed); the `jobWriteScope` fence opt fails CLOSED — a malformed fence is its own
39
+ `fence-invalid` red, never silently skipped, and each escaping scope reds at its own
40
+ indexed path (`gate.writeScope.N`); scope normalization moved into the shared
41
+ `globToPrefix` (leading `./`, interior `/./`, `//`, trailing `/` collapse) so a
42
+ validateJob-green fence like `src/` no longer deadlocks contained workflow configs;
43
+ `canon()` follows JSON semantics (undefined-valued keys dropped) so approvals survive
44
+ a disk round-trip, and `checkApproval` never throws (non-JSON spec → `false`);
45
+ `SECRET_RE` gained a left boundary (`flask-sqlalchemy` no longer reds) and the sweep
46
+ is shared by BOTH validators — the agent-authored workflow config is now swept too;
47
+ `interpret` accepts `jobWriteScope` and enforces the fence at the choke point (entry
48
+ + revision candidates); revision candidates are judged and installed on their PARSED
49
+ form (a JSON-string candidate no longer false-reds arbiter-touch); exported arbiter
50
+ menus are frozen; `isObj`/`isNonEmptyString` single-copied in `validate.js`.
51
+ - **Second-round review (self-review of the hardening commit found a regression IT
52
+ introduced — all fixes TDD'd, mutation-checked, zero feature regressions):**
53
+ **critical containment escape** — the fence-normalization added to `globToPrefix`
54
+ stripped a leading `./` before collapsing `//`, so `.//src/**` minted the ABSOLUTE
55
+ prefix `/src`, validated green, and resolved outside the run directory at enforcement
56
+ (design law #1); fixed by collapsing `//`+`/./` first (so `.//src/**` → `src`, safe),
57
+ a belt in `scopeContained` rejecting any normalized-absolute prefix, and an enforcement
58
+ belt in `interpret` that refuses to build a Gate whose resolved scope escapes the
59
+ workdir. `canon()` now honors `toJSON` (a `Date` no longer hashes as `{}`; distinct
60
+ values no longer collide) and `jobSpecHash` never throws (the minting path the runner
61
+ calls directly is now crash-free on `BigInt`/cycles). `SECRET_RE` left boundary extended
62
+ to `-`/`_` (`pipeline-sk-transform-utils-v2` no longer false-reds; real keys still red).
63
+ `jobWriteScope: null`/`undefined` are the legitimate no-fence spellings (no more deadlock
64
+ on every config); a malformed fence reds `fence-invalid` at path `jobWriteScope`, not the
65
+ innocent workflow field (no ledger misattribution), with the detail bounded. Shared
66
+ `legalScopeEntry` gives the scope-legality law one home across all three call sites.
67
+ - **Secrets never enter the spine (hard line), enforced at the source.** `runClose`
68
+ (`src/ralph.js`) scrubs close-command output the moment it is captured, so a secret a
69
+ checked command echoes (a 401 dumping a `Bearer …`/`sk-…` header) never reaches the
70
+ append-only spine or the next worker prompt. The redactor is injected (the shell stays
71
+ stdlib-only); `interpret` wires bareguard's exported `redact`. A benign gap is returned
72
+ byte-identical — the failure still reaches the human, just without the token (design
73
+ law #7 / V4 intact: the redactor is a fixed shell primitive, not an emergent component).
74
+ - `NOTICE` ships in the tarball (npm auto-includes LICENSE/README but not NOTICE; Apache-2.0
75
+ wants both) — found validating the installed 0.1.0 artifact.
76
+ - **Release-gate review (fresh `/security` + `/diff-review` on the whole release diff;
77
+ every finding execution-verified, every fix TDD'd):** the spine redactor now scrubs
78
+ **every shape the validator reds** — bareguard's defaults cover only `Bearer`/`sk-`,
79
+ so a git close echoing a `ghp_`/`github_pat_`/`AKIA`/`xox` token passed unredacted
80
+ into the append-only spine (the most plausible leak for job #1, a GitHub PR workflow);
81
+ `SECRET_PATTERNS` is now the one shape inventory shared by detection and redaction.
82
+ `interpret` normalizes `workdir` once at entry — a trailing-slash or relative spelling
83
+ made the enforcement belt false-red every legal scope — and the belt now treats a scope
84
+ resolving to the run dir itself as escaped. `checkApproval` no longer routes through the
85
+ un-hashable sentinel (two distinct un-hashable specs cross-approved each other; now
86
+ un-hashable = unapproved). The secrets sweep tests object **keys**, not just values (a
87
+ token could ride a key in a `gold` `expected` onto the spine through a green spec). A
88
+ non-object `cadence` reds once at `cadence`, not twice at paths that don't exist.
89
+
90
+ ## [0.1.0] — 2026-07-11
91
+
92
+ ### Added
93
+ - **PRD addendum v1.5: the upstream ledger.** Auto-detected upstream fixes + user-facing
94
+ workflow debugging, derived purely from the spines: 8 lib-incident classes (test reds
95
+ and budget halts excluded by design — workflow stories never pollute the upstream
96
+ queue), signature-deduped counts, append-only state-as-fold, human-appended fix
97
+ lifecycle (the tool drafts, never files). Two audiences, one file: panel workflow
98
+ health (N6) and the maintainer's pre-drafted UPSTREAM-ASKS queue. New admission
99
+ obligation ~N2/N3: per-job known-answer `primitive-smoke` before tokens — the only
100
+ detector for silently-degrading primitives (adaptlearn A3 class). Spec + reference
101
+ implementation upstream in adaptlearn (validated: re-derived the menu-probe session's
102
+ incidents, zero false positives from ~100 close reds).
103
+ - **F2 + PRD addendum v1.4: the menu probes return (adaptlearn F21/F22).** The v1.1 §4
104
+ graduated-disclosure open question RESOLVED: the registry gate is met (menu axis
105
+ wired-in; admission chain proven end-to-end) — the request-red registry builds ~N3/N4.
106
+ Author selection is cargo-cult (zero need signal; picks are a superset of need); need
107
+ reads off the ledger (within-run request-red frequency + outcome contrast); curation is
108
+ evidence-driven, never appetite-driven. New doctrine: partial retrieval poisons gap
109
+ attribution. N2 requirements filed: artifact-red category, fence-robust extraction.
110
+ - **N0 — the token-free rung (PRD §10).** The five spine modules, rewritten from the
111
+ adaptlearn originals (graduation-is-a-rewrite): `src/spine.js` (append-only JSONL
112
+ emitter; seq monotonic, ts last), `src/ralph.js` (the dumb shell: close exit code =
113
+ truth, cap-halt its own category, decision-ready escalations), `src/validate.js`
114
+ (schema v1 predicate — named reds before tokens; litectx-bound vocabulary; `diffPaths`
115
+ one-knob checker), `src/interpret.js` (the only config reader; composes Gate + LiteCtx +
116
+ Loop; mid-run revision seam with interpreter-owned acceptance; emits `config-final` —
117
+ the run-as-executed record, design law #2), `src/extract.js` (rules distiller: one
118
+ sealed shot, bounds enforced mechanically, rejected whole). 70 tests carried from
119
+ adaptlearn's reference semantics, all hermetic and token-free (scripted stub providers).
120
+ Rigging per LIBRARY_CONVENTIONS: tsconfig (checkJs + strictNullChecks), `typecheck` /
121
+ `build:types` / `prepublishOnly` scripts, `.github/workflows/ci.yml`
122
+ (typecheck → build:types → test, no lint). Deps: litectx ^0.28.0, bareguard ^0.12.0,
123
+ bare-agent ^0.26.2. Code-review hardening (two rounds, all guards watch-it-fail
124
+ validated): writeScope **containment reds** (no absolute/Windows paths, no ".."
125
+ segments, not the run dir itself — a scope can never reach the arbiter's inputs,
126
+ design law #1); **verb placement tightened** — each verb legal only in its one
127
+ effective slot (recall/compress → before-attempt, stash → after-red, remember →
128
+ on-green; an inert-but-listed op is a fake knob in the contrast evidence, law #3);
129
+ **prototype-safe lookups** (`Object.hasOwn`) in the validator's param check and the
130
+ shell's escalation decision map; **silent-red gap sentinel** (a close that exits
131
+ nonzero with no output must not kill feedback/stall detection); spine **reserved-key
132
+ guard** (type/seq/ts are the envelope's, by mechanism); shared **`globToPrefix`** and
133
+ **`stripFences`** (`src/text.js` — one copy each, F9-class drift guards);
134
+ `extractRules` **never throws** (provider transport errors degrade to a
135
+ `provider-error` red as data); halt-as-return guard in `ask()` (bare-agent returns
136
+ `{error: 'halt:…'}` rather than throwing — forward armor for N2's tool loops); honest
137
+ cost emit (`metrics.costUsd ?? cost` — unpriced stays null, never a silent zero);
138
+ **package entry point** — `src/index.js` + `main`/`types`/`exports` map per
139
+ LIBRARY_CONVENTIONS §2 (the shipped `.d.ts` were previously unreferenced and the
140
+ package unimportable); a `CategorizedError` typedef and a `RecallHit` typedef replace
141
+ every `any`-cast (CLAUDE.md library-shape rule).
142
+ - **F1 in `docs/FINDINGS.md`:** first `npm install` as a suite consumer surfaced two
143
+ upstream gaps (stale bare-agent peer range; GateDecision/Decision null-reason type
144
+ drift) — both fixed upstream and consumed via bare-agent 0.26.2, per two-red routing.
145
+ No shims.
146
+ - PRD **addendum v1.3** + CYBERNETICS.md O1–O5: the orchestration position — not a second
147
+ runtime modality (credit attribution, accumulation, the arbiter — grounded in F15–F20);
148
+ convergence path is orchestrate-first-encounter → crystallize via run-as-executed
149
+ inheritance; admission only by pre-registered probe.
150
+ - PRD **addendum v1.2**: the menu-breadth (graduated-disclosure) probe is assigned to
151
+ adaptlearn (successor-POC track, F19/F20 style) and returns to bareloop as findings;
152
+ the registry-gating separation requirement is unchanged.
153
+ - PRD locked at **v1** (2026-07-11) after the bloat audit: §6→§9 open-questions dedup,
154
+ §4 secrets-never-enter-the-spine invariant, §5 mobile-responsive mandate. Amendments
155
+ from here are dated addenda, never rewrites.
156
+ - PRD **addendum v1.1** (post-lock interview + adaptlearn cross-check): panel layout and
157
+ web-CLI command bar; full five-package primitive disclosure with the **two-red routing
158
+ rule** (locked-but-exists → in-loop registry admission; missing/broken → fix baresuite
159
+ and consume, never a local shim); **graduated-disclosure** open question pre-registered
160
+ with M3 discipline (minimal-menu vs +1-extra contrast must separate before the
161
+ request-red registry is built) — verified never exercised in adaptlearn.
162
+ - Panel spec — **PRD Appendix A** (provisional; briefly `PANEL.md`, folded into the PRD
163
+ same day — one product doc): two panes (left chat + command bar speaking the exact
164
+ headless-CLI verbs; right progress/cost/step over results cards); primitive menu
165
+ grouped under recall / compress / stash / remember (provisional); context-graph third
166
+ view reserved (consumes litectx `ContextGraph` + the spine); mobile stacks; headless
167
+ first.
168
+ - `.github/workflows/publish.yml` — npm trusted publishing (OIDC, no token), manual
169
+ dispatch, idempotent, asserts registry end-state.
170
+ - `bareloop.context.md` — adopter contract per LIBRARY_CONVENTIONS §3 (draft; API
171
+ sections fill in as rungs land). `LICENSE` + `NOTICE` (Apache-2.0, matching the suite;
172
+ corrects the 0.0.1 placeholder's MIT declaration).
173
+ - README rewritten in the bareagent shape: banner, badges, agent-first quick start,
174
+ layers/verdict tables, science table, ladder roadmap, ecosystem section.
175
+
176
+ ### Changed
177
+ - `docs/UPSTREAM-ASKS.md` repurposed: upstream-gap **fix queue** only (we own baresuite —
178
+ fix-and-consume, version bump; request-red admissions resolve in-loop and never land
179
+ here).
180
+ - Repo hygiene per LIBRARY_CONVENTIONS §7: `.claude/`, `.litectx/`, `.idea/` ignored and
181
+ de-tracked; `CLAUDE.md` stays tracked as the agent-doctrine file.
182
+ - `package.json` takes the library shape: `"type": "module"`, Node `>=20` (bareguard's
183
+ floor governs), `files` ships `src/` + `types/` + the doc set (paths land at N0);
184
+ repository/homepage links to GitHub.
185
+
186
+ ## [0.0.1] — 2026-07-11
187
+
188
+ ### Added
189
+ - **Repo cut** from the adaptlearn seed per the close-out plan (adaptlearn archived and
190
+ closed at v0.11.1 — the science behind this product).
191
+ - **Named `bareloop`** (working dir renamed from the `looped` placeholder; `looped` and
192
+ `reloop` verified squatted on npm). Name reserved: `bareloop@0.0.1` published to npm —
193
+ README + package.json only, no code.
194
+ - Seed docs: PRD (named, v0.2 at the time), design record
195
+ `docs/plans/2026-07-10-agentic-automation-successor-design.md` with the naming
196
+ resolution annotated, adaptlearn FINDINGS F1–F20 + CYBERNETICS.md carried as closed
197
+ records in `docs/00-context/`.
198
+ - Scaffold: `CLAUDE.md`, fresh `docs/FINDINGS.md` (numbering starts at F1),
199
+ `docs/UPSTREAM-ASKS.md`, guardrails pre-tool hook (local), `.gitignore`.
200
+ - Public GitHub repo `hamr0/bareloop`, `main` branch.
201
+
202
+ [0.2.0]: https://github.com/hamr0/bareloop/compare/v0.1.0...v0.2.0
203
+ [0.1.0]: https://github.com/hamr0/bareloop/compare/v0.0.1...v0.1.0
204
+ [0.0.1]: https://github.com/hamr0/bareloop/releases/tag/v0.0.1
package/LICENSE ADDED
@@ -0,0 +1,202 @@
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 [yyyy] [name of copyright owner]
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 implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
package/NOTICE ADDED
@@ -0,0 +1,13 @@
1
+ bareloop
2
+ Copyright 2026 hamr0
3
+
4
+ This product includes software developed by hamr0
5
+ (https://github.com/hamr0/bareloop).
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License").
8
+ You may obtain a copy of the License at:
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ This NOTICE file is required by Section 4(d) of the License.
13
+ Forks and derivative works MUST preserve this attribution.
package/README.md CHANGED
@@ -1,17 +1,129 @@
1
- # bareloop
1
+ ```
2
+ ╭──────────────────────────────────────╮
3
+ │ ╔╗ ╔═╗╦═╗╔═╗╦ ╔═╗╔═╗╔═╗ │
4
+ │ ╠╩╗╠═╣╠╦╝╠╣ ║ ║ ║║ ║╠═╝ │
5
+ │ ╚═╝╩ ╩╩╚═╚═╝╩═╝╚═╝╚═╝╩ │
6
+ │ run ──→ verdict ──→ inherit │
7
+ │ ↑ │ │
8
+ │ └─────────────────────┘ │
9
+ ╰──╮───────────────────────────────────╯
10
+ ╰── workflows that earn their own design
11
+ ```
2
12
 
3
- > **Name reserved — product in design.** First release will be the headless loop (N0–N2).
13
+ <p align="center">
14
+ <img src="https://img.shields.io/github/package-json/v/hamr0/bareloop?label=version&color=2a4f8c" alt="version (auto from package.json)">
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-pre--code%20%C2%B7%20PRD%20locked-8a6d1a" alt="status: pre-code, PRD locked">
17
+ </p>
4
18
 
5
- **"Automate this job — I don't know the best workflow."**
6
-
7
- bareloop is a system for tasks that are **repeated, long, and verifiable**: you describe the
8
- job and its checkpoints; an agent authors the workflow scaffolding (a constrained, validated
9
- config — never freeform code); runs execute under an un-gameable outer gate; and the
10
- scaffolding *improves across runs* through verdict-gated, run-as-executed inheritance with
11
- ledger-counted attribution.
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.
12
24
 
13
25
  The pitch in one line: **workflows that earn their own design, with receipts** — every
14
26
  inherited rule carries the green that minted it and the contrast that attributed it.
15
27
 
16
- Built on the bare suite (bareagent, bareguard, litectx, barebrowse, baremobile). The science
17
- behind it: the adaptlearn experiment (v0.11.1), findings F1–F20.
28
+ > **Status: pre-code.** The name is reserved, the PRD is locked, and the build ladder is
29
+ > in flight (roadmap below). The first usable release is the headless loop.
30
+
31
+ ## Quick start
32
+
33
+ ```bash
34
+ npm install bareloop
35
+ ```
36
+
37
+ **Give your AI assistant the integration guide**
38
+
39
+ ```
40
+ Read bareloop.context.md from node_modules/bareloop/bareloop.context.md
41
+ ```
42
+
43
+ That single file is the complete adopter contract — the boundary, the architecture, the
44
+ refusals, the constraints — and it grows API sections as rungs land. (Suite-wide pattern:
45
+ every bare package ships its `*.context.md`.)
46
+
47
+ ---
48
+
49
+ ## How it works
50
+
51
+ Three layers; nothing inside negotiates with the layer above it.
52
+
53
+ | Layer | What it is | Emergent? |
54
+ |---|---|---|
55
+ | **Outer shell** | Per-run budget cap (bareguard), retry cap, verdict collection, escalation routing. Stateless across runs | never — permanent, dumb, un-gameable |
56
+ | **Emergent middle** | The authored workflow config: steps, per-step verdict class, memory binding, write scopes — schema-validated, config-red before tokens burn | yes — authored and improved by the agent |
57
+ | **Floor** | Append-only JSONL spine (single source for every UI), litectx store per job, per-run ledger | never — the record |
58
+
59
+ Every checkpoint in a workflow carries its own **verdict class**, and the class decides
60
+ what the run's learning is worth:
61
+
62
+ | Verdict | Truth source | Mints inheritance? |
63
+ |---|---|---|
64
+ | **Hard green** | predicate / exit-code (tests, build, lint) | automatically |
65
+ | **Soft green** | rubric / assessment | only with HITL confirm or N consistent repeats |
66
+ | **HITL green** | a human is the close (PR merge, "publish") | yes — and merge stays human, forever |
67
+
68
+ The full bare-suite surface is *disclosed* to the authoring agent; only *admitted* verbs
69
+ are callable per job. A request against a locked primitive is a structured red — real
70
+ diagnostic signal, and the admission path when it's justified.
71
+
72
+ ## The science behind it
73
+
74
+ bareloop is the productization of **[adaptlearn](https://github.com/hamr0/adaptlearn)**
75
+ (archived at v0.11.1) — a closed experimental record, findings F1–F20. What it settled,
76
+ bareloop consumes without re-proving:
77
+
78
+ | Mechanism | Evidence |
79
+ |---|---|
80
+ | Agents author valid harness configs at hand-written parity | M4 (F10) |
81
+ | Mid-run revision recovers stuck runs | M5 (F11: 3/3 vs 1/3) |
82
+ | Verdict-gated inheritance beats ungated on pass/fail | F19: gated late 1.00 vs ungated 0.13 |
83
+ | Run-as-executed inheritance transmits in-run learning | F20: 6/6 lineages, ~½ cost |
84
+ | Which-knob attribution is countable from the ledger | V2: contrast bit 16/16 gens |
85
+ | Where memory pays: regularities outside the worker's prior | F17/F18: ~8× under acquisition cost |
86
+
87
+ Full PRD with design laws and open questions: [`docs/01-product/PRD.md`](docs/01-product/PRD.md).
88
+
89
+ ## Roadmap — the build ladder
90
+
91
+ Each rung POCs its riskiest assumption; a rung that cannot meet its exit stops the
92
+ ladder, and the stop is a result.
93
+
94
+ | Rung | What lands |
95
+ |---|---|
96
+ | **N0** | Port + outer shell + spine (token-free) |
97
+ | **N1** | Job/close schema + validator |
98
+ | **N2** | Single-job headless loop — job #1 minimal (review→fix→PR, hard greens only) |
99
+ | **N3** | Executed inheritance + contrast-bit extractor — **kill-switch: rules must transmit across non-identical runs** |
100
+ | **N4** | Verdict classes complete (soft/HITL minting) |
101
+ | **N5** | Scheduler + budget ops |
102
+ | **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) |
103
+
104
+ ## The bare ecosystem
105
+
106
+ Local-first, composable agent infrastructure. Same API patterns throughout —
107
+ mix and match, each module works standalone. bareloop is the suite's flagship consumer:
108
+ it exercises every package and gaps get fixed upstream, never shimmed.
109
+
110
+ **Core** — the brain, the gate, the memory.
111
+
112
+ - **[bareagent](https://npmjs.com/package/bare-agent)** — the think→act→observe loop. *Goal in → coordinated actions out.* Replaces LangChain, CrewAI, AutoGen.
113
+ - **[bareguard](https://npmjs.com/package/bareguard)** — the single gate every action passes through. *Action in → allow / deny / ask-a-human out.* Replaces hand-rolled allowlists and scattered policy code.
114
+ - **[litectx](https://npmjs.com/package/litectx)** — tree-sitter code + memory graph with activation decay, plus lightweight context engineering (write · select · compress · isolate). *Query in → ranked context out.*
115
+
116
+ **Optional reach** — give the agent hands.
117
+
118
+ - **[barebrowse](https://npmjs.com/package/barebrowse)** — a real browser for agents. *URL in → pruned snapshot out.* Replaces Playwright, Selenium, Puppeteer.
119
+ - **[baremobile](https://npmjs.com/package/baremobile)** — Android + iOS device control. *Screen in → pruned snapshot out.* Replaces Appium, Espresso, XCUITest.
120
+ - **[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.
121
+
122
+ **Why this exists:** most automation stacks make you design the workflow before you know
123
+ what works. bareloop's bet — proven in adaptlearn — is that for repeated, verifiable
124
+ jobs, selection under an honest gate designs a better workflow than you would, and shows
125
+ its receipts.
126
+
127
+ ## License
128
+
129
+ Apache License, Version 2.0 — see [LICENSE](LICENSE) and [NOTICE](NOTICE).