Task-Specialist
Local task management with SQLite. Offline, persistent, zero dependencies beyond sqlite3 and bash.
Quick Start
CODEBLOCK0
Agent Principles
When using the task-specialist CLI, follow these principles to ensure high-quality, organized project execution:
- - Decompose First: Always break large, multi-step requests into smaller, logical subtasks using
task break. - Status Transparency: Keep task statuses (
start, block, complete) updated in real-time so your progress is traceable and accurate. - Dependency Management: Use
task depend to link tasks that rely on each other, preventing illogical execution order. - Document Progress: Use the
--notes or task show output to keep track of critical information as you move through a project. - Multi-Agent Swarm Queue: If executing in parallel alongside other agents, NEVER pick tasks blindly from
task list (this causes severe race conditions). ALWAYS run task claim --agent="<YourName>". This executes an atomic SQL lock to fetch the highest-priority, fully unblocked pending task exclusively for you and paints your node's identifier onto the global Kanban board. - Context Persistence: Use
task note <Next_Task_ID> "Your specific context string" to permanently pass vital URLs, file paths, or error codes to downstream agents before you close your current task. WARNING: Never store API keys or secrets in task notes; use secure local environment variables instead. - Verification Checkpoints: If a task has a
--verify="cmd" bound to it, running task complete <ID> will natively print the Bash subshell checkpoint. For security (RCE prevention), these checkpoints must be executed manually.
Swarm Orchestrator Guide
If you are the Primary Agent (Orchestrator) managing a complex project, task-specialist is designed to help you spawn parallel Subagents to execute decoupled work simultaneously.
- 1. When to Spawn Subagents: Use the Swarm for horizontally scalable logic (e.g., "Write isolated unit tests for 10 different files", or "Simultaneously deploy 3 independent Docker containers"). Do not spawn subagents for highly linear, sequential work.
- Decomposing the Board:
- First, create all the parallel objectives using
task create.
- Create a final integration task (e.g., "Merge services") and link it to the subtasks using
task depend. This automatically blocks the final task until all Subagents finish.
- Use
task edit <ID> --notes="..." to inject deep context (URLs, file paths, git SHAs) directly into the task payload.
- 3. Spawning the Subagents: Use your native OpenClaw
sessions_spawn tool to horizontally scale. Set mode: "run" for one-shot parallel workers. Pass them the strict execution prompt in the task parameter:
{
"tool": "sessions_spawn",
"runtime": "subagent",
"mode": "run",
"label": "worker-alpha",
"task": "You are a Swarm Worker utilizing the `task-specialist` skill. The task payload DB is at $PWD/.tasks.db. (Read SKILL.md for CLI syntax if needed).\n1. Run `task claim --agent=\"worker-alpha\"` to atomically pop the queue.\n2. Read your target objective via `task show <ID>`.\n3. Execute the objective. Record vital context for me via `task note <ID> \"msg\"`.\n4. Run `task complete <ID>` and self-terminate."
}
- 4. Monitoring the Swarm: While your
mode: "run" Subagents are executing asynchronously:
- Run
task board periodically to monitor their live Kanban progress through the SQLite matrix.
- Run
task stuck to catch any agents that have timed out and require termination (
subagents(action=\"kill\")) and queue restart.
Swarm Subagent Guide
If you are a freshly spawned Subagent Worker, your sole purpose is to execute pending tasks in the queue without colliding with other parallel agents.
- 1. Acquiring Work: NEVER pick tasks blindly from
task list. ALWAYS run task claim --agent=\"<YourName>\". This natively executes an atomic SQL lock to guarantee you aren't fighting another agent for the same process. - Context Intake: Once you have acquired a task (e.g., Task #5), run
task show 5. Read the Notes: section! Your Orchestrator or previous subagents may have left you precise URLs, file paths, or parameters there. - Context Persistence: When your work is done, ask yourself: "Does the next downstream agent need to know I did this?" If yes, use
task note <Next_Task_ID> \"Your context string here\" to permanently append that knowledge to the downstream task's envelope. - Completion and Checkpoints: Run
task complete <ID>. If your task contains a Checkpoint Validation (a Bash subshell script), the engine will output the command for you to run manually. You must repair the codebase until the tests pass before you can technically complete the task and self-terminate.
CLI Reference
Task Lifecycle
CODEBLOCK2
Status flow: pending → in_progress → blocked → INLINECODE35
Priority: 1 (low) to 10 (critical). Default: 5.
Delete: Refuses if task has subtasks unless --force is passed, which cascades the delete to all children and their dependencies.
Querying & Observability
CODEBLOCK3
Subtask Decomposition
CODEBLOCK4
Creates children linked to parent. Auto-chains dependencies: step 2 depends on step 1, step 3 depends on step 2.
Manual Dependencies
CODEBLOCK5
When starting a task, all dependencies must be done or the command is refused with a list of blockers.
When completing a task, any dependent tasks whose deps are now all satisfied are auto-unblocked (blocked → pending).
Heartbeat
CODEBLOCK6
Integrate into long-running scripts:
CODEBLOCK7
Schema
CODEBLOCK8
Environment
| Variable | Default | Purpose |
|---|
| INLINECODE40 | INLINECODE41 | Path to SQLite database |
The DB defaults to a hidden .tasks.db file in the current working directory where the command is executed. This natively supports separate task lists for different projects/workspaces without data collision.
Security
- - No
eval(), no external API calls, no crypto - Pure SQLite + Bash — passes VirusTotal clean
- Integer-only validation on all task IDs via
require_int() guard before any SQL use - Status whitelist:
task list --status only accepts pending, in_progress, blocked, INLINECODE49 - Date format enforcement:
--since only accepts YYYY-MM-DD format via regex check - Text inputs sanitized via single-quote escaping (
sed "s/'/''/g") - Temp-file SQL delivery: SQL is written to a temp file and fed to sqlite3 via stdin redirect to avoid all argument-injection vectors
任务专家
基于SQLite的本地任务管理。 离线、持久化,除sqlite3和bash外无任何依赖。
快速开始
bash
安装(仅创建数据库,不修改PATH)
bash install.sh
或者安装并同时在~/.local/bin中创建简易CLI符号链接
bash install.sh --symlink
创建和处理任务
task create 构建认证模块 --priority=8
task start 1
task-heartbeat 1 # 保持活跃的ping
task complete 1
代理原则
使用task-specialist CLI时,请遵循以下原则以确保高质量、有组织的项目执行:
- - 先分解:始终使用task break将大型、多步骤的请求分解为更小、更合理的子任务。
- 状态透明:实时更新任务状态(start、block、complete),使你的进度可追溯且准确。
- 依赖管理:使用task depend链接相互依赖的任务,防止不合逻辑的执行顺序。
- 记录进度:在项目推进过程中,使用--notes或task show输出记录关键信息。
- 多代理集群队列:如果与其他代理并行执行,切勿盲目从task list中选取任务(这会导致严重的竞态条件)。始终运行task claim --agent=<你的名称>。这会执行原子SQL锁,专门为你获取最高优先级、完全无阻塞的待处理任务,并将你的节点标识绘制到全局看板上。
- 上下文持久化:在关闭当前任务之前,使用task note <下一个任务ID> 你的具体上下文字符串向下游代理永久传递重要的URL、文件路径或错误代码。警告:切勿在任务备注中存储API密钥或机密信息;请改用安全的本地环境变量。
- 验证检查点:如果任务绑定了--verify=cmd,运行task complete 将原生打印Bash子shell检查点。出于安全考虑(防止远程代码执行),这些检查点必须手动执行。
集群编排器指南
如果你是管理复杂项目的主代理(编排器),task-specialist旨在帮助你生成并行子代理,同时执行解耦的工作。
- 1. 何时生成子代理:对可水平扩展的逻辑使用集群(例如,为10个不同文件编写独立的单元测试,或同时部署3个独立的Docker容器)。不要为高度线性、顺序性的工作生成子代理。
- 分解看板:
- 首先,使用task create创建所有并行目标。
- 创建一个最终的集成任务(例如,合并服务),并使用task depend将其链接到子任务。这会自动阻塞最终任务,直到所有子代理完成。
- 使用task edit
--notes=...将深层上下文(URL、文件路径、Git SHA)直接注入任务负载中。
- 3. 生成子代理:使用你的原生OpenClaw sessions_spawn工具进行水平扩展。对于一次性并行工作器,设置mode: run。在task参数中传递严格的执行提示:
json
{
tool: sessions_spawn,
runtime: subagent,
mode: run,
label: worker-alpha,
task: 你是一个使用task-specialist技能的集群工作器。任务负载数据库位于$PWD/.tasks.db。(如需CLI语法,请阅读SKILL.md)。\n1. 运行task claim --agent=\worker-alpha\以原子方式弹出队列。\n2. 通过task show 读取你的目标。\n3. 执行目标。通过task note \msg\为我记录重要上下文。\n4. 运行task complete 并自行终止。
}
- 4. 监控集群:当你的mode: run子代理异步执行时:
- 定期运行task board,通过SQLite矩阵监控它们的实时看板进度。
- 运行task stuck捕获任何已超时并需要终止(subagents(action=kill))和队列重启的代理。
集群子代理指南
如果你是一个新生成的子代理工作器,你的唯一目的是执行队列中的待处理任务,而不与其他并行代理冲突。
- 1. 获取工作:切勿盲目从task list中选取任务。始终运行task claim --agent=\<你的名称>\。这原生执行原子SQL锁,保证你不会与另一个代理争夺同一进程。
- 上下文获取:一旦你获取了一个任务(例如,任务#5),运行task show 5。阅读备注:部分!你的编排器或之前的子代理可能在那里留下了精确的URL、文件路径或参数。
- 上下文持久化:当你的工作完成时,问问自己:下一个下游代理是否需要知道我完成了这项工作? 如果是,使用task note <下一个任务ID> \你的上下文字符串\将该知识永久附加到下游任务的信封中。
- 完成和检查点:运行task complete 。如果你的任务包含检查点验证(Bash子shell脚本),引擎将输出命令供你手动运行。你必须修复代码库直到测试通过,才能正式完成任务并自行终止。
CLI参考
任务生命周期
bash
task create 描述 [--priority=N] [--parent=ID] [--project=NAME] [--verify=cmd] [--due=YYYY-MM-DD] [--tags=a,b] # → 打印任务ID
task edit ID [--desc=新文本] [--priority=N] [--project=NAME] [--verify=cmd] [--assignee=NAME|--unassign] [--due=YYYY-MM-DD] [--tags=a,b] # 调整详情
task claim [--agent=NAME] # 原子锁定并获取最高优先级的待处理任务
task start ID # pending → in_progress(集群中优先使用claim)
task block ID 原因 # → blocked(原因记录在备注中)
task unblock ID # blocked → pending
task note ID 消息 # 将运行时逻辑或错误上下文追加到任务中
task complete ID # → done。检查点验证将打印出来供手动执行。
task restart ID # done/in_progress → pending。重置分配人。
task delete ID [--force] # 删除任务(--force用于父任务)
状态流转: pending → in_progress → blocked → done
优先级: 1(低)到10(关键)。默认值:5。
删除: 如果任务有子任务则拒绝删除,除非传递--force,这将级联删除所有子任务及其依赖。
查询与可观测性
bash
task board # 渲染可视化的ASCII看板仪表板
task list [--status=S] [--parent=ID] [--project=N] [--format=chat] [--tag=T] # 表格列表或GitHub Markdown
task export [--status=STATUS] [--project=NAME] [--json] # Markdown表格或原始JSON数组钩子
task show ID # 完整详情、分配人和依赖
task stuck # 超过30分钟不活跃的in_progress任务
子任务分解
bash
task break 父任务ID 步骤1 步骤2 步骤3
创建链接到父任务的子任务。自动链式依赖:步骤2依赖步骤1,步骤3依赖步骤2。
手动依赖
bash
task depend 任务ID 依赖任务ID
启动任务时,所有依赖必须为done状态,否则命令将被拒绝并列出阻塞项。
完成任务时,任何依赖现已全部满足的被依赖任务将自动解除阻塞(blocked → pending)。
心跳
bash
task-heartbeat 任务ID # 更新last_updated时间戳
task-heartbeat # 报告停滞任务(无参数)
集成到长时间运行的脚本中:
bash
while workinprogress; do
do_work
task-heartbeat $TASK_ID
sleep 300 # 每5分钟
done
模式
sql
tasks: id, requesttext, project, status, priority, parentid,
createdat, startedat, completedat, lastupdated, notes, verification_cmd, assignee
dependencies: taskid, dependsontaskid(复合主键)
环境变量
| 变量 | 默认值 | 用途 |
|---|
| TASK_DB | $PWD/.tasks.db | SQLite数据库路径 |
数据库默认位于执行命令的当前工作目录中的隐藏.tasks.db文件。这原生支持不同项目/工作空间拥有独立的任务列表