airust 0.6.8

Rust-native knowledge and memory engine for AI agents and local LLM applications: lexical search, optional semantic retrieval, versioned memory, source-bound evidence and MCP
Documentation

AIRust

The Memory Layer for Intelligent Systems.

AIRust is a modular Rust-native knowledge and memory engine for AI agents and local LLM applications. Its small core indexes application records in memory and finds them with lexical search (BM25 or TF-IDF), without a language model, a server or a cloud service. Optional Cargo features add versioned memory records with provenance, persistent record storage, application-supplied embeddings with hybrid ranking, source evidence bound to exact document revisions, and a read-only MCP server for agents.

AIRust stores, finds and returns evidence. It does not generate answers and it is not a complete AI platform: the application or its model writes the answer.

Term What it means here State
Knowledge engine Manage and search knowledge records. Implemented: the default lexical core, plus optional documents, retrieval, embeddings, hybrid ranking, reranking and MCP.
Memory engine Keep information durable and retrievable for an application. Implemented as optional features: versioned records, the memory lifecycle, record storage, snapshots and bounded JSON formats. The application decides when to persist, retain and refresh.
Intelligent memory Automatic relevance scoring, consolidation, conflict detection from text and controlled forgetting. Not implemented. Conflicts cover caller-declared claims only, and retention runs only when the application calls it.

Small by design. With the optional web feature, AIRust is a single server binary of about 13 MB with a built-in DOS-style terminal, using about 12 MB of memory when idle (macOS arm64, stripped release build, measured for 0.6.5). No Python, Node, Docker or external AI service is required.

Start in 15 minutes

The quickstart goes from an empty directory to a searched record, a returned source passage and an optional MCP connection. Its Rust examples are compiled and run by the test suite. The shortest start follows.

Search application records

Use Rust 1.89 or newer. Add the published library:

[dependencies]
airust = { version = "=0.6.8", default-features = false }
use airust::{Engine, KnowledgeEntry};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut index = Engine::new();
    index.upsert(KnowledgeEntry::new(
        "ownership",
        "Rust ownership protects memory.",
    ))?;
    index.upsert(KnowledgeEntry::new(
        "scripting",
        "Python helps with scripting.",
    ))?;

    let hits = index.search("Rust memory", 5);
    assert_eq!(hits[0].entry.id, "ownership");
    println!("{}", hits[0].entry.text);
    Ok(())
}

From a source checkout, run cargo run --locked --example core. Applications own IDs, storage, permissions and presentation. Search returns borrowed original entries, scores and matching terms. Equal scores use ascending IDs; a query without a match returns an empty list. BM25 is the default, with TF-IDF available explicitly. Scores are relevance values, not probabilities.

Return source passages

Use documents to bind passages to an exact text revision and UTF-8 range. Add retrieval for owned, bounded excerpts and JSON suitable for an application transport.

cargo run --locked --features documents --example documents
cargo run --locked --features retrieval --example checked_evidence

Keep the snapshot together with its passages. Resolve citations against that revision after retrieval. A verified quotation establishes a byte match with supplied text; the application still reviews whether it supports an answer. Read the task cookbook, document contract and citation checks.

Connect a local agent

Install the published read-only MCP executable:

cargo install airust --version 0.6.8 --locked --no-default-features --features mcp --bin airust-mcp
airust-mcp --knowledge /absolute/path/knowledge.json

Use --document /absolute/path/snapshot.json for checked document coordinates. Select one knowledge file or one or more document snapshots. The client can read every loaded document. The five tools search, read a passage, compare entries, suggest relations and report status over standard input/output. Returned source text is untrusted content. See client configuration, schemas and limits and the trust boundary.

Try the complete reference workflow

The source checkout includes an application example that imports Markdown, saves immutable snapshots, returns citations and serves the same collection over MCP:

export AIRUST_DEMO_DIR="$(mktemp -d /tmp/airust-reference.XXXXXX)"
cargo run --locked --features mcp --example reference_workspace -- build tests/fixtures/reference-v1/sources "$AIRUST_DEMO_DIR/workspace" manuals
cargo run --locked --features mcp --example reference_workspace -- query "$AIRUST_DEMO_DIR/workspace" "Welche Bytepositionen verwendet TextSpan?"
cargo run --locked --features mcp --example reference_workspace -- serve "$AIRUST_DEMO_DIR/workspace"

The serve command runs until its MCP client closes standard input. Use a new output directory for each import. The saved collection retains its original text if input files later change. Queries return at most six passages with checked source coordinates and a complete 64 KiB JSON bound. Nonempty results leave answerability unassessed. Workflow, accepted inputs and failure behavior.

Choose optional capabilities

Default Cargo features are empty. Enable only the capabilities used by the application.

Task Features Guide
Exact document revisions and positions documents Documents
Compact excerpts, explicit question preparation and citation checks retrieval Retrieval
Phrases and German word forms advanced-search Text search
Application-supplied embeddings and rank fusion embeddings, hybrid Semantic, hybrid
A bounded second ranking stage reranking Reranking
Local ONNX model adapters local-embeddings, local-reranking Local embeddings, local reranking
Original-record persistence or SQLite full-text search storage, sqlite-storage, disk-index Storage, disk index
Consistent concurrent search/vector/source readers snapshots Snapshots
Versioned records with expected-revision checks and bounded history versioning Versioning
Memory records with provenance, declared claims, conflict policies, reported retention and source freshness memory Memory lifecycle
Relationships, provenance, feedback or explicit rules Select the corresponding module Complete feature and support matrix

The provider-neutral library supports Rust 1.89. Local ONNX adapters require Rust 1.92 and explicitly supplied assets. Builds do not download model weights or ONNX Runtime binaries. Historical Agent, KnowledgeBase and dashboard interfaces remain compatibility paths; start new record-search integrations with Engine and Retriever.

Evaluate the chosen workload

The reference application declares its use case and acceptance thresholds. Its dataset contains 150 explicitly authored questions over frozen documentation, with development and evaluation source families separated. The reference report retains configuration costs and individual regressions. These reference results do not establish customer adoption or general retrieval superiority.

The historical 0.4.4 comparison found no general hybrid-quality or token-saving advantage over SQLite plus the same embeddings. It remains historical evidence. Larger synthetic capacity and prior performance campaigns retain their original scope in the benchmark guide and change history.

Recent releases

AIRust 0.6.8 normalizes non-ASCII text faster without changing a result, which shortens index construction for such text; the gain was measured on synthetic corpora. See the changelog and the validation record.

AIRust 0.6.7 made relate, fuzzy matching, exact semantic search and the vector search of the web interface faster without changing a result (validation record).

AIRust 0.6.6 re-evaluated a memory supersession marker when its superseding record is removed or stops conflicting, and initialized a new web database in one transaction, which shortens the first start on a slow disk (validation record).

AIRust 0.6.5 replaced the web dashboard with a DOS-style terminal and enforced the web Content Security Policy.

AIRust 0.6.4 added an optional memory lifecycle: per-record provenance, caller-declared claims with explicit conflict policies, reported retention and source freshness in search results. Read scope and criteria and release validation.

AIRust 0.6.3 added operational robustness for the process worker: an optional bounded ProcessPool, fault-injection soak validation (passed on a host without foreign load; two earlier loaded runs failed the latency-drift criterion and remain recorded), a Linux native CI job, and security fixes (admin mode requires a token, reduced worker environment, optional runtime identity, web size limits). Read scope and release validation.

AIRust 0.6.2 added an opt-in native-model process owner for predictable repeated MiniLM unload/reload, plus review fixes and resource-aware test control. Read scope, migration and release validation and open limits. AIRust 0.6.1 added bounded reranking batch/candidate settings, offline profile-check, shared training snapshots, bounded file/diagnostic costs and optional verified native file loading (scope, migration, configuration ownership).

The bounded local pilot and explicit live search profiles introduced in 0.6.0 remain compatible. Actual local answer attempts and retained measurements precede these changes; the final-source confirmation records costs and regressions. Native models still exceed 1 GiB here, and independently reviewed retrieval quality remains unestablished. Engineering validation is separate from those product-readiness gates.

The published 0.5.3 baseline provides the reference workflow, frozen evaluation and measured maintenance improvements used for comparison. Its release verification remains reproducible. The published 0.5.2 baseline remains reproducible.

The 0.6.2 process owner requires a matching trusted worker and a verified private file snapshot. It keeps unloaded-parent memory stable across repeated load/drop, but its warm-recovery latency tail is not established within 10 % of direct loading: that gate failed in 4 of 11 serial comparisons. See the before/after evidence and latency regressions.

Build and validate

./test.sh

This checks the default library, optional features, complete examples, real CLI/MCP boundaries, Clippy, documentation and package contents. Native-model evaluation is a separate explicit operation. Read contribution requirements, platform support, startup and tools, and the roadmap.

AIRust is MIT-licensed. The optional maintained PDF backend preserves its own upstream licenses and notices; its maintenance contract is described in PDF maintenance.