context-finder

context-finder is a skill for Claude Code, Codex from adamw7/tools. It costs 118 tokens per session (1,523 once invoked), scanned A, original, MIT.

A guide for selecting the code files an AI agent needs as context, finding class dependencies, building project trees, and estimating token use. It supports Java, Kotlin, and Scala projects and can create Open Knowledge Format (OKF) bundles, which package project context for reuse.

In plain words
What is it for?
Use it to gather dependencies for a file, build a project tree, estimate prompt size, find relevant context, or create an OKF bundle.
Why use it?
It reduces irrelevant code in an agent's input and helps avoid exceeding a model's context limit. It also chooses more accurate class matches when different packages contain classes with the same name.

Skill for Claude CodeCodex

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 skills/adamw7/tools/context-finder
Any agent
npx skills add adamw7/tools --skill context-finder
Clone the repo
git clone --depth 1 https://github.com/adamw7/tools

Made for: Claude Code, Codex.

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 context-finder

README.md
[![agentmods](https://agentmods.dev/badge/skills/adamw7/tools/context-finder.svg)](https://agentmods.dev/skills/adamw7/tools/context-finder)
Your own site
<a href="https://agentmods.dev/skills/adamw7/tools/context-finder"><img src="https://agentmods.dev/badge/skills/adamw7/tools/context-finder.svg" alt="Measured on agentmods" height="20"></a>
Per session 118 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,523 The whole file, excluding the scripts and references it only reads on demand.
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.00118 $0.01523
Opus 5 $0.00059 $0.00762
Sonnet 5 $0.00024 $0.00305
Haiku 4.5 $0.00012 $0.00152

Measured 4d ago against content hash 9492c162b777, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

context-finder 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 4d 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.

.claude/skills/context-finder/SKILL.md · 116 lines

How it starts

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

Context Finder Skill

Use code/context to answer "which classes does this file actually need?" and "how many tokens will that cost?" — the module behind the project_tree, find_context, estimate_tokens and okf_bundle MCP tools.

The core contract

public interface Context {
    Set<ClassContainer> find(ClassContainer root, int depth);
}

A ClassContainer is just a className (the file name) plus its originalCode. depth bounds a breadth-first expansion, so nearest dependencies come first — which is what makes budgeting meaningful.

Load a project's sources with new ProjectSources(Language.JAVA).load(root), which returns Map<Path, ClassContainer>. Languages: JAVA (.java), KOTLIN (.kt), SCALA (.scala).

Pick the right finder

Finder Resolves by Use when
Finder simple file name, indexed once at construction one class per simple name; fastest
PackageAwareFinder package + import declarations two classes share a simple name in different packages

PackageAwareFinder prefers, in order: an explicit import, the referencing file's own package, a wildcard import, then a sole project-wide candidate — and leaves a genuinely ambiguous reference unresolved rather than guessed. Both strip comments and string/character literals before matching, so a class name mentioned in a comment is not reported as a dependency. The package/import grammar is shared by all three languages.

Budgeting

BudgetedContext decorates any Context: it keeps the delegate's breadth-first order and accepts containers until the next one would exceed the budget, so you keep the highest-priority prefix of the graph.

Context context = new BudgetedContext(new Finder(containers), new SubwordTokenEstimator(), 8_000);

Estimators implement TokenEstimator: SubwordTokenEstimator (respects word and symbol boundaries — the better default) and HeuristicTokenEstimator.

Project tree

ProjectTreeBuilder(contextFactory, language, depth).build(root) returns a ProjectTreeNode. Serialize with a ProjectTreeSerializer: ProjectTreeJsonSerializer (the MCP default), …Markdown…, …Dot… (Graphviz), …Mermaid…, or print with ProjectTreePrinter. The builder takes a ContextFactory, so a different finder can be substituted without touching the builder — add a serializer or a factory rather than branching inside the builder.

Read the full file on GitHub · 116 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 4d ago First seen · 116 lines · 118 tokens per session scan A 9492c162b777

Subscribe to this mod's changes

context-finder is a skill published in the GitHub repository adamw7/tools (11 stars, last pushed yesterday), licensed MIT. It adds 118 tokens to every session and 1,523 once invoked, about $0.0006 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.

Related

Other skills, from other repositories

ccxt-java

CCXT cryptocurrency exchange library for Java developers. Covers both REST API (standard) and WebSocket API (real-time). Helps install CCXT, connect to exchanges, fetch market data, place orders, stream live tickers/orderbooks, handle authentication, and manage errors in Java projects. Use when working with crypto…

ccxt/ccxt · 83 tokens

fin-data-acquisition

根据REFINEDDESIGN.md中的变量定义,自动获取所需数据并生成可执行的回归分析脚本(Python/Stata)。.

csmar432/finai-research · 36 tokens

agent-guidance-boundary-guard

Use when auditing SHAFT agent guidance, host adapters, hooks, guidance budgets, or retrieval setup.

ShaftHQ/SHAFT_ENGINE · 28 tokens

load-tests

Run the VibeTags benchmark harness in load-tests/ and report the numbers honestly — annotation-volume and memory sweeps, JMH hot-path and cache-hit microbenchmarks, the processor-tax control — then record a release baseline under load-tests/results/. Use when the user says "load tests", "benchmarks", "capture a…

PIsberg/vibetags · 94 tokens

fruit-pi

全球水果价格收集与查询。管理水果池,自动采集榴莲/荔枝/樱桃等水果每日批发价,支持国内外报价,RMB/公斤换算。Fruit price tracker for global fruits, wholesale market data, agricultural commodity prices.

kobenfang/FruitPi · 64 tokens

llmquant-data

Router skill for LLMQuant Data primitive workflows. Use when the user needs SEC filings, 13F holders, macro snapshots, or source-grounded macro briefs.

LLMQuant/skills · 38 tokens