AIRust
by LEVOGNE
README.md
<p align="center"><img src="https://raw.githubusercontent.com/LEVOGNE/airust/v0.6.11/assets/airust-logo-512.png" alt="AIRust logo" width="180"></p>
# 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](docs/MEMORY.md), 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). On Linux x86_64 the stripped binary is about 16 MB and uses about 14 MB when idle ([measured for 0.6.11](docs/validation-0.6.11/README.md#web-binary-size-and-idle-memory-on-linux-measured)). No Python, Node, Docker or external AI service is required.
<p align="center"><img src="https://raw.githubusercontent.com/LEVOGNE/airust/master/assets/airust-demo.gif" alt="AIRust web terminal of 0.6.11 answering two questions from its built-in sample knowledge, the second typed in lower case without a question mark" width="800"></p>
## Start in 15 minutes
The [quickstart](docs/QUICKSTART.md) 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. In a new project (`cargo new airust-demo`), add the published library to the `[dependencies]` table of `Cargo.toml`:
```toml
[dependencies]
airust = { version = "=0.6.11", default-features = false }
```
Replace `src/main.rs` with this program and run `cargo run` in the project directory:
```rust
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(())
}
```
The same program ships as an example: in a clone of the AIRust repository, 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. These two examples run in a clone of the AIRust repository; in your own project, follow [quickstart step 4](docs/QUICKSTART.md#4-return-the-source).
```bash
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](docs/API-COOKBOOK.md), [document contract](docs/DOCUMENTS.md) and [citation checks](docs/CITATIONS.md).
## Connect a local agent
Save your records as a JSON array of objects with `id`, `text` and optional `metadata` in a file such as `knowledge.json` ([example](docs/QUICKSTART.md#5-optional-connect-an-mcp-client-or-a-local-model)); the program above keeps its records in memory only. Install the published read-only MCP executable and pass the absolute path of that file:
```bash
cargo install airust --version 0.6.11 --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](docs/MCP.md) and [the trust boundary](docs/MCP-SECURITY.md).
AIRust is also listed in the [Glama MCP directory](https://glama.ai/mcp/servers/LEVOGNE/airust). There you can browse its tools, check its quality score and try it with the [MCP Inspector](https://glama.ai/mcp/inspector) before installing it.
## 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:
```bash
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](docs/REFERENCE-APPLICATION.md).
## 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](docs/DOCUMENTS.md) |
| Compact excerpts, explicit question preparation and citation checks | `retrieval` | [Retrieval](docs/RETRIEVAL.md) |
| Phrases and German word forms | `advanced-search` | [Text search](docs/TEXT-SEARCH.md) |
| Application-supplied embeddings and rank fusion | `embeddings`, `hybrid` | [Semantic](docs/SEMANTIC.md), [hybrid](docs/HYBRID.md) |
| A bounded second ranking stage | `reranking` | [Reranking](docs/RERANKING.md) |
| Local ONNX model adapters | `local-embeddings`, `local-reranking` | [Local embeddings](docs/LOCAL-EMBEDDINGS.md), [local reranking](docs/LOCAL-RERANKING.md) |
| Original-record persistence or SQLite full-text search | `storage`, `sqlite-storage`, `disk-index` | [Storage](docs/STORAGE.md), [disk index](docs/DISK-INDEX.md) |
| Consistent concurrent search/vector/source readers | `snapshots` | [Snapshots](docs/SNAPSHOTS.md) |
| Versioned records with expected-revision checks and bounded history | `versioning` | [Versioning](docs/VERSIONING.md) |
| Memory records with provenance, declared claims, conflict policies, reported retention and source freshness | `memory` | [Memory lifecycle](docs/MEMORY.md) |
| Relationships, provenance, feedback or explicit rules | Select the corresponding module | [Complete feature and support matrix](docs/SUPPORT.md) |
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](docs/REFERENCE-APPLICATION.md) 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](docs/measurements/reference-v1/README.md) retains configuration costs and individual regressions. These reference results do not establish customer adoption or general retrieval superiority.
The [historical 0.4.4 comparison](docs/HONEST-COMPARISON-0.4.4.md) 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](docs/BENCHMARKS.md) and [change history](CHANGELOG.md).
## Recent releases
**AIRust 0.6.11** keeps float values in snapshots exact: 0.6.10 parsed floats in metadata approximately, so values such as `1.0 / 11.0` could come back one unit in the last place off and a reloaded snapshot was no longer byte-identical. The process pool keeps a healthy worker after a request it rejected before sending, the web terminal lists every user table and answers unknown paths only for GET and HEAD, and the start guides now work when followed as written. The README gives Linux figures for binary size and idle memory. See the [changelog](CHANGELOG.md) and the [validation record](docs/validation-0.6.11/README.md).
AIRust 0.6.10 makes `remember` with claims faster: the conflict search reads the claims of earlier records from its index, and the 0.6.4 cost criterion (at most 20 µs p95 with four claims) is now met on the Linux host with 16.52 µs. Snapshot writes can be bounded by the load limit, so a store fails when it saves instead of when it restarts, and `safe_purge_horizon` tells how far deleted history can be purged. The process pool replaces an idle worker whose process has exited, and the reference pilot recovers from a dead isolated worker. See the [changelog](CHANGELOG.md) and the [validation record](docs/validation-0.6.10/README.md).
AIRust 0.6.9 adds an opt-in bound on the IDs a versioned index or memory store tracks: deleted IDs can be purged and new IDs limited, which keeps a store that receives new IDs from growing without bound. In the web terminal, knowledge added through the API or from approved bot data is now stored and survives a restart. The crate ships without measurement data. See the [changelog](CHANGELOG.md) and the [validation record](docs/validation-0.6.9/README.md).
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 ([validation record](docs/validation-0.6.8/README.md)).
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](docs/validation-0.6.7/README.md)).
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](docs/validation-0.6.6/README.md)).
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](docs/MEMORY.md): per-record provenance, caller-declared claims with explicit conflict policies, reported retention and source freshness in search results. Read [scope and criteria](docs/validation-0.6.4/SCOPE.md) and [release validation](docs/validation-0.6.4/RELEASE.md).
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](docs/CHANGES-0.6.3.md) and [release validation](docs/validation-0.6.3/RELEASE.md).
AIRust 0.6.2 added an opt-in [native-model process owner](docs/LOCAL-MODEL-PROCESSES.md) for predictable repeated MiniLM unload/reload, plus review fixes and resource-aware test control. Read [scope](docs/CHANGES-0.6.2.md), [migration](docs/MIGRATION-0.6.2.md) and [release validation and open limits](docs/validation-0.6.2/RELEASE.md). 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](docs/CHANGES-0.6.1.md), [migration](docs/MIGRATION-0.6.1.md), [configuration ownership](docs/CONFIGURATION.md)).
The bounded local pilot and explicit live search profiles introduced in 0.6.0 remain compatible. [Actual local answer attempts and retained measurements](docs/measurements/profile-practical-0.6.0/README.md) precede these changes; the [final-source confirmation](docs/measurements/configuration-0.6.1-final/README.md) 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](docs/validation-0.5.3/README.md) remains reproducible. The published [0.5.2 baseline](docs/validation-0.5.2/closeout.json) 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](docs/measurements/native-lifecycle-0.6.2/README.md).
## Build and validate
```bash
./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](CONTRIBUTING.md), [platform support](docs/SUPPORT.md), [startup and tools](STARTUP.md), and the [roadmap](ROADMAP.md).
AIRust is MIT-licensed. The optional maintained PDF backend preserves its own upstream licenses and notices; its maintenance contract is described in [PDF maintenance](docs/PDF-MAINTENANCE.md).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues