# Reflexio

> An open-source AI agent self-improvement harness that turns user corrections and interaction signals into persistent behavioral changes agents reuse across future runs.

Reflexio is an AI agent self-improvement harness built by MEMODB PTE. LTD. and published under the Apache 2.0 license. It connects to any AI agent via a Python SDK, REST API, or CLI, then closes a continuous learning loop: the agent publishes what happened, Reflexio extracts what to do differently, and the next run reads those lessons back — without retraining the underlying model.

## What It Is

Reflexio sits between an AI agent and its users, capturing every correction, failed path, and successful outcome as structured behavioral guidance. Unlike traditional memory tools that store what users said, Reflexio extracts *how the agent should act differently* — producing user profiles, user playbooks, and agent playbooks that are retrieved at inference time and injected into the prompt. Every learned behavior is auditable, scored against a control response, and revocable: rejecting a playbook immediately drops it from retrieval.

## How the Learning Loop Works

The core loop has four steps:

- **Publish**: The agent sends completed conversation turns to Reflexio after each interaction.
- **Extract**: Background workers run configurable extractors to pull profiles (per-user facts) and playbooks (behavioral rules) from corrections and outcomes.
- **Aggregate**: User-level playbooks that recur across multiple users are clustered and promoted to shared agent playbooks through an approval workflow.
- **Retrieve**: Before the agent responds, a single semantic search call returns ranked profiles and playbooks, which are injected into the system prompt.

The GitHub README reports that on 4 of 5 real knowledge-work tasks from OpenAI's public GDPVal benchmark, Reflexio cut a median −81% planning steps and −72% tokens on a Hermes agent running `minimax/MiniMax-M2.7` — measured against a warm baseline where the same agent had already learned from itself.

## Architecture and Deployment Model

Reflexio ships as a FastAPI backend with a Python SDK (`reflexio-ai` on PyPI) and a first-class CLI. The backend runs locally with SQLite storage out of the box, or connects to Supabase/Postgres for production use. Deployment options range from fully managed cloud (Reflexio Cloud) to BYOK (bring your own model provider keys), your own database, or a fully self-hosted BYOC deployment inside AWS, GCP, or Azure. The API surface the agent calls never changes across deployment modes.

Key architectural components include:
- **ProfileGenerationService** — extracts and versions per-user facts
- **PlaybookGenerationService** — extracts user playbooks, aggregates to agent playbooks
- **GroupEvaluationScheduler** — samples sessions (5% by default) for head-to-head evaluation
- **UnifiedSearchService** — hybrid vector + full-text search across all entity types in parallel, benchmarked at ~57 ms p50 / ~73 ms p95 across ~3,000 indexed rows on Apple Silicon

## Multi-Provider LLM and Framework Support

Reflexio is powered by LiteLLM and supports OpenAI, Azure OpenAI, Anthropic, Google Gemini, OpenRouter, MiniMax, DeepSeek, DashScope/Qwen, Zhipu AI/GLM, Moonshot/Kimi, xAI/Grok, and custom OpenAI-compatible endpoints. Framework integrations include:

- **OpenClaw** — native integration with the OpenClaw agent framework
- **mem0** — drop-in wrapper (`from reflexio.mem0 import MemoryClient`) that publishes to Reflexio alongside mem0 with no other code changes
- **Coding agents** — a portable `integrate-reflexio` skill for Codex, Claude Code, and Cursor that inspects an existing agent lifecycle and wires the Reflexio loop automatically

## Current Status

The repository was created in April 2026 and last pushed in September 2026, showing active development. The project carries 367 GitHub stars and 48 forks. The core platform is open source under Apache 2.0; a managed cloud offering with enhanced retrieval and continuous RL-driven improvement is available alongside the self-hosted path. The PyPI package is `reflexio-ai` and requires Python ≥ 3.12.

## Features
- User profile extraction from interactions
- Agent playbook extraction and aggregation
- Expert learning from human-provided ideal responses
- Session-level agent success evaluation
- Per-turn head-to-head shadow comparison
- Hybrid vector + full-text semantic search
- Approval workflow for agent playbooks
- Auditable and revocable learned behaviors
- Conflict resolution and de-duplication of learning signals
- BYOK model provider support
- BYOC self-hosted deployment
- Data export and erasure on request
- CLI for end-to-end loop testing
- Python SDK with minimal integration footprint
- mem0 drop-in wrapper integration
- Portable integrate-reflexio skill for coding agents
- Configurable extraction windows and strides
- Multi-provider LLM support via LiteLLM
- Evaluation dashboard with impact metrics
- Local SQLite and Supabase/Postgres storage backends

## Integrations
OpenAI, Azure OpenAI, Anthropic, Google Gemini, OpenRouter, MiniMax, DeepSeek, DashScope/Qwen, Zhipu AI/GLM, Moonshot/Kimi, xAI/Grok, mem0, OpenClaw, Codex, Claude Code, Cursor, Supabase, PostgreSQL, SQLite, LiteLLM

## Platforms
WINDOWS, LINUX, WEB, API, DEVELOPER_SDK, CLI

## Pricing
Open Source, Free tier available

## Links
- Website: https://www.reflexio.ai
- Documentation: https://www.reflexio.ai/docs
- Repository: https://github.com/ReflexioAI/reflexio
- EveryDev.ai: https://www.everydev.ai/tools/reflexio
