Quickstart¶
Tenets gives your AI two superpowers: intelligent code context (finds the right files automatically) and automatic tenets injection (your guiding principles in every prompt).
MCP-first (recommended)¶
Add to your IDE:
- Cursor (
~/.cursor/mcp.json) - Claude Desktop (
~/Library/Application Support/Claude/claude_desktop_config.json) - Windsurf / VS Code MCP
Ask your AI: "Use tenets to find the auth code and pin src/auth."
The Two Core Features¶
1. Intelligent Code Context¶
Your AI asks tenets to find relevant code. Tenets uses NLP (BM25, import centrality, git signals) to rank and aggregate the best files within your token budget.
2. Automatic Tenets Injection¶
Define guiding principles once—they're automatically injected into every prompt. This prevents context drift in long conversations and ensures consistent coding standards.
Real-world flow: System instruction + Tenets + Sessions¶
# Create a working session
tenets session create auth-refresh
# Add guiding principles (tenets)
tenets tenet add "Prefer small, safe diffs" --priority high --category style
tenets tenet add "Always validate user input" --priority critical --category security
# Apply tenets for this session
tenets instill --session auth-refresh
# Set a global system instruction
tenets system-instruction set "You are a senior engineer. Add tests and document trade-offs." --enable
# Build context with transformations for token efficiency
tenets distill "add OAuth2 refresh tokens" --session auth-refresh --remove-comments --condense
# Pin files as you learn what matters
tenets instill --session auth-refresh --add-file src/auth/service.py --add-folder src/auth/routes
tenets instill --session auth-refresh --list-pinned
See also: CLI > System Instruction Commands, Tenet Commands, and Instill.
Quick Start¶
Get productive with Tenets in under 60 seconds.
1. Install¶
2. Generate Context (CLI)¶
Copy straight to your clipboard:
Or enable auto-copy in tenets.toml:
3. Refine¶
Pin or force-include critical files:
# Build context for investigation
tenets distill "investigate cache stampede"
# Pin files are managed through instill command for sessions
tenets instill --add-file cache/*.py --add-file config/settings.py
Exclude noise:
4. Python API¶
from tenets import Tenets
tenets = Tenets()
result = tenets.distill(
prompt="implement bulk import",
max_tokens=80_000,
)
print(result.token_count, "tokens")
# Copy is done via CLI flag --copy or config setting
5. Sessions (Iterate)¶
tenets = Tenets()
# Sessions are managed through distill parameters
first = tenets.distill("trace 500 errors in checkout", session_name="checkout-fixes")
second = tenets.distill("add instrumentation around payment retries", session_name="checkout-fixes")
6. Visualization & Insight¶
# Complexity & hotspots
tenets examine . --show-details --hotspots
# Dependency graph (Interactive HTML)
tenets viz deps --format html --output deps.html
7. Next¶
- See full CLI options: CLI Reference
- Tune ranking & tokens: Configuration
- Dive deeper: Architecture