Strata
Knowledge Base as Code. Strata turns large reference documents — standards, regulations, internal specs, policy manuals, engineering handbooks, compliance frameworks — into a layered knowledge base that humans review in a pull request and AI agents query for exactly the passage they need.
Nothing about Strata is tied to a domain or an industry. If your organisation has documents too long for anyone to re-read on demand, Strata is for those documents.
- No database, no runtime state. The knowledge base is
.yamland.mdfiles in Git. Review it the way you review code. - Tables are never rewritten by an AI. They are machine-copied from the source and automatically diffed against the original on every build.
- A query loads a slice, not a corpus. Typical lookups return 1–4 sections instead of a whole document — a few sections' worth of tokens per call, not the document's.
pip install "strata-kb[ingest]"
mkdir my-hub && cd my-hub && git init
kb init --kind hub
kb ingest source/employee-handbook.pdf --id hr-handbook --tags hr,policy
kb summarize # needs the claude or copilot CLI on your PATH
kb build
git add -A && git commit -m "kb: hr-handbook" # publish ships committed content
kb publish # a hub searches only federation/, so it publishes to itself first
kb query "parental leave eligibility"
Contents
The problem · The method · Install · Repo kinds · The lifecycle · Command reference · Guides · Development · License
The problem
Long reference documents share two traits, whatever the field:
| Trait | Why it hurts |
|---|---|
| Hundreds of pages | Nobody — human or model — re-reads the whole thing to answer one question. Pasting it into a prompt is slow and expensive; doing it on every question is untenable. |
| Detail that matters character-by-character | Codes, field lengths, thresholds, identifiers. Summarise those into prose and a single miscopied character silently becomes wrong data in whatever depends on it. |
Strata attacks both at once:
- Split by section, so a lookup lands on the right passage instead of the right document.
- Tables never pass through a model. Code extracts them verbatim, and
kb builddiffs every summary table against the original. A table that was altered, dropped, duplicated, reordered or invented fails the build and blocks the change — in both directions.
The method
Four layers: L0 → L1 → L2 → L3
Think of a library lookup stack, coarse to fine: department catalogue → table of contents → chapter summary → full text.
| Layer | Name | What it holds | Typical size |
|---|---|---|---|
| L0 | Master catalogue | One index.yaml listing every document: id, revision, tags, one-line description |
Hundreds of tokens for the whole store |
| L1 | Detailed contents | Per document, a _manifest.yaml listing each section: id, title, a ≤ 25-word summary, status |
Tens of thousands of tokens per document |
| L2 | Condensed summary | .md — prose condensed to ~20–30% of the original, in the source document's language, tables kept verbatim |
Medium |
| L3 | Full original | .raw.md — full extracted text, nothing cut |
Largest |
A lookup walks L0 (which documents matter) → L1 (which sections matter — almost free) → L2 (condensed content of the few relevant sections). L3 is opened only when absolute fidelity is required. That is where the token saving comes from: the model never loads what it did not need.
The non-negotiable rule: an AI may write the prose around tables. The
tables themselves are always machine-copied at both L2 and L3, and
kb build verifies it. Whitespace and alignment differences are normalised
(NBSP, tabs, trailing spaces, :-- alignment rows); everything else is compared
byte for byte.
Every section has a stable id (5.129, ch2), which is also the citation key.
A section is pending until a model writes its summary, summarized after that,
and reviewed once a human approves it; approval is a human act and is never
automatic. A ticket or spec cites sections in a
kb-context block pinned to the hub's commit, so kb resolve can tell you
later whether what it cited still says the same thing.
Federation: hub, child, ba, dev
One repo holds the shared, searchable copy; the others author or consume.
outside documents product code
| |
+----v----+ +----v----+
| child | | dev |
+----+----+ +----+----+
| kb publish | kb publish (CI: kb ci-publish)
+--------------+ +-------------+
v v
+---------+ read-only
| hub |<------------------ ba
+----+----+ (publishes its own plan)
|
kb query / MCP / Web UI
Each repo publishes its full .kb/ to the hub's federation/<repo-id>/ through a
pull request. Merging that pull request is the single gate that makes content
searchable. Nothing is searched except what the hub holds. The system design
(data model, trust model, topologies) is in the
architecture document.
Install
Needs Python 3.11+ and Git.
pip install strata-kb # kb CLI + MCP server
pip install "strata-kb[ingest]" # + PDF ingestion (docling)
pip install "strata-kb[embed]" # + semantic search
pip install "strata-kb[server]" # + hosting the shared HTTP server and Web UI login
pip install "strata-kb[code]" # + routes, pages, jobs, symbols in `kb code-ingest`
pip install "strata-kb[s3]" # + S3 asset offloading
From source:
git clone https://github.com/vuonglq01685/strata-kb
cd strata-kb
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[ingest,dev]"
kb --help
- Git 2.31 or newer on any machine whose hub URL carries a credential (the
https://x-access-token:<token>@github.com/org/repo.gitshape the CI templates pass inSTRATA_KB_HUB). Older git ignores the mechanism that hides the token and every hub command fails with git's own authentication error. An sshhub:, a publichttps://hub and a local-directoryhub:carry no credential and need no particular version. .kb/config.yamlis committed, so never put a token inhub:— pass a credentialed URL inSTRATA_KB_HUB, which overrides the file.- Docker.
kb docker-setup(or/kb-docker-setup) prepares a hub (.env, a generatedSTRATA_KB_HTTP_TOKEN,docker compose up -d) or a child (pulls the ingest image, so ingestion needs no local Python). Abaordevrepo needs neither. Release tags pushghcr.io/vuonglq01685/strata-kb. The hub's HTTP auth is a bearer token plus local hub accounts — no OAuth or SSO. That is adequate for an internal network and not ready for the public internet. - Windows is fully supported (every release is gated on
windows-latest).kbforces UTF-8 on stdin/stdout/stderr on every OS. If a deep KB tree hits the 260-character path limit, rungit config --global core.longpaths trueand enableLongPathsEnabledin the registry.
Repo kinds
kb init --kind hub|child|ba|dev scaffolds a repo for its role and records
kind: in .kb/config.yaml. Re-running kb init refreshes the scaffold and
keeps your .kb/config.yaml and .kb/index.yaml.
| Kind | Purpose | Guide |
|---|---|---|
hub |
Central knowledge hub. Hosts federation/ — the single source of truth for search — and runs the shared HTTP MCP server and Web UI. Merging a hub PR is the gate that makes content searchable. |
Hub |
child |
Authoring repo. Ingest documents → summarize → kb build → kb publish to the hub. Does not host the shared service. |
Child |
ba |
Requirements repo. Drafts Dev-ready tickets and mission plans grounded in the KB, gated by CI Definition-of-Ready checks. Publishes only its own plan (<repo_id>-plan). |
BA |
dev |
Product code repo. Implements BA tickets grounded in the KB through an agent workflow. Publishes knowledge about its own code (-code generated, -svc curated), never outside documents. |
Dev |
Slash commands are scaffolded for Claude Code, GitHub Copilot and Cursor, and the
MCP client is wired in .mcp.json and .cursor/mcp.json; each guide lists them
and the few that differ per assistant.
ba and dev repos can run unattended (/kb-auto, kb auto). Read the
Automation modes section of the BA or
Dev guide before turning it on: an unattended run
merges its own pull requests with the rights of your gh login (--admin changes
nothing) and publishes with no human review, and it needs branch protection on
main first; see Automation modes, Security.
The lifecycle
source PDF ──kb ingest──► sections, L3 full text, L2/L1 scaffold (machine, no AI)
──kb l3 ─────► L3 checked against the PDF (human, if flagged)
──kb summarize► L2 prose + L1 one-liners (AI fills the blanks)
──kb build───► gate: nothing pending, tables match, quality rules
── pull request ► a subject-matter expert reads the diff (human)
──kb publish─► pull request on the hub; merge = live
──kb query / MCP / Web UI──► the 1–4 most relevant sections, with citations
Machines do the mechanical work (sectioning, verbatim tables, integrity checks).
AI does the language work (summaries). Humans sign off. No step skips the check
that follows it. Source documents never go into Git: they live under source/,
which kb init ignores.
Command reference
Every command takes --help. One line per command or group; the guides give the
daily use.
| Command | Purpose |
|---|---|
kb init |
Scaffold or refresh a repo of a given kind |
kb docker-setup |
Prepare Docker (hub: .env, token, start; child: pull image) |
kb mcp-setup |
Write the hub's HTTP MCP credentials into a reader repo's .env and verify them |
kb ingest |
Parse a PDF, split into sections, write L3, scaffold L1/L2 |
kb l3 |
report, confirm, lint and fix (on, off, pages, apply): check L3 against the PDF and record review |
kb summarize |
Fill pending L1/L2 summaries via a headless LLM CLI |
kb authored |
Tag a hub doc authored (markdown is the master; kb ingest refuses it) |
kb status |
List sections still pending summarization |
kb build |
Validate the store: no blanks, table integrity, quality rules, token counts |
kb approve |
Mark sections reviewed |
kb query |
Hybrid search (keyword + semantic, RRF-fused) → L2 within a budget |
kb get |
Fetch exactly one section at a chosen level |
kb stats |
Token size per level, per document |
kb tags |
List every tag published on the hub |
kb publish |
Mirror .kb/ to the hub's federation/<repo-id>/ through a pull request |
kb ci-publish |
Publish from a repo's GitHub Actions job via OIDC, no secrets |
kb reindex |
Rebuild federation/index.yaml when it has drifted |
kb doctor |
Store and hub health check; --context also checks citation staleness |
kb context new |
Generate a kb-context citation block pinned at the hub's commit |
kb resolve |
Resolve a kb-context block: sections at the pinned version, plus freshness |
kb diff |
Diff sections between the worktree and a git rev |
kb assets |
Asset store operations on a hub: migrate, verify |
kb code-sync |
Hub only: scan, issue, baseline, run — hub docs that name code that changed |
kb user |
Hub only: accounts for the Web UI (add, passwd, role, remove, list, hash) |
kb code-ingest |
Extract a codebase's structure into .kb/<repo_id>-code/ — deterministic, no LLM |
kb svc note |
Record which tickets touched which service in <repo_id>-svc |
kb plan-ingest |
Build .kb/<repo_id>-plan/ from the ready missions and tickets of a ba repo |
kb plan waves |
Dependency waves of a dev plan: which tasks can run in parallel |
kb ticket |
BA ticket gates and tools: kb ticket lint (Definition of Ready), kb ticket check (SA grounding), kb ticket stale, kb ticket export, kb ticket tidy, and kb ticket fetch (a published ticket by id, for a Dev) |
kb mission |
lint (Definition of Ready) and next (which story is done, ready, draft or blocked) for BA mission plans |
kb impl tidy |
Move flat docs/impl/<id>-* files into docs/impl/<id>/ |
kb pr |
lint, find, view, open, checks, merge, edit: pull requests over the GitHub REST API (what the skills call instead of gh pr) |
kb claim |
Ticket claims on the hub for several Devs on one repo: take, update, release, list |
kb auto |
Full-auto mode for ba and dev repos: on, off, status, run, wait |
kb usage |
Token and cost measurement: kb usage ingest-transcript, kb usage note, kb usage report |
Exit codes: 0 success, 1 error (including a misconfiguration), 2 citation
stale (and a few command-specific results, listed in the guides), 3 a ticket
claim taken or lost.
Guides
One guide per role: who it is for, first-time setup, daily work, automation modes, troubleshooting and a short reference appendix. English first, then Vietnamese; the PDFs are rendered from the same sources.
| Role | Markdown (EN) | Markdown (VI) | PDF (EN) | PDF (VI) |
|---|---|---|---|---|
| Hub operator | guide-hub.en.md | guide-hub.vi.md | ||
| Child author | guide-child.en.md | guide-child.vi.md | ||
| Business analyst | guide-ba.en.md | guide-ba.vi.md | ||
| Developer | guide-dev.en.md | guide-dev.vi.md |
- Architecture — data model, components, federation, trust model, topologies: EN · VI · PDF EN · PDF VI
- Running the hub as a remote MCP server: docs/deploy-remote-mcp.md
- Release notes: CHANGELOG.md
Development
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[ingest,dev]"
./scripts/gate.sh # the CI tiers on one interpreter: lint, tests, package checks
pytest # tests only
The gate runs ruff check ., ruff format --check . and pyright (T0), the
tests (T1), then builds the wheel and sdist and checks them (T2), runs the real
user journey from the installed wheel (T3) and the compatibility suites (T4). CI
adds ubuntu × Python 3.11/3.12/3.13 and windows-latest.
To release: bump the version in pyproject.toml, run uv lock, commit, and once
CI on main is green for that commit push the tag vX.Y.Z. The release re-runs
the artifact tiers and the image build and publishes to PyPI and GHCR only when
everything is green. To rebuild the PDFs:
uv run --extra docs python docs/src/build_pdf.py.
License
Apache-2.0. See LICENSE.
Metadata
Release files for strata-kb 1.34.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| strata_kb-1.34.2.tar.gz | 2.6 MB | With provenance | Details for strata_kb-1.34.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| strata_kb-1.34.2-py3-none-any.whl | Python 3 | none | any | Details for strata_kb-1.34.2-py3-none-any.whl |
Total release size: 5.5 MB
Release files / strata_kb-1.34.2.tar.gz
| Download URL | strata_kb-1.34.2.tar.gz |
|---|---|
| Size | 2.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94e6e65a314263b101d53b10a7b9e5ac42bcb278898b83b4ada414b2b656cae9
|
|
BLAKE2b-256 checksum How to use checksums |
fd12f4d482f33f390449b9ffd0b378150dff53fc1d7999e76e8e997a7a846675
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / strata_kb-1.34.2-py3-none-any.whl
| Download URL | strata_kb-1.34.2-py3-none-any.whl |
|---|---|
| Size | 2.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
298dcf0116e5454785f136f3cdc475a0927eb86ca683aba0dbc67b4443ffd719
|
|
BLAKE2b-256 checksum How to use checksums |
adc475e900e91d8984ec8b5d2ea50bcee536ff66f7853ad433b8e5536c26f80a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logSecurity for strata-kb 1.34.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for strata_kb-1.34.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.