Metadata-Version: 2.4
Name: frontal-lobe-memory
Version: 0.1.0
Summary: Duct tape for your LLM's leaky context window. A zero-infrastructure memory router to cure deterministic amnesia.
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: google-genai>=0.1.0

# 🧠 FrontalLobe

**Duct tape for your LLM's leaky context window.**

Current LLM architectures suffer from deterministic amnesia the second they hit their context limits. Standard solutions tell you to spin up massive vector databases, deploy Redis clusters, and rewrite your entire stack just to remember a single API key. 

We built **FrontalLobe** because we needed the Equitas AI safety platform to stop forgetting its own override protocols mid-conversation. 

FrontalLobe treats LLM memory like a Linux operating system. It offloads background context classification to a blistering-fast, ultra-lightweight edge model (like Gemini 1.5 Flash-8B), which acts as an executive routing agent. It pins critical safety entities to a persistent Core RAM, while aggressively archiving conversational noise to a searchable disk. 

Installs faster than you can boot up Neovim. Zero external database dependencies required.

## Features
- **Asymmetric Dual-Model Routing:** Fast, cheap background routing protects your expensive foreground context.
- **Zero-Infrastructure:** Pure Python implementation. If you can install `genai`, you can run this. 
- **Deterministic Entity Protection:** Stop your LLM from dropping critical keys, rules, and parameters into the semantic abyss.

## Quickstart

```python
from frontal_lobe import FrontalLobeMemory
from google import genai

# Spin up the Frontal Lobe
memory = FrontalLobeMemory(api_key="YOUR_API_KEY")
client = genai.Client(api_key="YOUR_API_KEY")

# 1. Feed the noisy user input to the middleware
user_text = "Wait, before we continue, the Equitas deployment code is OMEGA-99."
memory.ingest_message("user", user_text)

# 2. Get the optimized, RAM-injected prompt
optimized_prompt = memory.build_optimized_prompt(user_text)

# 3. Send to your heavy, frontend model
response = client.models.generate_content(
    model="gemini-2.0-flash",
    contents=optimized_prompt
)
memory.ingest_message("assistant", response.text)
