Skip to content

Conversation

@scottfrasso
Copy link
Member

Summary

  • Add "Impact Analysis" section to codebase_understanding.j2 teaching agents to query callers/dependencies before modifying code
  • Add 6 new Cypher patterns to cypher_query_patterns.j2 for multi-hop traversal, blast radius, dead code detection
  • Make impact analysis mandatory in plan.j2 with required section format
  • Add dependency-aware task ordering in tasks.j2 (low-risk first, high-risk last)

Why This Matters

This activates the graph DB as a competitive differentiator against Claude Code and other text-based tools:

Query Grep Graph DB
"What calls this function?" ❌ False positives ✅ Exact callers
"What breaks if I change this?" ❌ Manual ✅ Transitive deps
"Dead code that nothing uses" ❌ Impossible ✅ No incoming edges

Test plan

  • Linting passes (uv run ruff check .)
  • Type checking passes (uv run mypy src/)
  • CI tests pass (note: test_telemetry_settings_defaults may fail due to env-specific PostHog key)

🤖 Generated with Claude Code

scottfrasso and others added 6 commits December 8, 2025 11:51
Enhance prompts to leverage the graph DB for impact analysis and change
planning - a key differentiator against text-based code search tools.

Changes:
- codebase_understanding.j2: Add "Impact Analysis" section teaching agents
  to query callers and dependencies before modifying code
- cypher_query_patterns.j2: Add 6 new patterns for multi-hop traversal,
  blast radius analysis, dead code detection, and risk assessment
- plan.j2: Make impact analysis mandatory for existing codebases, add
  required "Impact Analysis" section format
- tasks.j2: Add dependency-aware task ordering by blast radius

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Update prompts to make clear that:
- Shotgun agents create plans and tasks
- Coding agents (Claude Code, Cursor, etc.) execute them
- Impact analysis informs better planning, not direct code changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Only show impact analysis guidance in prompts when a codebase graph
is actually indexed. This prevents confusing agents with instructions
for tools they can't use.

Changes:
- Add has_codebase_indexed field to AgentDeps
- Check for indexed graphs before rendering system prompt
- Wrap impact analysis sections in plan.j2, tasks.j2, and
  codebase_understanding.j2 with {% if has_codebase_indexed %}

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Update test mocks to properly handle the new has_codebase_indexed field:
- Add AsyncMock for codebase_service.list_graphs_for_directory
- Add has_codebase_indexed attribute to mock fixtures
- Update assertion checks to expect has_codebase_indexed parameter
- Patch add_system_prompt_message in exception handling tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Remove "check codebase before answering any question" - too aggressive
- Replace verbose 6-step workflow with focused 3-step version
- Emphasize "graph queries are cheap, file reads are expensive"
- Add explicit "NEVER read files to understand the codebase"

This should reduce context bloat from excessive file exploration.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- "NEVER read files" was too broad
- Changed to "Avoid reading many files just to explore"
- Allow reading files user mentions or that are identified as relevant

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@dabal
Copy link
Contributor

dabal commented Dec 31, 2025

Hi, would it be possible to pull this into the project?

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.

3 participants