atxtechbro / atxtechbro/dotfiles
Document preprocessing tasks to offload from AI agents to generation layer
- Dominant language
- Shell
- Stars
- 27
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
## Context
Following up on #968's discussion about eliminating git workflow bottlenecks, this issue documents all preprocessing tasks that could be moved from the AI agent (intelligence layer) to the generation layer (shell preprocessing).
## Problem Statement
Every API call and validation check performed by AI agents consumes:
- Token context window space
- Request-response cycles
- Cognitive attention that could focus on value creation
Tasks that are deterministic and predictable should be offloaded to preprocessing.
## Workflow Analysis
### Current /close-issue Workflow
**Generation Layer (preprocessing, zero token cost):**
- Command argument validation (issue number required)
- Shell environment setup
- Command template selection
**Intelligence Layer (AI agent, token cost):**
- GitHub API calls to fetch issue data
- Git status checks and cleanup
- Branch creation and management
- Code analysis and implementation
- PR creation and submission
## Proposed Task Distribution
### Move to Generation Layer
These tasks are deterministic and can be handled by shell scripts:
#### 1. GitHub API Data Prefetching
- **Current**: Agent calls `get_issue` and `get_issue_comments` (2-3 cycles)
- **Proposed**: Shell prefetches with `gh issue view` and `gh issue comment list`
- **Benefit**: Save 2-3 request/response cycles on EVERY close-issue command
- **Implementation**: Inject as environment variables (ISSUE_TITLE, ISSUE_BODY, ISSUE_COMMENTS)
#### 2. Git Environment Validation
- **Current**: Agent discovers dirty branches, uncommitted changes
- **Proposed**: Shell validates and auto-remediates common issues
- **Tasks**:
- Check for uncommitted changes → auto-stash
- Verify not on main branch → fail fast
- Ensure main is synced with origin → auto-fetch and fast-forward
- Check for untracked files → warn or handle
- **Benefit**: Prevent 2-10 recovery cycles when issues occur
#### 3. Worktree Setup
- **Current**: Agent manages worktree creation/navigation
- **Proposed**: Shell creates worktree and sets WORKTREE_PATH
- **Benefit**: Agent starts in clean, isolated environment
#### 4. Tool Availability Checks
- **Current**: Agent discovers missing tools mid-task
- **Proposed**: Shell validates all required tools upfront
- **Tools**: gh, git, jq, any command-specific requirements
- **Benefit**: Fail fast with clear installation instructions
#### 5. Authentication Validation
- **Current**: Agent fails on API calls if not authenticated
- **Proposed**: Shell checks `gh auth status` before starting
- **Benefit**: Clear error message before wasting cycles
### Keep in Intelligence Layer
These tasks require contextual understanding and decision-making:
#### 1. Issue Analysis
- Understanding the issue requirements
- Determining implementation approach
- Making architectural decisions
#### 2. Code Implementation
- Writing actual solution code
- Adapting to codebase patterns
- Handling edge cases
#### 3. Testing Strategy
- Determining what tests to write
- Running and interpreting test results
- Fixing test failures
#### 4. PR Description
- Summarizing changes made
- Explaining implementation decisions
- Linking related issues
#### 5. Error Recovery
- Handling unexpected API responses
- Debugging implementation issues
- Making judgment calls on ambiguous requirements
## Implementation Priority
1. **Highest Impact**: Issue data prefetching (affects 100% of commands)
2. **High Impact**: Git state validation (affects ~30% of commands)
3. **Medium Impact**: Worktree automation (improves isolation)
4. **Low Impact**: Tool/auth checks (one-time setup issues)
## Success Metrics
- **Cycle Reduction**: 90%+ reduction in non-value-add cycles
- **Token Efficiency**: 20-30% reduction in context usage
- **Time to Value**: Agents start productive work immediately
- **Error Prevention**: Zero "empty PR" incidents
## Related Issues
- #968 - Parent issue discussing the git workflow bottleneck
- #969 - Initial preprocessing validation pattern
- #974 - Systematic enforcement of preprocessing patterns
## Principles Applied
- **subtraction-creates-value**: Remove tasks from agent workload
- **systems-stewardship**: Build reusable preprocessing infrastructure
- **ose**: Maintain external perspective on task allocation
- **tracer-bullets**: Validate impact through implementation
---
This separation ensures AI agents focus on intelligent decision-making while deterministic tasks happen at zero token cost in the generation layer.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the discussion in #968 and the related patterns in #969 and #974, then inspect the current close-issue workflow. Compare the existing generation and intelligence layer responsibilities with the proposed gh, git, jq, worktree, and authentication checks. Done means the preprocessing tasks and their implementation priorities are documented against the relevant workflow entry points.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, git, github, shell
- Domain
- cli, documentation, tooling
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100