Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

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

- Add MAX_TODOS = 7 constant to enforce compact lists
- Update tool description to teach 'high precision at center' model
- Guide AI to summarize old completed and far future work
- Add validation with educational error messages
- Add visual styling:
  - Detect summary items via regex pattern: (N items|tasks|steps)
  - Apply italic + smaller font to summaries
  - Gradient fade for older completed items (exponential decay)
- Add test coverage for MAX_TODOS validation
- Encourage bidirectional flow: expand/condense as work progresses

This keeps TODOs focused on what matters NOW (recent + current + immediate)
while maintaining context through summarization.

Generated with `cmux`
Simplified visual treatment:
- Removed summary item detection (regex pattern)
- Removed italic styling and font-size changes for summaries
- Keep gradient fade for old completed items
- Fade effect still guides AI to condense old completions
@ammar-agent ammar-agent marked this pull request as ready for review October 15, 2025 02:26
- Far future items fade more (exponential decay)
- First 2 pending items stay full opacity (immediate next steps)
- Later pending items fade progressively (0.5 min opacity)
- Mirrors the completed items fade (distant past ↔ distant future)
- Reinforces 'high precision at center' visual model
- Create calculateFadeOpacity() helper for exponential decay
- Reduces duplication between completed/pending fade logic
- Same behavior, cleaner code
@ammario ammario enabled auto-merge October 15, 2025 02:34
@ammario ammario added this pull request to the merge queue Oct 15, 2025
Merged via the queue into main with commit ba7b2c5 Oct 15, 2025
7 checks passed
@ammario ammario deleted the todo-limit-7-fresh branch October 15, 2025 02:48
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.

2 participants