S radar todo

From xg-gh-25/SwarmAI · View interactive version

S radar todo is an AI agent skill from the GitHub repository xg-gh-25/SwarmAI. Manage SwarmAI ToDos: add, list, edit, complete, delete; each todo is a self-contained work packet. Also creates todos from action items. TRIGGER: \"add todo\", \"create todo\", \"my todos\", \"加个待办\". NOT FOR: calendar events.

How to use this skill

Skill file

ToDo Skill

Skill NAME (s_radar-todo) is a legacy identifier — kept stable. The SURFACE is

the left-nav ToDo card (nav-todo → swarm:show-todo → ToDoOverlay, a

fullscreen Flow|History workbench). There is NO "Radar sidebar" anymore.

Manage ToDo items surfaced in the left-nav ToDo card/overlay. ToDos are stored in

SQLite (~/.swarm-ai/data.db) and displayed in the ToDo overlay's Flow board.

Core principle: Every todo is a self-contained work packet. When a user

drags a todo into a chat tab or says "work on this todo", the agent must be able

to start executing immediately — no re-discovery, no context hunting.

Tool

"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/todo_db.py <command> [options]

Work Packet Schema (linked_context)

Every todo's linked_context field stores a JSON object with structured context:

{
  "files": ["backend/core/session_unit.py", "desktop/src/hooks/useChatStreamingLifecycle.ts"],
  "design_docs": ["Knowledge/Designs/2026-03-21-append-message-design.md"],
  "commits": ["81f596c", "a070ca3"],
  "sessions": ["3af6258b"],
  "memory_refs": ["COE:2026-03-20:big-bang-refactor", "Lesson:2026-03-22:invariants"],
  "next_step": "Extract _handle_agent_task_result into dispatch table in session_unit.py",
  "acceptance": "Append message queues during stream, last-message-wins, no content loss on tab switch",
  "blockers": ["Need to verify queue drain in finally block handles CancelledError"],
  "notes": "Design doc v2 approved. Queue-based approach — never stops stream."
}

| Field | Required? | Purpose |

|-------|-----------|---------|

| next_step | YES | Concrete first action. Not vague — an actual step the agent executes. |

| files | YES for code todos | Source files to read/modify. Relative to swarmai repo root. |

| acceptance | Recommended | How to know it's done. "Tests pass" is not enough — describe the behavior. |

| design_docs | If exists | Design docs or specs. Agent reads these before starting. |

| commits | If relevant | Related git commits for context (e.g. prior fix attempts). |

| sessions | If relevant | Chat session IDs where this was discussed. |

| memory_refs | If relevant | MEMORY.md entries (COEs, lessons, decisions) that apply. |

| blockers | If any | What's preventing progress. High priority if blockers exist. |

| notes | Optional | Free-form context that doesn't fit elsewhere. |

Commands

Add a todo (with full context)

"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/todo_db.py add \
  --title "Implement append-message queue (Phase 1)" \
  --priority high \
  --source-type chat \
  --description "Design doc v2 approved. Queue-based append: never stops stream, input always enabled, last message wins." \
  --files backend/core/session_unit.py desktop/src/hooks/useChatStreamingLifecycle.ts desktop/src/pages/ChatPage.tsx \
  --design-docs Knowledge/Designs/2026-03-21-append-message-design.md \
  --commits 3af6258b \
  --next-step "Extract _handle_agent_task_result into dispatch table in session_unit.py" \
  --acceptance "User can type new message during streaming. Last message wins. No content loss. Tests pass." \
  --notes "Kiro reviewed and approved. Queue-don't-kill is the model."

Context args (all optional, but fill as many as applicable):

Other args:

(not ai_detected: see below)

List todos

"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/todo_db.py list           # compact: active only (pending + overdue)
"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/todo_db.py list --all      # all statuses
"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/todo_db.py list -s handled  # specific status
"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/todo_db.py list -v          # full work packets for all items

