Metadata-Version: 2.4
Name: getflex
Version: 0.20.0
Summary: Knowledge engine for AI agents. Compile any data source into a queryable SQLite cell with embeddings, graph intelligence, and full-text search.
License-Expression: MIT
Project-URL: Homepage, https://getflex.dev
Project-URL: Repository, https://github.com/damiandelmas/flex
Project-URL: Paper, https://arxiv.org/abs/2603.22587
Keywords: vector-search,sql,embeddings,ai-agents,mcp,sqlite,knowledge-base,retrieval,semantic-search
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Database
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy<3,>=2.0
Requires-Dist: networkx<4,>=3.0
Requires-Dist: scikit-learn<2,>=1.5
Requires-Dist: onnxruntime<2,>=1.17
Requires-Dist: tokenizers<1,>=0.19
Requires-Dist: pyyaml<7,>=6.0
Requires-Dist: rich<14,>=13.0
Requires-Dist: tzlocal<6,>=5.0
Requires-Dist: mcp<2,>=1.0
Requires-Dist: starlette<1,>=0.49.1
Requires-Dist: uvicorn<1,>=0.30
Dynamic: license-file

<p align="center">
  <img src="assets/banner.png" alt="flex" width="100%">
</p>

# flex

[![PyPI](https://img.shields.io/pypi/v/getflex)](https://pypi.org/project/getflex/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/)

Vector and hybrid retrieval for structured data. Flex compiles any data source into a SQLite database with embeddings, knowledge graphs, and structured views. Installing flex registers an MCP endpoint with a single tool — the AI agent reads the schema and writes SQL against the database.

```bash
curl -sSL https://getflex.dev/install.sh | bash
```

## what's inside

- **[flexvec](https://github.com/damiandelmas/flexvec)** — SQL vector retrieval kernel. suppress, diversify, decay, trajectory — composable operations on the score array before selection. [paper](https://arxiv.org/abs/2603.22587).
- **MCP server** — a single read-only tool (`flex_search`). The agent discovers the schema at runtime and writes SQL.
- **worker** — a background service that detects new data and embeds it within seconds.
- **modules** — data source adapters. `claude_code` ships built-in.

## claude code

The claude_code module indexes your entire Claude Code session history — file lineage, decision archaeology, weekly digests. One install command.

```bash
curl -sSL https://getflex.dev/install.sh | bash -s -- claude-code
```

The installer scans existing sessions, embeds everything, starts a background worker, and registers the MCP server.

```
"Use flex: what's the history of worker.py?"
"Use flex: what did we build this week?"
"Use flex: how did we create the curl install script?"
```

→ [claude code docs](flex/modules/claude_code/)

## how it works

```
data source
       │
  [compile]  parse → chunks + metadata + embeddings
       │
       ▼
  SQLite database
       │
  [manage]  knowledge graph, fingerprints, project attribution
       │
  [MCP server]  read-only SQL surface
       │
       ▼
  AI agent writes SQL
```

Each database is a single `.db` file with the same schema — chunks, edges, enrichments, and views. The database describes itself; the agent discovers what's available at query time.

## local-first

```bash
ls ~/.flex/cells/
claude_code.db    284M

sqlite3 claude_code.db "SELECT COUNT(*) FROM sessions"
4547
```

Everything runs in-process. No external services, no cloud dependency.

---

```bash
curl -sSL https://getflex.dev/install.sh | bash
```

MIT · Python 3.12 · SQLite · [getflex.dev](https://getflex.dev) · [paper](https://arxiv.org/abs/2603.22587) · [x](https://x.com/damian_delmas)
