Problem
The REST API has endpoints for listing tasks (GET /api/tasks), moving tasks (POST /api/task/<id>/move), and triggering runs (POST /api/task/<id>/run), but there is no endpoint to create tasks programmatically.
This means external integrations (OpenClaw, other agents, automation scripts) must shell out to the CLI (agentflow add-task ...) to create tasks. This breaks the pure-HTTP workflow and makes it harder for external tools to manage the full task lifecycle via API.
Suggested API
POST /api/tasks
Content-Type: application/json
{
"project": "openclaw-tasks",
"title": "Fix null pointer in auth middleware",
"description": "When the token is expired, the middleware crashes instead of returning 401.",
"priority": 5,
"impact": 4,
"effort": 2,
"source": "github",
"external_id": "42"
}
Response:
{
"ok": true,
"task_id": 7,
"task": { ... }
}
Implementation
Approximately 15-20 lines in console.py do_POST():
if path == "/api/tasks":
payload = self._parse_json(body)
project = str(payload.get("project", ""))
title = str(payload.get("title", ""))
if not project or not title:
self._send_json({"error": "project and title are required"}, status=400)
return
task_id = store.add_task(
project=project,
title=title,
description=payload.get("description"),
priority=int(payload.get("priority", 3)),
impact=int(payload.get("impact", 3)),
effort=int(payload.get("effort", 3)),
source=payload.get("source"),
external_id=payload.get("external_id"),
)
task = store.get_task(task_id)
self._send_json({"ok": True, "task_id": task_id, "task": _task_to_dict(task)})
return
Why this matters
- Enables pure-HTTP task lifecycle management (create → list → move → run → audit)
- Required for OpenClaw integration to create tasks without shelling out to CLI
- Foundation for webhook-driven and agent-driven task creation flows
- Part of the broader goal: external agent runbooks can fully manage tasks via REST
Depends on
None — standalone API addition.
Problem
The REST API has endpoints for listing tasks (
GET /api/tasks), moving tasks (POST /api/task/<id>/move), and triggering runs (POST /api/task/<id>/run), but there is no endpoint to create tasks programmatically.This means external integrations (OpenClaw, other agents, automation scripts) must shell out to the CLI (
agentflow add-task ...) to create tasks. This breaks the pure-HTTP workflow and makes it harder for external tools to manage the full task lifecycle via API.Suggested API
Response:
{ "ok": true, "task_id": 7, "task": { ... } }Implementation
Approximately 15-20 lines in
console.pydo_POST():Why this matters
Depends on
None — standalone API addition.