Compact output includes the next_step hint:

  ⏳ 🔴 [a30ac3d8] Implement append-message queue → Extract _handle_agent_task_result...
  ⏳ 🟡 [78d62711] Review Kiro commits → Read recent git log and identify catch-vs-eliminate patterns

Get a specific todo (full work packet)

"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/todo_db.py get <todo_id_or_prefix>

Output is a full work packet — human-readable header + JSON payload:

======================================================================
TODO: Implement append-message queue (Phase 1)
======================================================================
  ID:       a30ac3d8-...
  Priority: 🔴 HIGH
  Status:   pending

  WHY: Design doc v2 approved. Queue-based append...

  NEXT STEP: Extract _handle_agent_task_result into dispatch table

  DONE WHEN: User can type new message during streaming...

  FILES:
    - backend/core/session_unit.py
    - desktop/src/hooks/useChatStreamingLifecycle.ts

  DESIGN DOCS:
    - Knowledge/Designs/2026-03-21-append-message-design.md
---JSON---
{ ... full structured data ... }

Short ID prefixes work (first 8 chars is usually enough).

Update a todo (context merges)

"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/todo_db.py update <todo_id> \
  --files backend/routers/chat.py \
  --next-step "Wire queue drain into SSE disconnect handler" \
  --blockers "Need to verify CancelledError path"

Context merges intelligently: list fields (files, commits, blockers) extend

without duplicates; scalar fields (next_step, acceptance) overwrite.

Change status

"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/todo_db.py status <todo_id> handled
"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/todo_db.py status <todo_id> in_discussion
"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/todo_db.py status <todo_id> cancelled

Valid statuses: pending, overdue, in_discussion, handled, cancelled, deleted

Delete a todo

"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/todo_db.py delete <todo_id>          # soft delete (status → deleted)
"$SWARM_BACKEND_BIN" py {SKILL_DIR}/scripts/todo_db.py delete <todo_id> --hard    # hard delete (remove from DB)

CRITICAL: Context Requirements by Source

Every todo's linked_context is validated against source-specific required fields.

Validation warns on missing fields (logged, tagged _missing_fields) but never blocks creation.

Universal fields (ALL source types)

| Field | Required | Purpose |

|-------|----------|---------|

| next_step | YES | Concrete first action. Not vague — an actual step the agent executes. |

| created_by | Recommended | Who created: job:morning-inbox, agent:session_abc, user:manual |

Email todos (source_type=`email`)

Created by scheduled jobs (morning-inbox). Job agents output structured

<!-- RADAR_TODOS [...] --> JSON blocks with email context.

| Field | Required | Example |

|-------|----------|---------|

| email_subject | YES | "Quarterly report due Friday" |

| email_from | YES | "no-reply@example.com" |

| email_date | YES | "2026-03-30T08:15:00Z" |

| email_snippet | YES | First 200 chars of email body |

| suggested_action | YES | reply / forward / delegate / read |

| email_message_id | Optional | For re-fetching via the email MCP |

| email_thread_id | Optional | For thread context |

Slack todos (source_type=`slack`)

| Field | Required | Example |

|-------|----------|---------|

| channel_name | YES | "#general" |

| sender | YES | "alice" |

| message_snippet | YES | First 500 chars of message |

| thread_url | YES | Slack permalink |

| channel_id | Optional | For API lookups |

| thread_ts | Optional | For thread replies |

User chat todos (source_type=`chat`)

When user says "add a todo for X" during conversation:

| Field | Required | Purpose |

|-------|----------|---------|

| session_id | YES | Current session ID for back-reference |

| user_intent | YES | WHY — capture the user's intent and discussion context |

| next_step | YES | What the user would do first if they started now |

| files | Recommended | Any files mentioned or being worked on |

| design_docs | Recommended | Related design docs / specs / material the todo depends on |

| commits | Optional | Related git commits |

| acceptance | Optional | What "done" looks like |

Attach the material. When a chat todo references a design doc, spec, report,

or any document the work depends on, put its workspace-relative path in

--design-docs (and source files in --files). The ToDo detail drawer renders

