CLI & API Architecture¶
Command Structure¶
YAML
# Main Commands
tenets:
distill: # Build optimal context for prompts
--copy # Copy to clipboard
--format # Output format (markdown, xml, json, html)
--max-tokens # Token limit
--exclude # Exclude patterns
--session # Session name
--algorithm # Ranking algorithm
examine: # Code quality analysis
--show-details # Detailed metrics
--hotspots # Show maintenance hotspots
--ownership # Show code ownership
--format # Output format
chronicle: # Git history analysis
--since # Time range
--author # Filter by author
--format # Output format
momentum: # Velocity tracking (WIP)
--team # Team metrics
--detailed # Detailed breakdown
session: # Session management
create # Create new session
list # List sessions
delete # Delete session
tenet: # Manage guiding principles
add # Add new tenet
list # List tenets
remove # Remove tenet
instill: # Apply tenets and system instructions
--dry-run # Preview what would be applied
--force # Force application
system-instruction: # Manage system instructions
set # Set instruction
get # Get current
enable/disable # Toggle
Python API Design¶
Python
from tenets import Tenets
# Initialize
tenets = Tenets(path="./my-project")
# Simple usage
context = tenets.distill("implement OAuth2 authentication")
# Advanced usage
result = tenets.distill(
prompt="refactor database layer",
algorithm="ml",
max_tokens=50000,
filters=["*.py", "!test_*"]
)
# Session management
session = tenets.create_session("oauth-implementation")
context1 = session.distill("add OAuth2 support")
context2 = session.distill("add unit tests", incremental=True)
# Analysis tools
examination = tenets.examine()
chronicle = tenets.chronicle()
momentum = tenets.momentum()
# Configuration
tenets.configure(
ranking_algorithm="thorough",
use_ml=True,
cache_ttl_days=30
)