Skip to content

Add --max-depth flag to limit codebase traversal depth #326

@fuleinist

Description

@fuleinist

Problem

Claude Context indexes the entire codebase without a way to limit traversal depth. For large monorepos, this can be slow and include files that are irrelevant to the current task.

Solution

Add a --max-depth CLI flag (default: unlimited) that stops traversal at the specified directory depth. This allows users to scope the context to the relevant subtree.

Use case

A developer working in packages/api/src/ doesn't need the entire monorepo context — --max-depth 4 would capture the relevant package scope without pulling in unrelated packages/web/ or packages/shared/ content. This would also reduce indexing time and API costs for large codebases.

Notes

Non-breaking addition — existing behavior unchanged when flag is omitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions