bareloop 0.0.1 → 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.
- package/CHANGELOG.md +124 -0
- package/LICENSE +202 -0
- package/README.md +123 -11
- package/bareloop.context.md +115 -0
- package/package.json +40 -3
- package/src/extract.js +95 -0
- package/src/index.js +9 -0
- package/src/interpret.js +228 -0
- package/src/ralph.js +109 -0
- package/src/spine.js +29 -0
- package/src/text.js +9 -0
- package/src/validate.js +213 -0
- package/types/extract.d.ts +23 -0
- package/types/index.d.ts +5 -0
- package/types/interpret.d.ts +57 -0
- package/types/ralph.d.ts +48 -0
- package/types/spine.d.ts +6 -0
- package/types/text.d.ts +1 -0
- package/types/validate.d.ts +38 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
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
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] — 2026-07-11
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **PRD addendum v1.5: the upstream ledger.** Auto-detected upstream fixes + user-facing
|
|
14
|
+
workflow debugging, derived purely from the spines: 8 lib-incident classes (test reds
|
|
15
|
+
and budget halts excluded by design — workflow stories never pollute the upstream
|
|
16
|
+
queue), signature-deduped counts, append-only state-as-fold, human-appended fix
|
|
17
|
+
lifecycle (the tool drafts, never files). Two audiences, one file: panel workflow
|
|
18
|
+
health (N6) and the maintainer's pre-drafted UPSTREAM-ASKS queue. New admission
|
|
19
|
+
obligation ~N2/N3: per-job known-answer `primitive-smoke` before tokens — the only
|
|
20
|
+
detector for silently-degrading primitives (adaptlearn A3 class). Spec + reference
|
|
21
|
+
implementation upstream in adaptlearn (validated: re-derived the menu-probe session's
|
|
22
|
+
incidents, zero false positives from ~100 close reds).
|
|
23
|
+
- **F2 + PRD addendum v1.4: the menu probes return (adaptlearn F21/F22).** The v1.1 §4
|
|
24
|
+
graduated-disclosure open question RESOLVED: the registry gate is met (menu axis
|
|
25
|
+
wired-in; admission chain proven end-to-end) — the request-red registry builds ~N3/N4.
|
|
26
|
+
Author selection is cargo-cult (zero need signal; picks are a superset of need); need
|
|
27
|
+
reads off the ledger (within-run request-red frequency + outcome contrast); curation is
|
|
28
|
+
evidence-driven, never appetite-driven. New doctrine: partial retrieval poisons gap
|
|
29
|
+
attribution. N2 requirements filed: artifact-red category, fence-robust extraction.
|
|
30
|
+
- **N0 — the token-free rung (PRD §10).** The five spine modules, rewritten from the
|
|
31
|
+
adaptlearn originals (graduation-is-a-rewrite): `src/spine.js` (append-only JSONL
|
|
32
|
+
emitter; seq monotonic, ts last), `src/ralph.js` (the dumb shell: close exit code =
|
|
33
|
+
truth, cap-halt its own category, decision-ready escalations), `src/validate.js`
|
|
34
|
+
(schema v1 predicate — named reds before tokens; litectx-bound vocabulary; `diffPaths`
|
|
35
|
+
one-knob checker), `src/interpret.js` (the only config reader; composes Gate + LiteCtx +
|
|
36
|
+
Loop; mid-run revision seam with interpreter-owned acceptance; emits `config-final` —
|
|
37
|
+
the run-as-executed record, design law #2), `src/extract.js` (rules distiller: one
|
|
38
|
+
sealed shot, bounds enforced mechanically, rejected whole). 70 tests carried from
|
|
39
|
+
adaptlearn's reference semantics, all hermetic and token-free (scripted stub providers).
|
|
40
|
+
Rigging per LIBRARY_CONVENTIONS: tsconfig (checkJs + strictNullChecks), `typecheck` /
|
|
41
|
+
`build:types` / `prepublishOnly` scripts, `.github/workflows/ci.yml`
|
|
42
|
+
(typecheck → build:types → test, no lint). Deps: litectx ^0.28.0, bareguard ^0.12.0,
|
|
43
|
+
bare-agent ^0.26.2. Code-review hardening (two rounds, all guards watch-it-fail
|
|
44
|
+
validated): writeScope **containment reds** (no absolute/Windows paths, no ".."
|
|
45
|
+
segments, not the run dir itself — a scope can never reach the arbiter's inputs,
|
|
46
|
+
design law #1); **verb placement tightened** — each verb legal only in its one
|
|
47
|
+
effective slot (recall/compress → before-attempt, stash → after-red, remember →
|
|
48
|
+
on-green; an inert-but-listed op is a fake knob in the contrast evidence, law #3);
|
|
49
|
+
**prototype-safe lookups** (`Object.hasOwn`) in the validator's param check and the
|
|
50
|
+
shell's escalation decision map; **silent-red gap sentinel** (a close that exits
|
|
51
|
+
nonzero with no output must not kill feedback/stall detection); spine **reserved-key
|
|
52
|
+
guard** (type/seq/ts are the envelope's, by mechanism); shared **`globToPrefix`** and
|
|
53
|
+
**`stripFences`** (`src/text.js` — one copy each, F9-class drift guards);
|
|
54
|
+
`extractRules` **never throws** (provider transport errors degrade to a
|
|
55
|
+
`provider-error` red as data); halt-as-return guard in `ask()` (bare-agent returns
|
|
56
|
+
`{error: 'halt:…'}` rather than throwing — forward armor for N2's tool loops); honest
|
|
57
|
+
cost emit (`metrics.costUsd ?? cost` — unpriced stays null, never a silent zero);
|
|
58
|
+
**package entry point** — `src/index.js` + `main`/`types`/`exports` map per
|
|
59
|
+
LIBRARY_CONVENTIONS §2 (the shipped `.d.ts` were previously unreferenced and the
|
|
60
|
+
package unimportable); a `CategorizedError` typedef and a `RecallHit` typedef replace
|
|
61
|
+
every `any`-cast (CLAUDE.md library-shape rule).
|
|
62
|
+
- **F1 in `docs/FINDINGS.md`:** first `npm install` as a suite consumer surfaced two
|
|
63
|
+
upstream gaps (stale bare-agent peer range; GateDecision/Decision null-reason type
|
|
64
|
+
drift) — both fixed upstream and consumed via bare-agent 0.26.2, per two-red routing.
|
|
65
|
+
No shims.
|
|
66
|
+
- PRD **addendum v1.3** + CYBERNETICS.md O1–O5: the orchestration position — not a second
|
|
67
|
+
runtime modality (credit attribution, accumulation, the arbiter — grounded in F15–F20);
|
|
68
|
+
convergence path is orchestrate-first-encounter → crystallize via run-as-executed
|
|
69
|
+
inheritance; admission only by pre-registered probe.
|
|
70
|
+
- PRD **addendum v1.2**: the menu-breadth (graduated-disclosure) probe is assigned to
|
|
71
|
+
adaptlearn (successor-POC track, F19/F20 style) and returns to bareloop as findings;
|
|
72
|
+
the registry-gating separation requirement is unchanged.
|
|
73
|
+
- PRD locked at **v1** (2026-07-11) after the bloat audit: §6→§9 open-questions dedup,
|
|
74
|
+
§4 secrets-never-enter-the-spine invariant, §5 mobile-responsive mandate. Amendments
|
|
75
|
+
from here are dated addenda, never rewrites.
|
|
76
|
+
- PRD **addendum v1.1** (post-lock interview + adaptlearn cross-check): panel layout and
|
|
77
|
+
web-CLI command bar; full five-package primitive disclosure with the **two-red routing
|
|
78
|
+
rule** (locked-but-exists → in-loop registry admission; missing/broken → fix baresuite
|
|
79
|
+
and consume, never a local shim); **graduated-disclosure** open question pre-registered
|
|
80
|
+
with M3 discipline (minimal-menu vs +1-extra contrast must separate before the
|
|
81
|
+
request-red registry is built) — verified never exercised in adaptlearn.
|
|
82
|
+
- Panel spec — **PRD Appendix A** (provisional; briefly `PANEL.md`, folded into the PRD
|
|
83
|
+
same day — one product doc): two panes (left chat + command bar speaking the exact
|
|
84
|
+
headless-CLI verbs; right progress/cost/step over results cards); primitive menu
|
|
85
|
+
grouped under recall / compress / stash / remember (provisional); context-graph third
|
|
86
|
+
view reserved (consumes litectx `ContextGraph` + the spine); mobile stacks; headless
|
|
87
|
+
first.
|
|
88
|
+
- `.github/workflows/publish.yml` — npm trusted publishing (OIDC, no token), manual
|
|
89
|
+
dispatch, idempotent, asserts registry end-state.
|
|
90
|
+
- `bareloop.context.md` — adopter contract per LIBRARY_CONVENTIONS §3 (draft; API
|
|
91
|
+
sections fill in as rungs land). `LICENSE` + `NOTICE` (Apache-2.0, matching the suite;
|
|
92
|
+
corrects the 0.0.1 placeholder's MIT declaration).
|
|
93
|
+
- README rewritten in the bareagent shape: banner, badges, agent-first quick start,
|
|
94
|
+
layers/verdict tables, science table, ladder roadmap, ecosystem section.
|
|
95
|
+
|
|
96
|
+
### Changed
|
|
97
|
+
- `docs/UPSTREAM-ASKS.md` repurposed: upstream-gap **fix queue** only (we own baresuite —
|
|
98
|
+
fix-and-consume, version bump; request-red admissions resolve in-loop and never land
|
|
99
|
+
here).
|
|
100
|
+
- Repo hygiene per LIBRARY_CONVENTIONS §7: `.claude/`, `.litectx/`, `.idea/` ignored and
|
|
101
|
+
de-tracked; `CLAUDE.md` stays tracked as the agent-doctrine file.
|
|
102
|
+
- `package.json` takes the library shape: `"type": "module"`, Node `>=20` (bareguard's
|
|
103
|
+
floor governs), `files` ships `src/` + `types/` + the doc set (paths land at N0);
|
|
104
|
+
repository/homepage links to GitHub.
|
|
105
|
+
|
|
106
|
+
## [0.0.1] — 2026-07-11
|
|
107
|
+
|
|
108
|
+
### Added
|
|
109
|
+
- **Repo cut** from the adaptlearn seed per the close-out plan (adaptlearn archived and
|
|
110
|
+
closed at v0.11.1 — the science behind this product).
|
|
111
|
+
- **Named `bareloop`** (working dir renamed from the `looped` placeholder; `looped` and
|
|
112
|
+
`reloop` verified squatted on npm). Name reserved: `bareloop@0.0.1` published to npm —
|
|
113
|
+
README + package.json only, no code.
|
|
114
|
+
- Seed docs: PRD (named, v0.2 at the time), design record
|
|
115
|
+
`docs/plans/2026-07-10-agentic-automation-successor-design.md` with the naming
|
|
116
|
+
resolution annotated, adaptlearn FINDINGS F1–F20 + CYBERNETICS.md carried as closed
|
|
117
|
+
records in `docs/00-context/`.
|
|
118
|
+
- Scaffold: `CLAUDE.md`, fresh `docs/FINDINGS.md` (numbering starts at F1),
|
|
119
|
+
`docs/UPSTREAM-ASKS.md`, guardrails pre-tool hook (local), `.gitignore`.
|
|
120
|
+
- Public GitHub repo `hamr0/bareloop`, `main` branch.
|
|
121
|
+
|
|
122
|
+
[Unreleased]: https://github.com/hamr0/bareloop/compare/v0.1.0...HEAD
|
|
123
|
+
[0.1.0]: https://github.com/hamr0/bareloop/compare/v0.0.1...v0.1.0
|
|
124
|
+
[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/README.md
CHANGED
|
@@ -1,17 +1,129 @@
|
|
|
1
|
-
|
|
1
|
+
```
|
|
2
|
+
╭──────────────────────────────────────╮
|
|
3
|
+
│ ╔╗ ╔═╗╦═╗╔═╗╦ ╔═╗╔═╗╔═╗ │
|
|
4
|
+
│ ╠╩╗╠═╣╠╦╝╠╣ ║ ║ ║║ ║╠═╝ │
|
|
5
|
+
│ ╚═╝╩ ╩╩╚═╚═╝╩═╝╚═╝╚═╝╩ │
|
|
6
|
+
│ run ──→ verdict ──→ inherit │
|
|
7
|
+
│ ↑ │ │
|
|
8
|
+
│ └─────────────────────┘ │
|
|
9
|
+
╰──╮───────────────────────────────────╯
|
|
10
|
+
╰── workflows that earn their own design
|
|
11
|
+
```
|
|
2
12
|
|
|
3
|
-
>
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
17
|
-
|
|
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).
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# bareloop — Integration Guide
|
|
2
|
+
|
|
3
|
+
> **DRAFT — pre-code.** bareloop is at the name-reservation stage; the API sections below
|
|
4
|
+
> fill in as build-ladder rungs land (PRD §10). What is already settled — the boundary,
|
|
5
|
+
> the architecture, the refusals, the constraints — is settled for good and recorded now.
|
|
6
|
+
> Per LIBRARY_CONVENTIONS §3 this file ships with the package and is the complete adopter
|
|
7
|
+
> contract; the README is only the pitch.
|
|
8
|
+
|
|
9
|
+
## What this is
|
|
10
|
+
|
|
11
|
+
**"Automate this job — I don't know the best workflow."** bareloop runs tasks that are
|
|
12
|
+
repeated, long, and verifiable: you describe the job and its checkpoints; an agent authors
|
|
13
|
+
the workflow scaffolding (a constrained, validated config — never freeform code); runs
|
|
14
|
+
execute under an un-gameable outer gate; the scaffolding improves across runs through
|
|
15
|
+
verdict-gated, run-as-executed inheritance with ledger-counted attribution. Every
|
|
16
|
+
inherited rule carries the green that minted it and the contrast that attributed it.
|
|
17
|
+
|
|
18
|
+
## What bareloop is and is not
|
|
19
|
+
|
|
20
|
+
- **Is:** a place where repeated, verifiable jobs get better at themselves — job model,
|
|
21
|
+
authored-workflow lineages, verdict classes, inheritance with receipts, a panel to
|
|
22
|
+
operate it.
|
|
23
|
+
- **Is not:** a general agent, a swarm, or an orchestrator framework. One-off or small
|
|
24
|
+
jobs are out of scope — that's a CLI session, not a bareloop job.
|
|
25
|
+
|
|
26
|
+
## Minimal usage
|
|
27
|
+
|
|
28
|
+
*TBD at N2 (first headless single-job loop). Will show: define a job (description,
|
|
29
|
+
checkpoints + verdict classes, budget, cadence, provider) → run → watch the spine.*
|
|
30
|
+
|
|
31
|
+
## All options
|
|
32
|
+
|
|
33
|
+
*TBD at N1 (job/close schema + validator lands). The schema is the option surface;
|
|
34
|
+
config-red before tokens burn.*
|
|
35
|
+
|
|
36
|
+
## Public API
|
|
37
|
+
|
|
38
|
+
*Landed through N0 (spine + shell + validator + interpreter + extractor). Still TBD:
|
|
39
|
+
N1 (job/close schema), N2 (headless job loop), N3 (contrast-bit extractor), N4 (verdict
|
|
40
|
+
classes), N5 (scheduler + budget ops), N6 (panel).*
|
|
41
|
+
|
|
42
|
+
### `makeSpine(file)` → `emit(type, data?)` — `src/spine.js`
|
|
43
|
+
|
|
44
|
+
Append-only JSONL event emitter bound to one file. `seq` monotonic per spine, `ts` stamped
|
|
45
|
+
last. Consumers are pure listeners; nothing reads the file back. Returns each event as
|
|
46
|
+
written.
|
|
47
|
+
|
|
48
|
+
### `ralph({ middle, close, capRuns, emit })` → `'green' | 'escalated'` — `src/ralph.js`
|
|
49
|
+
|
|
50
|
+
The dumb outer shell: `while close-red and under-cap: run the middle`. `close` is an argv
|
|
51
|
+
whose exit code is truth (`runClose` is also exported); the red gap text feeds the next
|
|
52
|
+
iteration. Escalations are decision-ready (category, options, spend); cap-halt is its own
|
|
53
|
+
category, never merged with "wrong". A thrown middle is relayed by its `category`
|
|
54
|
+
property (`cap-halt`, `gate-red`, …); an unnamed throw is `interpreter-red`.
|
|
55
|
+
|
|
56
|
+
### `validateConfig(input, { shellCapUsd? })` → `{ ok, reds }` — `src/validate.js`
|
|
57
|
+
|
|
58
|
+
Deterministic schema-v1 predicate; never throws. Every failure is a named red
|
|
59
|
+
`{ code, path, detail? }` — reds before tokens burn. Verb vocabulary bound from litectx
|
|
60
|
+
(`LOOP_SHAPES`, `SLOTS`, `VERBS` exported). `diffPaths(a, b)` returns changed JSON paths —
|
|
61
|
+
the one-knob mutation checker.
|
|
62
|
+
|
|
63
|
+
### `interpret(configRaw, opts)` → `'green' | 'escalated' | 'config-red'` — `src/interpret.js`
|
|
64
|
+
|
|
65
|
+
The only code that reads a config. Composes bareguard `Gate` (write scopes, USD budget),
|
|
66
|
+
litectx (recall/compress/stash/remember hook ops), and the bareagent `Loop` under `ralph`.
|
|
67
|
+
The provider and the close arrive from the shell, never the config. Optional `revisor`
|
|
68
|
+
seam fires once after `STALL_REDS` consecutive close reds; the interpreter owns acceptance
|
|
69
|
+
(arbiter-touch / cap-touch / validation reds). Emits `config-final` — the run-as-executed
|
|
70
|
+
config (design law #2) — on every run.
|
|
71
|
+
|
|
72
|
+
### `extractRules({ config, provider, priorRules, revisionDiff? })` — `src/extract.js`
|
|
73
|
+
|
|
74
|
+
One sealed LLM call distilling a lineage's rules from ledger facts after a green run.
|
|
75
|
+
`MAX_RULES`/`MAX_RULE_CHARS` bounds enforced mechanically post-call, rejected whole.
|
|
76
|
+
Malformed output is a red as data (`rules: null`) — the caller keeps prior rules.
|
|
77
|
+
|
|
78
|
+
## Architecture
|
|
79
|
+
|
|
80
|
+
Three layers. An **outer shell** (dumb, permanent): per-run budget cap via bareguard,
|
|
81
|
+
retry cap, verdict collection, escalation routing — stateless across runs; nothing inside
|
|
82
|
+
negotiates with it. An **emergent middle**: the authored workflow config — steps, per-step
|
|
83
|
+
verdict class, memory binding, write scopes — schema-validated. A **floor**: append-only
|
|
84
|
+
JSONL spine (single source for every UI), litectx store per job, per-run ledger. Built on
|
|
85
|
+
the bare suite: bareagent, bareguard, litectx, barebrowse, baremobile — the full surface
|
|
86
|
+
is disclosed to the authoring agent; only admitted verbs are callable per job.
|
|
87
|
+
|
|
88
|
+
## What's NOT in bareloop, and why
|
|
89
|
+
|
|
90
|
+
- **No agent-authored arbiters.** Closes, budgets, caps, merge/publish decisions live
|
|
91
|
+
outside the emergent part, permanently — the product's trust story depends on the gate
|
|
92
|
+
being un-gameable (adaptlearn's no-breach record is the evidence).
|
|
93
|
+
- **No freeform code as scaffolding.** Configs are schema-validated; config-red before
|
|
94
|
+
tokens burn.
|
|
95
|
+
- **No self-adjusted budgets — ever.** Hard cap per run, cap-not-estimate.
|
|
96
|
+
- **No swarm / orchestrator frameworks; one process per run.** Fewer moving parts is the
|
|
97
|
+
point of the name.
|
|
98
|
+
- **No local shims over baresuite gaps.** A missing/broken primitive is fixed upstream in
|
|
99
|
+
its own package and consumed by version bump.
|
|
100
|
+
- **Merge stays human, forever.** For repo jobs the PR is the escalation artifact; a
|
|
101
|
+
human is the close.
|
|
102
|
+
|
|
103
|
+
## Gotchas
|
|
104
|
+
|
|
105
|
+
*TBD from real adopter friction; recorded here as they're found (repo-side friction goes
|
|
106
|
+
to `docs/FINDINGS.md`).*
|
|
107
|
+
|
|
108
|
+
## Constraints
|
|
109
|
+
|
|
110
|
+
- **Node >= 20** (bareguard's floor governs the suite).
|
|
111
|
+
- **Pure ESM + JSDoc**; generated `.d.ts` ship, never hand-written (LIBRARY_CONVENTIONS §2).
|
|
112
|
+
- **Secrets load from the environment** and never enter the spine, configs, or ledger —
|
|
113
|
+
an append-only record that captures a key captures it forever.
|
|
114
|
+
- **The spine is append-only** and the single source of truth; every UI (panel included)
|
|
115
|
+
is a pure observer of it.
|
package/package.json
CHANGED
|
@@ -1,10 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bareloop",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Workflows that earn their own design, with receipts — agent-authored workflows for repeated, long, verifiable jobs that improve across runs under an un-gameable gate.",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./src/index.js",
|
|
7
|
+
"types": "./types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./types/index.d.ts",
|
|
11
|
+
"default": "./src/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"license": "Apache-2.0",
|
|
6
15
|
"author": "hamr0",
|
|
7
|
-
"
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=20"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "node --test",
|
|
21
|
+
"typecheck": "tsc --noEmit",
|
|
22
|
+
"build:types": "tsc",
|
|
23
|
+
"prepublishOnly": "npm run build:types"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"bare-agent": "^0.26.2",
|
|
27
|
+
"bareguard": "^0.12.0",
|
|
28
|
+
"litectx": "^0.28.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^22.0.0",
|
|
32
|
+
"typescript": "^5.5.0"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/hamr0/bareloop.git"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/hamr0/bareloop#readme",
|
|
39
|
+
"files": [
|
|
40
|
+
"src/",
|
|
41
|
+
"types/",
|
|
42
|
+
"bareloop.context.md",
|
|
43
|
+
"CHANGELOG.md"
|
|
44
|
+
],
|
|
8
45
|
"keywords": [
|
|
9
46
|
"agent",
|
|
10
47
|
"workflow",
|