A crowdsourced knowledge management system for AI agent context
Project description
Knowledge Tree
Crowdsourced knowledge management for AI agent context.
npm for AI agent knowledge — crowdsourced Markdown packages that give your AI coding agents the context they need.
What is Knowledge Tree?
AI coding agents (Cursor, Claude Code, Copilot, etc.) are only as good as the context they have. Teams repeatedly explain the same conventions, patterns, and gotchas to their AI tools, project after project.
Knowledge Tree is a CLI tool (kt) that manages curated Markdown knowledge packages. Think npm install, but for knowledge. You point it at a registry — a git repo, a local directory, or an archive file — install what you need, and the content is automatically exported to your AI tool's native format (Claude Code skills, Roo Code rules) where agents can read it.
Registries are crowdsourced — teams curate packages for coding conventions, API patterns, framework guides, and more. Packages have dependencies, classification (evergreen vs seasonal), and a promotion pipeline from community contributions to curated packages.
Quick Start
# 1. Install
pip install knowledge-tree
# 2. Initialize from a registry (git repo, local directory, or archive)
kt init https://github.com/your-org/knowledge-registry.git
kt init ./my-registry/ # local directory
kt init ./registry-export.tar.gz # archive file (.tar.gz, .tgz, .zip)
# 3. Add more registries (optional — multi-registry support)
kt registry add https://github.com/your-org/internal-rules.git --name internal
# 4. Browse available packages
kt status --available
# 5. Install a package (dependencies auto-install)
kt add api-patterns
kt add company-standards --from internal # from a specific registry
# 6. See what you have
kt tree
🌳 Knowledge Tree
├── 🌲 base (installed) — Universal coding conventions
│ └── 🌲 git-conventions — Git commit message standards
└── 🍂 api-patterns (installed) — REST API patterns and auth
Packages are automatically exported to your AI tool's native format (Claude Code, Roo Code) when a format is configured. Share the registry URL with your team — each member runs kt init <url> to get the same packages.
Key Concepts
Packages — Named bundles of Markdown files with metadata (package.yaml). Each package lives in a directory with a name like base, git-conventions, or api-patterns. Packages can contain knowledge (context for AI agents) and commands (user-invocable slash commands like /do-thing).
Registries — Collections of packages with a registry.yaml index, a packages/ directory (curated), and a community/ directory (contributions). A registry can be a git repo (remote or local), a plain directory, or an archive file (.tar.gz, .tgz, .zip).
Evergreen vs Seasonal — Packages are classified as evergreen (stable conventions, long-term relevance) or seasonal (experimental, trend-based, may change). kt update notifies you about new evergreen packages.
Relationships — Three types:
parent— organizational grouping (shown inkt tree)depends_on— functional dependency (auto-installed withkt add)suggests— optional recommendations (shown inkt info)
Multi-Registry — Projects can use multiple registries simultaneously. Each registry gets a name (default: "default") and all storage is namespaced by registry. Use kt registry add/remove to manage registries and --from <registry> on kt add when a package exists in multiple registries.
Auto-Export — When a tool format is configured (during kt init or via kt config set export_format <format>), packages are automatically exported on install and re-exported on update. Supported formats:
claude-code— generates.claude/skills/<registry>/<package>/SKILL.mdwith YAML frontmatterroo-code— generates.roo/rules/kt-<registry>-<package>-<nn>-<file>.mdwith managed-by headers
Use kt update --format <name> or kt update --switch-tool to change formats (automatically unexports old format and re-exports in new format).
Zero-Clutter Storage — All KT state lives in a single .knowledge-tree/ directory (config at .knowledge-tree/kt.yaml, registry caches at .knowledge-tree/registries/<name>/). Every directory KT creates gets its own .gitignore — nothing is committed to your repo, and your project's .gitignore is never modified.
Commands
Core Commands
| Command | Description |
|---|---|
kt init [<url>] |
Initialize project; with URL, also adds registry and installs all packages |
kt add <package> [--from <registry>] |
Install a package and its dependencies (auto-exports) |
kt remove <package> |
Remove a package and clean up exports (warns about dependents) |
kt search <query> |
Search by name, description, or tags |
kt tree |
Show hierarchical package tree |
kt update [<package>] |
Pull latest, update installed packages (auto-re-exports) |
kt update --format <name> |
Switch export format (unexports old, re-exports new) |
kt update --switch-tool |
Interactively select a new export format |
kt status [--available] [--community] |
Show registries, packages, and project stats |
kt info <package> |
Detailed package information |
Registry Management
| Command | Description |
|---|---|
kt registry add <source> [--name <n>] |
Add a new registry (installs all packages, exports, applies templates) |
kt registry remove <name> [--force] |
Remove a registry (--force if packages are installed from it) |
Authoring Commands
| Command | Description |
|---|---|
kt author validate <path> [--all] |
Validate package structure |
kt author contribute <file> --name <n> |
Contribute to community (git registries only) |
kt author rebuild <path> |
Rebuild registry.yaml from packages directory |
Configuration
| Command | Description |
|---|---|
kt config get <key> |
Get a configuration value |
kt config set <key> <value> |
Set a configuration value |
kt config list |
List all configuration keys and values |
kt completion <shell> |
Output shell completion script (bash/zsh/fish) |
Run kt --help or kt <command> --help for full options.
How It Works
Initialization — kt init <source> detects the source type automatically and caches the registry in .knowledge-tree/registries/<name>/:
- Git repos — shallow-cloned; tracks commit refs
- Local directories — copied into the cache
- Archives — extracted (handles root-level and nested layouts, with path-traversal protection for tar files)
It creates .knowledge-tree/kt.yaml (config), installs all packages from the registry, exports them to your chosen tool format, and applies any registry templates. Use --name to set a custom registry name (default: "default"). Use --no-install to register the source without installing packages.
Multi-registry — Add more registries with kt registry add <source> --name <name>. All storage is namespaced by registry name under .knowledge-tree/registries/<name>/. If a package name exists in multiple registries, use kt add <package> --from <registry> to disambiguate.
Installing packages — kt add resolves the full dependency chain and auto-exports content directly from the registry cache to your configured tool format (e.g., .claude/skills/ for Claude Code, .roo/rules/ for Roo Code). There is no intermediate step — exporters read from cache and write to tool directories.
Updating — kt update refreshes the cache from all registries (git pull, directory re-copy, or archive re-extraction), re-exports all installed packages, and alerts you to new evergreen packages you haven't installed yet.
Contributing — kt author contribute is only available for git-backed registries. It creates a branch and prepares a merge request URL.
Creating a Registry
A registry is a directory (git repo, plain folder, or archive) with this structure:
your-registry/
registry.yaml
packages/
base/
package.yaml
safe-deletion.md
file-management.md
api-patterns/
package.yaml
rest-conventions.md
authentication.md
community/
CONTRIBUTING.md
Each package needs a package.yaml:
name: base
description: Universal coding conventions and safe practices
authors:
- Your Team
classification: evergreen
tags:
- core
- conventions
content:
- safe-deletion.md
- file-management.md
See workspace/sample-registry/ for a complete example. Use kt author validate to check package structure and kt author rebuild to regenerate the index.
For detailed guidance on registry creation including templates, content types, and advanced patterns like one-shot wire commands, see the Registry Authoring Guide in the project documentation.
To distribute a registry without git, you can tar/zip the directory and share the archive file — kt init registry.tar.gz will extract it automatically.
Contributing
- Knowledge packages — See
CONTRIBUTING.mdin your registry for contribution guidelines - The
kttool — Fork, branch, PR on GitHub - Test suite: 478 tests using real git repos (no mocking), 91% coverage
Development
git clone https://github.com/kBisla9/knowledge-tree.git
cd knowledge-tree
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest tests/ -v
Requires Python 3.10+.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
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 knowledge_tree-0.2.5.tar.gz.
File metadata
- Download URL: knowledge_tree-0.2.5.tar.gz
- Upload date:
- Size: 77.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e048b1e175cdaa6e56b9a26807204c302c58c97e2bfe0f4d818ab71799ca859
|
|
| MD5 |
6751286268536b003a48c7d9c5028d5f
|
|
| BLAKE2b-256 |
6f4bfc72ac2ec08a45c25486b28e0a92a36b3bcf7b7f841e16fe64cb28f42fdd
|
Provenance
The following attestation bundles were made for knowledge_tree-0.2.5.tar.gz:
Publisher:
publish.yml on kBisla9/knowledge-tree
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
knowledge_tree-0.2.5.tar.gz -
Subject digest:
9e048b1e175cdaa6e56b9a26807204c302c58c97e2bfe0f4d818ab71799ca859 - Sigstore transparency entry: 1095928147
- Sigstore integration time:
-
Permalink:
kBisla9/knowledge-tree@fbb4b785b80526238066d46f6be370cb2564e0b8 -
Branch / Tag:
refs/tags/v0.2.5 - Owner: https://github.com/kBisla9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fbb4b785b80526238066d46f6be370cb2564e0b8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file knowledge_tree-0.2.5-py3-none-any.whl.
File metadata
- Download URL: knowledge_tree-0.2.5-py3-none-any.whl
- Upload date:
- Size: 45.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2954e18c9ce94c3d09c3ccc349e13d893a810ca74ac1ccd75b25e8e42453db8b
|
|
| MD5 |
9ad86cc37625e19a1d1471eaab20136e
|
|
| BLAKE2b-256 |
470a133e53b6c787a3eb2329b172fcedb384e47fc00506f1606e03d653d66fae
|
Provenance
The following attestation bundles were made for knowledge_tree-0.2.5-py3-none-any.whl:
Publisher:
publish.yml on kBisla9/knowledge-tree
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
knowledge_tree-0.2.5-py3-none-any.whl -
Subject digest:
2954e18c9ce94c3d09c3ccc349e13d893a810ca74ac1ccd75b25e8e42453db8b - Sigstore transparency entry: 1095928152
- Sigstore integration time:
-
Permalink:
kBisla9/knowledge-tree@fbb4b785b80526238066d46f6be370cb2564e0b8 -
Branch / Tag:
refs/tags/v0.2.5 - Owner: https://github.com/kBisla9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fbb4b785b80526238066d46f6be370cb2564e0b8 -
Trigger Event:
release
-
Statement type: