Skip to content

[FEATURE]: Add persistent todo list to prevent losing progress when context limits are reached #18071

Closed as not planned

Description

@swpuchenxinde

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Problem Description

Currently, OpenCode's todo list (managed via the TodoWrite tool) is stored only in memory and is associated with individual sessions. When a session reaches its context limit and a new session is created, all todo tasks from the previous session are lost.

This is a significant issue for long-running development tasks because:

  1. Context Limits: Large projects or complex tasks often exceed the context window limit
  2. Lost Progress: When starting a new session, the agent loses track of pending tasks
  3. Reduced Productivity: Users must manually reconstruct the todo list from memory or conversation history
  4. Poor UX: Users expect their task tracking to persist across sessions, similar to how project management tools work

Proposed Solution

Implement persistent todo list storage that survives session boundaries. The todo list should:

  1. Persist to Disk: Save todo tasks to a project-local file (e.g., .opencode/todo.json)
  2. Load on Session Start: Automatically load existing todos when creating a new session
  3. Sync with Sessions: Keep todos in sync across multiple sessions working on the same project
  4. Optional Configuration: Allow users to disable persistence if desired (via opencode.json)

Implementation Suggestions

File Format

{
  "version": "1.0",
  "todos": [
    {
      "id": "uuid",
      "content": "Task description",
      "status": "pending|in_progress|completed",
      "priority": "high|medium|low",
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-01T00:00:00Z",
      "sessionId": "optional-session-id"
    }
  ]
}

Configuration Options

{
  "todo": {
    "enabled": true,
    "persistence": true,
    "filePath": ".opencode/todo.json",
    "autoSave": true
  }
}

Behavior

  1. When a todo is created/updated: Automatically save to the persistence file
  2. When a new session starts: Load todos from the file (if it exists)
  3. When sessions end: Ensure all pending todos are saved
  4. Multi-session support: Multiple sessions can read/write to the same todo file (with proper locking)
  5. Git integration: Consider adding .opencode/todo.json to .gitignore by default (or make it configurable)

Benefits

  1. Continuity: Maintain task continuity across sessions
  2. Better UX: Users don't lose their task tracking when hitting context limits
  3. Collaboration: Multiple developers/agents can share the same todo list (if committed to git)
  4. Flexibility: Users can inspect/edit the todo file manually if needed
  5. Backward Compatible: Can be implemented as an opt-in feature initially

Use Cases

  1. Large Refactoring: Breaking down a large refactoring into multiple sessions
  2. Multi-day Development: Continuing work after stopping/restarting OpenCode
  3. Context Management: When a session gets too long, start fresh without losing task context
  4. Team Collaboration: If todos are committed to git, team members can see what's in progress

Related Documentation

  • Server API: GET /session/:id/todo (currently in-memory)
  • SDK: @opencode-ai/sdk could expose methods for todo persistence
  • Configuration: Extend opencode.json schema

This feature would significantly improve the developer experience when working on complex, long-running tasks that exceed single-session context limits.

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Mar 18, 2026
  2. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 18, 2026
  3. github-actions commented on Mar 18, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    These issues cover the same underlying problem of todo/task state not surviving session boundaries. It may be worth adding your input there rather than opening a new issue.

  4. lucharo commented on Apr 9, 2026

    @lucharo

    We ran into a narrower version of this that seems worth capturing here.

    The problem isn't only losing todos across session boundaries or compaction. It can also happen inside an active session when the visible todo list gets rewritten for a subtask. From the user's point of view, still-relevant unfinished items can disappear from the list even though the work is not actually done.

    A helpful addition would be safer write semantics for the todo tool/UI, for example:

    • an append or merge mode instead of only replace-style writes
    • preserving existing unfinished items by default unless they're explicitly completed or removed
    • clearer distinction between "rewrite the whole list" and "add these items"

    That would make it much harder to accidentally hide pending work while narrowing focus to a subtask.

  5. assigned and unassigned on Apr 26, 2026
  6. splitice commented on May 1, 2026

    @splitice

    When using the github integration the best place to put this would be the issue / pr that triggered the event. This would would result in a similar user experience as tools like Copilot Cloud agent,

  7. removed
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  8. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions