@mba-ai/core
v0.1.11
Published
Model Behavioral Adapter (MBA) framework — per-model behavior resolution, BCB/TCB tool-circuit-breaker engine, and the global MBA config service
Maintainers
Readme
@mba-ai/core
The Model Behavioral Adapter (MBA) framework. It gives local LLMs per-model behavioral profiles — each model gets its own adapter (context budget, tool-circuit-breaker rules, server setup) resolved from a lineage tree of YAML files — and a real-time engine that enforces those behavioral rules on the model's tool calls.
What it does
- Adapter resolution (B1–B4). Adapters are YAML files in a lineage
folder tree (e.g.
vendor/family/model.yaml). The resolver scores and merges them least-specific-first into a single resolved config per model. - TCB (Tool Circuit Breaker). A real-time watchdog over the model's tool calls. Rules are notice-only detectors with an escalation ladder (nudge → mask → kill). Rule classes bundle detectors; state persists in SQLite.
- The global service. Owns the resolved config and rule state on one
machine. It binds
127.0.0.1on an OS-assigned port and writes a discovery file (<state dir>/mba/service.json) so consumers can find it.
The companion package @mba-ai/mcp-server is a thin MCP
client over this service — it has zero dependency on the framework.
Installation
npm install @mba-ai/coreRunning the global service
npx @mba-ai/core
# or, from a checkout:
npm run start:serviceThe service binds 127.0.0.1:<port> and writes a discovery file
(<state dir>/mba/service.json).
Upgrading from a pre-0.1.1 install? Run mba migrate-paths once — it moves
the legacy ~/.mba state and ~/models/adapters store to the OS-aware
locations (local-only, works with the service stopped, never overwrites).
Environment variables
|Variable|Description|Default|
|---|---|---|
|MBA_BASE_DIR|State dir (service discovery + SQLite state)|OS-aware (see src/service/paths.ts)|
|MBA_ADAPTER_DIR|Directory containing the adapter lineage tree|OS-aware model store (see src/service/paths.ts)|
|MBA_UPSTREAM_URL|Upstream model endpoint the service fronts|—|
Development
npm install
npm run typecheck # tsc --noEmit
npm test # vitest run
npm run build # emit dist/Requires Node ≥ 20.
Related
See ADR-0084 (specification), ADR-0090 (lineage tree), and ADR-0092 (standalone framework) for the design.
