superbee 0.2.1-pre.1 → 0.2.1

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
@@ -1,114 +1,110 @@
1
1
  # superbee
2
2
 
3
+ Shared, versioned, conflict-safe knowledge for AI coding agents, stored as plain markdown in
4
+ your repo.
5
+
6
+ Superbee is pre-1.0. Commands and formats may change between releases.
7
+
3
8
  ## What is Superbee?
4
9
 
5
- Superbee gives AI coding agents shared, versioned, conflict-safe memory as a folder of
6
- plain markdown in your repo.
7
-
8
- Agents forget everything between sessions, overwrite each other's work, and keep what they
9
- know invisible to the humans they work for. Superbee fixes all three:
10
-
11
- - **Memory that persists.** Agents write context notes, decisions, plans, and research into a
12
- knowledge bundle that survives the session. The next session or a different agent — picks
13
- up exactly where the last one left off. An optional `SessionStart` hook (Claude Code, Codex,
14
- OpenCode) orients every new session automatically.
15
- - **Safe for many writers.** Every document write is compare-and-swap versioned and attributed
16
- to an actor. Two agents racing on the same document get a clean, typed conflict instead of a
17
- silent lost update and `doc history` shows who changed what, when.
18
- - **Visible to humans.** Everything is plain markdown you can open in any editor, render on
19
- GitHub, and diff in git. `superbee ui` serves the bundle locally as rendered, cross-linked
20
- pages with derived backlinks, a live activity feed, and launchable bundle Views. `superbee
21
- sync` shares the bundle with teammates on a dedicated `board` branch pulling their changes
22
- and pushing yours without touching your code.
23
- - **Views on demand.** Ask your agent to create whatever representation you need and Superbee will
24
- create it: a self-contained HTML View, registered in the bundle as a typed document, that
25
- `superbee ui` launches in a sandboxed iframe. A reading surface for one dense document, a board, a
26
- timeline, a filtered queue, a chart, a dashboard the shape follows the question rather than a
27
- fixed set of built-in screens, and a view worth keeping stays. A data View reads live bundle
28
- content through a narrow read-only bridge and refreshes as documents change. Views are bundle
29
- content, so they travel with `sync` and open the same way for a teammate's agent.
30
- - **Agent-native by design.** The CLI follows the AXI principles for agent-facing tools:
31
- structured, token-lean output; result counts and truncation with explicit escape hatches;
32
- idempotent mutations; structured errors with a small, stable exit-code taxonomy. Agents get
33
- predictable responses they can act on without parsing prose or flooding their context window.
34
- - **Yours, and portable.** Bundles conform to the Open Knowledge Format — new bundles are
35
- written as OKF v0.2, and existing v0.1 bundles stay supported in place so they survive the
36
- tool: hand the folder to someone else, or read it with anything that speaks markdown.
37
- Everything works offline; the filesystem is the source of truth. Typed document schemas
38
- ("kinds") live in the bundle itself, so the bundle describes its own structure.
39
-
40
- The npm package ships one self-contained executable with zero runtime dependencies, plus an
41
- Agent Skill that teaches agents how to use it.
42
-
43
- ## How do I download Superbee on Windows?
44
-
45
- **Requirements: Node.js 20 or newer on macOS, Linux, or native Windows.** You do not need WSL,
46
- Ubuntu, or Docker. On Windows, Superbee keeps per-user operational state under
47
- `%LOCALAPPDATA%\Superbee`; npm installs the command as `superbee.cmd`.
48
-
49
- Superbee currently has two npm release channels:
50
-
51
- - `latest` is the stable channel selected by bare `superbee`, including native Windows support.
52
- - `next` is the prerelease channel for testing the current release candidate.
53
-
54
- Install the current prerelease on Windows:
55
-
56
- ```powershell
57
- npm install -g superbee@next
58
- superbee.cmd setup
10
+ Agents forget everything between sessions, overwrite each other's work, and keep what they know
11
+ invisible to the humans they work for. Superbee fixes all three with a **knowledge bundle**: a
12
+ folder of markdown documents, by convention `.superbee/` at your project root, that agents read
13
+ and write through a small command-line tool.
14
+
15
+ - **Context that persists.** Agents write context notes, decisions, plans, and research into the
16
+ bundle. The next session, or a different agent, picks up where the last one left off. An
17
+ optional `SessionStart` hook for Claude Code, Codex, and OpenCode orients every new session
18
+ automatically.
19
+ - **Safe for many writers.** Each write can carry the actor that made it. A writer can name the
20
+ version it last read; if anyone changed the document since, the write fails with a typed
21
+ conflict error instead of silently overwriting their work.
22
+ - **Visible to humans.** The bundle is plain markdown. Open it in any editor, render it on
23
+ GitHub, diff it in git. `superbee ui` serves it locally as cross-linked pages with backlinks and
24
+ a live activity feed. No bundle content leaves your machine until you run `superbee sync`, which
25
+ shares the bundle with teammates through the board: a copy of the bundle kept on its own git
26
+ branch, separate from your code.
27
+ - **Views on demand.** Ask your agent for a dashboard, a timeline, a filtered task queue, or a
28
+ reading view of one dense document. It builds a self-contained HTML page, stores it in the bundle
29
+ as a View, and `superbee ui` hosts it in a sandboxed frame. A View reads the bundle live and can
30
+ change it only through a write you confirm. Views are bundle content, so they travel with `sync`.
31
+ - **Built for agents.** Output is structured and token-lean, and errors carry a small, stable set
32
+ of exit codes. Agents act on responses without parsing prose or flooding their context window.
33
+ - **Yours, and portable.** Bundles follow the Open Knowledge Format (OKF), a convention of
34
+ markdown with frontmatter, so they outlive the tool: hand the folder to someone else, or read it
35
+ with anything that speaks markdown. New bundles are written as OKF v0.2, and existing v0.1
36
+ bundles keep working as they are. Reading and writing the bundle works offline; only sharing
37
+ needs a network. The document schemas, called kinds, live inside the bundle, so it describes
38
+ its own structure.
39
+
40
+ The npm package is one self-contained executable with zero runtime dependencies, plus an Agent
41
+ Skill, an instruction file your agent loads, that teaches it how to use the tool.
42
+
43
+ ## Install
44
+
45
+ Requires Node.js 20 or newer on macOS, Linux, or Windows. Native Windows is supported; you do not
46
+ need WSL or Docker.
47
+
48
+ ```sh
49
+ npm install -g superbee
59
50
  ```
60
51
 
61
- On macOS or Linux, the stable channel remains available with `npm install -g superbee`. To test the
62
- same prerelease as Windows, install `superbee@next` instead.
52
+ Stable releases publish on npm's `latest` tag and prereleases on `next`.
53
+
54
+ On Windows, Superbee keeps its private per-user state, such as the workspace catalog and remote
55
+ credentials, under `%LOCALAPPDATA%\Superbee`. npm installs `superbee.cmd` alongside the `superbee`
56
+ command; if PowerShell's execution policy blocks the `.ps1` wrapper, call `superbee.cmd` instead.
57
+
58
+ Run `superbee version --check` to compare your install with the current stable release.
63
59
 
64
- After installation, ask your AI agent to run `superbee setup` (`superbee.cmd setup` when invoking
65
- the Windows shim explicitly). Setup walks the agent through Agent Skill, SessionStart hook, and MCP
66
- registration. It is read-only: it inspects your configuration and returns one safe next command at
67
- a time, so the agent performs any actual changes with your approval.
60
+ ## First run: let your agent finish setup
68
61
 
69
- The managed Agent Skill works in Claude Code, Codex, and OpenCode. OpenCode discovers Superbee from
70
- its documented Claude-compatible Skill path. It shares Claude Code's Skill bytes by default; if
71
- Claude Code is explicitly relocated, the installer manages the two documented host paths separately.
62
+ `npm install` gives you the CLI. The integrations (the Agent Skill, the `SessionStart` hook, and
63
+ MCP server registration, where MCP is the Model Context Protocol) are installed by your agent,
64
+ not by hand. Ask it:
72
65
 
73
- Upgrading from the legacy `@holaxis/aslite` package or the retired marketplace plugin? Install
74
- `superbee` alongside it, have your agent run `superbee setup` to migrate the exact legacy
75
- integrations, then remove the old package with `npm uninstall -g @holaxis/aslite`. Existing
76
- `.agentstate-lite/` bundles and `.agentstate.json` bindings keep working with no migration.
66
+ > Run `superbee setup` and follow its instructions.
77
67
 
78
- ## How to use Superbee
68
+ Setup itself changes nothing. It inspects your configuration and returns one safe next command at
69
+ a time, and the agent runs each with your approval. Setup knows Claude Code, Codex, and OpenCode,
70
+ plus Claude Desktop for the MCP registration only.
79
71
 
80
- Superbee is agent-first: you don't type its commands yourself — you ask your agent for what
81
- you need, and the Agent Skill included with this package helps the agent translate your
82
- instructions into CLI commands. For example:
72
+ ## Everyday use
83
73
 
84
- - "Set up a Superbee workspace for this project and track our tasks in it."
74
+ You rarely type Superbee commands yourself. You ask your agent, and the Agent Skill translates the
75
+ request into CLI calls:
76
+
77
+ - "Set up a Superbee bundle for this project and track our tasks in it."
85
78
  - "Write up what we decided about the auth design as a doc, and link it to the task."
86
79
  - "What did the last session leave off on? Check the context notes."
87
80
  - "Sync the board so my teammate's agent sees this."
88
81
  - "Give me a view of the open tasks grouped by owner."
89
82
 
90
- Behind those requests, the agent drives a small, predictable CLI: `init` creates a bundle in a
91
- conventional `.superbee/` folder (discovered automatically, the way git finds `.git`); `new`,
92
- `doc write`, `doc update`, `doc field`, and `link add` create and connect typed documents; `list` and
93
- `doc read` query them; `sync` shares the board with teammates.
94
-
95
- Use `superbee doc field <action> <document-id> <field-name>` to change one field.
96
- `set` assigns a supported non-collection field; `add` and `remove` change tags or sources;
97
- `edit` changes a selected source; `replace-all` replaces the complete tags or sources list.
98
- `edit` and `replace-all` require `--expected-version` from a document read. Source selectors
99
- use an exact `--id` or a unique `--resource` for an ID-less source. Supply structured values
100
- through a JSON or YAML `--from-file`. Verification remains `doc verify`.
83
+ Behind those requests the agent uses a small set of commands: `init --dir .superbee` creates the
84
+ bundle, `new` creates a document of a declared kind, `doc write` writes a free-form one,
85
+ `doc update` changes a document, `link add` connects two, `list` and `doc read` query them, and
86
+ `sync` shares the board. `superbee --help` lists the commands, and `superbee <command> --help`
87
+ gives each one's full reference.
101
88
 
102
- When you want to see the knowledge yourself, ask the agent to open it — or run the two
103
- human-facing commands directly:
89
+ The two commands meant for you are the ones that show you the knowledge:
104
90
 
105
91
  ```sh
