Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

cyrrus

Context routing for LLM calls.

Instead of sending a full static system prompt every time, cyrrus decides what context is relevant right now and sends only that.

from cyrrus import Projector
from cyrrus.providers import ollama

bot = Projector.minimal(llm_call=ollama("llama3.2"))
reply = bot.ask("hello")

That's it. No config required to start.


What it does

Every time a user sends a message, cyrrus:

  1. Routes — matches the message against your slides to find what's relevant
  2. Remembers — pulls stored facts about this user that relate to this message
  3. Packs — fits the relevant context into your token budget, highest priority first
  4. Sends — builds a proper messages array and calls your LLM
  5. Learns — extracts new facts from the conversation and stores them for later

The LLM receives clean, relevant context. Not a wall of everything you've ever defined.


Numbers

  • 51.6% token reduction on average across mixed conversations (real tiktoken counts)
  • 0.018 MB core install — zero required dependencies
  • 121.9 MB / 241.7 MB RAM for the optional embeddings block
  • 500 concurrent users with zero errors
  • Surviving every adversarial test thrown at it

Install

pip install cyrrus                  # core, zero dependencies
pip install cyrrus[embeddings]      # + semantic routing and memory

The import is always:

from cyrrus import Projector

Three ways to use it

Zero config

from cyrrus import Projector
from cyrrus.providers import ollama

bot = Projector.minimal(llm_call=ollama("llama3.2"))
reply = bot.ask("write me a python function")

With context routing

config = {
    "core_lamp": {
        "content": "You are a helpful assistant.",
    },
    "code_lens": {
        "content": "Output only clean code blocks, no filler.",
        "triggers": ["code", "script", "python", "function", "bug"],
    },
    "casual_lens": {
        "content": "Keep it short and natural.",
        "triggers": ["hey", "hi", "hello"],
    },
}

bot = Projector(config, llm_call=ollama("llama3.2"))
reply = await bot.process("write a sorting function", session_id=str(user_id))

tokens and priority are optional — cyrrus fills them in automatically.

Individual components

from cyrrus import MemoryVault, IntentRouter, SlideTray

# Use any component standalone
memory = MemoryVault()
facts = await memory.retrieve("user_123", "what is my name", limit=3)

Providers

Ready-made wrappers for common APIs. Pass them directly as llm_call:

from cyrrus.providers import ollama, openai, anthropic, groq

# Local Ollama — free, no API key
bot = Projector(config, llm_call=ollama("llama3.2"))

# OpenAI
bot = Projector(config, llm_call=openai("gpt-4o-mini", api_key="sk-..."))

# Anthropic
bot = Projector(config, llm_call=anthropic("claude-haiku-4-5", api_key="sk-..."))

# Groq — fast, generous free tier
bot = Projector(config, llm_call=groq("llama-3.1-8b-instant", api_key="..."))

Or bring your own — any async function that takes a messages list and returns a string:

async def my_llm(messages: list) -> str:
    response = await client.chat.completions.create(
        model="my-model",
        messages=messages,
    )
    return response.choices[0].message.content

bot = Projector(config, llm_call=my_llm)

Memory

cyrrus remembers things users tell it. No setup needed — the default extractor runs automatically:

User: "my name is Muratha"          → stored: user_name = Muratha
User: "I'm building cyrrus"         → stored: user_project = cyrrus
User: "I prefer Ollama"             → stored: user_preference = Ollama

On the next message, relevant facts are retrieved and injected into the system prompt automatically.

With cyrrus[embeddings]: retrieval uses semantic similarity, so "what am I working on" finds user_project: cyrrus even without shared keywords.

Without: keyword overlap matching. Fast, zero dependencies, catches most cases.

Memory is per session_id. Facts never leak between users.


Conversation history

cyrrus maintains a sliding window of conversation history per session. The LLM always sees recent context, so follow-up questions work:

User: "what's the capital of France?"
Bot:  "Paris."
User: "what's the population there?"   ← LLM knows "there" means Paris
Bot:  "Around 2.1 million in the city proper."

What cyrrus is not

  • Not an agent framework. It controls input, never output.
  • Not a vector database. Memory is SQLite with semantic retrieval optional.
  • Not a replacement for LangChain. It's a layer, not a framework.
  • Not magic. Keyword routing misses natural phrasing. Install cyrrus[embeddings] if you need paraphrase matching.

session_id

This is important. Every user needs a unique session_id:

# Discord bot
reply = await bot.process(message.content, session_id=str(message.author.id))

# Web app
reply = await bot.process(user_input, session_id=request.session["user_id"])

# Single-user script — use ask() and don't worry about it
reply = bot.ask("hello")

Without a unique session_id, users share memory. That's a bug, not a feature.


Tracing

Every call stores a trace:

await bot.process("write a script", session_id="u1")

trace = bot.last_trace
print(trace["routed_slide_ids"])        # which slides matched
print(trace["memory_slide_ids"])        # which facts were retrieved  
print(trace["dropped_slide_ids"])       # what didn't fit the budget
print(trace["messages"])                # exact messages sent to LLM
print(trace["stats"]["history_turns"])  # how many turns of history

License

AGPLv3. If you run cyrrus as part of a network service, you must make your modifications available. See LICENSE.


cyrrus — formerly known as slid3s

Metadata

Release files for cyrrus 0.3.0b1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cyrrus 0.3.0b1
File Size Uploaded
cyrrus-0.3.0b1.tar.gz 88.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cyrrus 0.3.0b1
File Interpreter ABI Platform
cyrrus-0.3.0b1-py3-none-any.whl Python 3 none any Details

Total release size: 137.6 kB

Release files / cyrrus-0.3.0b1.tar.gz

Download URL cyrrus-0.3.0b1.tar.gz
Size 88.5 kB
Tags Source
SHA-256 checksum
How to use checksums
23412c22eb284bd35f0005a9aace42033c99998947c407c9e00d558144f334e1
BLAKE2b-256 checksum
How to use checksums
bc8823d3b6d43cff4647034b3525e8fd9769b3fbfe550dd0eb09a6de1bff6e4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5

Release files / cyrrus-0.3.0b1-py3-none-any.whl

Download URL cyrrus-0.3.0b1-py3-none-any.whl
Size 49.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a1da0b7cad4519b18200f3ad876bd4c976df7047216b0f966e79c65ba9034f1
BLAKE2b-256 checksum
How to use checksums
c710255a65af324528c6ffa552849a607bc8794897eb2892102208d0f2a6f04a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.5
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page