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
- You write markdown files with OKF frontmatter declaring
type,workspace,tokens, andrefs. wkp indexembeds 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).wkp search "topic"runs hybrid retrieval: vector similarity + BM25 keyword search merged via Reciprocal Rank Fusion, filtered by tier and token budget.wkp materialize --tier 0pre-assembles the always-on context into.wkp/tier0.md.- 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(downloadsall-MiniLM-L6-v2on first index run, ~22MB)networkx(graph analytics — only loaded bywkp 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6bd06ad71cbf91d67cb501ef22d09fa68bb21e911fa265328f1b60c3a454ff6
|
|
| MD5 |
efaa52c93bf41881dfe2a9f78cd5d0c7
|
|
| BLAKE2b-256 |
fa5fd688ed6d593b666783f558bf98a709822ecbcd397b8e92d4d9aa2a142b5b
|
Provenance
The following attestation bundles were made for agent_wkp-0.1.0.tar.gz:
Publisher:
publish.yml on williamcaban/agent-wkp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_wkp-0.1.0.tar.gz -
Subject digest:
d6bd06ad71cbf91d67cb501ef22d09fa68bb21e911fa265328f1b60c3a454ff6 - Sigstore transparency entry: 2692996115
- Sigstore integration time:
-
Permalink:
williamcaban/agent-wkp@4e7192543408afc9b12c5d396113876e426e122d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/williamcaban
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4e7192543408afc9b12c5d396113876e426e122d -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13e95f5e61ef7b489fdf3ef81807bcce75af3fb2131a18f26f242517e5f4c907
|
|
| MD5 |
1a708a67782e081f5845208528f4f698
|
|
| BLAKE2b-256 |
f458f9f0bc9c4f50701d7b49c9fa288b7d1bd7099efc7c54be625cb71d2e9081
|
Provenance
The following attestation bundles were made for agent_wkp-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on williamcaban/agent-wkp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_wkp-0.1.0-py3-none-any.whl -
Subject digest:
13e95f5e61ef7b489fdf3ef81807bcce75af3fb2131a18f26f242517e5f4c907 - Sigstore transparency entry: 2692996139
- Sigstore integration time:
-
Permalink:
williamcaban/agent-wkp@4e7192543408afc9b12c5d396113876e426e122d -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/williamcaban
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4e7192543408afc9b12c5d396113876e426e122d -
Trigger Event:
push
-
Statement type: