Repository navigation
Added
-
brain update— self-update via the official installer. A new command
queries the GitHub Releases API for the latest tag and, if it is newer than the
running binary, runs the documented one-line installer pinned to that version
(the installer owns arch detection + SHA-256 verification, so there is one
audited download path).--checkreports availability without installing,
--yesskips the confirmation prompt, and--tag <v>pins an exact release
for reinstall/downgrade. This is the only place Brain probes for updates —
brain --versionand daemon startup never touch the network (no passive
checks). Self-install is Unix-only; Windows is pointed atcargo install/ the
releases page. -
Startup benchmark. A
startupcriterion bench (cargo bench -p brainos --bench startup) pins the two dominant cold-start costs — config resolution
from defaults and a fresh database open + full migration walk — so a regression
surfaces as a number. -
Config file migration across versions. The user's
config.yamlcarries a
brain.versionstamp; a newer binary now forward-migrates an older file at
startup before loading it, so values stored under renamed or moved keys
survive instead of being silently dropped (figment would otherwise ignore the
old key and back-fill the new one from defaults). An ordered transform registry
(config::migrate, keyed by the version that introduced each change) applies
any migrations in(file, binary], the prior file is snapshotted to
config.yaml.bak-v<old>, and the file is rewritten with the new stamp.
Unrecognized keys (typos, or fields removed in a newer version) are warned
about and left in place — never deleted. Version comparison is numeric
(0.9 < 0.10). An older binary reading a newer config is untouched (figment is
already tolerant). Explicit--config <path>files are not auto-migrated. -
Schema version reconciliation + pre-migration backups (data-loss
prevention). Opening the database now reconciles the on-disk schema version
against the version this build supports before any migration runs. A
database written by a newer build is refused outright (SchemaTooNew)
instead of being operated on by an older binary against a future schema — the
forward-only corruption path; a recovery/export caller can opt in via the
downgrade override. When a forward migration is pending against an existing
database, a consistentdb/brain.db.bak-v<old>snapshot (viaVACUUM INTO,
capturing committed + WAL state) is written first.brain doctor --deepnow
reports the on-disk schema version alongside the build's supported version so
skew is explicit. Fresh databases are unaffected (nothing to back up). -
Runtime resource gauges + pressure events. A single bounded background
task now samples process RSS, CPU, open SQLite connections, and~/.brain
disk usage everyobservability.resource_sample_secs(30s default), writing
into a lock-freeResourceMetricsstore. Crossing a configured ceiling
(observability.thresholds.{rss_mb,cpu_pct,disk_mb}) emits an edge-triggered
ResourcePressureevent onto the bus — once per crossing, the same discipline
asBudgetCrossed— visible inbrain tail. The gauges are also surfaced
one-shot inbrain doctor --deepandbrain status(Vitals). Ceilings are
generous and fail-safe; set any threshold to0to disable it. Unsupported
platforms degrade individual gauges to "unavailable" rather than failing. -
Per-principal capability scoping (modifier constraints). An identity
principal can now constrain individual action modifiers, not just the
filesystem path. A newconstraints:list under each principal scopes any
(verb, modifier)pair — e.g. allownet.httponly to*.github.com,
shell.execonly to commands starting withgit, ormcp.mountonly to a
named server — withexact,prefix, orhost_suffixmatching. Checks are
fail-closed: a constrained verb that arrives without its modifier, or with a
value outside the allow-list, is denied at signal-entry (not at execution).
Constraints are opt-in; a principal without them behaves exactly as before.
This generalises the existingpath_allowlist(kept as the built-in path
case) and is the enforcement substrate for future capability-scoped skill
packs. -
Model context-window auto-detection. On startup Brain probes the active
LLM provider for its real context window and scales the prompt budgets to
match, instead of clipping everything to the conservative default. Detection
uses the provider API where available (OpenRouter advertisescontext_length
per model; Ollama exposes it via/api/show) and falls back to model-name
heuristics for providers that don't (OpenAI, Groq, DeepSeek, and others). A
detected window only widens the budget — a value you set in
llm.context_windowis never lowered, and a configured value larger than the
detected capacity is kept with a warning. The extra room flows into richer
grounding: path-attachment snapshots, directory listings, and the number of
recalled memories all scale with the available budget, so a 128k- or
1M-window model reads far more file content and surfaces more relevant
context than the 8k default. -
Learned capability fitness. Brain now learns which tools actually work,
not just which exist. After every tool dispatch it records a per-tool
success/failure outcome (learning.capability_fitness, on by default), and
those observations decay under the forgetting curve (half_life_days,
default 30). The learned record nudges tool selection — a proven tool wins
a tie among equally-relevant candidates when the chat model is offered
tools, but never overtakes a stronger keyword match — and the reasoner's
capability digest gains a "Proven here" line listing tools with a track
record. Awareness/preference only: execution stays consent-gated. Backed by
a newcapability_fitnesstable (procedural memory). Set
learning.capability_fitness.enabled: falseto opt out (ranking and digest
then behave exactly as before). -
Release automation. Tagging a
vX.Y.Zrelease now builds pre-built
binaries —brain-<target>.tar.gzfor macOS (aarch64/x86_64) and
Linux (aarch64/x86_64), each with a.sha256— and publishes a
GitHub Release with an SPDX SBOM and the changelog section as notes
(.github/workflows/release.yml). This is whatscripts/install.sh
downloads, so the one-line installer now resolves to a real binary on
every supported platform. Maintainers drive releases with
scripts/release.sh X.Y.Z, which validates the tree/version/changelog,
runs the full CI-parity gate,cargo publishes every crate in dependency
order, then tags and pushes;scripts/changelog-extract.shprints a
single version's notes. -
Structured logging policy. New
[logging]config section: base
level, per-subsystemtargetsoverrides,format(pretty|json),
and daemon log-filerotation(daily|hourly|never). Long-running
services (serve,mcp) now log through a rotating file appender at
~/.brain/logs/brain.loginstead of an unbounded shell-redirected file;
one-shot commands keep stderr.RUST_LOGstill overrides the computed
filter. -
brain doctor --deep. Store-level health probes beyond the
environment check: SQLite open + schema version, audit-logprev_hash
linkage continuity, episode/fact/graph-node counts, RuVector store
(per-collection counts + dimension), and an embedder round-trip
asserting the output dimension matches config. The vector-store probe is
skipped when a daemon holds the lock. -
MCP resources & prompts. The MCP server now implements
resources/list+resources/read(brain://profile,
brain://capabilities,brain://namespaces) andprompts/list+
prompts/get(recall-context,daily-review) instead of stubbing them
to empty arrays. -
Graph memory now influences recall. The episodic graph was
write-only with respect to retrieval; it now contributes two candidate
lists to hybrid recall. A full-text index over node bodies (nodes_fts,
migration v23 with sync triggers) backsEpisodicGraph::search_text
(BM25), and the terminal graph sink embeds node bodies at write time
into a newgraph_vecvector collection, setting each node's
vector_idfor ANN.DualMemoryReader::recall_candidatesproduces both
lists;RecallEngine::recallfolds them into RRF fusion alongside
episodic + semantic results and emits a newMemorySource::Graph.
Terminal/tool activity is now recallable by text and by semantic
similarity. Embedding on the write path is best-effort — a failure
leaves the node un-vectored rather than dropping it. -
Pre-commit gate.
scripts/install-hooks.shinstalls a repo-managed
pre-commit hook that runscargo fmt --check,cargo clippy --all-targets -D warnings, and the crate-naming check. Opt-in;
bypassable withgit commit --no-verify. -
CONTRIBUTING.md, PR template, and bug/feature issue templates.
Codifies the commit-message style, MSRV expectations, conventions, and
required local CI parity steps. -
MSRV policy. Workspace declares
rust-version = "1.91"(current
stable is 1.93; this matches the stated N-2 floor). The hard floor is
1.89 — ruvector-core usesstdarch_x86_avx512, stabilized in 1.89.
NewmsrvCI job pins to the declared toolchain and runscargo check --workspace --lockedon every push/PR. -
CHANGELOG validation.
scripts/check-changelog.sh+changelog
CI job verifies the workspace version has a matching section and
fails the build when source/manifest changes lack a CHANGELOG entry. -
cargo-denylicense + advisory enforcement.deny.tomlallow-lists
permissive licenses, blocks unknown registries/git sources, and the
denyCI job runscargo deny check allon every PR. -
Third-party attribution scaffolding.
about.toml+about.hbs+
scripts/generate-attribution.shproduceTHIRD_PARTY_LICENSES.md
viacargo-about. License set mirrorsdeny.toml. -
Cross-platform CI matrix.
checkandtestnow run on Ubuntu and
macOS. Windows is omitted: both the grpc and terminal adapters depend
onprotobuf-src(build dep), which compiles Abseil + protoc from C++
source and fails to link against MSVC's ucrt (__imp_nan,
__imp_modf, …). Since terminal is a non-optional dep of the cli and
most pillar crates pull it transitively, there's no useful subset of
the workspace that compiles on Windows without first gating protobuf
build deps oncfg(not(windows)). Tracked as v0.6.0 work. -
Migration regression tests.
test_migrations_record_all_expected_versions
asserts every declared migration appears in the_migrationstable
aftermigrate();test_schema_snapshot_matchescompares
post-migrationsqlite_masteragainst a committed snapshot to catch
silent schema drift in existing migrations. -
Module-boundary enforcement.
scripts/check-boundaries.shplus
boundariesCI job verify no workspace crate depends on thebrainos
CLI binary and transport adapters don't depend on each other. -
Multi-stage Dockerfile +
.dockerignore. Distrolessnonroot
runtime image; default feature set enabled; documented buildx
command for multi-arch (linux/amd64 + linux/arm64) images. -
scripts/install.sh— Linux/macOS one-line installer. Probes the
GitHub Releases binary for the host triple; falls back to
cargo install brainosorcargo install --gitfrom source. -
Live capability digest in the SOUL prompt. The chat reasoner's
"Your Capabilities" section is now rendered from the live wired
capability set — the tool registry (MCP servers, native backends,
terminal) and the delegate agent registry — instead of a hardcoded
three-line string. Mount a new MCP server and the next chat turn's
self-description reflects it. Read-only awareness only: execution stays
gated by the consent/audit/breaker path, and untrusted MCP tool
descriptions are not inlined. Newcortex::context::DEFAULT_CAPABILITIES
constant +capabilitiesparameter on
ContextAssembler::assemble_full;
signal::pipeline::conversation::capability_digest. -
Unified capability manifest. The kernel's native
capabilities (action-dispatcher backends — memory, web, scheduling,
messaging — plus the terminal bridge) now register into the same
intent::ToolRegistrythe MCP host populates, so one manifest describes
every tool the kernel can dispatch to — not just mounted MCP servers.
intent::ToolDescriptorgains ausage: ToolUsagefield carrying
reasoner-facing guidance (when_to_use/when_not_to/preconditions
/cost/example/tier); native descriptors are stamped with the
canonical verb summary + tier fromintent::verbs. New
brain capabilitiessubcommand andIntent::ListCapabilities
(/capabilitiesin chat) render the live manifest grouped by source and
tagged with tier; a new read-onlybrain_capabilitiesMCP tool exposes
the same manifest to external clients. Awareness only — execution stays
gated. Untrusted MCP descriptions are sanitized before display. -
Planner sees the live capability roster. Task decomposition now
composes against what the kernel can actually do:DecompositionContext
gainsavailable_agents(the realdelegate::AgentRegistryroster) and
available_capabilities(live manifest summary lines — mounted MCP
servers with their verbs, native backends, the terminal), both surfaced
in the decompose and replan prompts. Animplementstep that names an
agent which isn't registered is now rejected at plan time with the
list of available agents, instead of failing once execution reaches the
step. The sandbox binary allowlist (available_tools) is unchanged and
still gatesexecute/testargv steps. New
signal::pipeline::conversation::planner_capabilities. -
Tool-use loop in chat. A chat turn can now use the kernel's tools, not
just describe them.cortex::LlmProvidergains a tools channel
(generate_with_toolswithToolDef/ProposedToolCall; defaults to
plain text so providers without one degrade gracefully) implemented for
OpenAI and Ollama. The pipeline advertises a relevance-ranked slice of the
unified capability manifest to the model, and when the model proposes a
call it is mapped to anintent::IntentToken, passed through the same
tier-based confirmation gate every other capability invocation uses,
executed on approval, and its result fed back so the model can ground its
answer — looping over a bounded number of rounds within one turn.
cortex::MessagegainsRole::Tooland tool-call linkage; untrusted MCP
descriptions are sanitized before reaching a provider. Awareness stays
distinct from permission — advertising a tool only lets the model propose
it. Newsignal::pipeline::toolloop.
Changed
- Routine dependency bumps.
clap4.5 → 4.6,tempfile3.25 → 3.27,
tracing-subscriber0.3.22 → 0.3.23,ruvector-core2.0.5 → 2.2.0, and the
criteriondev-dependency 0.5 → 0.8 (benchmarks recompile cleanly under the
new API). All verified against the Rust 1.91 MSRV. Batches Dependabot #9–#13. - Scheduled intents fire through the pipeline. The direct-execution
scheduled-intent poller inserve(a fixed 60s ticker that delivered a
bare[scheduled] …notification and bypassed identity, confirmation,
and per-tool breakers) has been retired. Firing now flows exclusively
throughreflex::CronReflex: each due intent becomes a
Provenance::Reflexsignal and runs the full pipeline (classification,
confirmation gate, breakers, audit).actions.schedulingremains the
write axis (create/persist intents);reflex.cron.enabledis now the
sole fire axis.brain doctorandservestartup warn when
scheduling is enabled while the cron reflex is disabled, since intents
would then persist but never fire. scripts/check-crate-names.sh— header comment and error footer
no longer reference gitignored docs paths. Rule is inlined; rationale
moved toCONTRIBUTING.md.- Dockerfile —
RUST_VERSIONnow tracks the workspace MSRV (was pinned
at 1.85, below the declared 1.91, so the image no longer built). Corrected
the inaccurate "musl" header comment (the build is glibc/distroless). A
newdockerCI job builds the linux/amd64 image on every PR so it can't
rot again (no registry push).
Removed
.cargo/config.toml— deleted. The hardcodedPROTOC = "/opt/homebrew/bin/protoc"was stale: the grpc adapter'sbuild.rs
already vendors protoc viaprotobuf-src, and the hardcoded path
broke Linux builds.
Fixed
- Budget: an unset (
0) provider ceiling no longer blocks every request.
A provider with no configured token cap stores its ceiling as0, which the
status view already treats as "no limit" — but the spend check read0as
"block everything", so any check against such a provider was denied as
exceeded (even a zero-cost one). A0ceiling now means unbounded,
consistent with the rest of the budget surface; an explicit cap of1+ is
still enforced exactly as before.
Security
-
Tool outputs are fenced as untrusted before re-entering model context.
Results fed back to the model by the chat tool-use loop (MCP response
bodies, fetched pages, file contents, shell stdout) now get the same
labeled-fence treatment as MCP tool descriptions — control/ANSI
stripping, fence defanging, an explicit truncation marker, and a header
marking the block as data, not instructions — closing a prompt-injection
path where a hostile tool result could steer the surrounding
conversation. Property tests pin the fence as inescapable for arbitrary
adversarial bytes. -
Patched dependencies flagged by RUSTSEC advisories (clears the
cargo-denyadvisory gate and the corresponding Dependabot alerts):
rkyv0.8.15 → 0.8.16 (panic-safety bug inInlineVec/SerVec::clear
that could enable arbitrary code execution; transitive via
ruvector-core),rpassword7.4.0 → 7.5.4 (partial password reveal on
interrupted input),rand0.8.5 → 0.8.6 and 0.9.2 → 0.9.4
(custom-logger unsoundness), andlru0.12 → 0.16 (IterMut
Stacked-Borrows violation). The now-resolved advisory ignores were
dropped fromdeny.toml.