Skip to content

Agent Protocol

Switch to Zen Mode

This document defines how external Agents (AI CLI tools, custom scripts, cron jobs) read from and write to Mutsumi’s mutsumi.json.

Backward compatibility: Mutsumi also accepts tasks.json as a fallback filename. However, mutsumi.json is the canonical name going forward.

Core principle: Mutsumi does not bind to any specific Agent. Any program that can correctly read and write JSON is a legitimate Controller.

Mutsumi ships 5 bundled skills that follow the Agent Skills open standard. When installed, agents discover them automatically — no manual prompt pasting needed.

Terminal window
mutsumi setup --agent claude-code # or codex-cli, gemini-cli, opencode

This creates symlinks from ~/.mutsumi/skills/ (SSOT) into the agent’s skill directory.

SkillDescriptionTrigger
mutsumi-manageTask CRUD — add, edit, done, remove via CLI or direct JSONUser asks to manage tasks
mutsumi-trackAuto-update task progress as the agent worksAuto-triggered (user-invocable: false)
mutsumi-planDecompose a complex goal into parent + subtasksUser asks to plan or break down work
mutsumi-reportGenerate a status summary grouped by scopeUser asks for a report (disable-model-invocation: true)
mutsumi-contextLoad task board state at session start for priority awarenessAuto-triggered (user-invocable: false)

Each skill is a directory with a SKILL.md file:

mutsumi-manage/
SKILL.md ← YAML frontmatter + Markdown instructions

The frontmatter follows the agentskills.io specification:

---
name: mutsumi-manage
description: >
Add, edit, complete, or remove tasks in mutsumi.json.
---

Key frontmatter fields:

  • name — lowercase + hyphens, max 64 chars
  • description — when the agent should activate this skill
  • user-invocable: false — agent auto-triggers, user cannot invoke directly
  • disable-model-invocation: true — only activated when user explicitly asks
Bundled in pip package SSOT (single copy) Agent skill dirs
mutsumi/skills/ → ~/.mutsumi/skills/ → ~/.claude/skills/
mutsumi-manage/ mutsumi-manage/ mutsumi-manage/ (symlink)
mutsumi-track/ mutsumi-track/ mutsumi-track/ (symlink)
mutsumi-plan/ mutsumi-plan/ ...
mutsumi-report/ mutsumi-report/
mutsumi-context/ mutsumi-context/
references/ references/

Step 1: ensure_ssot() copies bundled skills → ~/.mutsumi/skills/. Step 2: install_for_agent() creates symlinks from SSOT → agent directory.

This SSOT architecture ensures all agents share the same skill definitions. Updating Mutsumi (pip install --upgrade) automatically refreshes the SSOT on next mutsumi setup.

AgentTypeIntegration Level
Claude CodeAI CLINative (recommended)
Codex CLIAI CLINative
Gemini CLIAI CLINative
OpenCodeAI CLINative
AiderAI CLINative
Shell scriptsCustomNative
Cron jobsSystemNative

“Native” means only JSON file read/write is needed. No SDK, no plugin, no driver.

  1. Read the current mutsumi.json (full content)
  2. Parse as JSON
  3. Modify the tasks array (add / update / delete)
  4. Write the entire file back (no partial writes)
  5. Mutsumi’s watchdog detects the change and re-renders
RuleDescription
Preserve unknown fieldsDo not delete fields you don’t recognize. Keep them as-is.
Atomic writeWrite to a temp file, then os.replace(). Prevents Mutsumi from reading a half-written state.
Valid JSONThe file must be valid JSON after writing.
Generate valid IDsNew task IDs should use UUIDv7. At minimum, ensure uniqueness.
Required fieldsEvery task must include id, title, status.
Enum compliancestatus must be "pending" or "done".
import json, uuid, datetime, tempfile, os
# 1. Read
with open("mutsumi.json") as f:
data = json.load(f)
# 2. Add
new_task = {
"id": str(uuid.uuid7()), # or any unique string
"title": "Fix login bug",
"status": "pending",
"scope": "day",
"priority": "high",
"tags": ["bugfix"],
"created_at": datetime.datetime.now(datetime.UTC).isoformat(),
"children": []
}
data["tasks"].append(new_task)
# 3. Write (atomic)
tmp = tempfile.NamedTemporaryFile(
mode='w', dir='.', suffix='.tmp', delete=False
)
json.dump(data, tmp, ensure_ascii=False, indent=2)
tmp.close()
os.replace(tmp.name, "mutsumi.json")
for task in data["tasks"]:
if task["id"] == target_id:
task["status"] = "done"
task["completed_at"] = datetime.datetime.now(datetime.UTC).isoformat()
break
Terminal window
# Mark a task done
jq '(.tasks[] | select(.id == "01JQ...")).status = "done"' mutsumi.json > tmp.json
mv tmp.json mutsumi.json

When a user operates in the TUI, Mutsumi appends events to events.jsonl (JSONL format, one event per line):

{"ts":"2026-03-21T10:00:00Z","event":"task_completed","task_id":"01JQ...","title":"Fix cache bug","source":"tui"}
{"ts":"2026-03-21T10:01:22Z","event":"task_created","task_id":"01JQ...","title":"Write unit tests","source":"tui"}
{"ts":"2026-03-21T10:05:00Z","event":"task_deleted","task_id":"01JQ...","title":"Outdated task","source":"tui"}
{"ts":"2026-03-21T10:06:30Z","event":"task_updated","task_id":"01JQ...","changes":{"priority":"high->low"},"source":"tui"}
EventFieldsDescription
task_createdtask_id, titleNew task created
task_completedtask_id, titleTask marked done
task_deletedtask_id, titleTask deleted
task_updatedtask_id, changesTask fields modified
schema_errorfile, messageJSON validation failed
Terminal window
# Real-time monitoring
tail -f events.jsonl | jq .
# In agent prompt
"Check events.jsonl for recent user actions on tasks"

Agents can retrieve the current JSON Schema via CLI:

Terminal window
# JSON Schema output
mutsumi schema
# Markdown field descriptions
mutsumi schema --format markdown
Agent writes invalid JSON
|
v
Mutsumi watchdog detects change
|
v
Parse fails -> TUI shows error banner
| "mutsumi.json has errors, showing last valid state"
v
Error logged to stderr + error.log
|
v
Event emitted: {"event":"schema_error","file":"mutsumi.json","message":"..."}
|
v
Agent can read error.log or events.jsonl to self-correct

Add to your agent’s system prompt:

After writing to mutsumi.json, check ~/.local/share/mutsumi/error.log
for any schema validation errors. If errors exist, fix and rewrite.

When multiple Agents operate on the same mutsumi.json simultaneously:

  1. Read-before-write — Always read the latest version before writing
  2. Minimize write scope — Only modify the tasks you care about; don’t reorder others
  3. Idempotent operations — Marking complete should be idempotent (no error on repeat)
  4. Use unique IDs — UUIDv7 ensures IDs from different Agents never collide

Mutsumi does not provide a locking mechanism. Strategy: Last Write Wins.

In practice, Agent writes are discrete (typically seconds to minutes apart), so the probability of conflict is extremely low.

The recommended template for embedding in any agent’s system prompt:

## Task Management (Mutsumi Integration)
You have access to a local task file at `./mutsumi.json`.
When the user asks you to manage tasks, read and write this file.
Schema:
- Required fields: id (unique string), title (string), status ("pending" | "done")
- Optional fields: scope ("day"|"week"|"month"|"inbox"),
priority ("high"|"normal"|"low"), tags (string[]),
children (Task[]), due_date (ISO date), description (string)
- Preserve any fields you don't recognize -- do NOT delete them
- Use atomic write (temp file + os.replace()) when possible
- Generate UUIDv7 for new task IDs
Example task:
{"id":"01JQ...","title":"Fix auth","status":"pending","scope":"day",
"priority":"high","tags":["dev"],"children":[]}