MOTH
Machine-Optimized Text Hierarchy
Compact notation for technical specifications, PRDs, and coding rules
Companion to kablUI for complete application specification
What is MOTH?
MOTH is a line-based notation system designed for technical documentation that needs to stay in LLM context windows. It compresses verbose specs into dense, scannable formats optimized for AI coding agents.
From the kablUI family:
- kablUI → Describe what users SEE (UI components, layouts, interactions)
- MOTH → Describe what systems DO (APIs, data models, business logic, architecture)
Together, they let you specify entire applications in a fraction of the tokens.
The Problem
Traditional PRD: 156KB, 42K tokens
Architecture docs: 89KB, 24K tokens
.cursorrules: 47KB, 12K tokens
Total context used: 292KB, 78K tokens
Remaining for code: 122K / 200K tokens (39% wasted!)
The Solution
PRD.moth: 12KB, 3.5K tokens
architecture.moth: 8KB, 2.1K tokens
.cursorrules.moth: 4KB, 1.2K tokens
Total context used: 24KB, 6.8K tokens
Remaining for code: 193K / 200K tokens (91% efficient!)
Result: 91% compression, same information density.
Use Cases
1. PRDs for AI Agents
Spec entire products in a format that stays in context while coding.
2. Coding Rules (.cursorrules replacement)
Replace 50KB rules files with 5KB MOTH specs.
3. Architecture Docs
System designs that guide implementation.
4. Combined with kablUI
Full application specification (UI + backend).
Core Syntax
# Comments start with hash
[SECTION_NAME] # Sections in ALL_CAPS
key:value # Primary data pattern
key:value; key2:value2 # Semicolon separation
list:[item1;item2] # Inline lists
state:{k=v;k2=v2} # Configuration objects
[SECTION.subsection] # Hierarchical nesting
nested_key:value # 2-space indentationGetting Started
- 1. Read the Quick Reference - Learn the syntax in 5 minutes
- 2. Check Examples - Review real-world MOTH files for inspiration
- 3. Customize - Edit to match your project
- 4. Use - Load in Cursor, Cline, or your LLM