106
- superbee ui --open # the bundle, rendered: pages, links, backlinks, live Views
107
- superbee doc open <id> # one exact document in the same local browser reader
92
+ superbee ui --open # the whole bundle, rendered in your browser
93
+ superbee doc open <id> # one document, by an id from `superbee list`
108
94
  ```
109
95
 
110
- Run `superbee --help` (or any subcommand with `--help`) for the full command reference.
111
- Design and format docs live in the [repository](https://github.com/Holaxis-ai/superbee).
96
+ ## Upgrading from aslite
97
+
98
+ If you installed the earlier `@holaxis/aslite` package or its marketplace plugin: install
99
+ `superbee` alongside it, have your agent run `superbee setup` to migrate the integrations, then
100
+ run `npm uninstall -g @holaxis/aslite`. Existing `.agentstate-lite/` bundles and
101
+ `.agentstate.json` bindings keep working with no migration.
102
+
103
+ ## Learn more
104
+
105
+ The [repository](https://github.com/Holaxis-ai/superbee) holds the source, the
106
+ [CLI contract](https://github.com/Holaxis-ai/superbee/blob/main/packages/cli/AXI-CONTRACT.md),
107
+ and the [wire protocol](https://github.com/Holaxis-ai/superbee/blob/main/docs/WIRE-PROTOCOL.md).
112
108
 
113
109
  ## License
114
110
 
@@ -2869,7 +2869,7 @@ var require_js_yaml2 = __commonJS({
2869
2869
  });
2870
2870
 
2871
2871
  // ../publication/src/bridge.ts
2872
- import { createHash as createHash4 } from "node:crypto";
2872
+ import { createHash as createHash3 } from "node:crypto";
2873
2873
 
2874
2874
  // ../core/src/backend.ts
2875
2875
  import path3 from "node:path";
@@ -4129,8 +4129,161 @@ var nodeFilesystemIdentityPort = Object.freeze({
4129
4129
  }
4130
4130
  });
4131
4131
 
4132
- // ../core/src/versioning.ts
4133
- import { createHash as createHash3 } from "node:crypto";
4132
+ // ../core/src/sha256.ts
4133
+ var K = new Uint32Array([
4134
+ 1116352408,
4135
+ 1899447441,
4136
+ 3049323471,
4137
+ 3921009573,
4138
+ 961987163,
4139
+ 1508970993,
4140
+ 2453635748,
4141
+ 2870763221,
4142
+ 3624381080,
4143
+ 310598401,
4144
+ 607225278,
4145
+ 1426881987,
4146
+ 1925078388,
4147
+ 2162078206,
4148
+ 2614888103,
4149
+ 3248222580,
4150
+ 3835390401,
4151
+ 4022224774,
4152
+ 264347078,
4153
+ 604807628,
4154
+ 770255983,
4155
+ 1249150122,
4156
+ 1555081692,
4157
+ 1996064986,
4158
+ 2554220882,
4159
+ 2821834349,
4160
+ 2952996808,
4161
+ 3210313671,
4162
+ 3336571891,
4163
+ 3584528711,
4164
+ 113926993,
4165
+ 338241895,
4166
+ 666307205,
4167
+ 773529912,
4168
+ 1294757372,
4169
+ 1396182291,
4170
+ 1695183700,
4171
+ 1986661051,
4172
+ 2177026350,
4173
+ 2456956037,
4174
+ 2730485921,
4175
+ 2820302411,
4176
+ 3259730800,
4177
+ 3345764771,
4178
+ 3516065817,
4179
+ 3600352804,
4180
+ 4094571909,
4181
+ 275423344,
4182
+ 430227734,
4183
+ 506948616,
4184
+ 659060556,
4185
+ 883997877,
4186
+ 958139571,
4187
+ 1322822218,
4188
+ 1537002063,
4189
+ 1747873779,
4190
+ 1955562222,
4191
+ 2024104815,
4192
+ 2227730452,
4193
+ 2361852424,
4194
+ 2428436474,
4195
+ 2756734187,
4196
+ 3204031479,
4197
+ 3329325298
4198
+ ]);
4199
+ var INITIAL_STATE = new Uint32Array([
4200
+ 1779033703,
4201
+ 3144134277,
4202
+ 1013904242,
4203
+ 2773480762,
4204
+ 1359893119,
4205
+ 2600822924,
4206
+ 528734635,
4207
+ 1541459225
4208
+ ]);
4209
+ var encoder = new TextEncoder();
4210
+ function rotr(value, bits) {
4211
+ return value >>> bits | value << 32 - bits;
4212
+ }
4213
+ function compress(h, w, view, offset) {
4214
+ for (let i = 0; i < 16; i++) {
4215
+ w[i] = view.getUint32(offset + i * 4);
4216
+ }
4217
+ for (let i = 16; i < 64; i++) {
4218
+ const w15 = w[i - 15];
4219
+ const w2 = w[i - 2];
4220
+ const s0 = rotr(w15, 7) ^ rotr(w15, 18) ^ w15 >>> 3;
4221
+ const s1 = rotr(w2, 17) ^ rotr(w2, 19) ^ w2 >>> 10;
4222
+ w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
4223
+ }
4224
+ let a = h[0];
4225
+ let b = h[1];
4226
+ let c = h[2];
4227
+ let d = h[3];
4228
+ let e = h[4];
4229
+ let f = h[5];
4230
+ let g = h[6];
4231
+ let hh = h[7];
4232
+ for (let i = 0; i < 64; i++) {
4233
+ const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
4234
+ const ch = e & f ^ ~e & g;
4235
+ const t1 = hh + S1 + ch + K[i] + w[i] >>> 0;
4236
+ const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
4237
+ const maj = a & b ^ a & c ^ b & c;
4238
+ const t2 = S0 + maj >>> 0;
4239
+ hh = g;
4240
+ g = f;
4241
+ f = e;
4242
+ e = d + t1 >>> 0;
4243
+ d = c;
4244
+ c = b;
4245
+ b = a;
4246
+ a = t1 + t2 >>> 0;
4247
+ }
4248
+ h[0] = h[0] + a >>> 0;
4249
+ h[1] = h[1] + b >>> 0;
4250
+ h[2] = h[2] + c >>> 0;
4251
+ h[3] = h[3] + d >>> 0;
4252
+ h[4] = h[4] + e >>> 0;
4253
+ h[5] = h[5] + f >>> 0;
4254
+ h[6] = h[6] + g >>> 0;
4255
+ h[7] = h[7] + hh >>> 0;
4256
+ }
4257
+ function sha256HexOfBytes(bytes) {
4258
+ const h = new Uint32Array(INITIAL_STATE);
4259
+ const w = new Uint32Array(64);
4260
+ const length = bytes.byteLength;
4261
+ const view = new DataView(bytes.buffer, bytes.byteOffset, length);
4262
+ const fullBlocks = length >>> 6;
4263
+ for (let block = 0; block < fullBlocks; block++) {
4264
+ compress(h, w, view, block * 64);
4265
+ }
4266
+ const remaining = length - fullBlocks * 64;
4267
+ const tail = new Uint8Array(remaining + 1 + 8 > 64 ? 128 : 64);
4268
+ tail.set(bytes.subarray(fullBlocks * 64));
4269
+ tail[remaining] = 128;
4270
+ const tailView = new DataView(tail.buffer);
4271
+ const bitLengthHigh = Math.floor(length / 536870912);
4272
+ const bitLengthLow = length << 3 >>> 0;
4273
+ tailView.setUint32(tail.length - 8, bitLengthHigh);
4274
+ tailView.setUint32(tail.length - 4, bitLengthLow);
4275
+ for (let offset = 0; offset < tail.length; offset += 64) {
4276
+ compress(h, w, tailView, offset);
4277
+ }
4278
+ let hex = "";
4279
+ for (let i = 0; i < 8; i++) {
4280
+ hex += h[i].toString(16).padStart(8, "0");
4281
+ }
4282
+ return hex;
4283
+ }
4284
+ function sha256HexOfUtf8(input) {
4285
+ return sha256HexOfBytes(encoder.encode(input));
4286
+ }
4134
4287
 
4135
4288
  // ../core/src/version-transport.ts
4136
4289
  var VersionConflict = class extends Error {
@@ -4150,16 +4303,17 @@ var VersionConflict = class extends Error {
4150
4303
 
4151
4304
  // ../core/src/versioning.ts
4152
4305
  function sha256Hex(input) {
4153
- return createHash3("sha256").update(input, "utf8").digest("hex");
4306
+ return sha256HexOfUtf8(input);
4154
4307
  }
4155
4308
  function versionOfBytes(raw) {
4156
4309
  return `sha256:${sha256Hex(raw)}`;
4157
4310
  }
4158
4311
  function blobVersion(bytes) {
4159
- return `sha256:${createHash3("sha256").update(bytes).digest("hex")}`;
4312
+ return `sha256:${sha256HexOfBytes(bytes)}`;
4160
4313
  }
4161
4314
  function defaultActor() {
4162
- return process.env.USER?.trim() || process.env.USERNAME?.trim() || process.env.LOGNAME?.trim() || "local";
4315
+ const env = typeof process !== "undefined" ? process.env : void 0;
4316
+ return env?.USER?.trim() || env?.USERNAME?.trim() || env?.LOGNAME?.trim() || "local";
4163
4317
  }
4164
4318
 
4165
4319
  // ../core/src/backend.ts
@@ -4401,9 +4555,19 @@ var FilesystemBackend = class _FilesystemBackend {
4401
4555
  }
4402
4556
  };
4403
4557
 
4404
- // ../core/src/bundle.ts
4558
+ // ../core/src/bundle-ops.ts
4559
+ var defaultBackendFactory;
4560
+ function setDefaultBackendFactory(factory) {
4561
+ defaultBackendFactory = factory;
4562
+ }
4405
4563
  function backendFor(bundle) {
4406
- return bundle.backend ?? new FilesystemBackend(bundle.root);
4564
+ if (bundle.backend) return bundle.backend;
4565
+ if (defaultBackendFactory === void 0) {
4566
+ throw new InvalidInputError(
4567
+ `Bundle '${bundle.root}' has no backend and this runtime installs no default: pass bundle.backend explicitly or register one with setDefaultBackendFactory.`
4568
+ );
4569
+ }
4570
+ return defaultBackendFactory(bundle.root);
4407
4571
  }
4408
4572
  async function readBundleOkfVersion2(bundle) {
4409
4573
  return readBundleOkfVersion(backendFor(bundle));
@@ -4421,6 +4585,9 @@ async function queryEdges2(bundle, filter = {}) {
4421
4585
  return queryEdges(backendFor(bundle), filter);
4422
4586
  }
4423
4587
 
4588
+ // ../core/src/bundle.ts
4589
+ setDefaultBackendFactory((root) => new FilesystemBackend(root));
4590
+
4424
4591
  // ../core/src/kinds.ts
4425
4592
  var CONVENTIONS_PREFIX = "conventions/";
4426
4593
  var CONVENTION_TYPE = "Convention";
@@ -5652,7 +5819,7 @@ var PUBLICATION_BRIDGE_V0 = "v0";
5652
5819
  // ../publication/src/bridge.ts
5653
5820
  var STATIC_LAUNCH_ID = "publication-snapshot";
5654
5821
  function digest(bytes) {
5655
- return `sha256:${createHash4("sha256").update(bytes).digest("hex")}`;
5822
+ return `sha256:${createHash3("sha256").update(bytes).digest("hex")}`;
5656
5823
  }
5657
5824
  function createPublicationBridge(options) {
5658
5825
  if (options.protocol !== PUBLICATION_BRIDGE_V0) {