Skip to content

feat(mcp): cora.scan_prepare needs include/exclude, smarter batch ordering and size hints (agent mode is impractical on large repos) #686

Open

Description

@ajianaz

Problem

cora scan has --include, --exclude, --extensions, --batch-files and --incremental; cora.scan_prepare accepts only path and batch. Together with a path-sorted batch order, this makes agent mode hard to use on a real repository.

Observations (cora 0.19.0, 133-file Rust workspace)

  • scan_prepare with no path returns total_batches: 44 of roughly 60 KB each (about 2.7 MB of prompt text, hundreds of thousands of tokens) with no way to estimate that up front.
  • Batch 0 is made of CODE_OF_CONDUCT.md, Cargo.toml, six evals/traces/**.meta.json files, a baseline JSON, evals/tier2/*.py ... because files are ordered by path. The core Rust sources land in later batches, so a user who judges the first few batches gets the least valuable code.
  • The only way to narrow the scope is path (a directory); for this repo the useful batches were found by listing all 11 batches of one subdirectory and choosing by file name.

Proposal

  1. Accept the same selection inputs as the CLI: include, exclude, extensions, batch_files, and incremental (or changed_since: <git rev> which is the natural unit for an agent: "review what changed on this branch").
  2. Order batches by value: source files before docs/data/traces/lockfiles, then by directory depth; or expose order: "path" | "source-first".
  3. Return planning data from every prepare call: total_chars and estimated_tokens for the whole scan, files with sizes per batch, so the agent (or a human) can decide how much to review.

Done when

scan_prepare {"include": ["crates/**/*.rs"], "exclude": ["**/tests/**"]} returns only matching files, reports an estimated total size, and orders source files first.

Related: #647.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions