Skip to main content
Glama

Iranti

License: AGPL-3.0 MCP Server npm npm version iranti MCP server

Shared memory for AI coding tools — Claude Code, Codex CLI, and GitHub Copilot.

Iranti is a self-hosted MCP server that gives your AI tools persistent, identity-based memory. Facts written in one session are retrievable in any other — across tools, projects, and context resets.


Quick Start

# Install globally
npm install -g iranti

# Run the guided setup (configures database, API key, project binding)
iranti setup

# Start the instance
iranti run --instance local

Then wire it into your AI tool:

iranti claude-setup    # Claude Code
iranti codex-setup     # Codex CLI
iranti copilot-setup   # GitHub Copilot

That's it. Your AI tool now has persistent memory across sessions.


Related MCP server: Turbo Quant Memory MCP Server

Supported Tools

Tool

Command

What it does

Claude Code

iranti claude-setup

Adds .mcp.json, CLAUDE.md, and session hooks

Codex CLI

iranti codex-setup

Registers Iranti in the global MCP registry

GitHub Copilot

iranti copilot-setup

Writes MCP config to .mcp.json + .vscode/mcp.json, protocol instructions to .github/copilot-instructions.md

Any MCP client

iranti mcp

Runs the stdio MCP server directly


What It Does

Iranti stores facts as entityType/entityId → key → value triples in PostgreSQL. Any agent that knows the entity and key can retrieve the fact exactly — no semantic guessing, no hallucinated state.

Agent A writes:  project/my-app → deployment_status → "deployed to staging"
Agent B reads:   project/my-app → deployment_status → "deployed to staging" ✓

Facts persist across sessions, context resets, and tool switches. When you restart Claude Code tomorrow, it can pick up exactly where you left off.

Key capabilities

  • Exact lookup — retrieve by entityType/entityId + key, deterministic and fast

  • Hybrid search — lexical + vector similarity when exact keys are unknown

  • Cross-tool sharing — Claude Code, Codex, and Copilot share the same memory

  • Conflict resolution — concurrent writes from multiple agents are detected and resolved

  • Per-fact confidence — every fact carries a confidence score; low-confidence facts age out

  • Session recovery — checkpoint/resume for interrupted work

  • User operating rules — define trigger-based rules that surface only when relevant

  • File-change recall — agents remember which files changed and why


Staff agents

Iranti is built around four internal Staff components that run alongside the host AI tool. Each Staff member has a specific job, and together they turn the memory layer into an active participant in the session — not just a dictionary the agent reads from.

Staff

Role

What it does

Librarian

Writes and conflict resolution

Normalizes facts before storage, runs multi-step conflict resolution with cited evidence, enforces schema and confidence rules

Attendant

Turn-time context

Pre-response memory injection, mid-turn tool-call guidance, post-response autowrite nudges, drift detection, session objective tracking

Archivist

Background maintenance

Decays stale facts, archives expired entries, processes escalations, runs a bounded reasoning pass that proposes compressions and demotions

Resolutionist

Human-in-the-loop

Consumes escalation files for conflicts the Librarian could not auto-resolve

Attendant agency (what the Attendant surfaces on every turn)

The Attendant runs in three phases — pre-response, mid-turn, and post-response — and returns a structured result each time. Beyond raw fact injection, every attend response carries:

  • toolCallGuidance — when the host passes a pending tool call (Read, Grep, Glob, Bash, WebSearch, WebFetch), the Attendant derives entity hints from the tool args and emits a shouldSkip verdict when stored facts already cover the target. Hosts can gate tool execution on the verdict instead of string-matching notes.

  • drift — detects when the latest message has diverged from the declared task topic. Emits the driving tokens so the host can surface a confirmation prompt. Suppressed when checkpoint.currentStep starts with COMPLETE — so a finished task does not produce spurious drift alarms as the conversation winds down.

  • sessionObjective — derived from the task description or checkpoint continuation, threaded through every attend call as a stable anchor.

  • autoCheckpointSignal — fires when pressure has built up (drift, turns-without-write, tool-cost threshold) so the host can checkpoint before the next risky step.

  • refinementPass — when the first retrieval pass comes back empty, the Attendant runs a bounded widened-hint retry (max 1 extra observe call) and reports the outcome.

  • subTurnLoopPlan — on mid-turn attends, when the host passes a partialResponse of the Attendant's own in-progress assistant output, the Attendant re-scores the partial against memory, harvests novel tokens and entity hints from the text, and fires one bounded extra observe call with the widened hints unioned onto the original ones. Net-new facts are deduped against the pre-retry baseline so repeat hits are dropped. Gated by phase, partial length, a once-per-turn budget, and a novelty check on the tokens. This is refinementPass re-applied on response progress rather than empty initial retrieval — the "most agentic" sub-turn loop from the M-series memo.

  • attendantToolPlan — up to three planned follow-up tool calls (search_related, observe_entity, query) derived from brief entities, drift tokens, or the session objective. Deterministic and surfaced, never executed.

  • councilConsultationPlan — proposes which peer Staff members the Attendant would consult for this turn (e.g. Librarian for source-reliability on a clear topic, Archivist when the injection surface has multiple low-confidence facts). Proposal only.

  • usageGuidance — carries the MANDATORY protocol reminder block. Gated on compliance health: when all counters (turnsWithoutWrite, consecutiveUnusedMemoryInjections, etc.) are zero the reminder is suppressed so well-behaved agents do not pay the injection cost every turn.

  • writeNudge — reminds the host to write a fact after substantial activity without a durable write.

  • toolResultExtraction — on mid-turn/post-response, the Attendant extracts candidate facts from the tool result so the host can autowrite them.

  • responseFileCapture — on post-response, the Attendant scans the assistant's reply for file paths, infers the action (edited/created/read) from the ±150-character context window around each match, and auto-writes project/{id}/file/{basename} facts so file-scoped memory is populated without host involvement. Result carries autowriteBatchId, filesDetected, factsWritten, entities, skipped, and durationMs. Only present on post-response attend calls.

Archivist reasoning budget

Each Archivist scan cycle ends with a bounded, deterministic reasoning pass that emits proposals (never mutations) for the Resolutionist to consider:

  • compress — clusters of duplicate entries at the same entityType/entityId/key

  • flag_drift — clusters with high confidence spread suggesting disagreement

  • demote — stale low-confidence single entries

  • review_stale — very old single entries regardless of confidence

Proposals fire as reasoning_proposal_emitted staff events and travel on the ArchivistReport so callers can ship them onward.

Council mode

Staff members can propose consultations with each other before finalising a decision. The Librarian can ask the Attendant for relevance when resolving a conflict; the Attendant can ask the Librarian for source-reliability context on a topic; the Resolutionist can ask the Archivist for pending reasoning-proposal context on an escalation. Consultations are proposed, bounded, and fired as council_consultation_proposed staff events — they are not executed automatically today.


MCP Tools

When connected via MCP, Iranti exposes these tools to your AI tool:

Tool

Purpose

iranti_handshake

Initialize session, load operating rules and working memory

iranti_attend

Pre/post-response memory injection — call before every reply

iranti_write

Write a durable fact to shared memory

iranti_query

Exact entity+key lookup

iranti_search

Hybrid semantic/lexical search

iranti_checkpoint

Save current task progress

iranti_ingest

Extract facts from prose or documents

iranti_relate

Create a relationship between two entities

iranti_related / iranti_related_deep

Traverse entity relationships

iranti_history

Fact history with timestamps

iranti_who_knows

Find which agents have written about an entity

iranti_observe

Demand-driven context injection with entity hints

iranti_write_rule

Write a user operating rule with trigger conditions

iranti_remember_response

Auto-persist facts from an assistant response


Install Strategy

Iranti uses a two-layer model: one machine-level runtime, many project bindings.

1. Install and set up

npm install -g iranti
iranti setup

iranti setup walks you through:

  • Instance creation and database onboarding (local Postgres, managed Postgres, or Docker)

  • LLM provider API keys (OpenAI, Claude, Gemini, Groq, Mistral, or local Ollama)

  • Project binding

Non-interactive automation:

iranti setup --defaults --db-url "postgresql://postgres:yourpassword@localhost:5432/iranti"

2. Start the instance

iranti run --instance local

3. Bind a project

cd /path/to/your/project
iranti project init . --instance local --agent-id my_agent

This writes .env.iranti with IRANTI_URL, IRANTI_API_KEY, and agent identity. Each agent in a multi-agent system gets its own --agent-id.

4. Integrate with your AI tool

iranti claude-setup    # or codex-setup / copilot-setup

API Keys

# Create a scoped key for one user or service
iranti auth create-key --instance local --key-id my_app --owner "My App" \
  --scopes "kb:read,kb:write,memory:read,memory:write"

# List keys
iranti list api-keys --instance local

# Revoke a key
iranti auth revoke-key --instance local --key-id my_app

SDK Usage

Python (PyPI):

from iranti import IrantiClient

client = IrantiClient(base_url="http://localhost:3001", api_key="your_key")

# Write a fact
client.write(
    entity="project/my-app",
    key="status",
    value="in_review",
    summary="App is in review",
    confidence=90,
    source="my_script",
    agent="my_agent",
)

# Read it back
fact = client.query(entity="project/my-app", key="status")

TypeScript (npm):

import { IrantiClient } from "@iranti/sdk";

const client = new IrantiClient({ baseUrl: "http://localhost:3001", apiKey: "your_key" });

await client.write({
    entity: "project/my-app",
    key: "status",
    value: "in_review",
    summary: "App is in review",
    confidence: 90,
    source: "my_script",
    agent: "my_agent",
});

const fact = await client.query("project/my-app", "status");

User Operating Rules

Rules are trigger-based instructions that surface only when the agent is about to do a relevant task (e.g. releasing, pushing to CI). Unlike project policies which are always injected, rules match against the current context using keyword triggers.

# Create a rule via MCP (iranti_write_rule tool) or the API
# Example: remind the agent to use GitHub Releases instead of npm publish
#   triggers: ["publish", "release", "npm"]
#   enforcement: "hard" (required) or "soft" (guidance)

# List all rules
iranti list-rules

# Remove a rule
iranti delete-rule no_npm_publish

Rules are stored as rule/* entities. During iranti_attend, triggers are matched against the current conversation context — single-word triggers match as tokens, multi-word triggers match as phrases.


Diagnostics

iranti doctor              # Validate database, API key, and provider
iranti status              # Show known instances and project bindings
iranti chat                # Interactive chat shell for sanity checking
iranti upgrade --check     # Check for available updates
iranti upgrade --yes       # Apply updates

Operator-facing CLI help now includes short "what it does" and "use this when" guidance for every command — run iranti --help or iranti <command> --help for details.


Configuration

Environment variables (set during iranti setup or manually in .env):

Variable

Description

DATABASE_URL

PostgreSQL connection string (pgvector required)

IRANTI_API_KEY

Server authentication key

LLM_PROVIDER

openai | claude | gemini | groq | mistral | ollama | mock

IRANTI_PORT

API port (default: 3001)

IRANTI_ARCHIVIST_WATCH

Watch escalation files and auto-run maintenance (true/false)


Uninstall

iranti uninstall --dry-run    # Preview what would be removed
iranti uninstall --all --yes  # Remove runtime + project bindings

Guides

License

AGPL-3.0-or-later

Available Tools

16 tools
iranti_attendA

Ask Iranti whether memory should be injected before the next LLM turn. REQUIRED CALL SEQUENCE — follow this every turn, regardless of host:

  1. Call with phase='pre-response' BEFORE replying to the user.

  2. Call BEFORE any lookup tool (Read, Grep, Glob, Bash, WebSearch, WebFetch) where Iranti might already hold the answer. When you do, pass the pendingToolCall field so Iranti can derive entity hints from the tool target (file, URL, query) and preempt the lookup with stored facts.

  3. If you just ran Edit/Write/Bash/WebSearch/WebFetch since your last iranti_write, call iranti_write FIRST — then attend.

  4. Call with phase='post-response' AFTER every reply, without exception.

If the user is asking you to recall a remembered fact (preference, decision, blocker, next step, prior project detail), use this before answering instead of guessing or saying you do not know. Returns an injection decision plus any facts that should be added to context if relevant memory is missing. If no handshake has been performed yet for this agent in the current process, attend will auto-bootstrap the session first and report that in the result metadata. This is the minimum safe pre-reply call even when the host skipped handshake. Omitting currentContext falls back to the latest message only; pass the full visible context when available. For host compatibility, message is accepted as an alias for latestMessage. When phase='post-response', pass the assistant response so Iranti can persist strict continuity facts and shared checkpoint state before closing the turn.

Inputs: latestMessage, message, currentContext, entityHints, +7 more.

iranti_checkpointA

Persist a shared progress checkpoint while you work. Use this at meaningful milestones so current step, next step, open risks, recent outputs, structured actions, and shared entity state survive across turns, sessions, and agents. This is the strongest shared-RAM tool for active work: prefer it over ad-hoc prose when you need another session or another agent to pick up where you left off. If entityTargets are supplied, Iranti also writes canonical shared state such as current_step, next_step, open_risks, recent_actions, and recent_file_changes to those entities for handoff.

Inputs: task (required), recentMessages, currentStep, nextStep, +9 more.

iranti_handshakeA

Initialize or refresh an agent's working-memory brief for the current task. Call this at session start or when a new task begins, passing the task and recent messages. Returns operating rules plus prioritized relevant memory for that task. If the recent messages appear to contain durable facts that are not yet in shared memory, the result may include a backfill suggestion. If your host does not support a true session-start hook, call this on the first user turn before you start answering recall-style questions. Do not use this as a per-turn retrieval tool; use iranti_attend.

Inputs: task (required), recentMessages, agent, agentId, +2 more.

iranti_historyA

Retrieve the full version history of a fact for an exact entity+key pair. Returns all archived past values plus the current value, ordered oldest-first. Each entry includes value, summary, confidence, source, validFrom, validUntil, isCurrent, archivedReason, and resolutionState. REQUIRED: call iranti_attend before this discovery tool so Iranti can decide whether memory should be injected first. Use this to understand how a fact evolved over time — decisions that changed, blockers that were resolved, values that were contested or superseded.

Inputs: entity (required), key (required), limit, includeExpired, +3 more.

iranti_ingestC

Ingest a raw text block and let the Librarian chunk it into atomic facts.

Inputs: entity (required), content (required), confidence, source, +2 more.

iranti_observeB

Recover relevant facts that have fallen out of Claude context.

Inputs: currentContext (required), entityHints, maxFacts, agent, +1 more.

iranti_queryA

Retrieve the current fact for an exact entity+key lookup. REQUIRED: call iranti_attend before this discovery tool so Iranti can decide whether memory should be injected before exact lookup. Use this when you already know both the entity and the key. Returns the current value, summary, confidence, source, and temporal metadata when available. Prefer this over iranti_search when the target fact is already known, and do not answer from memory alone before checking Iranti.

Inputs: entity (required), key (required), agent, agentId.

iranti_relateC

Create a relationship edge between two entities.

Inputs: fromEntity (required), relationshipType (required), toEntity (required), propertiesJson, +1 more.

iranti_remember_responseA

Persist a strict durable summary from your own response. Use this after you decide to say something like "the next step is ...", "the blocker is ...", "we decided ...", or "the current owner is ...". This uses the same narrow summary extractor as the Claude Stop hook, but it is explicit and works for Codex or any MCP client. Do not use this for arbitrary prose or every turn.

Inputs: response (required), projectEntity, personalEntity, source, +3 more.

iranti_who_knowsA

List which agents have written facts about an entity. REQUIRED: call iranti_attend before this discovery tool so Iranti can decide whether memory should be injected before provenance discovery.

Inputs: entity (required), agent, agentId.

iranti_writeA

Write one durable fact to shared memory for a specific entity. TIMING: Call IMMEDIATELY when a fact is confirmed — do not batch or defer to end of turn. One call per finding. If you edited a file, write before the next action. If you ran a command and got a result, write before the next action. If you got a search result, write before moving on. Use this when you learned something concrete that future turns, agents, or sessions should retain. Requires: entity ("type/id"), key, value JSON, and summary. Confidence is optional and defaults to 85. Conflicts on the same entity+key are detected automatically and may be resolved or escalated. Personal-memory keys honor the configured canonical personal entity for this project/session. Use properties JSON when you need structured issue or workflow metadata such as issueStatus=open|resolved, severity, or resolution notes.

Inputs: entity (required), key (required), valueJson (required), summary (required), +7 more.

iranti_write_issueA

Write a canonical open or resolved issue fact on a stable key. Use this when you want defects, bugs, or chores to remain first-class shared memory instead of loose prose. The same issueId always maps to the same issue_ key, so changing status from open to resolved archives the prior state automatically while preserving history. Prefer this over hand-rolling issueStatus properties through iranti_write when the fact is specifically a trackable issue lifecycle entry.

Inputs: entity (required), issueId (required), title (required), status (required), +12 more.

iranti_write_ruleA

Write a task-scoped user operating rule with trigger keywords. Rules surface during iranti_attend only when the current context matches one or more trigger keywords. Use this for recurring guidelines that should be applied to specific task types (e.g. "always use GitHub Releases, not npm publish" triggered by "release", "publish", "npm"). Rules are stored as rule/<rule_id> entities and persist across sessions.

Inputs: ruleId (required), rule (required), triggers (required), scope, +4 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 16 tool updatesv0.3.37
    • First observediranti_attend
    • First observediranti_checkpoint
    • First observediranti_handshake
    • First observediranti_history
    • First observediranti_ingest
    • First observediranti_observe
    • First observediranti_query
    • First observediranti_relate
    • First observediranti_related
    • First observediranti_related_deep
    • First observediranti_remember_response
    • First observediranti_search
    • First observediranti_who_knows
    • First observediranti_write
    • First observediranti_write_issue
    • First observediranti_write_rule

TDQS

A3.9/5.0

Scored across 16 tools

Disambiguation4/5

Most tools have distinct purposes, but there is some overlap between iranti_observe and iranti_search (both retrieve facts) and between iranti_write and iranti_write_issue/iranti_write_rule (all write facts). The descriptions clarify differences, but an agent might initially confuse these pairs.

Naming Consistency5/5

All tools follow a consistent iranti_verb or iranti_verb_noun pattern, using snake_case throughout. The naming is highly predictable, with clear prefixes and descriptive suffixes.

Tool Count4/5

16 tools is slightly high but reasonable for a memory management system, covering handshake, checkpointing, querying, writing, and history. It might feel heavy, but each tool appears to serve a specific role in the workflow.

Completeness5/5

The toolset provides comprehensive coverage for memory operations: initialization (handshake), per-turn checks (attend), CRUD operations (write, query, search), history (history), relationships (relate, related), and specialized writes (issue, rule). No obvious gaps exist for the domain.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides AI coding agents with persistent, graph-connected memory across projects, enabling cross-project context retrieval via synaptic connections and hybrid search.
    10 npm
    8
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides long-term memory for AI coding agents, enabling them to remember, search, and organize information across sessions and platforms like Claude Code, ChatGPT, and Cursor.
    16 npm
    8
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Persistent memory for AI coding agents that stores and recalls preferences, decisions, and conventions via semantic similarity, with zero cloud dependencies and plug-and-play MCP integration for Claude Code.
    Apache 2.0