Building tenets: Intelligent context aggregation for AI pair programming (jddunn.github.io)

🤖 AI Summary
Tenets is a new Python library that intelligently navigates code repositories to collect, rank, summarize and return the most relevant context for AI pair-programming tools. It was built to solve a common pain point: current LLM assistants often resort to brittle, literal phrase searches, shallow file reads, and repeated LLM calls that waste tokens and API credits. Tenets runs locally (no API cost for its core functions), supports optional LLM summarization, and is designed to be used programmatically by tools like aider, Claude CLI or Copilot-based workflows — typically distilling hundreds of files in 30–40 seconds without embeddings. Technically, Tenets combines deterministic algorithms (regex, BM25 ranking, sparse cosine similarity) with optional ML embeddings and extractive summarization. Keyword extraction uses RAKE (simple, corpus-free), and a multi-signal ranking aggregates ten weighted factors — e.g., BM25 (0.25), keyword match (0.20), path relevance (0.15), import centrality (0.10), git recency/frequency (0.05 each), semantic similarity (0.10), plus code-pattern, complexity and AST signals. It offers fast/balanced/thorough modes (embeddings only in thorough), smart truncation that preserves full methods and critical lines under token budgets, and session/team features. For the AI/ML community this means more deterministic, cost-efficient context retrieval, fewer unnecessary LLM calls, and better-quality inputs for code-focused generation and debugging.
Loading comments...
loading comments...