this material so the executing agent — and the user reviewing it — has everything

in the work packet. A chat todo about work-with-a-doc that omits design_docs

is an incomplete work packet.

AI-detected todos (source_type=`ai_detected`) — not written by this skill

An ai_detected ToDo is one a model writes without the user in the loop. The backend

writes it through one gate (credentials redacted; refused when the injection scanner

flags its text), which this CLI cannot apply, so add does not accept

--source-type ai_detected. Nothing writes one after a session: the activity summary

only sends an open ToDo the session finished to review, it never creates one (a ToDo

written later from the transcript was mostly work still in progress or already done).

A ToDo you create during a chat, with the user there, is a chat ToDo; give it

--description (why, and what triggered it), --next-step and --files.

Meeting todos (source_type=`meeting`)

| Field | Required | Example |

|-------|----------|---------|

| meeting_title | YES | "Sprint Review" |

| meeting_date | YES | "2026-03-31" |

| attendees | YES | "Alice, Bob, Carol" |

| action_item | YES | The specific action assigned |

| meeting_id | Optional | Calendar event ID |

| notes_url | Optional | Link to meeting notes |

Manual todos (source_type=`manual`)

Only next_step is required. Everything else is optional.

Proactive ToDo Detection

A ToDo has two ways in: the user asks for one in a session, or you, the agent in the

session, record work that was decided to be done later and say so in your reply. No

ToDo is written after the session. So when a session leaves real work for later, this

is the only moment it gets recorded: decide it here, with the rules below.

The Regret Test

Before creating any proactive todo, ask: "Would the user regret NOT seeing this tomorrow?"

If you're not confident the answer is yes → don't create it.

Hard Limits

only create 2, you'll pick the ones that actually matter. Todo fatigue kills the

entire system — a noisy ToDo list gets ignored.

```

📌 Added to ToDo: "Test SSE disconnect with real network kill" (🔴 high)

```

User can immediately say "remove that" if it's noise. Silent creation = shadow

decisions = trust violation.

When to Create (passes regret test)

  1. User commits to future action: "I'll do X tomorrow", "need to follow up on Y",

"let me think about Z" — people forget verbal commitments. Capture before it's lost.

  1. Blocker identified: Work can't proceed because of a dependency, missing info,

or approval needed. Without a visible todo, the blocker gets buried in chat history.

  1. COE follow-up: Patch ships now, the real architectural fix is the todo. Without

it, the fix never happens. (Evidence: 3 COEs in our history with this exact pattern.)

When NOT to Create (fails regret test)

next_step with a concrete action, it's not ready.

closed by the knowledge flow) is not duplicated as a ToDo.

Note it in the session, move on.

important enough. Save it for next session or don't create it.

Context Requirements for Proactive Todos

Every proactive todo MUST have:

Should have (when applicable):

Lifecycle & DB Hygiene

Todos follow a 3-layer cleanup lifecycle (runs during daily maintenance):

| Layer | What | When | Action |

|-------|------|------|--------|

| Soft expire | pending todos | >30 days old | status → cancelled |

| Overdue escalation | overdue todos | >14 days with no change | status → cancelled |

| Archive purge | handled/cancelled/deleted | >14 days since last update | archive to JSONL → hard DELETE |

Archive location: Knowledge/Archives/todo-archive.jsonl — each purged todo

is appended as a JSON line with _purged_at timestamp before deletion.

Config (in schemas/todo.py → TODO_LIFECYCLE):

TODO_LIFECYCLE = {
    "soft_expire_days": 30,
    "overdue_cancel_days": 14,
    "purge_retention_days": 14,
    "archive_before_purge": True,
}

Active todos (pending, overdue, in_discussion) are NEVER purged regardless of age.

Integration Notes

when the user opens the ToDo card or switches tabs.

writes from agent. Single-writer serialization is automatic.

Agent calls get <id> to load the full work packet, then executes.

blocks with source-specific context. Falls back to legacy regex for old agents.

Verification

Before marking this task complete, show evidence for each:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.