Skip to content

feat: Auto-slim completed tasks to reduce tasks.json size #1642

@reinamora137

Description

@reinamora137

"Completed tasks carry full details and testStrategy indefinitely, inflating tasks.json. In our 51-tag workspace, tasks.json is 13 MB / 85K lines — most of that is done tasks that will never be read in detail again."

Motivation

When a task is marked status: "done", its details and testStrategy fields are no longer actionable. These fields often contain multi-paragraph implementation plans, code snippets, and test strategies that were useful during development but serve no purpose after completion. Retaining them inflates tasks.json and increases parse time for every read operation.

Proposed Solution

When set_task_status transitions a task to "done", automatically:

  1. Remove details field (or set to empty string)
  2. Remove testStrategy field (or set to empty string)
  3. Truncate description to first 200 characters (preserving the summary)

This is a one-way slim — the git history preserves the original content if ever needed.

High-Level Workflow

  1. set_task_status({id: "5", status: "done"}) is called
  2. Before writing, check if new status is "done"
  3. If so, strip details, testStrategy, truncate description
  4. Write slimmed task to tasks.json
  5. Git commit preserves pre-slim state in history

Key Elements

  • Only triggers on transition TO done (not on already-done tasks)
  • Preserves title, id, status, priority, dependencies, subtasks
  • description truncated to 200 chars with ... suffix
  • Could be opt-in via config flag: "slimDoneTasks": true
  • A separate slim_done_tasks tool could retroactively slim all existing done tasks

Example Workflow

// Before slim (task with status: "done"):
{
  "id": "5",
  "title": "Implement auth system",
  "description": "Set up JWT-based authentication with bcrypt hashing, token refresh, and session management...",  // 500 chars
  "details": "Use bcrypt for hashing...\nImplement refresh tokens...\n...",  // 2000 chars
  "testStrategy": "Unit tests for auth functions...\nIntegration tests...\n...",  // 1500 chars
  "status": "done"
}
// Total: ~4000 chars

// After slim:
{
  "id": "5",
  "title": "Implement auth system",
  "description": "Set up JWT-based authentication with bcrypt hashing, token refresh, and session management...",  // truncated to 200 chars
  "details": "",
  "testStrategy": "",
  "status": "done"
}
// Total: ~300 chars (92% reduction per task)

Implementation Considerations

  • Git history preserves original data — no information is permanently lost
  • Should respect a config flag for users who want to keep full details
  • Subtasks should also be slimmed when parent goes to done
  • Could include a migration tool to slim existing done tasks retroactively

Benchmarks (from our implementation)

We implemented this in our Python MCP replacement:

  • Before slimming: 13 MB tasks.json
  • After retroactive slim of all done tasks: ~30% size reduction on large tags
  • Parse time improvement proportional to size reduction

Out of Scope (Future Considerations)

  • Archiving done tasks to a separate file
  • Compression of tasks.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions