You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🤖 Limit TODOs to 7 items with precision gradient (#261)
## Summary
Enforces a 7-item limit on TODO lists to keep them focused and
token-efficient. Introduces the "high precision at center" mental model
where AI maintains detail for recent/current work while summarizing
distant past and far future.
## Changes
### Backend
- Add `MAX_TODOS = 7` constant to `src/constants/toolLimits.ts`
- Validate TODO count in `validateTodos()` with educational error
message
- Error guides AI to condense: _"summarize old completed work (e.g.,
'Setup phase (3 tasks)')..."_
### Tool Description
Updated `todo_write` description to teach the precision gradient model:
- **Old completed**: Summarize into 1 overview item
- **Recent completions**: Keep detailed (last 1-2 items)
- **Current work**: One in_progress with clear description
- **Immediate next**: Detailed pending (next 2-3 actions)
- **Far future**: Summarize into phase items
AI learns to expand/condense dynamically as work progresses.
### Visual
- **Gradient fade** for old completed items (exponential decay)
- Older items fade more, visually hinting they're candidates for
summarization
- Only applies when >2 completed items exist
### Tests
- Test MAX_TODOS limit enforcement (8 items → error)
- Test exact limit acceptance (7 items → success)
- All 13 tests passing
## Token Efficiency
- **Before**: Unmanaged lists could reach 50+ items (~2,500 tokens per
update)
- **After**: Max 7 items with summarization (~200-400 tokens typical)
- **83% reduction** in token usage
## Example Evolution
**Early** (5 items):
```
✓ Set up types
✓ Implemented validation
⏳ Adding UI components
○ Update docs
○ Add tests
```
**Mid-project** (7 items):
```
✓ Initial setup (2 tasks)
✓ Implemented validation
✓ Added UI components
⏳ Updating documentation
○ Add unit tests
○ Add integration tests
○ Final polish (3 items)
```
Notice how AI naturally summarizes old work to stay under limit.
## Why 7 Items?
- Fits working memory model (Miller's law: 7±2 items)
- Prevents token bloat from frequent updates
- Forces focus on immediate actionable work
- Encourages natural summarization patterns
_Generated with `cmux`_
0 commit comments