Skip to content

Context Management System #17

Description

@frankbria

Summary

Implement systematic context reset mechanisms to prevent quality degradation in long AI conversations.

Problem

Long AI conversations lead to:

  • Attention decay on earlier context
  • Shortcut patterns reinforcing
  • Gradual quality decline
  • Loss of architectural understanding

Tasks

1. Context Management Rules

  • Define token budget for conversations (~50k)
  • Set checkpoint frequency (every 5 responses)
  • Establish reset triggers
  • Document context handoff process

2. Checkpoint System

  • Add mandatory checkpoint every 5 AI responses
  • Require full test run at checkpoints
  • Require coverage report at checkpoints
  • Ask "continue or reset?" at each checkpoint

3. Context Handoff Template

  • Create template for summarizing context
  • Include: completed features, current state, known issues
  • Format for easy copy-paste to new conversation
  • Include test/coverage evidence

4. Automated Detection

  • Integrate with quality-ratchet.py
  • Auto-suggest resets when quality drops
  • Track conversation length
  • Warn at token budget limits

5. Documentation

  • Update .claude/rules.md with context limits
  • Document handoff process
  • Provide example context summaries
  • Explain why resets are necessary

Context Handoff Template

## Context Summary for Continuation

### Completed Features
- Feature A: [status] - tests passing, coverage 85%
- Feature B: [status] - tests passing, coverage 82%

### Current State
- All tests passing: [yes/no]
- Coverage: [XX]%
- Known issues: [list]

### Next Tasks
- [ ] Task 1
- [ ] Task 2

### Test Evidence
[paste pytest output]
[paste coverage report]

Reset Triggers

Automatic context reset recommended when:

  1. Quality drops >10% (via quality-ratchet)
  2. Response count exceeds 15-20
  3. Token budget approaches limit (~45k)
  4. AI shows signs of "laziness" (shortcuts, false claims)

Success Criteria

  • Context resets happen before quality degrades
  • Handoff process is smooth and documented
  • Quality remains consistent across resets
  • Token budgets are respected

User Experience

  • Make resets feel natural, not disruptive
  • Provide clear value: "Let's start fresh to maintain quality"
  • Template makes handoff painless
  • Document the "why" so users buy in

Dependencies

Estimated Effort: 2-3 hours

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions