Skip to content

feat: --components flag for targeted component analysis#16

Open
hankbobtheresearchoor wants to merge 2 commits into
Layr-Labs:mainfrom
hankbobtheresearchoor:feat/components-filter
Open

feat: --components flag for targeted component analysis#16
hankbobtheresearchoor wants to merge 2 commits into
Layr-Labs:mainfrom
hankbobtheresearchoor:feat/components-filter

Conversation

@hankbobtheresearchoor
Copy link
Copy Markdown

Summary

Adds --components CLI flag for targeted analysis of specific components instead of full codebase sweeps.

Motivation

Running the full 9-component RAG pipeline on every commit is brute force. When only 1-2 components changed between commits, re-analyzing everything wastes tokens and time. The existing --last-sha/--head-sha incremental mode soft-hints to the LLM which components changed, but there is no hard filter at the execution level — the agent can still waste tokens analyzing unchanged components.

Changes

agent/cli.py

  • New --components flag: comma-separated component names (e.g., --components coordinator,provider-api)
  • resolve_component_filter(): validates names against components.json, then expands to include transitive dependencies via BFS on graph.json edges (if component A depends on B, analyzing A requires B's upstream context)
  • analyze() skips discovery and graph building when component_filter is set, reusing existing artifacts instead

agent/burr_app.py

  • read_discovery() applies the filter: prunes depth_order to only include filtered components, so the analysis pipeline only spawns subagents for them
  • build_analysis_pipeline() accepts component_filter parameter, passed as initial Burr state

Usage

# Targeted analysis (specific components only, requires existing artifacts)
flashlight --repo /path/to/repo --output ./artifacts/company/eigenda \
    --components coordinator,provider-api --head-sha def5678

CI Integration Pattern

The intended workflow for the knowledge-maintenance cron:

  1. Commit watcher detects new commits, runs git diff --name-only between SHAs
  2. Map changed files → affected components (using components.json root_path prefix matching — same logic as the existing map_files_to_components())
  3. Run flashlight with --components <affected> instead of full sweep
  4. Weekly/biweekly full sweep as baseline refresh

This keeps flashlight as the engine but makes it callable per-component instead of per-repo.

Adds a --components CLI flag that accepts a comma-separated list of
component names and restricts analysis to only those components (plus
their transitive dependencies resolved from graph.json).

Key changes:
- resolve_component_filter() expands requested names to include
  transitive deps via BFS on the dependency graph edges
- analyze() skips discovery and graph building when component_filter
  is set, reusing existing artifacts instead
- read_discovery() prunes depth_order to only include filtered
  components, so the analysis pipeline only spawns subagents for them
- build_analysis_pipeline() accepts and passes component_filter as
  initial Burr state

This enables incremental CI workflows: detect changed files, map to
affected components, and re-analyze only the delta instead of the
full codebase.
When the repo directory name matches the service_name (e.g. /tmp/d-inference),
the work_dir /tmp/d-inference collides with the repo path, causing
_setup_project_dir to refuse symlinking. Detect this and append
'-flashlight' suffix to the service_name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant