Bee Box

Bee Box is a personal assistant and operating system: agents process inputs, take actions, or ask questions. The filesystem is state, Git is history, and bbx is the command-line interface.

Design serves the values in spirit.md: if the architecture contradicts it, the architecture is wrong. docs/design/ explains why the system has its current shape.

bbx is the box agent's surface, not yours. Its verbs are what an agent running inside a box does there — read and write that box's cards, answer a question, run a procedure. Operators and the deploy scripts get bbx engine, a small permanent set that starts servers and manages the machine. End users get neither; they live in the web UI and chat. An agent developing Bee Box in this repository gets none of it: bbx health, bbx status, and bbx doctor are not developer diagnostics, and running them against a real box is touching someone's data to answer a question about your own code. Use the tests, the dev router, and the box's own files instead. src/cli/entry/surface-data.ts classifies every verb and says why.

Work only on the requested problem. Do not expand scope into adjacent cleanup, policy, schemas, UI, or workflows without the boxholder's approval. Read the relevant code, schema, and tests before changing a format or contract.

Never copy private box content or personal operational details into tracked source, docs, tests, or public issues. Follow the monorepo root's private-issues/ boundary, and ask when publication safety is uncertain.

Development

The monorepo root instructions own worktrees, the shared dev router, browser evidence, issues, privacy, landing, and deployment effects. Within this package:

When committing, use plain git commit so hooks run, fix relevant failures, and leave no half-finished task changes. Never use --no-verify.

Production runs bundled dist/cli.mjs, not tsx. Resolve package assets through PACKAGE_ROOT in src/lib/package-root.ts. Deployment topology and rollback are in deploying.

Cards

Cards use YAML frontmatter plus a Markdown body and are named Name.<type>.card; the filename determines the schema. Attachments use the sibling Name.attach/ scope. Schemas live in src/schemas/, and boxes may add schemas through the public beebox/cards API. For format or attachment work, read the card format; for schema changes, the schema workflow; for changes to existing on-disk data, the migration runbook. The implemented RFC is design history, not the live manual.

Cards validate on load. When mutating existing card text, parse, change, and reserialize it; serialization follows schema field order and need not preserve the original frontmatter order. bbx validate and the hooks installed by bbx init provide broader validation; see card validation. Do not infer a card shape from an example when its schema is available.

Box Git trailers such as Created-By are structured metadata. Box commits use plain git commit so the installed pre-commit hook can run staged validation, link warnings, and the unlisted-binary guard.

Source Layout

Open the owner for the area being changed:

Boxes live outside this repository. A box is one package and operational root with shapeVersion: 3; box code imports only public beebox/{cards,schema,view-widgets} specifiers and, for an activated plugin, beebox/plugins/<name>, never engine internals. Read the box layout before changing its on-disk shape, and box work before running anything against a box: the test box, a throwaway box, or production.

Key Concepts

bbx wakeup preprocesses intake, runs housekeeping and wakeup scripts, syncs connectors, runs the reactor over pending jobs, finalizes outbound work, and pushes the box. Recurrence belongs to bbx tick; see the scheduler. Services wrap external dependencies behind typed real and fake implementations. Connectors implement filesystem synchronization. Procedures are YAML-frontmatter workflows under a box's configuration; see the procedure guide.

Behavioral Notes

Improving These Instructions

When a correction exposes missing durable guidance, put a short rule at the narrowest accurate owner: this file for package-wide constraints, a nested AGENTS.md for an area, code-style.md or frontend.md for coding contracts, and docs/ for conditional reference material. New infrastructure must have a discoverable current owner. Do not use historical plans as live manuals.

Guides

Use the topic index to find a guide, and docs/README.md for documentation organization and naming. Common entry points are engineering principles, testing, cards, API endpoints, box layout, mobile contract, secrets, the production server, and deployment. Proposed work lives under docs/plans/; implemented plans and RFCs record history unless a current guide explicitly says otherwise.

@code-style.md