Files
msd-core/get-shit-done/templates/agent-history.md
Lex Christopherson eaed8822e2 feat(10-04): update agent-history schema to v1.2
- Add 7 new fields for parallel execution tracking
- execution_mode, parallel_group, granularity, depends_on
- files_modified, checkpoints_skipped, task_results
- Add queued and failed status values
- Update status lifecycle diagram
2026-01-12 13:22:55 -06:00

4.8 KiB

Agent History Template

Template for .planning/agent-history.json - tracks subagent spawns during plan execution for resume capability.


File Template

{
  "version": "1.2",
  "max_entries": 50,
  "entries": []
}

Entry Schema

Each entry tracks a subagent spawn or status change:

{
  "agent_id": "agent_01HXXXX...",
  "task_description": "Execute tasks 1-3 from plan 02-01",
  "phase": "02",
  "plan": "01",
  "segment": 1,
  "timestamp": "2026-01-15T14:22:10Z",
  "status": "spawned",
  "completion_timestamp": null,
  "execution_mode": "sequential",
  "parallel_group": null,
  "granularity": "plan",
  "depends_on": null,
  "files_modified": null,
  "checkpoints_skipped": null,
  "task_results": null
}

Field Definitions

Field Type Description
agent_id string Unique ID returned by Task tool
task_description string Brief description of what agent is executing
phase string Phase number (e.g., "02", "02.1")
plan string Plan number within phase
segment number/null Segment number for segmented plans, null for full plan
timestamp string ISO 8601 timestamp when agent was spawned
status string spawned, completed, interrupted, resumed, queued, failed
completion_timestamp string/null ISO timestamp when completed
execution_mode string "sequential" or "parallel"
parallel_group string/null Batch ID linking agents in same parallel execution
granularity string "plan" or "task_group"
depends_on array/null Agent IDs or plan refs this depends on
files_modified array/null Files this agent created/modified
checkpoints_skipped number/null Count of checkpoints skipped in background
task_results object/null Per-task outcomes for task-level parallelization

Status Lifecycle

queued ──> spawned ──────────────────> completed
               │                           ^
               │                           │
               ├──> interrupted ──> resumed┘
               │
               └──> failed
  • queued: Waiting for dependency (parallel execution only)
  • spawned: Agent created via Task tool, execution in progress
  • completed: Agent finished successfully, results received
  • interrupted: Session ended before agent completed (detected on resume)
  • resumed: Previously interrupted agent resumed via resume parameter
  • failed: Agent execution failed (error during execution)

Usage

When to Create File

Create .planning/agent-history.json from this template when:

  • First subagent spawn in execute-plan workflow
  • File doesn't exist yet

When to Add Entry

Add new entry immediately after Task tool returns with agent_id:

1. Task tool spawns subagent
2. Response includes agent_id
3. Write agent_id to .planning/current-agent-id.txt
4. Append entry to agent-history.json with status "spawned"

When to Update Entry

Update existing entry when:

On successful completion:

{
  "status": "completed",
  "completion_timestamp": "2026-01-15T14:45:33Z"
}

On resume detection (interrupted agent found):

{
  "status": "interrupted"
}

Then add new entry with resumed status:

{
  "agent_id": "agent_01HXXXX...",
  "status": "resumed",
  "timestamp": "2026-01-15T15:00:00Z"
}

Entry Retention

  • Keep maximum 50 entries (configurable via max_entries)
  • On exceeding limit, remove oldest completed entries first
  • Never remove entries with status "spawned" (may need resume)
  • Prune during init_agent_tracking step

Example File

{
  "version": "1.0",
  "max_entries": 50,
  "entries": [
    {
      "agent_id": "agent_01HXY123ABC",
      "task_description": "Execute full plan 02-01 (autonomous)",
      "phase": "02",
      "plan": "01",
      "segment": null,
      "timestamp": "2026-01-15T14:22:10Z",
      "status": "completed",
      "completion_timestamp": "2026-01-15T14:45:33Z"
    },
    {
      "agent_id": "agent_01HXY456DEF",
      "task_description": "Execute tasks 1-3 from plan 02-02",
      "phase": "02",
      "plan": "02",
      "segment": 1,
      "timestamp": "2026-01-15T15:00:00Z",
      "status": "spawned",
      "completion_timestamp": null
    }
  ]
}
  • .planning/current-agent-id.txt: Single line with currently active agent ID (for quick resume lookup)
  • .planning/STATE.md: Project state including session continuity info

Template Notes

When to create: First subagent spawn during execute-plan workflow.

Location: .planning/agent-history.json

Companion file: .planning/current-agent-id.txt (single agent ID, overwritten on each spawn)

Purpose: Enable resume capability for interrupted subagent executions via Task tool's resume parameter.