WIP almost done with track planning
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# Deep AST-Driven Context Pruning
|
||||
|
||||
**Track ID:** deep_ast_context_pruning_20260306
|
||||
|
||||
**Status:** Planned
|
||||
|
||||
**See Also:**
|
||||
- [Spec](./spec.md)
|
||||
- [Plan](./plan.md)
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "deep_ast_context_pruning_20260306",
|
||||
"name": "Deep AST-Driven Context Pruning",
|
||||
"status": "planned",
|
||||
"created_at": "2026-03-06T00:00:00Z",
|
||||
"updated_at": "2026-03-06T00:00:00Z",
|
||||
"type": "feature",
|
||||
"priority": "medium"
|
||||
}
|
||||
@@ -1,16 +1,30 @@
|
||||
# Implementation Plan: Deep AST-Driven Context Pruning (RAG for Code) (deep_ast_context_pruning)
|
||||
# Implementation Plan: Deep AST Context Pruning (deep_ast_context_pruning_20260306)
|
||||
|
||||
## Phase 1: Research & Design
|
||||
- [ ] Task: Analyze existing backend implementation
|
||||
- [ ] Task: Design GUI/UX approach
|
||||
- [ ] Task: Conductor - User Manual Verification
|
||||
## Phase 1: AST Integration
|
||||
- [ ] Task: Initialize MMA Environment
|
||||
- [ ] Task: Verify tree_sitter availability
|
||||
- WHERE: requirements.txt, imports
|
||||
- WHAT: Ensure tree_sitter installed and importable
|
||||
- HOW: pip install tree_sitter
|
||||
|
||||
## Phase 2: Implementation
|
||||
- [ ] Task: Implement feature
|
||||
- [ ] Task: Write tests
|
||||
- [ ] Task: Conductor - User Manual Verification
|
||||
## Phase 2: Skeleton Generation
|
||||
- [ ] Task: Implement AST parser
|
||||
- WHERE: src/file_cache.py or new module
|
||||
- WHAT: Parse Python AST using tree_sitter
|
||||
- HOW: tree_sitter.Language + Parser
|
||||
- SAFETY: Exception handling for parse errors
|
||||
- [ ] Task: Implement skeleton generator
|
||||
- WHERE: src/file_cache.py
|
||||
- WHAT: Extract function signatures and docstrings
|
||||
- HOW: Walk AST, collect Def nodes
|
||||
- SAFETY: Handle large files gracefully
|
||||
- [ ] Task: Integrate with worker dispatch
|
||||
- WHERE: src/multi_agent_conductor.py
|
||||
- WHAT: Inject skeleton into worker prompt
|
||||
- HOW: Modify context generation
|
||||
- SAFETY: Verify tokens reduced
|
||||
|
||||
## Phase 3: Verification
|
||||
- [ ] Task: Run test suite
|
||||
- [ ] Task: Verify coverage
|
||||
- [ ] Task: Conductor - Phase Completion Verification
|
||||
## Phase 3: Tests & Verification
|
||||
- [ ] Task: Write AST parsing tests
|
||||
- [ ] Task: Verify token reduction
|
||||
- [ ] Task: Conductor - Phase Verification
|
||||
|
||||
@@ -1,28 +1,22 @@
|
||||
# Track Specification: Deep AST-Driven Context Pruning
|
||||
# Track Specification: Deep AST-Driven Context Pruning (deep_ast_context_pruning_20260306)
|
||||
|
||||
## Overview
|
||||
Use tree_sitter to parse target file AST and inject condensed skeletons into worker prompts.
|
||||
Use tree_sitter to parse target file AST and inject condensed skeletons into worker prompts. Currently workers receive full file context; this track reduces token burn by injecting only relevant function/method signatures.
|
||||
|
||||
## Current State Audit
|
||||
### Already Implemented
|
||||
- file_cache.py with skeleton generation
|
||||
- outline_tool.py for code outlines
|
||||
- AST-based file analysis
|
||||
|
||||
### Gaps to Fill
|
||||
- No automatic AST pruning based on edit target
|
||||
- Skeletons not customizable by user
|
||||
|
||||
## Goals
|
||||
- Parse target file AST before worker dispatch
|
||||
- Strip unrelated function bodies
|
||||
- Inject surgical skeleton to reduce tokens
|
||||
## Architectural Constraints
|
||||
- **Parsing Performance**: AST parsing MUST complete in <100ms per file.
|
||||
- **Caching**: Parsed AST trees SHOULD be cached to avoid re-parsing.
|
||||
- **Selective Exposure**: Only target functions/classes related to the ticket's target_file should be included.
|
||||
|
||||
## Functional Requirements
|
||||
- tree_sitter integration
|
||||
- Target function/method detection
|
||||
- Configurable skeleton depth
|
||||
- **AST Parser**: Integrate tree_sitter to parse Python files.
|
||||
- **Target Detection**: Identify which functions/methods to include based on ticket target_file.
|
||||
- **Skeleton Generation**: Generate condensed skeletons with signatures and docstrings only.
|
||||
- **Worker Integration**: Inject skeleton into worker prompt instead of full file content.
|
||||
|
||||
## Non-Functional Requirements
|
||||
- <100ms parsing time per file
|
||||
- >50% token reduction target
|
||||
## Acceptance Criteria
|
||||
- [ ] tree_sitter successfully parses Python AST.
|
||||
- [ ] Skeleton includes only target function/class with signature and docstring.
|
||||
- [ ] Token count reduced by >50% for typical worker prompts.
|
||||
- [ ] Workers can still complete tickets with skeleton-only context.
|
||||
- [ ] >80% test coverage.
|
||||
|
||||
Reference in New Issue
Block a user