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.
npx agentmods add commands/agentis-tools/ctx/smartgit clone --depth 1 https://github.com/agentis-tools/ctxWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.01052 |
| Opus 5 | $0.00000 | $0.00526 |
| Sonnet 5 | $0.00000 | $0.00210 |
| Haiku 4.5 | $0.00000 | $0.00105 |
Grade A, and why
smart 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.
How it starts
The opening of the file, as written. The whole thing — 146 lines — stays where its author put it; the contents beside it link to each section on GitHub.
ctx smart
Intelligently select files relevant to a task description using embeddings and call graph analysis.
Synopsis
ctx smart <TASK> [PATTERNS]... [OPTIONS]
Description
The smart command analyzes your task description and automatically selects the most relevant files from your codebase. It combines:
- Semantic search - Finds symbols related to your task using embeddings
- Call graph expansion - Includes callers and callees of matched symbols
- Token budgeting - Fits selection within your token limit
Optional positional patterns scope the entire selection pipeline. Literal
files, directories, and globs are ORed together; semantic matches and
call-graph expansion both stay within that scope. With no patterns, . selects
the whole repository.
Prerequisites
Before using ctx smart, you must:
- Index your codebase:
ctx index - Generate embeddings:
ctx embed
Options
| Option | Description | Default |
|---|---|---|
--max-tokens <N> |
Maximum tokens in output | 8000 |
--depth <N> |
Call graph expansion depth | 2 |
--top <N> |
Top semantic matches to consider | 10 |
--explain |
Show why each file was selected | false |
--dry-run |
Show selection without file contents | false |
--count-only |
Count the selected, budgeted files without preview or context output | false |
--encoding <ENCODING> |
Tokenizer used for selection and counting (cl100k_base, o200k_base, or p50k_base) |
cl100k_base |
--stats |
Print count timing to stderr with --count-only |
false |
Examples
Basic Usage
# Select files for adding a new feature
ctx smart "add user authentication"
# Review files for fixing a bug
ctx smart "fix the login timeout issue"
# Search and expand only within Rust source and one contract file
ctx smart "change request validation" "src/**/*.rs" tests/contracts.rs
With Token Budget
# Limit to 4000 tokens for smaller context
ctx smart "implement caching" --max-tokens 4000
# Measure exactly that selected pack using the target model's tokenizer
ctx smart "implement caching" --max-tokens 4000 --count-only --encoding o200k_base
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.
- yesterday First seen · 146 lines · 0 tokens per session scan A 5b15ecede70c
smart is a command published in the GitHub repository agentis-tools/ctx (11 stars, last pushed 15d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,052 tokens. 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.
Other commands, from other repositories
coograph-review
Review the changes in scope for spec compliance, convention violations, logic bugs, and architectural issues. You review — you do not author. Never edit files.
coograph-verify
Verify that the described work is complete and correct. Provide evidence for every claim. You verify — you do not implement or fix style.
api-gen
Generate REST API endpoints with routes, validation, error handling, and tests.
component-gen
Generate React or Vue components with prop types, styling, accessibility, and tests.
code-review
Review staged git changes for bugs, security issues, and style violations.
pr-description
Generate a PR title and description from the current branch diff against main.