canwhite/Krebs
An agent focused on attention management
What it solves
Krebs is a self-hosted AI gateway designed to manage long-term interactions and complex tasks without losing track of the original goal. It solves the problem of "context drift" and token limit exhaustion in LLMs by implementing aggressive context compression, persistent memory, and autonomous sub-agents.
How it works
Krebs acts as a middle layer between the user and LLMs (like DeepSeek or Claude). It uses a multi-layered approach to maintain coherence:
- Attention Management: It monitors token usage and triggers different compression layers (summarization, pruning, and collapse) as the conversation grows.
- Memory & RAG: It uses a two-phase memory system (consolidating summaries into a
MEMORY.mdfile) and BM25-based RAG to retrieve relevant information from past sessions. - Goal Constraint: The system extracts the core goal of a conversation and uses hybrid scoring to detect when the agent has drifted off-task, injecting correction messages automatically.
- Self-Verification: After responding, the agent verifies its own output against the original task and retries if it detects misalignment.
- Execution Environment: It provides a WASM-based sandbox for write commands to ensure security while allowing read-only shell access.
- Sub-agents: The main agent can spawn autonomous sub-agents to handle specific tasks, manage a task queue, and schedule recurring jobs.
Who it’s for
It is for developers and power users who want a self-hosted AI assistant that can handle complex, multi-turn dialogues and autonomous task execution with high reliability and minimal context loss.
Highlights
- Multi-layer Context Compression: Automatic pruning and summarization based on token thresholds.
- Goal Drift Detection: Active monitoring and correction of conversation drift.
- Autonomous Sub-agents: Ability to launch a fleet of agents for parallel task management.
- WASM Sandbox: Secure isolation for file-system write operations.
- Extensible Tooling: Support for custom Lua scripts and skill files.
- Session Persistence: Full session history management via SQLite and file storage.
Related
- Project
- Project
- Project
- Project
- Project