# Smrti

> Memory engine for self-evolving AI agent ecosystems. Multi-tenant, multi-space isolation with Bayesian truth maintenance, emotional valence, automatic consolidation, and configurable per-agent personality.

- **Type:** MCP server
- **Install:** `agentstack add mcp-cyqlelabs-smrti`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [cyqlelabs](https://agentstack.voostack.com/s/cyqlelabs)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [cyqlelabs](https://github.com/cyqlelabs)
- **Source:** https://github.com/cyqlelabs/smrti
- **Website:** https://smrti.im

## Install

```sh
agentstack add mcp-cyqlelabs-smrti
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# smrti

[](https://pypi.org/project/smrti/)
[](https://pypi.org/project/smrti/)
[](LICENSE)
[](https://github.com/cyqlelabs/smrti/actions/workflows/publish.yml)
[](https://codecov.io/gh/cyqlelabs/smrti)

AtomSpace-inspired memory engine for AI agents. Stores beliefs as graph nodes with Bayesian truth values, emotional valence, and attention weights in a single SQLite file with vector indexing. No extra infra to maintain. Just Plug & Play.

**Not just vector search.** Embedding similarity is only an entry point — a fast index to seed graph traversal. What gets returned and why is governed by graph topology (typed relation edges), Bayesian truth values (PLN), attentional economics (STI/LTI), and emotional valence. Similarity is one signal among five, not the ranking.

## How It Works

> [Pipeline diagram →](docs/pipeline.md)

**`remember()`** — Embeds and stores text as a typed atom (concept, belief, episode, or goal) with a Bayesian truth value, attention weight, and valence score. Evidence is append-only; truth values update via PLN revision. A hybrid GLiNER2 + LLM pipeline auto-extracts entities and relation edges; the LLM is only called when ≥2 entities are found (~40–60% fewer LLM calls). Pronouns are resolved against the live graph using persisted entity context, not raw conversation history.

**`recall()`** — Embeds the query → KNN seeds (top-50) → 1-hop graph expansion → salience re-ranking: `w_sim × similarity + w_sti × STI + w_conf × confidence + w_lti × LTI + w_val × |valence| × intensity`. When valence remember · recall · believe · reflect · forget · status"]
    end

    subgraph Servers
        MCP["mcp.pyMCP stdio"]
        REST["rest.pyFastAPI :8420"]
        PROXY["proxy.pyOpenAI proxy :8421"]
    end

    subgraph Core
        AS["AtomSpace"]
        DB["Database"]
        EMB["Embedder"]
        MOD["Models"]
    end

    subgraph Retrieval
        FAN["fan_out"]
        SAL["salience"]
        CLS["classify"]
    end

    subgraph Evolution
        EPO["epoch"]
        TRU["truth"]
        CON["connections"]
        HEA["healing"]
    end

    subgraph Spaces
        SOP["set_ops"]
        EMG["emergence"]
    end

    subgraph Extraction
        EXT["extract"]
        RES["resolve"]
        ALI["aliases"]
    end

    subgraph Storage
        SQL["SQLite + sqlite-vecmultilingual-MiniLM-L12-v2 · 384d · ONNX CPU"]
    end

    MCP & REST & PROXY --> S
    S --> Core & Retrieval & Evolution & Extraction & Spaces
    Core & Retrieval & Evolution & Extraction & Spaces --> SQL
```

**Retrieval pipeline:** Embed query → KNN over tenant partition → filter to read spaces → 1-hop graph expansion → salience scoring → top-k

**Salience formula:**

```
S = w_sim × similarity + w_sti × sti + w_conf × confidence + w_lti × lti + w_val × |valence| × intensity

When valence < -0.5, weight shifts dynamically from w_sti to w_val so critical errors outrank recent trivia.
```

**Consolidation epoch** (runs automatically every `SMRTI_REFLECT_INTERVAL` seconds, or manually via `reflect()`):

1. Process pending evidence via Bayesian update
2. Decay STI and confidence
3. Propagate STI and valence to 1-hop neighbors
4. Heal orphaned episodes (link to most salient person)
5. Promote high-STI atoms to LTI
6. Resolve contradictions (weaken less confident belief)
7. Discover cross-domain connections (every 10th epoch)
8. Materialize cross-space bridge atoms (every 10th epoch)
9. Prune atoms below confidence/LTI floors

## Data Model

| Atom Type  | Purpose                  | Example                          |
| ---------- | ------------------------ | -------------------------------- |
| `concept`  | Reusable entities        | "Alice", "Python", "OpenAI"      |
| `belief`   | Probabilistic facts      | "Alice prefers TypeScript"       |
| `episode`  | Timestamped observations | "User asked about deployment"    |
| `goal`     | Desired states           | "Finish the migration by Friday" |
| `relation` | Edges between atoms      | Alice → works_at → Acme Corp     |

Each atom carries:

- **TruthValue** — `probability` [0,1] and `confidence` [0,1], merged via PLN revision
- **AttentionValue** — `sti` (short-term importance, decays fast) and `lti` (long-term, accumulates)
- **Valence** — emotional tone [-1,1] and intensity [0,1]

## Testing

```bash
pytest tests/ -v
```

## License

MIT

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [cyqlelabs](https://github.com/cyqlelabs)
- **Source:** [cyqlelabs/smrti](https://github.com/cyqlelabs/smrti)
- **License:** MIT
- **Homepage:** https://smrti.im

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-cyqlelabs-smrti
- Seller: https://agentstack.voostack.com/s/cyqlelabs
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
