Skip to main content
Glama
minipeek

minipeek

Official
by mixpeek
README.md
<p align="center"><img src="docs/header.svg" alt="minipeek: Mixpeek on your laptop" width="100%"></p>

<p align="center">
  <a href="https://github.com/mixpeek/minipeek/actions/workflows/test.yml"><img src="https://github.com/mixpeek/minipeek/actions/workflows/test.yml/badge.svg" alt="tests"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue" alt="Apache-2.0"></a>
  <img src="https://img.shields.io/badge/python-3.10%2B-blue" alt="Python 3.10+">
  <img src="https://img.shields.io/badge/stages-38%2F38-22c55e" alt="38 of 38 Mixpeek retriever stages">
</p>

**Iterate fast with minipeek, then scale with Mixpeek.**

**minipeek** is a single-process [Mixpeek](https://mixpeek.com) for your laptop. Break video, images and text into
layers, search across them with multi-stage retrievers, cluster and classify, then measure and tune it all against
your own labels, in seconds per try. When it works, take the same manifest and the same .mvs files to Mixpeek, which
runs them on your whole corpus: distributed extraction, hosted models, and serving at production scale.

It speaks Mixpeek's API, reads and writes Mixpeek's namespace manifests, runs every one of Mixpeek's 38 retriever
stages, and stores every namespace in [.mvs](https://github.com/mixpeek/mvs-format), the file format Mixpeek's
vector store writes. There is no Ray, no database and no queue: one Python process, and ffmpeg for video.

```bash
pip install "minipeek[server] @ git+https://github.com/mixpeek/minipeek"
minipeek --example          # API, UI and MCP on http://127.0.0.1:8088, with a small example namespace
```

### Tell an agent what you want, get the best decomposition

Point an agent at a folder of samples and say what you want to find. minipeek's `explore` tool does the rest in
one call:
1. It reads the samples: text, images, videos, or CSV and JSON rows, with each file's same-name `.json` or `.txt` as
   its description.
2. It builds decompositions and scores each one on your example searches.
3. It keeps changing one thing at a time (the model, the layers, how videos are cut, how layers are fused) until F1
   and F2 stop improving.
4. It tunes the winner, checks it on held-out examples, and saves it.

The Experiments page shows every step as it runs.

```bash
claude mcp add minipeek -- minipeek mcp
claude "Use minipeek to make the furniture photos in ./samples searchable by description."
```

What it tries: another text model, each media file's own words as a second layer, how videos are cut (whole, 2 s,
5 s, 10 s, scenes, or two of them together), how layers are fused, BM25 keyword search beside the vectors (Mixpeek's
`lexical` search), and a cross-encoder reranker (`bge-reranker-v2-m3`, Mixpeek's default, on ONNX). It tries the
cheapest changes first: a retriever change reuses the layers already built, and only a new layer is extracted.

**Criteria** say what best means: `--criteria "favor recall, top 10, under 200 ms"`, or as JSON
`{"metric": "ndcg10", "k": 10, "max_query_ms": 200}`. The metric is one of f2, f1, ndcg10, recall, precision or mrr.
A decomposition over the latency budget isn't eligible. Plain words about what counts as relevant ("a note counts
only if it gives advice someone could act on") turn on an LLM judge when there are no examples. It writes the
searches from your goal and samples, judges what each decomposition returns, and every decomposition is scored on
the same judgments (`GEMINI_API_KEY` or `OPENAI_API_KEY`; calls and cost are in the result).

**Signals from Mixpeek** make the next round's examples. Export the namespace's collections from Mixpeek as .mvs
(`POST /v1/collections/{id}/export` with `"export_format": "mvs"`, one tar per collection), unpack them into one
folder, and pass it: `minipeek explore GOAL ./samples --examples ./export`, or `minipeek import-signals ./export
--out examples.json` to see them first. Clicks, purchases and feedback in `mxp_retriever_interactions`, and labels in
`mxp_document_annotations`, become searches and the files they should find, by the same rules Mixpeek's evaluations
use. `--examples mixpeek://NAMESPACE` reads them from a live namespace instead (`MIXPEEK_API_KEY`, and `MIXPEEK_API_URL`
when it isn't api.mixpeek.com).

An `examples.json` in the folder (a search and the files it should find) is picked up on its own. Without one,
each sample is checked against its own words and the result says so. On five kinds of samples, each agent run
was one `explore` call and a finished answer
([`docs/agent-trials-2026-12-03.json`](docs/agent-trials-2026-12-03.json)):

| samples | what won | F2: baseline → winner | agent |
|---|---|---|---|
| 53 product photos with listings | photos (SigLIP) plus their listing text, dbsf fusion | 0.550 → 0.632 (held-out 0.527 → 0.644) | Sonnet 33 s, $0.05; Haiku 27 s, $0.003 |
| 8 videos | 2 s segments instead of whole videos | 0.696 → 0.857 | Sonnet 20 s, $0.06 |
| a CSV catalog pointing at images | images plus each row's text | 0.389 → 0.598 | Sonnet 43 s, $0.06 |
| 12 text notes | MiniLM over e5 | 0.497 → 0.530 | Sonnet 14 s, $0.05 |

<p align="center"><img src="docs/explore-dark.png" alt="The Experiments page: the best decomposition, F2 by round, and every decomposition tried with its scores, latency, documents and size" width="100%"></p>

### Watch an agent build one

A Claude agent, given 12 notes and 14 labelled questions and minipeek's MCP tools, builds a namespace step by step:
a bucket, an e5 collection with the notes seeded, a retriever, an evaluation, a second model's collection to compare,
a topic filter, then a tuning run. The designer follows it live. Each resource appears as it is made, and each
candidate the tuner scores shows in purple with its F2. The run took 3 minutes and plays here at 6× speed
([MP4](docs/agent-flow.mp4)). It ran with the hash embedder, so the agent rightly reported that its two models tied.

<p align="center"><img src="docs/agent-flow.gif" alt="An agent builds and tunes a namespace over MCP while the minipeek designer follows it live, at 6x speed" width="100%"></p>

### The flow editor

<p align="center"><img src="docs/designer-dark.png" alt="The designer: the manifest on the left, the namespace drawn on the right, a tuning run's candidates in purple, and the activity feed" width="100%"></p>

### The run page

<p align="center"><img src="docs/run-light.png" alt="The run page: a retriever's stages with counts and timings, and its results as cards" width="100%"></p>

## Why

Deciding how to decompose your data is an experiment. Do you search whole videos, 3-second segments, scenes, or
windows inside scenes? Which embedding? Does a filter on a field help, or a hop from the segment to its parent?
Answering means trying many variants and scoring each one, which is slow and costly when every variant is a
platform build.

minipeek runs that loop on your machine in seconds, on a sample. When the winner is clear, scale it with Mixpeek:
export it as a namespace manifest and apply it there to build the full corpus, or push the documents you already
built. minipeek is the place to find the right manifest. Mixpeek is where it runs on everything, for every user.

## The loop

```bash
minipeek apply examples/notes.manifest.yaml                           # buckets, collections, retrievers, seed, extraction
minipeek search notes-demo search "a sleepy dog"                      # run a retriever
minipeek eval notes-demo search examples/notes.labels.json            # precision, recall, F1, F2, NDCG@10, per family
minipeek tune notes-demo search examples/notes.labels.json --save-as search_tuned
minipeek export notes-demo -o tuned.manifest.yaml                     # a manifest Mixpeek applies unchanged
minipeek push notes-demo --api https://api.mixpeek.com                # apply it to Mixpeek (MIXPEEK_API_KEY)
minipeek push notes-demo --api https://api.mixpeek.com --documents    # or ship the documents, vectors included
minipeek export notes-demo --mvs ./share                              # or the .mvs files and the manifest
minipeek import-mvs ./share --api https://api.mixpeek.com             # into Mixpeek, from the files alone
```

`tune` searches variants of a retriever built from what the namespace has: each layer's vectors alone, every layer
fused, k and score cutoffs, one result per source object, and a hop to a parent layer. It ranks them by F2 minus half
its standard error on two thirds of your queries, then confirms the winner on the held-out third. The winner is saved
only if it beats the baseline on held-out queries and no family of queries gets worse.

Labels are a Mixpeek evaluation dataset, so the same file posts to `POST /v1/retrievers/evaluations/datasets`:

```json
{"dataset_name": "notes-v1", "relevance_field": "note_id",
 "queries": [{"query_id": "q01", "query_input": {"query": "a lazy dog"}, "relevant_documents": ["n01"], "family": "pets"}]}
```

## Decompose in layers

A collection's source is a bucket or another collection, so layers chain. This one cuts each ad at its scene
changes, then cuts every scene into 1-second windows that keep the ad's clock and their lineage to it:

```yaml
collections:
  - name: ad_scenes
    source: {type: bucket, bucket: ads}
    feature_extractor:
      feature_extractor_name: multimodal_extractor
      version: v1
      input_mappings: {video: video}
      parameters: {split_method: scene, scene_detection_threshold: 0.3, run_multimodal_embedding: true}
  - name: scene_windows
    source: {type: collection, collection: ad_scenes}
    feature_extractor:
      feature_extractor_name: multimodal_extractor
      version: v1
      parameters: {split_method: time, time_split_interval: 1, run_multimodal_embedding: true}
retrievers:
  - name: windows_to_ads
    collections: [scene_windows]
    stages:
      - {stage_name: find, stage_id: feature_search, parameters: {searches: [{feature_uri: "mixpeek://multimodal_extractor@v1/vertex_multimodal_embedding", query: {input_mode: text, value: "{{INPUT.query}}"}, top_k: 50}]}}
      - {stage_name: late_only, stage_id: attribute_filter, parameters: {field: start_time, operator: gte, value: 3}}
      - {stage_name: one_per_ad, stage_id: group_by, parameters: {group_by_field: root_object_id, max_per_group: 1}}
      - {stage_name: to_ad, stage_id: traverse_edge, parameters: {follow: lineage, target_collection_id: ad_whole, include_evidence: true}}
```

Split methods are `time`, `scene`, `whole` and `windows`, as in Mixpeek. Descriptions and structured fields
(`description_prompt`, `response_shape`) go to your own model provider.

## Parity with Mixpeek, measured

`scripts/parity.py` applies one manifest to minipeek and to a Mixpeek API, runs the same queries on both, and
compares the rankings. On Mixpeek's standalone image, with the e5 model both sides run:

| leg | what moves | queries with the same top 5, in order | largest score difference |
|---|---|---|---|
| manifest | minipeek's exported manifest, applied to Mixpeek, which extracts the seed itself | 8 of 8 | 1.8e-7 |
| documents | minipeek's documents, vectors and lineage, written with Mixpeek's BYO upsert | 8 of 8 | 1.8e-7 |
| mvs | the .mvs files minipeek wrote, imported into Mixpeek from the files alone (`minipeek import-mvs`) | 8 of 8 | 1.8e-7 |
| back | Mixpeek's own export of the manifest leg's namespace, applied to minipeek | 8 of 8 | 0 |

The score differences are float32 rounding. The run's record is [`docs/parity-2026-12-03.json`](docs/parity-2026-12-03.json). Mixpeek's CI also checks minipeek's routes against its OpenAPI spec, its
example manifests against its manifest model, and its stage catalog against the stage registry
([`minipeek/contract/`](minipeek/contract)).

## Fast and small

### On real data, with real models, end to end

`scripts/lifecycle.py` runs the whole loop on [`examples/products`](examples/products): 38 products, 53 product
images and 6 regions cut from room shots, from Amazon Berkeley Objects (CC BY 4.0), with 53 labelled queries. It
ran on a MacBook (Apple Silicon, native) with the models Mixpeek runs, via ONNX:

| step | what | result |
|---|---|---|
| inputs | three tiers (product text, images, regions) and the queries graded by product, a third held out | 35 tuning, 18 held-out |
| baseline | product name, e5, one tier | tuning F2 0.512 |
| iterate | the whole listing as text; MiniLM instead of e5; images (SigLIP) as a second tier; regions as a third; max fusion | best: listing + images, F2 0.559 |
| select | `tune` on the winner, then held-out against the baseline | F2 0.544 → 0.610, F1 0.385 → 0.446: pass |
| scale | the winner exported as .mvs + manifest, imported into Mixpeek from the files, held-out queries run there | 18 of 18 queries with the same top 5 |

The whole run took 71 s: 27 s for every minipeek step on the laptop, and 41 s for the import and the 18 queries on Mixpeek. Repeating a variant is
nearly free: every text and image is embedded once per process and cached by content, so a second variant's apply
takes 0.2 to 0.9 s and a tune of about 30 candidates takes 3 s. Peak memory was 3.3 GB, nearly all of it the four
models' weights (e5-large alone is 1.7 GB). The run's record is
[`docs/lifecycle-2026-12-03.json`](docs/lifecycle-2026-12-03.json).

### Fast iteration, measured

Every explore round records its wall time per phase, CPU time, peak memory, and model work: embeddings computed
and served from cache, rerank pairs, LLM calls and their cost. The Experiments page shows them. Embeddings are cached
on disk by content, so a corpus is embedded once across runs, and a second explore in the same store waits for the
first.

`scripts/bench_fixed.py` runs one fixed set end to end (300 notes, 30 images, 4 videos, 30 searches, hash embedder)
and CI holds every change to it. Time to first result, time per iteration and peak memory can't get more than 50%
worse than [`docs/bench-baseline.json`](docs/bench-baseline.json). On this repo's last two versions, on a laptop:

| fixed set | before (1adf7f2) | now |
|---|---|---|
| decompositions tried | 23 | 28 |
| total | 28.36 s | 10.33 s |
| time per iteration | 1.233 s | 0.237 s |
| time to first result | not measured | 0.806 s |
| CPU | 19.06 s | 8.36 s |
| peak memory | 69.2 MB | 69.9 MB |

What made the difference:
- **Layer reuse.** One working namespace per run: a retriever change builds nothing, and a new layer extracts only
  itself.
- **Bulk seeding.** Objects are written in one commit, with the unique key indexed once instead of scanned per object.
- **Embeddings.** Texts are batched by length, models are warmed before latency is timed, and results are cached on
  disk.

### The loop itself

`scripts/profile_lifecycle.py` times one pass on 4 generated videos decomposed into 5 layers (76 documents, one layer
cut from another), then 120 queries, an eval, a tune, an export and a re-apply, with the hash embedder:

| phase | wall | processes started |
|---|---|---|
| decompose, 5 layers | 1.0 s | 28 ffmpeg |
| query | 0.22 ms each | 0 |
| eval | 2 ms | 0 |
| tune (two rounds of variants) | 24 ms | 0 |
| export | 6 ms | 0 |
| re-apply into a new namespace | 0.8 s | 20 ffmpeg |

Peak memory was 55 MB. Each video's frames are read in one ffmpeg pass for every segment of every layer, a child
layer reads its parent's span from the source video with nothing re-encoded, and a clip is cut only when a model
needs to watch it. 50,000 documents with 256-dimension vectors write in 1.0 s and reopen in 0.8 s.

## Every Mixpeek stage

All 38 stages run by their Mixpeek `stage_id` and parameter names:

| kind | stages | runs |
|---|---|---|
| filter | `feature_search` (rrf, dbsf, weighted, max fusion), `attribute_filter` (with `natural_language`), `llm_filter`, `query_expand`, `agent_search` | in process; model calls go to your provider |
| sort | `sort_attribute` (with `score_boosts`), `sort_relevance`, `score_normalize`, `mmr`, `rerank`, `maxsim_rerank` | in process; `rerank` uses a local cross-encoder when installed |
| reduce | `limit`, `score_threshold`, `group_by`, `deduplicate`, `sample`, `aggregate`, `temporal`, `moment_group`, `cluster`, `summarize` | in process (`cluster` beyond kmeans needs scikit-learn) |
| apply | `traverse_edge` (edges, lineage, time overlap), `unwind`, `json_transform`, `rag_prepare`, `cross_compare`, `document_enrich`, `llm_enrich`, `agentic_enrich`, `classify`, `taxonomy_enrich`, `code_execution` | in process; `code_execution` runs your code in a local subprocess with a timeout and memory limit |
| outside services | `api_call`, `web_scrape`, `external_web_search` (Exa), `external_reverse_image` (SerpAPI), `sql_lookup` (a local DuckDB or SQLite file) | call the service they name, with your key |
| marketplace | `subscribed_listing` | refused with a reason: a listing runs on Mixpeek |

A stage that can't run says why. It never answers with a quietly empty list.

## Any model, workflow or code as an extractor

Drop a file in `~/.minipeek/plugins` (or `MINIPEEK_PLUGINS`). A Mixpeek declarative plugin works unchanged:

```yaml
name: product_copy_embedder
version: v1
extends: text_extractor/v1
input: {field: content}
output: {vector_index: {model: all_minilm_l6_v2_v1}}
```

Or register any Python function:

```python
from minipeek import extractor

@extractor("caption_stats", "v1", vectors={"len_vec": 2})
def run(row, params, ctx):
    text = row.get("caption") or ""
    return [{"words": len(text.split()), "_vectors": {"len_vec": [len(text), len(text.split())]}}]
```

Its vectors are searchable as `mixpeek://caption_stats@v1/len_vec`, and a manifest names it like any extractor.

## Models

| feature URI output | local model |
|---|---|
| `multilingual_e5_large_instruct_v1` | `intfloat/multilingual-e5-large-instruct`, with Mixpeek's `query:` and `passage:` prefixes |
| `all_minilm_l6_v2_v1` | `sentence-transformers/all-MiniLM-L6-v2` |
| `google_siglip_base_v1` | `google/siglip-base-patch16-224` |
| `vertex_multimodal_embedding` | a stand-in: SigLIP base (Vertex is hosted, so its scores differ) |

Install them with the `models` extra (`pip install "minipeek[models] @ git+https://github.com/mixpeek/minipeek"`):
onnxruntime, tokenizers and Pillow, with no torch: about 110 MB of libraries, against about 1 GB for a torch install. The models' own ONNX exports are fetched
once from Hugging Face. They match the PyTorch models to within 3e-7, so vectors made here line up with Mixpeek's.
On Apple Silicon, use a native (arm64) Python: under Rosetta everything runs several times slower. With
`MINIPEEK_EMBEDDINGS=hash`, or without the model libraries, minipeek uses a deterministic hashing embedder: fast and
dependency free, good for wiring and tests, and no guide to quality. Every document records which embedder made its
vectors.

Descriptions, `llm_enrich` and the other model stages call your own provider: set `GEMINI_API_KEY`,
`OPENAI_API_KEY` or `ANTHROPIC_API_KEY`, or pass a stage's own `provider` and `api_key`.

## The files are .mvs

Every namespace is stored in [.mvs](https://github.com/mixpeek/mvs-format), the format of
[Mixpeek's vector store](https://docs.mixpeek.com/vector-store/storage-format), version 2: the same objects Mixpeek
keeps in your bucket, written byte for byte to its spec. Each write is one commit object, created once and never
changed:

```
~/.minipeek/mvs/ns/<namespace_id>/
  exists.json                     {"format": 1, "created_by": "minipeek 0.1.0"}
  wal/<desc(n)>.wal               commit n: MVS2WAL1 header, the ops, an xxh3-64 footer
~/.minipeek/namespaces/<name>/    the configuration Mixpeek keeps in its database: buckets, collections, retrievers
```

A document is one point, as on Mixpeek: its id is the `document_id`, its vectors are named by vector index, and its
payload is the document (`document_id`, `collection_id`, your fields at your paths, `metadata`, `_internal`). A
bucket's objects are points of its system collection, `mvs_bucket_<bucket_id>`. A write commits only what changed,
and a second process (an MCP agent, the CLI) reads the commits it hasn't seen, so everything sees one namespace.

Every push, minipeek's CI writes namespaces and checks each one twice with the open format's own tools from
[mvs-format](https://github.com/mixpeek/mvs-format). Its Rust validator (`mvs v2-fsck --strict`) must find nothing
wrong, and its Python reader must hold the same documents minipeek holds. That same Python reader puts any `.mvs`
namespace in DuckDB, Polars, pandas, DataFusion or Ray (`pip install mvs-format`; `mvs.duckdb("./plane")`).
Mixpeek's MVS shard compacts minipeek's namespaces with its own compactor into a chain entry, a generation and
its blobs. The shard's fsck is clean on the result, and mvs-format's validator finds nothing wrong
([`conformance/compacted`](https://github.com/mixpeek/mvs-format/tree/main/conformance/compacted)). So what minipeek
writes becomes the data Mixpeek serves, with nothing translated.
minipeek's commits are also checked against Mixpeek's own code: `tests/fixtures/mvs-shard/` holds commit objects the MVS
shard's encoder wrote, and the tests require minipeek to decode each one to the same ops and to encode the same ops
to the same bytes.

### SQL engines

`.mvs` is read by SQL engines in place, with no export and no second copy. The
[mvs-format](https://github.com/mixpeek/mvs-format) repo defines how each collection reads as a SQL table
([`spec/sql-tables.md`](https://github.com/mixpeek/mvs-format/blob/main/spec/sql-tables.md)). The table is named
after the collection, and its columns are `document_id`, `collection_id`, your fields at their own paths,
`metadata`, `_internal` and the vectors. A field the API exposes at `x.y` is the column `x.y`.

minipeek follows that mapping. `minipeek sql` hands each collection to DuckDB as that table, straight from the
`.mvs` files. The mvs-format roadmap adds a reader from `.mvs` to Arrow, so DuckDB, Polars and pandas can query a
bucket directly, then a DuckDB extension with vector search. mvs-format's validator also checks minipeek's
namespaces: `mvs v2-fsck` finds no failures.

```bash
minipeek sql notes-demo "select topic, count(*) from notes_e5 group by 1"   # each collection is a table
minipeek export notes-demo --mvs ./share                           # the .mvs files, plus the namespace manifest
minipeek import-mvs ./share --api https://api.mixpeek.com           # into Mixpeek, from the files alone
```

## The UI, the API, MCP

- **UI** at `/`. The designer draws the namespace from its manifest as you type. With Live on, it follows the
  namespace while anything changes it: an agent over MCP, the CLI or a tuning run. Each candidate a tuner scores
  appears beside the retrievers with its F2, and the activity feed lists every decision. The run page executes a
  retriever with a form built from its input schema, and shows each stage's counts and timing, the results with video
  clips at their time range, scores and evidence. Light and dark.
- **API** under `/v1`, on Mixpeek's paths and bodies with the `X-Namespace` header. Point a Mixpeek client at
  `http://127.0.0.1:8088`. The OpenAPI spec is at `/openapi.json`.
- **MCP**: `claude mcp add minipeek -- minipeek mcp`. Tools: `apply_manifest`, `describe_namespace`,
  `execute_retriever`, `evaluate_retriever`, `tune_retriever`, `export_manifest`, `list_documents`, `run_cluster`,
  `sql`, `explore`, `import_signals`, `experiments`. Give an agent your data and your questions, and watch it
  iterate in the designer.
- **Native API** for what Mixpeek doesn't have: `POST /minipeek/explore` (runs in the background; poll
  `GET /minipeek/explore/{run_id}`), `GET /minipeek/experiments` and `/minipeek/experiments/{id}`, and
  `POST /minipeek/signals/import`. They sit outside `/v1`, so a Mixpeek client sees only Mixpeek's paths.

```python
import minipeek

svc = minipeek.local()                                  # the same service, in process
svc.apply_manifest(open("examples/notes.manifest.yaml").read())
ns = svc.ns("notes-demo")
print(svc.execute(ns, "search", {"inputs": {"query": "baking bread"}})["documents"][0]["note_id"])
```

## Limits

- minipeek runs on one machine. It isn't a server for production traffic, and it has no auth: it binds to
  127.0.0.1.
- Search is exact (a matrix product), which is right up to a few hundred thousand vectors per collection.
- Transcription isn't run locally yet; a collection that asks for it records a warning on each document.
- A retriever's `planner` and the alert, trigger and webhook sections of a manifest are kept for Mixpeek and not run
  here; apply reports them as skipped.

## License

Apache-2.0. Made by [Mixpeek](https://mixpeek.com).