Files
gemini-cli/packages/core
Sandy Tao 5194cef9c1 feat: add Forever Mode for autonomous long-running agent sessions
Add --forever CLI flag that enables autonomous agent operation with
auto-resume, context management, and session optimization.

Core features:
- schedule_work tool: agent declares pause duration, system auto-resumes
  with countdown timer
- PreCompress hook enhancement: hooks can return newHistory to replace
  built-in LLM compression
- Idle hook: fires after configurable inactivity, can auto-submit prompts
- Forever mode disables MemoryTool, EnterPlanModeTool, interactive shell

Session optimization for long-running sessions:
- Record lastCompressionIndex on ConversationRecord; on resume, only load
  post-compression messages (O(N) → O(recent))
- Skip file I/O in updateMessagesFromHistory when no tool results to sync
- Prune UI history to last 50 items after each context compression to
  prevent unbounded memory growth
2026-03-17 14:33:58 -07:00
..