Skip to main content

invalidate Command

Clear the AST (Abstract Syntax Tree) cache to force a full re-parse on the next index operation.

Usage

batho invalidate --root /path/to/repo

Flags

FlagDefaultDescription
--rootrequiredPath to repository root

What It Does

The invalidate command deletes the AST cache database at .ctn/local/cache/ast_cache.db. This cache stores parsed tree-sitter AST results to avoid re-parsing unchanged files.

Clearing this cache forces Batho to re-parse all files on the next index operation, even if they haven't changed.

When to Use

Use invalidate when:

  • You suspect the AST cache is corrupted
  • Parser behavior changed (e.g., after a Batho update)
  • You want to force a complete re-parse without using --full
  • Debugging parser or indexing issues

Examples

# Clear file cache for current directory
batho invalidate --root .

# Clear file cache for specific project
batho invalidate --root /path/to/project

# Then re-index with fresh scan
batho index --root . --verbose

Difference from --full

CommandWhat it clearsWhen to use
invalidateAST cache databaseSuspected cache corruption, parser issues
index --fullDisables incremental reuseComplete rebuild needed
cache clearAST cache database (same as invalidate)Parser issues, language version changes
  • cache clear - Clear AST parser cache
  • cache invalidate - Invalidate AST entries by pattern
  • index --force - Clear both caches before indexing