brain_kernel 0.1.6
brain_kernel: ^0.1.6 copied to clipboard
Headless system kernel for knowledge-grounded multi-agent systems. Bundles project / canonical / patch / validate / build / MCP / chat / RAG over mcp_bundle and flowbrain_core. Products (builder / ind [...]
0.1.6 - 2026-07-02 - bk.philosophy provenance discipline + bk.agent.update #
Added #
bk.agent.updatestandard tool (48 tools). In-place mutation of a persistent agent —agentIdplus any ofdisplayName/role/model/systemPrompt/tags. Closes the CRUD asymmetry in thebk.agent.*surface (create/delete existed, update did not), so changing an agent's orchestration role or model through the kernel tool surface no longer requires delete→recreate — which destroys the individual's owned axis forks and history, contradicting the persistent-roster principle. An unknownrolevalue is rejected (not silently defaulted). Requiresflowbrain_core ^0.1.7(therole-accepting update seam) — floor bumped. Test:standard_tools_test.dart(in-place promote persists · untouched fields kept · unknown role rejected). 223 PASS.bk.philosophy.put/bk.philosophy.activateenforce a provenance lifecycle. An ethos payload may now carry an optionalprovenanceblock —payload['provenance'] = { 'kind': 'anchor'|'derived'|'workaround', 'serves': <principle id>, 'validWhile': <condition> }. Aderivedorworkaroundethos is a transient judgment, not an original principle: it must declare the principle itserves, and it is forced inactive onput— it becomes the active principle only through an explicitactivate(the confirm step), mirroring the fact candidate→confirm lifecycle. This keeps a derived judgment from silently being stored or activated as if it were a defining principle. Rides the existingEthosStorePortcontract (payload preserved as-is) — no core type change inmcp_bundle. Tests:philosophy_authoring_test.dart(anchor unconstrained · derived-without-serves rejected · derived forced inactive + provenance round-trip · workaround confirmed via activate). 222 PASS.
Backward compatibility #
- Fully additive.
kinddefaults toanchorwhen absent, so pre-existing ethos records and the stock seed (which carry noprovenance) are unconstrained and behave exactly as before. Floors unchanged.
0.1.5 - 2026-06-30 - KvStoragePortAdapter.keys(prefix:) string-prefix contract fix #
Fixed #
KvStoragePortAdapter.keys(prefix:)violated the string-prefix contract. It treatedprefixas a directory path (<rootDir>/<prefix>/), so flat colon-namespaced keys (e.g.philosophy.ethos:<id>, stored as a single<key>.jsonfile) were never listed:keys(prefix: 'philosophy.ethos:')returned[]even thoughget/setworked andkeys()(no prefix) listed them. This surfaced asbk.philosophy.listreturning an empty array whileput/getsucceeded. The method now walks the full store, reconstructs each key, and filters bykey.startsWith(prefix)— matching the in-memory referenceKvStoragePort. Hierarchical slash-namespaced prefixes (e.g.ws/A/) still match (keys use/separators) and partial-segment prefixes now match correctly too. Regression tests added (kv_storage_port_adapter_test.dart). 218 PASS.
0.1.4 - 2026-06-24 - BundleActivation tool-dispatch via injected callTool closure (additive) #
Added #
BundleActivationoptionalcallToolclosure — an alternative to a fullKernelServerHost bootfor wiring flow / behavior tool-action dispatch. A host whose endpoint is a registry (e.g. aBuiltinToolRegistrythat exposescallToolwithout ever surfacing a rawKernelServerHost) can now inject just the dispatch closure:BundleActivation(system: ..., bundleId: ..., callTool: server.callTool).registerBehavior/registerFlowroute tool steps throughcallTool ?? boot?.callTool. Mirrors the skill-executorcallToolbinding pattern already used across hosts. Tests:bundle_activation_behavior_test.dart(closure dispatch withboot == null· unwired-throws). 214 PASS.
Fixed #
- Registry-host topologies could not dispatch tool-action behavior / flow steps. When a host endpoint is a
BuiltinToolRegistry(not a rawKernelServerHost),bootis necessarily null and there was no other way to supply dispatch, so everykind: toolbehavior / flow step threwtool dispatch not wired (<ref>)at run time (the live-registered philosophy-gate path was latently affected too). ThecallToolseam closes that gap; the same diagnostic now fires only when neithercallToolnorbootis provided.
Backward compatibility #
- Fully additive. The
bootpath and thetool dispatch not wireddiagnostic are unchanged.BundleActivationcallers that don't passcallToolsee no behavior change.
0.1.3 - 2026-06-23 - FlowBrain orchestration tools (route/review) + destructive-action gate (spec 12 §5·§6) #
Added #
- §5 —
bk.agent.route+bk.agent.reviewstandard tools (agent_tools: 11 → 13) — expose the AgentFacade's manager-routing + reviewer-verdict as MCP tools so workflows / agents can drive rule-based agent→agent handoff (specplatform/12-flowbrain-runtime.md§5).route{managerId, request, candidateAgentIds?}→{targetAgentId, confidence, reason};review{reviewerId, targetAgentId, content}→{verdict, severity, comments}. standardTools map: 45 → 47. - §6 —
HostToolRegistrydestructive-action gate:registerExposed(destructive: true)+ optionalconfirmDestructivehost callback (ctor). Destructive tools (git push / mail / settlement / external publish) are gated through the callback before running — blocked when the human declines or no callback is wired (deny-by-default) (spec §6).destructivedefaults false → existing tools unaffected. The confirm UI is host-supplied (core has no UI). 209 PASS.
Fixed #
bk.philosophy.putaccepts a raw Ethos and never silently drops the body. PreviouslyputcalledEthosRecord.fromJson(input)directly, so an author / LLM passing a raw Ethos (nopayloadenvelope key) storedpayload: {}— the body was lost and every latergetEthos/intervene/checkProhibitionsoperated on an empty ethos (or crashed inEthos.fromJson).putnow detects the shape: an envelope (payloadpresent) is stored as before; a raw Ethos is wrapped into anEthosRecordwithpayload: <ethos>,id/name/versionderived from the ethos (version frommetadata.version). The body is validated viaEthos.fromJsonbefore storage, returning a clearinvalid ethos: <field-named message>(mcp_bundle 0.4.4) instead of storing garbage. Integration test:test/system/philosophy_authoring_test.dart(raw round-trip preserves body · envelope back-compat · malformed → clear error) over a realKvEthosStoreAdapter. 212 PASS.
Changed (dependency floor) #
flowbrain_core^0.1.4→^0.1.5— track the latest published cascade release (flowbrain_core 0.1.5 wires spec 12 §2·§3·§3b·§4·§4b). The kernel's §5 route/review tools wrap the existingAgentFacade.route/review(present since 0.1.x), so this is an internal-latest constraint bump, not a symbol requirement.mcp_bundle^0.4.1→^0.4.4— thebk.philosophy.putfix above relies on the Ethos graphfromJsonthrowing field-namedFormatExceptions (mcp_bundle 0.4.4) for the clear-error guarantee; floored to guarantee it.
Backward compatibility #
- Fully additive. No existing
HostToolRegistry,BundleActivation,standardTools, or host-abstract surface changed. Tools registered withoutdestructive: trueand hosts that don't passconfirmDestructivesee no behavior change.
0.1.2 - 2026-06-10 - Extension transport seam + clientTools export (additive) #
Added #
McpClientKernelHost.connectWith({id, transport})— new public method on the referenceKernelClientHostimplementation. Accepts a host-suppliedmcp_client.ClientTransport(e.g.TcpClientTransportorWebSocketClientTransportfrommcp_bridge) and opens aKernelClientConnectionover it. The kernel itself carries no FFI or platform dependency for the transport — the calling host owns those by design (specs/platform/08-extension.md§4 injection seam). The abstractKernelClientHostis unchanged.clientToolsfunction exported from the main barrel (lib/brain_kernel.dart). Returns thebk.mcp.*in-process tool map so hosts (e.g.appplayer_core) can register it alongsidestandardToolswithout reaching intosrc/.
Backward compatibility #
- Fully additive. No existing
KernelApp,BundleActivation,standardTools, or host-abstract surface changed. Hosts that do not use extension transports see no behavior change.
0.1.1 - 2026-06-01 - Behavior definition engine bridge + MCP serving (additive) #
Added #
bk.philosophy.checkstandard tool — wrapsPhilosophyFacade.checkProhibitions, evaluating a proposedaction/outputagainst active ethos and returning{hasHardViolation, violations}. The read-side ofbk.philosophy.*(the existing put/get/activate go to the ethos store); lets a behavior step gate onhasHardViolation.BundleActivation.registerBehavior(BehaviorDefinition)— maps a bundle'sbehavior.definitions[]entry to anOpsRuntime.behaviorRegistryfactory. Called automatically inside theactivateloop whenbundle.behavioris present; result carriesresult.behaviorscount andregisteredBehaviorslist.ownsBehavior(id)predicate and teardown unregistration included. The action dispatcher surfaces a step's tool/skill output into run state — a tool's JSON result (or a skill'sMapresult) is merged so a later step'swhenguard can read its keys (e.g. gate onhasHardViolationfrombk.philosophy.check).bk.behavior.run,bk.behavior.resume, andbk.behavior.liststandard tools registered inops_tools.dart, under thebk.behavior.*namespace alongsidebk.workflow.*/bk.pipeline.*/bk.runbook.*. Execution routes through the ops facade (app.system.ops.runBehavior/resumeBehavior/listBehaviors, added in mcp_knowledge 0.2.4) — the same layer the workflow/runbook tools use — so the kernel and tools layer hold no directmcp_knowledge_opsdependency for behavior execution.bk.behavior.resumeaccepts an optionalstatePatch(e.g.{"approved": true}) merged into the run state before re-evaluation, so an approval unblocks a waiting guard.BundleActivationoptionalbehaviorStorefield (StateStore?) — injected durable store for suspend/resume across restarts; defaults to per-behaviorEphemeralStateStorewhen absent.- MCP serving (
specs/mcp_serving1.0) —KernelEndpoint.activateexposes the activated bundle as the well-knownbundle://manifest.jsonresource (the bundle document: manifest metadata + sections) so a remote AppPlayer-class client canresources/readit, reconstruct theMcpBundle, and run it identically to a local bundle.KernelServerHostgains aresourceUrisintrospection getter (parity withtoolDefinitions/promptDefinitions), implemented byInProcessKernelServerHostandServerBootstrap. - New regression tests included in the system test suite.
Changed (dependency floors) #
The kernel uses symbols introduced in this round's lower releases, so the constraint floors are raised to guarantee them, not merely resolve to them (the prior ^0.2.1-style floors were satisfiable by versions lacking the symbols):
mcp_bundle^0.4.0→^0.4.1—BehaviorSection/BehaviorDefinition(bundle.behavior) consumed byBundleActivation.mcp_knowledge_ops^0.2.1→^0.2.2—BehaviorEngine/BehaviorRunnable/StateStore/OpsRuntime.behaviorRegistryconstructed byBundleActivation.flowbrain_core^0.1.2→^0.1.3— its re-exportedOpsFacademust carryrunBehavior/resumeBehavior/listBehaviors(flowbrain_core 0.1.3 raises its ownmcp_knowledgefloor to^0.2.4).
Backward compatibility #
- Fully additive. No existing
BundleActivation,KernelApp, or tool API changed. Hosts that do not setbundle.behaviorsee no behavior change.
0.1.0 - 2026-05-23 - Initial release #
First public release of brain_kernel. Headless system kernel that
wraps mcp_bundle and flowbrain_core with the project / canonical /
patch / validate / build / MCP / chat / RAG pieces every host needs, and
exposes the BundleActivation standard API that hosts (AppPlayer Core,
vibe_studio, future hosts) use to manage per-bundle catalog lifecycle.
Added #
- Core layer — project, canonical store, patch pipeline, asset validator, undo/redo stack, prefs / chat-log / history-log / undo-log sidecars.
- Feature layer — BM25 index, gold-question runner, asset extractor
- reviewer queue, asset-touch observer.
- Infra layer — bundle reader / knowledge writer / mcpb packager, embedding runner, BM25 query engine + bundle registry, domain storage, FlowBrain wiring (KvStoragePort adapter, runtime probe, LLM port adapter, FlowDefinitionWorkflow), MCP server bootstrap (tool scope + transport picker + server bootstrap), agent LLM sessions, agent chat controller + system-prompt composer.
- System layer —
BundleActivation+BundleActivationRegistry: the canonical asset-registration standard. Per-bundle catalog via<bundleId>.<asset.id>prefixing; idempotent registration; one registry handles N concurrent activations. - Re-exports —
flowbrain_core,mcp_bundle,mcp_server, and a selected slice ofmcp_clientare re-exported so products can stay on the kernel as the single MCP surface (FR-CMP-002).
Dependencies #
mcp_bundle: ^0.4.0flowbrain_core: ^0.1.2mcp_llm: ^2.1.1mcp_knowledge_ops: ^0.2.1mcp_server: ^2.0.0,mcp_client: ^2.0.0