When the 70% context budget is hit mid-directory, the early exit now
writes a partial directory cache entry from whatever file summaries
the agent cached in prior turns, instead of discarding the work.
If file entries exist: concatenates their summaries into a directory
entry marked partial=true. If no files were cached: writes a minimal
entry noting the budget was reached before processing.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rewrites ai.py from a single Claude API call into a multi-pass,
cache-driven agent architecture:
- Per-directory isolated agent loops (max 10 turns each) with context
discarded between directories
- Leaves-first processing order so child summaries inform parents
- Disk cache (/tmp/luminos/{uuid}/) persists across runs for resumability
- Investigation ID persistence keyed by target realpath
- Separate synthesis pass reads only directory-level cache entries
- Replaces urllib with Anthropic SDK (streaming, automatic retries)
- Token counting with 70% context budget threshold for early exit
- parse_structure tool via tree-sitter (Python, JS, Rust, Go)
- python-magic integration for MIME-aware directory listings
- Cost tracking printed at end of investigation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Introduces luminos_lib/capabilities.py as the single source of truth for
optional package availability. Detects anthropic, tree-sitter, python-magic
and their grammar packages. Provides check_ai_dependencies() for gating
--ai mode and print_status() for --install-extras. Also hosts clear_cache()
to avoid pulling heavy AI imports for cache cleanup.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds --ai flag that sends the directory tree, file categories, and
sampled file contents to Claude for analysis. Produces a brief
summary at the top of the report and a detailed breakdown at the
end. Requires ANTHROPIC_API_KEY env var; degrades gracefully without it.
Uses only stdlib (urllib) to keep the zero-dependency constraint.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Re-scans every 30 seconds and shows new files, deleted files, and
size changes between scans.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Human-readable terminal report with clear sections, plus JSON output
mode and file output support.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Uses du to show per-directory disk usage and highlights the top 5
largest directories.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Finds the 10 most recently modified files using find with printf
and shows human-readable timestamps.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Detects programming languages, counts lines of code per language via
wc -l, and flags unusually large files (>1000 lines or >10MB).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Classifies files by category (source, config, data, media, document,
archive, unknown) using extension mapping and the `file` command.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Renders a visual tree with file sizes, configurable depth, and
hidden file filtering.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>