Skip to main content
Glama

punt-quarry

Local semantic search for AI agents and humans.

License CI PyPI Python Working Backwards

Quarry indexes documents in 20+ formats, embeds them with a local ONNX model (snowflake-arctic-embed-m-v1.5), stores the vectors in LanceDB, and serves semantic search to Claude Code, Claude Desktop, and the command line. Everything runs locally — no API keys, no cloud accounts. One quarryd daemon per machine loads the model once; the CLI, the MCP (Model Context Protocol) server, and the Claude Code hooks are thin clients that send requests to it. Scripts can also call its HTTP API directly.

Platforms: macOS (Apple Silicon), Linux

Intel macOS is not supported by any install path: two of quarry's dependencies (lancedb and onnxruntime) publish no Intel macOS wheel.

Quick Start

Install the CLI, the daemon, the MCP server, and the Claude Code plugin:

curl -fsSL https://raw.githubusercontent.com/punt-labs/quarry/6a4b2c1/install.sh | sh

Restart Claude Code. At each session start, quarry registers your current project and starts indexing it in the background. See What It Looks Like for example searches.

Install the package:

uv tool install punt-quarry

Set up the daemon, TLS certificates, and MCP config:

quarry install

Check health:

quarry doctor

Install the formula. It puts the quarry, quarryd, and quarry-hook commands on PATH:

brew install punt-labs/tap/quarry

Download the model and set up the TLS certificates and the daemon service:

quarry install

To add the Claude Code plugin too, add the Punt Labs marketplace:

claude plugin marketplace add punt-labs/claude-plugins

Then install the plugin:

claude plugin install quarry@punt-labs

Use one install method per machine. Mixing Homebrew with the curl | sh installer puts two copies of quarry on PATH, and whichever comes first wins. Run which quarry (or command -v quarry) to see which one that is.

For other coding agents (Codex, Cursor), a plain terminal, or Claude Code setups where policy blocks plugin installs, --no-plugin installs everything except the Claude Code marketplace and plugin:

curl -fsSL https://raw.githubusercontent.com/punt-labs/quarry/6a4b2c1/install.sh | sh -s -- --no-plugin

Where a flag cannot be passed (CI templating a bare curl … | sh), set QUARRY_NO_PLUGIN=1 — honored only when exactly 1:

curl -fsSL https://raw.githubusercontent.com/punt-labs/quarry/6a4b2c1/install.sh | QUARRY_NO_PLUGIN=1 sh

Everything else runs unchanged. Use the CLI, or point your tool at the quarry mcp server (MCP over standard input/output); both talk to the quarryd daemon. Re-run the installer without --no-plugin to add the plugin later.

Download the installer:

curl -fsSL https://raw.githubusercontent.com/punt-labs/quarry/6a4b2c1/install.sh -o install.sh

Check its digest (shasum -a 256 install.sh on macOS):

sha256sum install.sh

Read it:

cat install.sh

Run it:

sh install.sh

Related MCP server: claude-context-local

Features

  • 20+ formats — PDFs (with OCR for scanned pages), source code (AST-aware splitting), spreadsheets, presentations, HTML, Markdown, LaTeX, DOCX, images.

  • Semantic search — retrieval is by meaning, not keyword. A query about "margins" finds passages about profitability even if they never use that word.

  • One daemon, thin clients — a single quarryd process loads the embedding model once and serves the CLI, the MCP server, and the Claude Code hooks over a versioned REST API. It caps its embedding and database compute threads at two each to limit CPU load.

  • Automatic knowledge capture — quarry enable sets up per-project file sync, web-fetch and session-transcript capture, and per-agent memory. Secrets and personal information are scrubbed from captures before they are stored, and captures are kept separate from the code index. See Knowledge Capture.

  • Named databases — separate databases, each with its own index and directory registrations, for example to keep work and personal documents apart. quarry use <name> sets the default database and --db <name> picks one for a single command. Each daemon serves one database, and the installed service serves the default; see Managing the Daemon to run another.

  • Remote server — run the daemon on a GPU host and connect from any Mac or Linux client over TLS. See ADVANCED-SETUP.md.

What It Looks Like

Sync a folder:

> /ingest ~/Documents/research

▶  Registering /Users/you/Documents/research as 'research' (task a1b2c3)
▶  Syncing all registrations (task d4e5f6)

Search by meaning:

> /find "what were the Q3 revenue figures"

▶ [report.pdf p.12 | text/.pdf] (similarity: 0.4521)
  Third quarter revenue reached $142M, up 18% year-over-year,
  driven primarily by expansion in the enterprise segment.
  Gross margins improved to 71% from 68% in Q2.

Commands

Slash Commands (Claude Code)

Command

What it does

/ingest <source>

Ingest a URL, or register and sync a local file or directory

/remember <name>

Ingest inline text under a document name

/learn <lesson> [as <name>]

Save a short lesson (up to 500 characters) that ranks higher in search results

/find <query>

Semantic search; questions get answers with citations, keywords get raw results

/explain <topic>

Search and write an explanation of a document or topic

/source <claim>

Find which document a claim comes from

/quarry [sub]

Manage: status (default), sync, collections, databases, registrations, use <name>, enable, disable, missions sync

/help

List quarry's slash commands

MCP Tools

Tool

Purpose

find

Semantic search with filters

show

Document metadata or page text

list

Documents, collections, databases, registrations

status

Database statistics

insights

Local search statistics: query volume, latency, empty-result rate, and result breakdowns

ingest / remember

Index a URL, or inline text

learn

Save a short lesson that ranks higher in search results

register_directory / deregister_directory

Manage a synced directory

sync_all_registrations

Re-index all registered directories

delete

Remove a document or collection

use

Switch the active database

missions_sync

Save each completed ethos mission round to the worker agent's memory

CLI

Command

What it does

quarry find "<query>"

Hybrid search (meaning plus keywords)

quarry ingest <url>

Index a webpage (for local files and directories, use quarry register)

quarry remember --name <name>

Index text read from standard input

quarry learn "<lesson>"

Save a short lesson (up to 500 characters) that ranks higher in search results

quarry show <document>

Show a document's metadata, or one page's text with --page

quarry list documents

List indexed documents (also collections, databases, registrations)

quarry delete <name>

Delete a document, or a collection with --type collection

quarry register <dir>

Watch a directory and keep its index current

quarry deregister <collection>

Stop watching a directory and remove its data (--keep-data keeps it)

quarry sync

Re-index registered directories

quarry enable / quarry disable

Turn project indexing and capture on or off for a repo

quarry missions sync

Save each completed ethos mission round to memory-<worker> (--mission, --dry-run, --force)

quarry use <name>

Set the default database

quarry status

Show document and chunk counts, storage size, and model

quarry insights

Local search statistics: query volume, latency, empty-result rate, and result breakdowns

quarry optimize

Compact the database and rebuild its indexes

quarry doctor

Health check

quarry install

Set up the daemon service, TLS certificates, and MCP config

quarry uninstall

Remove the daemon service (its launchd or systemd unit)

quarry login <host> --api-key <token>

Connect to a remote server; the server's certificate is pinned on first connection

quarry logout

Disconnect and go back to the local daemon

quarry version

Print the installed version

Run quarry --help for the full list, including captures, skills, backfill-sessions, remote, and mcp, and quarry <command> --help for each command's options.

ethos is the Punt Labs tool that gives agents named identities and runs delegated tasks ("missions"); the missions sync commands only matter if you use it.

A registered directory is indexed automatically: quarry watches it for changes and re-indexes as you work (honoring .gitignore and a root-level .quarryignore, so directories such as node_modules or .venv are skipped), with a periodic sweep that catches anything the live watch misses. You rarely need quarry sync. quarry list registrations shows each directory's watch state (watched, degraded, or scan-only); a scan-only directory still stays current through the sweep.

To set up a repo, run quarry enable in it. No other setup is needed. quarry enable also lets Claude call quarry without asking each time: it adds quarry's allow rules to that project's .claude/settings.json (admin and destructive commands still prompt), and quarry disable removes them. Driving quarry from an agent — memory tagging and agent handles — is covered in AGENTS.md.

Upgrading from an older version? Earlier quarry wrote the same allow rules to your user-global ~/.claude/settings.json at session start; quarry disable does not remove those. Delete them by hand if you want quarry to prompt again everywhere.

Setup

Quarry works with zero configuration. For environment variables and running the daemon on a remote or GPU host, see ADVANCED-SETUP.md.

Claude Desktop

The .mcpb bundle connects Claude Desktop to the same local index that the CLI and Claude Code use. It contains no search engine of its own: it registers the quarry mcp client, which talks to the same quarryd daemon. Install quarry first; the bundle does not work on its own.

quarry install configures Claude Desktop automatically. To add it by hand instead, download punt-quarry.mcpb and double-click it.

Uploaded files in Claude Desktop live in a sandbox quarry cannot read — use remember for that content, or give ingest a local path.

Knowledge Capture

The Claude Code plugin runs hooks (commands Claude Code runs on session events) that capture knowledge automatically:

Hook

What it captures

SessionStart

Registers the current project and starts indexing it in the background

PostToolUse (WebFetch)

Ingests URLs Claude fetches during research. If the URL was already captured, the hook tells Claude to use find instead of fetching it again

PostToolUse (WebSearch)

Files a scrubbed digest of search results under <repo>-captures

PostToolUse (Read)

Opt-in (off by default): captures prose files Claude reads from outside any registered directory, skipping likely secret files, non-prose file types, and large files

PreCompact

Captures the session transcript before context compaction discards it

SessionEnd

Captures the full session transcript on every close, even a short session that never compacts

SubagentStop

Captures a subagent's transcript separately from the parent session's. If the subagent has an ethos identity, its final report is also saved to that agent's memory (memory-<handle>)

If a hook fails, Claude Code continues normally. Each hook is independently toggleable in .punt-labs/quarry/config.md.

Captures are scrubbed (secrets, paths, emails, hostnames) before they are written to disk. The scrub matches known patterns and may miss some secrets. If the scrubber itself fails, the capture is not written. Content you add yourself with ingest or remember is not scrubbed. See DES-036 in DESIGN.md.

Private capture repo. Scrubbed session capture files live in the checkout's ignored .punt-labs/local/quarry/captures/ directory (PLD-2, PLD-4). You can opt in to a private companion repo per project (<repo> → private <repo>-quarry) so that scrubbed captures are pushed there instead of living in the public repo's history. Set it up with quarry captures init. See DES-039 in DESIGN.md and AGENTS.md.

Search telemetry. The daemon uses punt-observe to record typed search statistics to the private local file ~/.punt-labs/quarry/telemetry.db. Search text, result content, and filters are not stored. Insights groups empty queries, agents, and collections by per-install salted hashes and shows aggregate latency, counts, and hit-age bands. The shared store retains 90 days across all Quarry databases; the old per-database retention setting no longer applies. Set PUNT_TELEMETRY=off, QUARRY_TELEMETRY=off, or TELEMETRY_ENABLED=false in the daemon's environment and restart it to disable capture. Quarry does not opt in to network export.

Upgrading starts a fresh recall history. Quarry never reads or migrates the old per-database telemetry.db under the data root. Old files may contain scrubbed query text and are not automatically deleted. To discard them, stop any older Quarry daemons, then delete only the old per-database data/<db>/telemetry.db and its -wal and -shm sidecars for each affected database. If you set a custom data root, look there instead. The new installation-wide ~/.punt-labs/quarry/telemetry.db is separate.

Managing the Daemon

The CLI, MCP server, hooks, daemon, and detached sync dispatcher write diagnostics to ~/.punt-labs/quarry/logs/quarry.log. The shared sink redacts and rotates that private file. QUARRY_LOG_LEVEL adjusts terminal verbosity, not the file threshold. If the daemon cannot open its private log and you are using launchd or Homebrew services, stop the service and run quarryd in a terminal to see the startup diagnostic.

quarry install registers quarryd as a per-user service that starts at login and restarts if it crashes (launchd on macOS, systemd on Linux).

To upgrade, re-run the Quick Start installer. It installs the tested dependency versions, runs quarry install, restarts the daemon, and fails if the new daemon does not start and report ready. ADVANCED-SETUP.md lists the steps.

After upgrading some other way (for example uv tool install --force), restart the service yourself. A running daemon keeps using the old version until it restarts.

macOS:

launchctl kickstart -k gui/$(id -u)/com.punt-labs.quarry

Linux:

systemctl --user restart quarry

quarry doctor confirms the daemon is running and ready.

To use a second named database while the service runs, start another daemon for it in the foreground. --port 0 picks a free port, and --tls matches the installed service:

quarryd --db work --port 0 --tls

Then pass the same name to each command, for example quarry --db work find "<query>".

quarryd also serves a REST API for scripts and other integrations. See ADVANCED-SETUP.md.

Documentation

Architecture (PDF) | Advanced Setup | Design (ADR log) | Agents | Changelog | Contributing

License

MIT

Available Tools

14 tools
deleteA

Use to remove stale or wrong content before re-ingesting it.

Returns immediately — the daemon removes chunks in the background.

Args: name: Document filename or collection name to delete. kind: What to delete — "document" or "collection". collection: Optional collection scope (only for kind="document").

Returns: A deletion task identifier, not confirmation that the data is gone. Input refusals, daemon errors, and unexpected failures return Error: ... text. Connection failures include recovery guidance.

Inputs: name (required), kind, collection. Returns: result

deregister_directoryA

Use to stop tracking a directory and optionally retain indexed data.

Use to stop tracking a directory — keep its indexed data with keep_data=True, or purge it.

Returns the removed-file count synchronously; the chunk purge runs as a background task. An unknown collection surfaces as an error, not a removal confirmation.

Args: collection: Collection name to deregister. keep_data: If true, keep indexed data in LanceDB.

Returns: The removed registry-file count and the accepted chunk-purge task ID; the purge may still be running. Input refusals, daemon errors, and unexpected failures return Error: ... text. Connection failures include recovery guidance.

Inputs: collection (required), keep_data. Returns: result

findA

Use find before web research or answering rationale questions.

Use find before WebSearch or WebFetch for research, or before answering a why/how/what-did-we-decide question. Prefer grep for symbol and value lookups; prefer find for meaning.

Combines vector similarity and BM25 full-text search via Reciprocal Rank Fusion (RRF) for better recall on both meaning and exact terms.

Args: query: Natural language search query. limit: Maximum number of results (default 10, max 50). document_filter: Optional exact document name to filter by. collection: Optional collection name to search within. page_type: Optional content type filter (text, code, spreadsheet, etc.). source_format: Optional source format filter (.pdf, .py, .xlsx, etc.). agent_handle: Your own handle to recall only your memories (e.g. "rmh"); leave empty to search everything. memory_type: Optional memory type filter (fact, observation, lesson, etc.).

Returns: Ranked excerpts with document, page, collection, and relevance metadata; an empty result report means no indexed content matched. Input refusals, daemon errors, and unexpected failures return Error: ... text. Connection failures include recovery guidance.

Inputs: query (required), limit, page_type, collection, +4 more. Returns: result

ingestA

Use when you have a URL to add to the knowledge base.

Use when you have a URL to add to the knowledge base — a doc, an article, a spec.

remember = a specific durable fact, ingest = a URL, learn = a distilled lesson that gets retrieval preference.

Fetches a URL with smart sitemap discovery and single-page fallback. For local files and directories, use register_directory + sync_all_registrations — the daemon owns the filesystem, so there is no in-process file loader here.

Returns immediately — the daemon indexes in the background.

Args: source: HTTP(S) URL to ingest. overwrite: If true, replace a stored URL; if false, skip it. collection: Collection name. Auto-derived if empty.

Returns: An accepted ingest task ID, not a completed indexing report. Input refusals, daemon errors, and unexpected failures return Error: ... text. Connection failures include recovery guidance.

Inputs: source (required), overwrite, collection. Returns: result

insightsA

Use to read your own recall stats: query volume, latency, recall mix.

Returns: Formatted query volume, latency, and recall-mix statistics. Input refusals, daemon errors, and unexpected failures return Error: ... text. Connection failures include recovery guidance.

Inputs: no named parameters. Returns: result

learnA

Use learn to save a distilled lesson for preferential retrieval.

Use learn to save a distilled lesson that should outrank ordinary results for related queries -- a rule, a convention, a "do it this way" insight, not a one-off fact.

remember = a specific durable fact, ingest = a URL, learn = a distilled lesson that gets retrieval preference.

The daemon scrubs secrets/PII before indexing, same as remember. Lessons are capped at 500 characters -- use remember for anything longer. Returns immediately -- the daemon indexes in the background.

Args: lesson: The distilled lesson text (<= 500 chars). topic: Optional domain tag (e.g. "testing", "release-process"). name: Optional user-visible slug for later reference.

Returns: The admission status and task ID; lesson indexing runs in the background. Input refusals, daemon errors, and unexpected failures return Error: ... text. Connection failures include recovery guidance.

Inputs: lesson (required), name, topic. Returns: result

listA

Use to see what's already indexed before ingesting it again.

Args: kind: What to list — "documents", "collections", "databases", or "registrations". collection: Optional collection filter (only for kind="documents").

Returns: A formatted catalog of the selected kind, optionally collection-filtered. Input refusals, daemon errors, and unexpected failures return Error: ... text. Connection failures include recovery guidance.

Inputs: kind (required), collection. Returns: result

missions_syncA

Use after ethos mission close to file frozen rounds as memory.

Use after ethos mission close to file each frozen round into the worker's memory (memory-<worker>, type observation).

Reads this repo's .punt-labs/ethos/missions/ tree; safe to re-run — a round already filed is skipped, and a name held by another checkout is reported as an error, never overwritten.

Args: mission: Sync one mission id only; empty means every mission. dry_run: List what would be filed and post nothing. force: Re-file rounds the daemon already holds (matching key only).

Returns: A report of filed/skipped rounds, scan errors (including missing missions), and per-round daemon failures; dry-run reports proposed writes only. Uncaught errors return Error: ...; connection errors add recovery guidance.

Inputs: force, dry_run, mission. Returns: result

register_directoryA

Use to track a local directory so future changes sync automatically.

Returns immediately — the daemon records the registration in the background.

Args: directory: Absolute path to the directory. collection: Collection name. Uses the directory name, sanitized, if empty.

Returns: The resolved registration directory, collection, and accepted task ID; indexing continues in the background. Input refusals, daemon errors, and unexpected failures return Error: ... text. Connection failures include recovery guidance.

Inputs: directory (required), collection. Returns: result

rememberA

Use remember to save durable facts and observations across sessions.

Use remember when you learn something durable — a decision, a gotcha, a non-obvious fact, a procedure — so it survives context compaction.

remember = a specific durable fact, ingest = a URL, learn = a distilled lesson that gets retrieval preference.

Call it at these five moments, not at the end and not never: a non-obvious root cause or gotcha (fact); a ratified design decision with its reason (fact); a repeatable how-to (procedure); a judgement you will revisit (opinion); and once before submitting a mission result (observation). Always pass your own agent_handle — the daemon cannot infer it, and a subagent's working directory resolves to the repo's leader, not to you.

The daemon scrubs secrets/PII before indexing. Returns immediately — the daemon indexes in the background.

Args: content: The text content to remember. document_name: Name for the document (e.g., 'notes.md'). overwrite: If true, replace existing data for this document. If false, an existing document of this name is left untouched. collection: Collection name. Leave empty to route by agent_handle — memory-<handle> when a handle is given, else default. format_hint: Format hint: 'auto', 'plain', 'markdown', 'latex'. agent_handle: Your own handle (e.g. "rmh") — the memory is filed under it and recalled by it. memory_type: Memory classification: fact, observation, opinion, procedure. 'lesson' is reserved for the learn tool. summary: One-line summary of the content.

Returns: The document name and accepted task ID; indexing runs in the background. Input refusals, daemon errors, and unexpected failures return Error: ... text. Connection failures include recovery guidance.

Inputs: content (required), document_name (required), summary, overwrite, +4 more. Returns: result

showA

Use to read a specific page, or to check whether a document is indexed.

Use to read a specific page, or to check whether a document is already indexed.

Without page_number: shows document metadata (pages, chunks, collection). With page_number: shows the full text for that page.

Args: document_name: Document filename (e.g., 'report.pdf'). page_number: Page number (1-indexed); nonpositive means metadata only. collection: Optional collection scope.

Returns: Document metadata (nonpositive page_number) or full page text. Missing documents/pages return ordinary not-found text, not an Error: result. Other failures return Error: ...; connection errors add recovery guidance.

Inputs: document_name (required), collection, page_number. Returns: result

statusA

Use to check how much is indexed before you search or ingest.

Returns: Formatted counts, storage size, and engine/model status for the target. Input refusals, daemon errors, and unexpected failures return Error: ... text. Connection failures include recovery guidance.

Inputs: no named parameters. Returns: result

sync_all_registrationsA

Use after registering a new directory or changing tracked files.

Use after registering a new directory, or when tracked files changed outside quarry's own writes.

Returns immediately — the daemon runs the sync in the background.

Returns: An accepted sync task ID, not a completed synchronization report. Input refusals, daemon errors, and unexpected failures return Error: ... text. Connection failures include recovery guidance.

Inputs: no named parameters. Returns: result

useA

Use to point every other tool at a different named database.

All tools (find, ingest, sync, etc.) will target the selected database's daemon until changed again. Use list(kind="databases") to see the database the daemon is fixed to.

Only selects among LOCAL databases: while a remote target (QUARRY_URL or a 'quarry login') is active, the remote daemon is fixed to its own database and this has no effect.

Args: name: Database name (e.g., 'coding', 'work'). Use 'default' for the default database.

Returns: The prior and selected local database and its resolved storage path; the selection affects only this MCP process, not the persisted default. Input refusals, daemon errors, and unexpected failures return Error: ... text. Connection failures include recovery guidance.

Inputs: name (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 14 tools

    Disambiguation4/5

    The write-side trio (remember/learn/ingest) is explicitly disambiguated in each description, and find vs show vs list vs status are separated by purpose. Residual overlap: delete(kind="collection") and deregister_directory(keep_data=False) both purge a collection, and list/status both surface catalog state.

    Naming Consistency4/5

    Mostly a verb-first convention (remember, find, show, ingest, learn, delete, list, use) with compound verb_noun snake_case for the directory lifecycle tools. Minor deviations: missions_sync puts the noun first, and status/insights are noun-named admin tools.

    Tool Count4/5

    14 tools sits comfortably in the healthy band and each maps to a real operation in a memory/knowledge-base lifecycle. Slightly heavy at the margins: insights adds little beyond status, and missions_sync is a narrow, environment-specific workflow tool.

    Completeness4/5

    Strong lifecycle coverage: write (remember/learn), ingest, search/read (find/show), catalog (list/status), removal (delete), directory registration and sync, plus database selection. Minor gaps: no collection create/rename, no document update short of overwrite-and-reingest, and no reindex/export path.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables Claude Desktop to search and query personal document collections (PDF, Word, Markdown, text) using semantic search and conversational AI with full context preservation across exchanges.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides Claude Code with local semantic search and indexing of your codebase using AST-aware chunking and hybrid search, enabling deep code understanding without sending data to the cloud.
      56 PyPI
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides local-first, cross-session memory for Claude Code, enabling semantic search across past sessions to retrieve procedures, decisions, or answers without exposing secrets.
      Apache 2.0