Downcity
ServicesTask Service

Task Definition and Action Contracts

task.md schema, when trigger semantics, and action contracts

Task Definition and Action Contracts

Task definition file

.ship/task/<taskId>/task.md

taskId is derived from normalized title, and title should stay unique.

Frontmatter fields

FieldRequiredDescription
titleYesUnique task name
descriptionYesGoal description
contextIdYesExecution context id
whenYesTrigger: @manual / cron / time:ISO8601
statusYesenabled / paused / disabled
kindNoagent (default) or script

when semantics

  • @manual: manual trigger only.
  • cron expression: periodic scheduling.
  • time:2026-03-08T10:30:00+08:00: one-shot trigger (timezone required).

After one-shot execution succeeds:

  • status -> paused
  • when -> @manual

Actions

ActionPurposeKey response
listlist task definitionstasks[]
createcreate task definitionmay return reusedExisting=true
updateupdate definitionwrites task.md
runmanual run oncereturns accepted=true + executionId immediately
statusexplicit status setenabled/paused/disabled
enable/disablestatus shortcutssame as status update
deleteremove definition and run historyreturns task dir path

Create de-dup logic

create now deduplicates by exact title only:

  • same title exists: reuse existing task (reusedExisting=true)
  • otherwise: create a new task

No semantic-similarity dedup is applied.

run contract

run is async-accepted:

  1. verify task exists
  2. start runTaskNow(...) in background
  3. return immediately with accepted=true, message, and executionId

Additional agent rule:

  • success requires successful chat_send delivery
  • delivery failure is treated as executionStatus=failure

CLI and API

CLI:

city task run daily-check --reason "manual"

API:

city service command task run --payload '{"title":"daily-check","reason":"manual"}'

Table of Contents