← ClaudeAtlas

context-finderlisted

Assemble gen-AI context with the code/context module — the class-usage finders (name-based vs package-aware), the project-tree builder and its serializers, Open Knowledge Format (OKF) bundles, token estimation and budgeting, and the project_tree/find_context/estimate_tokens/okf_bundle MCP tools. Use when gathering the classes a file depends on, scanning a project into a tree, emitting an OKF bundle, sizing context for a model, or when the user says "find context", "project tree", "OKF", or "estimate tokens".
adamw7/tools · ★ 11 · AI & Automation · score 74
Install: claude install-skill adamw7/tools
# 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 ```java 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 `B