Skip to content

Brain OS v0.5.0

Latest

Choose a tag to compare

@github-actions github-actions released this 10 Jun 17:46
· 83 commits to main since this release

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). --check reports availability without installing,
    --yes skips the confirmation prompt, and --tag <v> pins an exact release
    for reinstall/downgrade. This is the only place Brain probes for updates —
    brain --version and daemon startup never touch the network (no passive
    checks). Self-install is Unix-only; Windows is pointed at cargo install / the
    releases page.

  • Startup benchmark. A startup criterion 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.yaml carries a
    brain.version stamp; 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 consistent db/brain.db.bak-v<old> snapshot (via VACUUM INTO,
    capturing committed + WAL state) is written first. brain doctor --deep now
    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 every observability.resource_sample_secs (30s default), writing
    into a lock-free ResourceMetrics store. Crossing a configured ceiling
    (observability.thresholds.{rss_mb,cpu_pct,disk_mb}) emits an edge-triggered
    ResourcePressure event onto the bus — once per crossing, the same discipline
    as BudgetCrossed — visible in brain tail. The gauges are also surfaced
    one-shot in brain doctor --deep and brain status (Vitals). Ceilings are
    generous and fail-safe; set any threshold to 0 to 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 new constraints: list under each principal scopes any
    (verb, modifier) pair — e.g. allow net.http only to *.github.com,
    shell.exec only to commands starting with git , or mcp.mount only to a
    named server — with exact, prefix, or host_suffix matching. 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 existing path_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 advertises context_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_window is 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 new capability_fitness table (procedural memory). Set
    learning.capability_fitness.enabled: false to opt out (ranking and digest
    then behave exactly as before).

  • Release automation. Tagging a vX.Y.Z release now builds pre-built
    binaries — brain-<target>.tar.gz for 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 what scripts/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.sh prints a
    single version's notes.

  • Structured logging policy. New [logging] config section: base
    level, per-subsystem targets overrides, format (pretty|json),
    and daemon log-file rotation (daily|hourly|never). Long-running
    services (serve, mcp) now log through a rotating file appender at
    ~/.brain/logs/brain.log instead of an unbounded shell-redirected file;
    one-shot commands keep stderr. RUST_LOG still overrides the computed
    filter.

  • brain doctor --deep. Store-level health probes beyond the
    environment check: SQLite open + schema version, audit-log prev_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) and prompts/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) backs EpisodicGraph::search_text
    (BM25), and the terminal graph sink embeds node bodies at write time
    into a new graph_vec vector collection, setting each node's
    vector_id for ANN. DualMemoryReader::recall_candidates produces both
    lists; RecallEngine::recall folds them into RRF fusion alongside
    episodic + semantic results and emits a new MemorySource::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.sh installs a repo-managed
    pre-commit hook that runs cargo fmt --check, cargo clippy --all-targets -D warnings, and the crate-naming check. Opt-in;
    bypassable with git 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 uses stdarch_x86_avx512, stabilized in 1.89.
    New msrv CI job pins to the declared toolchain and runs cargo check --workspace --locked on 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-deny license + advisory enforcement. deny.toml allow-lists
    permissive licenses, blocks unknown registries/git sources, and the
    deny CI job runs cargo deny check all on every PR.

  • Third-party attribution scaffolding. about.toml + about.hbs +
    scripts/generate-attribution.sh produce THIRD_PARTY_LICENSES.md
    via cargo-about. License set mirrors deny.toml.

  • Cross-platform CI matrix. check and test now run on Ubuntu and
    macOS. Windows is omitted: both the grpc and terminal adapters depend
    on protobuf-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 on cfg(not(windows)). Tracked as v0.6.0 work.

  • Migration regression tests. test_migrations_record_all_expected_versions
    asserts every declared migration appears in the _migrations table
    after migrate(); test_schema_snapshot_matches compares
    post-migration sqlite_master against a committed snapshot to catch
    silent schema drift in existing migrations.

  • Module-boundary enforcement. scripts/check-boundaries.sh plus
    boundaries CI job verify no workspace crate depends on the brainos
    CLI binary and transport adapters don't depend on each other.

  • Multi-stage Dockerfile + .dockerignore. Distroless nonroot
    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 brainos or cargo install --git from 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. New cortex::context::DEFAULT_CAPABILITIES
    constant + capabilities parameter 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::ToolRegistry the MCP host populates, so one manifest describes
    every tool the kernel can dispatch to — not just mounted MCP servers.
    intent::ToolDescriptor gains a usage: ToolUsage field carrying
    reasoner-facing guidance (when_to_use / when_not_to / preconditions
    / cost / example / tier); native descriptors are stamped with the
    canonical verb summary + tier from intent::verbs. New
    brain capabilities subcommand and Intent::ListCapabilities
    (/capabilities in chat) render the live manifest grouped by source and
    tagged with tier; a new read-only brain_capabilities MCP 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
    gains available_agents (the real delegate::AgentRegistry roster) 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. An implement step 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 gates execute/test argv 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::LlmProvider gains a tools channel
    (generate_with_tools with ToolDef / 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 an intent::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::Message gains Role::Tool and 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. New signal::pipeline::toolloop.

Changed

  • Routine dependency bumps. clap 4.5 → 4.6, tempfile 3.25 → 3.27,
    tracing-subscriber 0.3.22 → 0.3.23, ruvector-core 2.0.5 → 2.2.0, and the
    criterion dev-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 in serve (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
    through reflex::CronReflex: each due intent becomes a
    Provenance::Reflex signal and runs the full pipeline (classification,
    confirmation gate, breakers, audit). actions.scheduling remains the
    write axis (create/persist intents); reflex.cron.enabled is now the
    sole fire axis. brain doctor and serve startup 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 to CONTRIBUTING.md.
  • Dockerfile — RUST_VERSION now 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
    new docker CI job builds the linux/amd64 image on every PR so it can't
    rot again (no registry push).

Removed

  • .cargo/config.toml — deleted. The hardcoded PROTOC = "/opt/homebrew/bin/protoc" was stale: the grpc adapter's build.rs
    already vendors protoc via protobuf-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 as 0, which the
    status view already treats as "no limit" — but the spend check read 0 as
    "block everything", so any check against such a provider was denied as
    exceeded (even a zero-cost one). A 0 ceiling now means unbounded,
    consistent with the rest of the budget surface; an explicit cap of 1+ 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-deny advisory gate and the corresponding Dependabot alerts):
    rkyv 0.8.15 → 0.8.16 (panic-safety bug in InlineVec/SerVec::clear
    that could enable arbitrary code execution; transitive via
    ruvector-core), rpassword 7.4.0 → 7.5.4 (partial password reveal on
    interrupted input), rand 0.8.5 → 0.8.6 and 0.9.2 → 0.9.4
    (custom-logger unsoundness), and lru 0.12 → 0.16 (IterMut
    Stacked-Borrows violation). The now-resolved advisory ignores were
    dropped from deny.toml.