> For the complete documentation index, see [llms.txt](https://tinyhumans.gitbook.io/neocortex/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tinyhumans.gitbook.io/neocortex/readme.md).

# Introduction

## Introduction

## TinyCortex 🧠

**TinyCortex** is a local-first AI memory engine, shipped as the open-source Rust crate [`tinycortex`](https://crates.io/crates/tinycortex). It gives your agents a memory that works the way a brain does: it **intelligently forgets noise** so the model only reasons over what matters.

Every AI memory system you have used does the same thing — store everything, retrieve by similarity, hope for the best. The outcome is an agent that drowns in stale context: responses degrade and costs inflate. TinyCortex takes the opposite approach. Low-value memories **decay** over time, while the knowledge your users recall and interact with is **reinforced** and rises to the top. There is no manual cleanup and no context-window anxiety.

The engine ingests content, canonicalizes and chunks it, scores what is worth keeping, and **compresses** it into a hierarchical summary tree. Retrieval then serves a focused, explainable slice of long-term history — vector, keyword, graph, and tree search combined — instead of a noisy dump of everything ever stored.

{% hint style="info" %}
This documentation covers the **open-source Rust crate**. The hosted TinyCortex platform (managed API, language SDKs) is a separate product in **closed alpha** — [reach out](mailto:founders@tinyhumans.ai) for access. Crate-only vs. hosted-only capabilities are called out throughout.
{% endhint %}

### Quickstart

```bash
cargo add tinycortex
```

```rust
use tinycortex::memory::{InMemoryMemoryStore, MemoryInput, MemoryQuery, MemoryStore};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let store = InMemoryMemoryStore::new();

    store
        .insert(MemoryInput::new("preferences", "User prefers dark mode"))
        .await?;

    let hits = store.search(MemoryQuery::text("theme preference")).await?;
    for hit in hits {
        println!("{:.3}  {}", hit.score, hit.record.content);
    }
    Ok(())
}
```

See [**Getting Started**](/neocortex/getting-started.md) for the full walkthrough, or jump to the [**Architecture Overview**](/neocortex/concepts/architecture.md) to understand how the engine fits together.

### Why TinyCortex

* **Intelligent noise filtering** — memories that are not accessed decay; frequently recalled knowledge becomes durable. The store stays lean on its own.
* **Interaction-aware** — views, replies, reactions, and authored content all signal what matters.
* **Local-first & inspectable** — markdown files are the source of truth; SQLite, vectors, summary trees, and a git ledger are rebuildable derived indexes.
* **Explainable retrieval** — every hit carries a score breakdown across graph, vector, keyword, and freshness signals.
* **Provenance & safety** — every item carries source identity and a security `taint` (internal vs. external-sync).

### Where to go next

| If you want to…                                         | Read                                                              |
| ------------------------------------------------------- | ----------------------------------------------------------------- |
| Install and run your first store                        | [Getting Started](/neocortex/getting-started.md)                  |
| Understand the layered design                           | [Architecture Overview](/neocortex/concepts/architecture.md)      |
| Learn the vocabulary (namespaces, taint, decay, recall) | [Core Concepts](/neocortex/concepts/core-concepts.md)             |
| See how memories are compressed into a tree             | [Memory Tree & Compression](/neocortex/the-engine/memory-tree.md) |
| Query memory                                            | [Retrieval](/neocortex/the-engine/retrieval.md)                   |
| Read the generated API reference                        | [docs.rs/tinycortex](https://docs.rs/tinycortex)                  |

[Discord](https://discord.tinyhumans.ai) • [Reddit](https://www.reddit.com/r/tinyhumansai/) • [X](https://x.com/tinyhumansai) • [crates.io](https://crates.io/crates/tinycortex)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://tinyhumans.gitbook.io/neocortex/readme.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
