better_context

A rule for using btca, a tool that searches local copies of official software repositories to answer questions about libraries and frameworks.

In plain words
What is it for?
Use it to check current framework behavior, APIs, syntax, or implementation details, including which local source repositories are available.
Why use it?
It helps avoid outdated or inaccurate answers when a library's current code or API differs from what an agent remembers.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/davis7dotsh/better-context/better_context
Clone the repo
git clone --depth 1 https://github.com/davis7dotsh/better-context
Per session 1,939 This file is loaded in full into every session.
When invoked 1,939 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01939 $0.01939
Opus 5 $0.00970 $0.00970
Sonnet 5 $0.00388 $0.00388
Haiku 4.5 $0.00194 $0.00194

Measured yesterday against content hash 8bb1bdadb9ab, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

better_context scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

apps/web/src/lib/assets/rules/better_context.mdc · 236 lines

How it starts

The opening of the file, as written. The whole thing — 236 lines — stays where its author put it; the contents beside it link to each section on GitHub.

btca – Better Context Agent

btca queries local clones of library/framework repositories to answer questions with up-to-date, source-first information. Use it instead of web searches when the user needs accurate, current details about technologies.

When to Use btca

  • User asks "how does X work in Svelte 5?" or similar framework/library questions
  • User needs current API behavior that may differ from your training data
  • User explicitly says "use btca" or references a configured resource
  • You need to verify syntax or patterns for a specific library version

Agent Behavior

  • Prefer btca ask over the interactive TUI (agents can't operate TUIs reliably)
  • Ask for missing information – if the user wants to add/change resources or models but doesn't provide all required details, ask them before running commands
  • Run btca resources first if you're unsure which resources are available

  • If unsure what's configured: btca resources
  • If missing: add it with btca add --name svelte --type git --url https://github.com/sveltejs/svelte --branch main

btca ask (Primary Command for Agents)

  • btca ask --resource <resource> --question '<question>'
  • For multiple resources: btca ask --resource svelte --resource effect --question '<question>'
  • You can also use @mentions in the question: btca ask --question 'How do @svelte stores work?'
Flag Required Description
-q, --question <text> Yes The question to ask
-r, --resource <name...> No Resource(s) to search; repeatable. If omitted, uses all configured resources

Features:

  • Supports @mentions in the question: btca ask -q "@svelte @tailwind How do I style components?"
  • Combine -r flags with @mentions; duplicates are deduplicated

Read the full file on GitHub · 236 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 236 lines · 1,939 tokens per session scan A 8bb1bdadb9ab

Subscribe to this mod's changes

better_context is a cursor rule published in the GitHub repository davis7dotsh/better-context (1,157 stars, last pushed 4mo ago), licensed MIT. It adds 1,939 tokens to every session, about $0.0097 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.