AI-optimized hierarchical documentation with fractal 3-layer structure
Knowledge Tree Starter Kit provides a fractal documentation system that enables token-efficient AI context loading.
The Innovation: 3-layer hierarchical documentation
- Strategic (800 tokens) β High-level architecture & decisions
- Tactical (3,200 tokens) β Implementation approaches & modules
- Implementation (18,000 tokens) β Specific code & details
The Impact: 97% token savings - AI can scan 30+ projects in the same token budget as loading 1 full tree.
Traditional approach:
Load full codebase β 500,000 tokens β Can't fit in AI context
Fractal approach:
Load strategic layers only β 15,000 tokens β Entire codebase fits!
Need details? β Load tactical/implementation progressively
Real-world benefit: Your AI assistant can understand your entire organization's architecture in a single conversation.
git clone https://github.com/Mxcks/KT-starter-kit.git
cd kt-starter-kit
pip install -r requirements.txt # (no dependencies currently!)# Initialize a project
python kt.py init my-first-project "Learning Knowledge Tree"
# Add nodes as you work
python kt.py add decision "Use Python for backend" --branch my-first-project \
--reasoning "Team expertise, great libraries"
python kt.py add commit "Set up project structure" --branch my-first-project
# View your work
python kt.py tree my-first-project# Generate 3-layer summaries
python branches/system-documentation/tools/kt-hierarchical-summarizer.py --branch my-first-project
# Update ISS indexes
python branches/system-documentation/tools/iss-hierarchical-indexer.py# Search for context
python tools/kt-integration/tools/iss-query.py search "python"
# Load strategic layer (97% token savings!)
python tools/kt-integration/tools/iss-query.py layer my-first-project strategic| Doc | Purpose | Time |
|---|---|---|
| QUICK-REFERENCE.md | At-a-glance overview + command cheat sheet | 5 min |
| QUICKSTART.md | Detailed getting started guide | 15 min |
| ARCHITECTURE.md | Complete system architecture | 30 min |
| BUILD-PLAN.md | Development roadmap | 10 min |
Location: branches/system-documentation/
A complete operational branch demonstrating the 3-layer pattern:
- 8 nodes explaining the system
- 4 automation tools included
- Pre-generated ISS summaries
- Meta: The branch uses its own pattern to document itself!
Tools:
- kt-hierarchical-summarizer.py - Generate 3-layer summaries
- iss-hierarchical-indexer.py - Update ISS indexes
- kt-intelligent-loader.py - Smart context discovery
- kt-tool-node-generator.py - Tool scanning with local LLM
Location: tools/kt-integration/
Query tools for OpenClaw with intelligent automation:
- Query KT index and ISS systems
- Auto-search when planning
- Auto-load strategic layers
- Configurable on/off switches
Coming soon: Core KT engine, CLI, branch management
- Tree-based context management
- Branch system for distributed workspaces
- Query engine for cross-project search
- Sync system for team collaboration
# AI assistant searches for related work
python tools/kt-integration/tools/kt-smart.py discover --query "authentication API"
# Loads strategic layers of relevant projects
# Shows: "Found 3 related projects: auth-service, api-gateway, user-management"
# Token cost: ~2,400 tokens (vs 75,000 for full trees)# Load tactical + implementation for specific module
python tools/kt-integration/tools/iss-query.py layer my-project tactical
python tools/kt-integration/tools/iss-query.py layer my-project implementation
# Focused context on just what's being reviewed
# Token cost: ~7,000 tokens (vs 25,000 for full tree)# Compare strategic layers across multiple projects
python tools/kt-integration/tools/iss-query.py search "database architecture"
# Cross-project architectural analysis
# Token cost: ~5,000 tokens for 5 projects (vs 125,000)| Scenario | Traditional | Fractal | Savings |
|---|---|---|---|
| Understand 1 project | 25,000 tokens | 800 tokens | 97% |
| Scan 5 projects | 125,000 tokens | 4,000 tokens | 97% |
| Scan entire codebase (30 projects) | 750,000 tokens | 24,000 tokens | 97% |
| Planning + deep dive (3 projects) | 75,000 tokens | 12,000 tokens | 84% |
KT Nodes (JSONL)
β
kt-hierarchical-summarizer.py
β
3-Layer Markdown Summaries
βββ strategic.md (800 tokens)
βββ tactical.md (3,200 tokens)
βββ implementation.md (18,000 tokens)
β
iss-hierarchical-indexer.py
β
ISS Indexes (fast lookups)
β
kt-intelligent-loader.py
β
Auto-Discovery & Context Loading
- Manage multiple projects without losing context
- Progressive learning curve (strategic β tactical β implementation)
- Quick refreshers on old projects
- Onboard new members efficiently
- Share architectural decisions
- Maintain consistency across projects
- Cross-project pattern analysis
- Understand entire codebases
- Smart context loading
- Token-efficient cross-project analysis
- Progressive detail as needed
# Set your KT root
export KT_ROOT=/path/to/kt-starter-kit
# Optional: Custom ISS location
export ISS_ROOT=/custom/pathEdit tools/kt-integration/config/settings.json:
{
"auto_preload": false, // Load context on session start
"auto_search_on_planning": true, // Auto-search when planning
"auto_load_strategic": true, // Auto-load strategic layers
"quiet_mode": false // Silent queries
}Toggle features:
# Enable smart mode
python tools/kt-integration/tools/kt-config.py smart
# Manual mode only
python tools/kt-integration/tools/kt-config.py manual- System Documentation Branch - Complete fractal docs guide
- kt-integration Skill - OpenClaw integration
- Publishing Guide - How to customize and publish
- β Fractal documentation system
- β system-documentation operational branch
- β kt-integration OpenClaw skill
- β ISS integration
- Core KT engine integration
- CLI tools (kt.py)
- Branch management system
- More operational branches (templates, examples)
- MCP server for universal AI access
- VS Code extension
- Team collaboration features
- CI/CD integrations
We welcome contributions!
See CONTRIBUTING.md for:
- Ways to contribute (code, docs, examples, bugs)
- Development workflow
- Code style guidelines
- 60+ contribution ideas
- Extension points
Quick ideas:
- Add more examples to QUICKSTART.md
- Create reusable templates
- Build integrations (VS Code, Obsidian)
- Improve error messages
- Add new CLI commands
MIT License - See LICENSE for details
- Issues: GitHub Issues
- Discord: Join our community (coming soon)
- Docs: Full documentation (coming soon)
Created by: Max Stern
Inspiration: Need for token-efficient AI context in large codebases
Special Thanks: Knowledge Tree community
If you find this useful, give it a star! It helps others discover token-efficient AI context management.
Ready to optimize your AI context? Clone and start with strategic layers! π
git clone https://github.com/yourusername/kt-starter-kit.git
cd kt-starter-kit
python tools/kt-integration/tools/kt-smart.py preload