better_context

better_context is a cursor rule for Cursor from davis7dotsh/better-context. It costs 1,939 tokens per session, scanned A, original, MIT.

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 for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: mentions OpenCode.

Good fit Use it to check current framework behavior, APIs, syntax, or implementation details, including which local source repositories are available.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/davis7dotsh/better-context/better_context
About the project

better-context, also called btca, helps coding agents answer questions about project libraries and frameworks by searching their actual source code instead of relying only on documentation. It is for developers who need current technical context during coding, and the catalogue entries package its agent skill, rule, command, and instruction.

davis7dotsh/better-context · 1,156 stars · on GitHub · btca.dev

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.

Clone the repo
git clone --depth 1 https://github.com/davis7dotsh/better-context

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for better_context

README.md
[![agentmods](https://agentmods.dev/badge/rules/davis7dotsh/better-context/better_context/github.svg)](https://agentmods.dev/rules/davis7dotsh/better-context/better_context)
Your own site
<a href="https://agentmods.dev/rules/davis7dotsh/better-context/better_context"><img src="https://agentmods.dev/badge/rules/davis7dotsh/better-context/better_context/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for better_context

Your own site · 80×15
<a href="https://agentmods.dev/rules/davis7dotsh/better-context/better_context"><img src="https://agentmods.dev/badge/rules/davis7dotsh/better-context/better_context.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.01939 $0.01939
Opus 5.5 $0.00776 $0.00776
Sonnet 5.5 $0.00388 $0.00388
Haiku 4.5 $0.00194 $0.00194

Measured 1mo ago against content hash 8bb1bdadb9ab, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo ago.

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. 1mo ago 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,156 stars, last pushed 6mo ago), licensed MIT. It adds 1,939 tokens to every session, about $0.0078 per session on Opus 5.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.