Skip to main content

WKP — Workspace Knowledge Protocol

Progressive disclosure knowledge index for AI agent workspaces. WKP turns a directory of markdown files into a searchable, tier-aware knowledge store that any agent harness can consume — without heavy infrastructure.

The problem it solves

Agent context windows are finite. Loading everything you know into every session wastes tokens, degrades model performance, and inflates cost. But loading nothing means the agent starts cold every time.

WKP enforces a four-tier disclosure model so the agent always has the minimum useful context, and can fetch more on demand:

Tier Token budget When it loads Mechanism
0 ≤4k Every session, guaranteed Static file injected by SessionStart hook
1 ≤8k Session start, topic-gated Lightweight index assembled by hook
2 ≤16k Mid-session, on demand wkp search or wkp context via Bash
3 Unlimited Explicit fetch only Direct file read

Tier 0 is structurally guaranteed — it is never retrieved, never skipped, and does not depend on any search system being available.

How it works

  1. You write markdown files with OKF frontmatter declaring type, workspace, tokens, and refs.
  2. wkp index embeds each file (CPU-only, all-MiniLM-L6-v2, ~40ms/file) and stores the embeddings alongside metadata and explicit graph edges in a single SQLite file (.wkp/index.db).
  3. wkp search "topic" runs hybrid retrieval: vector similarity + BM25 keyword search merged via Reciprocal Rank Fusion, filtered by tier and token budget.
  4. wkp materialize --tier 0 pre-assembles the always-on context into .wkp/tier0.md.
  5. A git post-commit hook keeps the index current — only re-embeds files whose git blob SHA changed.

Quickstart

pip install agent-wkp    # or: pipx install agent-wkp

cd your-workspace
wkp init           # creates .wkp/, adds to .gitignore
wkp index          # full index (downloads ~22MB model on first run)
wkp materialize --tier 0
wkp hooks --framework claude_code --post-commit

# Search from any agent or shell
wkp search "rfe creation workflow"
wkp context "evalhub adapter" --tier 2 --budget 8000
wkp traverse memory/my-file.md --depth 2
wkp analyze        # PageRank — suggests Tier 1 promotions

OKF Frontmatter

WKP reads OKF (Open Knowledge Frontmatter) from every markdown file:

---
title: Short descriptive title
type: reference          # project-state | knowledge | reference | feedback | skill
workspace: root          # root | eval-hub | trustworthy-ai | ...
visibility: shared       # shared | private
tokens: ~800             # rough token estimate (used for budget enforcement)
tags: [rfe, jira, pm]
refs:
  - ../other-workspace/knowledge/shared/related-file.md
updated: 2026-09-02
---

Type → tier mapping (enforced in the SQLite schema):

OKF type Tier
feedback 1
project-state 1
skill 1
knowledge 2
reference 2

Files without OKF frontmatter are indexed with type = NULL (treated as Tier 2).

Using with Claude Code

After wkp hooks --framework claude_code, the SessionStart hook injects Tier 0 context before your first message. For Tier 2 on-demand retrieval, call wkp from a skill:

# Inside a skill instruction or directly in Claude Code:
wkp search "nemo guardrails" --tier 2 --budget 6000
wkp context "rfe creation" --tier 2

No MCP tool quota is consumed. wkp runs as a Bash subprocess.

To wire the hook into Claude Code add to .claude/settings.local.json:

{
  "hooks": {
    "SessionStart": [
      { "command": "bash .claude/hooks/wkp-session-start.sh" }
    ]
  }
}

CLI reference

wkp init                          Initialise index in this workspace
wkp index [FILES]                 Index all (or specified) markdown files
  --force                         Re-embed even if git blob SHA unchanged
wkp search QUERY                  Hybrid semantic + keyword search
  --tier INT                      Max tier to include (default: 2)
  --budget INT                    Token budget (default: 8000)
  -k INT                          Max results (default: 10)
  --format [text|json|paths]
wkp context TOPIC                 Tier-aware context assembly
  --tier INT  --budget INT
wkp traverse PATH                 BFS traversal from PATH via explicit edges
  --depth INT  --budget INT
wkp materialize --tier [0|1]      Pre-assemble static context file
wkp hooks --framework claude_code Install SessionStart hook
  --post-commit                   Also install git post-commit hook
wkp analyze                       PageRank — suggest Tier 1 promotions
  --top INT                       Number of candidates (default: 10)

Requirements

  • Python 3.12+
  • sqlite-vec (vector similarity in SQLite — no server required)
  • sentence-transformers (downloads all-MiniLM-L6-v2 on first index run, ~22MB)
  • networkx (graph analytics — only loaded by wkp analyze)
  • Git (for blob SHA cache invalidation)

No database server. No Docker. The entire index is a single file: .wkp/index.db.

Scalability

WKP uses a VectorBackend protocol so the storage layer can be swapped without changing CLI or skill code:

Scale Backend Switch
<100k items SqliteVecBackend (default) none
100k+ or multi-agent ChromaDBBackend WKP_BACKEND=chromadb
Enterprise / RHOAI PGVectorBackend WKP_BACKEND=memoryhub

See docs/architecture.md for the full design.

License

Apache 2.0 — see LICENSE.

Download files

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

Source Distribution

agent_wkp-0.1.0.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

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

agent_wkp-0.1.0-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file agent_wkp-0.1.0.tar.gz.

File metadata

  • Download URL: agent_wkp-0.1.0.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agent_wkp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d6bd06ad71cbf91d67cb501ef22d09fa68bb21e911fa265328f1b60c3a454ff6
MD5 efaa52c93bf41881dfe2a9f78cd5d0c7
BLAKE2b-256 fa5fd688ed6d593b666783f558bf98a709822ecbcd397b8e92d4d9aa2a142b5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_wkp-0.1.0.tar.gz:

Publisher: publish.yml on williamcaban/agent-wkp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_wkp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agent_wkp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agent_wkp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 13e95f5e61ef7b489fdf3ef81807bcce75af3fb2131a18f26f242517e5f4c907
MD5 1a708a67782e081f5845208528f4f698
BLAKE2b-256 f458f9f0bc9c4f50701d7b49c9fa288b7d1bd7099efc7c54be625cb71d2e9081

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_wkp-0.1.0-py3-none-any.whl:

Publisher: publish.yml on williamcaban/agent-wkp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page