1 unstable release

Uses new Rust 2024

0.1.0 May 21, 2026

#785 in Artificial intelligence

Apache-2.0

3MB
8K SLoC

vein

Version Status

Vein

What Vein Does

Vein is a memory layer for AI agents. When a session ends, all accumulated context is lost — Vein solves this by persisting what matters across sessions, whether the agent runs in a CLI or an IDE.

On each new session, instead of starting from zero, the agent queries its memory and retrieves only what is relevant to the current task. The full history is never loaded into context — only what is actually needed.

Multi-Agent Coordination

When multiple agents run in parallel, Vein gives each one visibility into the others' working state. An agent can query where a teammate is operating and detect potential conflicts before making a decision — useful when agents are working across branches or overlapping scopes.

Background Processing

For supported CLIs, Vein monitors session history in the background, continuously filtering noise, extracting relevant content, and routing it to the correct memory layer. Processing can be configured to start from a specific point in history, not just the current session.

One memory system. Every agent. Only what is needed, exactly when it is needed.


Table of Contents


Installation

Warning

unpublished

Two variants are available:

Variant Description Size
base Standard CLI, connects to remote providers (OpenAI, etc.) Smaller
local Includes MistralRS for running models locally (CPU/GPU) Larger

Set VEIN_VARIANT=local to install the local variant (default is base).

Linux

# base (default)
curl -fsSL https://raw.githubusercontent.com/DiegoZaluski/vein/main/download_cli.sh | bash

# local (with Mistralrs)
VEIN_VARIANT=local curl -fsSL https://raw.githubusercontent.com/DiegoZaluski/vein/main/download_cli.sh | bash

Windows (PowerShell)

# base (default)
iwr -Uri https://raw.githubusercontent.com/DiegoZaluski/vein/main/download_cli.ps1 -OutFile download_cli.ps1; .\download_cli.ps1

# local (with Mistralrs)
$env:VEIN_VARIANT = "local"; .\download_cli.ps1

Cargo

# base (default)
cargo install vein-recall-cli

# local (with Mistralrs)
cargo install vein-recall-cli --features vein/mistralrs
cargo install vein-server

Usage

vein --help

Tools

Tool What it does
dialogue_memory Timeline of session events with noise already filtered — recent history, structured and queryable
recall_insights Semantic search over important, useful, likely timeless insights stored across all embedding models
user_preferences Query the user's structured preference tree — rules, tech stacks, and scoped preferences organized hierarchically (language → framework → library)
add_user_preference Add a new preference to the user tree
add_recall_insight Persist a new insight into long-term memory

Foreign tools → see below


Integrations

LLM Providers

One function, 24+ providers. Set the provider name and its *_API_KEY env var.

See services/openai/README.md for the full list and usage.

Slack

Send messages and receive webhook events via tokio channels.

vein --config --slack-enabled true --slack-port 3000

See services/slack/README.md.

Local Models (MistralRS)

Run models locally without external APIs — no Ollama or LM Studio needed. Vein loads the model directly via mistralrs.

Required version: 0.8.1

cargo build --release --features mistralrs
# GPU:
cargo build --release --features cuda,cudnn,flash-attn

Configuration

Config lives at ~/.config/vein/Config.toml.

Edit the file directly

[llm_preference]
preference = "provider"     # "provider" or "internal"
local_internal = true

[llm_provider]
providers_and_models = [["openrouter", "google/gemini-2.0-flash-lite-001"]]

[server]
enabled = true
bind = "0.0.0.0:8088"
exposed_tools = ["dialogue_memory", "recall_insights"]

Use CLI flags

Flags only persist when --config is present. Without it, they are parsed but not saved.

vein --config --memory-mode hybrid --llm-preference-preference provider --slack-enabled true

See FLAGS.md for the complete list.


Quick Start MCP

See README MCP

Server & Foreign Tools

The server was created so teams can share memory without polluting each agent's tool list.

Without it: every new teammate adds their MCP tools to everyone's agent — tool count multiplies, tokens burn on irrelevant context, the model gets confused.

With it: one endpoint per teammate. Your agent calls foreign_* tools with the coworker's name and query. Results come back read-only — search only, no write access. Tool count stays flat.

Server config

[server]
enabled = true
bind = "0.0.0.0:8088"
exposed_tools = ["dialogue_memory", "recall_insights"]
co_worker = "diego_zaluski"

[server.auth]
mode = "disabled"  # "oidc_jwt" | "behind_proxy" | "disabled"

[server.rate_limit]
enabled = false
window_seconds = 10
max_requests = 60

[server.map_coworker]
diego_zaluski = "http://127.0.0.1:8088"

Foreign tools

Tool What it does
foreign_dialogue_memory Query a coworker's medium-term memory (SQL)
foreign_recall_insights Semantic search a coworker's long-term insights
foreign_user_preferences Query a coworker's preference tree

Specify the coworker name (mapped in [server.map_coworker]) and the query.


How Vein Works

Memory Modes

vein --memory-mode=mcp

Lightweight. Starts an MCP server with all memory tools. No internal model running in background — the agent itself manages context: adds relevant data, organizes the preference tree, and decides what to store.

vein --memory-mode=hybrid

Full autonomy. Includes everything MCP mode does, plus automatic background processing:

  • Captures session history from supported agent CLIs: Claude CLI, OpenCode, Gemini CLI, Kilo Code, Aider
  • Parses the full history, removes noise, summarizes into clean contexts without linguistic repetition
  • Separates entries by relevance — critical bugs and how they were resolved, code style decisions, preferences
  • Stores relevant content in the vector DB. The model decides binary (keep or discard) — no float scores, models give false confidence with those
  • Uses dispatch to route everything to the right place

How Memory Gets In

Two paths:

  1. Agent injection — the model itself decides something is relevant and stores it via tools (add_recall_insight, add_user_preference)
  2. Background capture (hybrid only) — Vein watches agent directories, processes sessions automatically, triages and stores what matters

Storage

  • SQL database (medium-term) — recent session data, queryable with dialogue_memory
  • Vector DB (long-term) — semantic embeddings, searchable with recall_insights
  • User tree — hierarchical preference tree (language → framework → library), queryable with user_preferences

Nothing is ever hard-deleted. Unused data is progressively compressed over time, like human memory — you never forget 100% of something, you just summarize it slowly until it fades. This enables generating timeline summaries from years ago. (Condensation is in progress)


License

Dependencies

~197MB
~3.5M SLoC