select-files

select-files is a command for coding agents from TrafficGuard/typedai. It costs 13 tokens per session (755 once invoked), scanned A, original, MIT.

A codebase search tool that finds the smallest group of files relevant to a task or requirement. It searches by text patterns and by meaning, then checks its choices.

In plain words
What is it for?
Use it to locate files for jobs such as tracing user authentication, preparing a feature change, or investigating a bug.
Why use it?
It reduces the time spent opening unrelated files and helps keep an agent’s working context focused on the task.

Command

Part of the code-analysis plugin — 3 commands shipped together

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 commands/trafficguard/typedai/select-files
Clone the repo
git clone --depth 1 https://github.com/TrafficGuard/typedai

Or install code-analysis, the plugin that ships this one along with the rest of its 3 commands.

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 select-files

README.md
[![agentmods](https://agentmods.dev/badge/commands/trafficguard/typedai/select-files.svg)](https://agentmods.dev/commands/trafficguard/typedai/select-files)
Your own site
<a href="https://agentmods.dev/commands/trafficguard/typedai/select-files"><img src="https://agentmods.dev/badge/commands/trafficguard/typedai/select-files.svg" alt="Measured on agentmods" height="20"></a>
Per session 13 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 755 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.00013 $0.00755
Opus 5 $0.00006 $0.00378
Sonnet 5 $0.00003 $0.00151
Haiku 4.5 $0.00001 $0.00076

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

Security

Grade A, and why

select-files 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-plugins/code-analysis/commands/select-files.md · 103 lines

How it starts

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

Select Files

Select the minimal set of files from a codebase that are essential for completing a given task. Uses an iterative LLM-driven search with both regex and semantic vector search capabilities.

How It Works

The select-files agent:

  1. Analyzes the repository structure and file summaries
  2. Iteratively searches and inspects files using regex and/or vector search
  3. Decides which files to keep or ignore based on relevance
  4. Returns the minimal set of files needed for the task

Usage

Via MCP Tool

If you have the TypedAI MCP server configured, use the selectFiles tool:

{
  "workingDirectory": "/path/to/your/project",
  "requirements": "Find all files related to user authentication",
  "initialFilePaths": ["src/auth/index.ts"]  // optional
}

Parameters:

  • workingDirectory (required): Absolute path to the project directory
  • requirements (required): Description of what files are needed and why
  • initialFilePaths (optional): Array of file paths to include in initial context

Via CLI

# Standalone command (recommended)
select-files "Find all files related to user authentication"

# With initial files to include
select-files --initial-files=src/auth/index.ts,src/config.ts "Find related configuration"

# From any directory (uses --fs flag automatically)
cd /path/to/your/project
select-files "Find database models"

# Alternative: via ai wrapper
ai select-files "Find database models"

Flags:

  • --initial-files=file1,file2: Comma-separated list of initial files to include
  • -r: Resume from previous agent run

Output Format

Returns a JSON array of selected files:

[
  {
    "filePath": "src/auth/authenticate.ts",
    "reason": "Contains the main authentication logic and session management"
  },
  {
    "filePath": "src/config/auth.config.ts",
    "reason": "Authentication configuration including JWT settings"
  }
]

Fields:

  • filePath: Relative path to the file from the project root
  • reason: Explanation of why this file was selected
  • readOnly (optional): Whether the file should only be read, not modified
  • category (optional): One of edit, reference, style_example, unknown

Read the full file on GitHub · 103 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. 4d ago First seen · 103 lines · 13 tokens per session scan A 49c9e5538f61

Subscribe to this mod's changes

select-files is a command published in the GitHub repository TrafficGuard/typedai (1,192 stars, last pushed 8mo ago), licensed MIT. It adds 13 tokens to every session and 755 once invoked, about $0.0001 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.