Skip to content

feat: Add core todo tool for structured task tracking (project vs session vs session-store) #282

Backlog

Description

@kskarthik

Feature Description

Add a core tool (todo or todowrite / todoread) that enables the model to create, update, and inspect a persistent, structured checklist during complex multi-step workflows.

This proposal compares three scoping / storage approaches (Project-scoped file, In-memory session, and Kit's native Session-Store) to ensure the task list survives turn-to-turn context compaction, subagent boundaries, or session switches.

Motivation / Use Case

  1. Combating Context Degradation & Attention Drift: During long-horizon or complex tasks involving multiple file reads, edits, and shell commands, context windows fill up quickly. LLMs often experience attention drift, forgetting early instructions or repeating work. An external checklist anchors the model's focus.
  2. Compaction-Resistant Working Memory: When context compaction triggers (internal/compaction), in-context scratchpads can be truncated or summarized away. A todo tool ensures the agent retains an explicit, uncorrupted record of pending and completed tasks.
  3. Resurrecting Built-in Todo Support Natively: Kit previously had an in-process MCP todo server (removed in 3f2a399e when moving to direct core tools). Residual hooks still exist in Kit's TUI (internal/ui/activity.go renders "Updating todos" and internal/ui/messages.go filters todos arguments). Implementing this as a native core tool directly fulfills those UI affordances with zero MCP/RPC overhead.
  4. Parity with Proven Patterns: Similar built-in checklist tools are core to Goose (todo-mcp), Claude Code, and other top-performing coding agents to achieve robust instruction following.

Proposed Implementation & Scope Considerations

There are three primary ways to manage the persistence of this list. Feedback is welcomed on which approach fits Kit's philosophy better.

Approach A: Project-Scoped (Workspace File)

State is written to a hidden file in the workspace (e.g. .kit/todos.json).

  • Pros: Survives everything. A task list initiated by an agent can be picked up later if the user restarts the terminal, uses the ctx.NewSession() API for multi-phase handoffs, or delegates to a subagent.
  • Cons: Mutates the user's workspace filesystem. Requires users to add .kit/ to .gitignore. Requires file locking for concurrency across subagents.

Approach B: Session-Scoped (In-Memory)

State is kept in memory attached to the active session metadata (similar to how Goose implements todo-mcp).

  • Pros: Zero filesystem clutter. No concurrency issues across multiple independent terminal sessions in the same repo.
  • Cons: State is lost if the CLI is restarted. Subagents or extensions using ctx.NewSession() would lose the context of the active checklist unless explicitly passed.

Approach C: Session-Store Backed (Kit's Native JSONL Tree via session.ExtensionDataEntry)

State is persisted to Kit's user-level session store (~/.kit/sessions/<cwd>/<session-id>.jsonl) using TreeManager.AppendExtensionData("todo", json) and GetExtensionData("todo").

  • Pros:
    • Zero repository clutter (no workspace files or .gitignore entries needed).
    • Survives CLI restarts and session resumption (kit --resume / session picker).
    • Survives compaction because ExtensionDataEntry lives in the persistent tree outside pruned message windows.
    • Fork/Branching aware: if the user rewinds or branches the session tree, the todo list at that point in tree history can be accurately restored.
  • Cons:
    • Scoped to that session (not automatically shared across brand new sessions unless inherited or forked).
    • Requires passing the session's store/tree interface to the tool runner or ToolConfig.

Shared Tool Definition (internal/core/todo.go)

Regardless of the backing storage, the unified todo core tool would look like:

  • Inputs:
    • todos: Optional list of tasks to overwrite or update.
    • Each task containing:
      • id (string): Unique identifier.
      • content (string): Short description.
      • status (string enum: pending, in_progress, completed).
      • priority (string enum: low, medium, high).
  • Behavior:
    • If todos is provided: validates the structure, saves the state, and returns the formatted checklist summary.

    • If todos is omitted or empty: retrieves existing items and returns the formatted checklist.

    • Return string renders a human-readable list:

      [X] Implement core tool in internal/core/todo.go
      [~] Add unit tests in internal/core/todo_test.go
      [ ] Wire into coreTools in internal/core/tools.go
      

Core Tool Registration & UI

  • Register in internal/core/tools.go map under "todo".
  • Kit's activity bar (internal/ui/activity.go) and message formatter (internal/ui/messages.go) already support "todo" / "todos".

Alternatives Considered

  • Extension-Only: Ship as a Yaegi extension in examples/extensions/todo.go. While flexible, task tracking is a fundamental agent capability that should be available by default without extra setup.
  • Single Markdown File (.kit/TODO.md): Using raw Markdown instead of structured JSON. JSON provides strict schema validation and structured status transitions (pending -> in_progress -> completed) which models follow more reliably than unstructured markdown edits.

Checklist

  • I've searched existing issues and this hasn't been requested yet
  • This feature aligns with Kit's design philosophy (native core tools, zero serialization overhead)

Activity

  1. mark-iii-labs-huly commented on Nov 25, 2026

    @mark-iii-labs-huly

    Connected to Huly®: KIT-283

  2. changed the title [-]feat: Add project-scoped core todo tool for structured task tracking[/-] [+]feat: Add core todo tool for structured task tracking (session vs project scoped)[/+] on Nov 25, 2026
  3. kskarthik commented on Nov 25, 2026

    @kskarthik
    ContributorAuthor

    I am leaning towards Approach B

  4. e4t commented on Nov 26, 2026

    @e4t
    Contributor

    @kskarthik You've asked me for my take on this. Having a TODO tool to track long term goals which may go out of focus due to context compaction. I'm tending more for approach A (file-backed approach): there should already be a session store which can be used for this so there is probably no need to store this data in the project.
    My sessions often go over days as I tend to get interrupted frequently. Having persistent TODO store which survives an agent restart would be very useful.
    There should already be a session store which can be used for this so there is probably no need to store this data in the project.

  5. changed the title [-]feat: Add core todo tool for structured task tracking (session vs project scoped)[/-] [+]feat: Add core todo tool for structured task tracking (project vs session vs session-store)[/+] on Nov 27, 2026
  6. kskarthik commented on Nov 27, 2026

    @kskarthik
    ContributorAuthor

    @e4t i added your idea as proposal c

  7. added a commit that references this issue on Nov 27, 2026
    6d148b9
  8. ezynda3 commented on Dec 1, 2026

    @ezynda3
    Contributor

    Decision on the approach:

    • Kit gets a core todo tool with approach C (the session store).
    • The tool is off by default in its first release. We can turn it on by default when the TUI shows the list.
    • The work lands in two steps. First, a separate pull request makes extension data stay available after a compaction. Then the tool lands on top of that fix.

    The details are in the review of #283.

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

Metadata

Metadata

Assignees

No one assigned

    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