Skip to main content

A portable, agent-first knowledge base. One directory = one KB.

Project description

pinakes

A portable, agent-first knowledge base. One directory = one KB.

The Pinakes were Callimachus's catalogue of the Library of Alexandria — the first known index of a body of knowledge.

License Python

📖 Guide · CLI · Manifest · Design · What ships today


The idea

A knowledge base is a plain directory you can read, edit, diff, commit and hand to someone:

my-kb/
├── pinakes.toml              # manifest: sources, models, chunking, budget
├── docs/                     # SOURCE OF TRUTH — your files, unmodified
│   ├── paper.pdf
│   ├── paper.pdf.pnk.yaml    # sidecar: stable ID, tags, links, provenance
│   ├── notes.md
│   └── notes.md.pnk.yaml
└── .pinakes/                 # generated, disposable, gitignored
    └── index.db              # SQLite: chunks, FTS5, vectors, links

Your documents and their metadata are the truth. The index is derived state that can always be rebuilt. That split is what makes a KB both a reproducible recipe and a directory you can move.

What makes it different

It costs nothing to run. Retrieval is BM25 (SQLite FTS5) + local embeddings + local reranking, fused and scored entirely on your CPU. No API key is needed to search, and re-indexing is free — so there is never a cost reason not to improve your chunking or swap your embedding model. That the free path stays free is enforced by a CI gate, not by a promise.

Reasoning is the caller's, not the KB's. The MCP tools return ranked, cited evidence. pinakes_search → pinakes_get → pinakes_search is a plan-retrieve-read-refine loop, and your agent already runs it in its own context. Multi-hop reasoning falls out of composable tools rather than a second agent framework.

Money is opt-in and bounded by design. Every paid path is an explicit, enumerated entry point, and a pre-call reservation makes a hard cap a real ceiling rather than an after-the-fact report. See what is actually built.

KBs link to each other. Sidecars carry pnk://<kb-ulid>/<doc-ulid> references, so links survive renames, moves, and being shared with someone else.

Its limits are published, not hidden. No vector tier is sublinear; cross-KB answers are capped by how well your KBs are linked; and the confidence heuristic's measured false-confidence rate is 0.25 — one no-answer question in four still gets a confident answer. A heuristic whose cost is unmeasured is worse than one whose cost is known.

Quickstart

Not yet on PyPI — install from source:

uv add "pinakes[st] @ git+https://github.com/lucagattoni/Pinakes"     # default backend
uv add "pinakes[light] @ git+https://github.com/lucagattoni/Pinakes"  # fastembed, no torch
pnk init my-kb                        # stamp a KB
pnk sync                              # index what changed (git-hook friendly)
pnk search "hybrid retrieval"         # free: BM25 + vector + rerank
pnk doctor                            # environment, coherence, orphans, link coverage

uvx --from "git+https://github.com/lucagattoni/Pinakes" pnk serve     # MCP server

⚠️ Two things pnk init cannot know, each needing one manifest edit: on a [light] install set provider = "fastembed", and to index PDFs add "**/*.pdf" to [sources] include. Both are in the Guide.

Full guide — PDFs, filters, calibration, git hooks, MCP setup, troubleshooting.

Development

make install    # sync the dev environment (the light extra — CI's minimum leg)
make check      # every gate, stopping at the first failure — run before every commit
make demo       # index the synthetic demo KB
make eval       # golden-set evaluation against the recorded baseline
make corpus     # regenerate the synthetic PDF corpus in place
make pdf-eval   # extraction-quality baseline + floor-drift check (needs [pdf])
make help       # all targets

Every target wraps the command CI actually runs, so green locally means green on the runner. Note that make check formats Python inside Markdown fences too — a docs-only change can fail it.

Conventions and the increment workflow are in CLAUDE.md; how the docs are organised — and which file to edit when you land a feature — is in docs/README.md.

Your data stays yours

This repository contains the engine only. Real knowledge bases live outside it. The sole KB here is a small synthetic corpus used for tests and retrieval benchmarking, and the only other committed content is tests/pdf-corpus/ — PDFs generated from scratch by a committed script to exercise hard extraction cases. Neither was harvested from anywhere; no real-world document is committed here.

pnk init ships a .gitignore covering .pinakes/, so your index — and your spend ledger — never leaves your machine. Note that publishing a KB repo publishes docs/ and every sidecar: titles, tags and provenance URLs included.

Licence

Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pinakes-0.2.2.tar.gz (852.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pinakes-0.2.2-py3-none-any.whl (147.6 kB view details)

Uploaded Python 3

File details

Details for the file pinakes-0.2.2.tar.gz.

File metadata

  • Download URL: pinakes-0.2.2.tar.gz
  • Upload date:
  • Size: 852.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.33 {"installer":{"name":"uv","version":"0.11.33","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pinakes-0.2.2.tar.gz
Algorithm Hash digest
SHA256 692c09c2ab8fa69928dd1cdc71107e4257362839f63a5364fd28288cc68244b9
MD5 ca09b166d9b5dcaaaf2293fa43406783
BLAKE2b-256 29ca4dc681ba047b8714d29c731b9922d6c57721870c85de236cddbb931ab157

See more details on using hashes here.

File details

Details for the file pinakes-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: pinakes-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 147.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.33 {"installer":{"name":"uv","version":"0.11.33","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pinakes-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d1f3e268b37c2de2a63345d9a1aa198e149d499ca5b6ab56571f0d16e86cf894
MD5 03726e4e0a9c2f0cd12e2b60f8af3f7a
BLAKE2b-256 4e007def0e2164eef41fadcb033a9aaf413abd480379345236b18ed8a83928c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page