Skip to content

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).

Bash
pip install tenets[mcp]
tenets-mcp

Add to your IDE:

  • Cursor (~/.cursor/mcp.json)
    JSON
    { "mcpServers": { "tenets": { "command": "tenets-mcp" } } }
    
  • Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json)
    JSON
    { "mcpServers": { "tenets": { "command": "tenets-mcp" } } }
    
  • Windsurf / VS Code MCP
    JSON
    { "tenets": { "command": "tenets-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

Bash
# 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

Bash
pip install tenets

2. Generate Context (CLI)

Bash
tenets distill "add optimistic locking to order updates"

Copy straight to your clipboard:

Bash
tenets distill "refactor payment flow" --copy

Or enable auto-copy in tenets.toml:

TOML
[output]
copy_on_distill = true

3. Refine

Pin or force-include critical files:

Bash
# 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:

Bash
tenets distill "debug webhook" --exclude "**/migrations/**,**/tests/**"

4. Python API

Python
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)

Python
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

Bash
# Complexity & hotspots
tenets examine . --show-details --hotspots

# Dependency graph (Interactive HTML)
tenets viz deps --format html --output deps.html

7. Next