Agent GTD
A complete executive function stack for AI agents. Three layers working together:
| Layer | Tool | Role |
|---|
| RAM | Taskwarrior | Actionable tasks, current focus, backlog |
| Hard Drive |
Markdown files | Context, decisions, lore, "why" |
|
Workbench |
ops/session_state.md | What I was doing 5 seconds ago |
Rule of thumb: task to finish → Taskwarrior. Fact to remember → Markdown. Mid-task state → session_state.
Installation
Taskwarrior (required)
CODEBLOCK0
Python 3 (required for helper scripts)
Timewarrior (optional — enables vitality heartbeat)
CODEBLOCK1
ClawVault (optional — structured session handoffs)
Falls back gracefully if absent; task_manager.py sleep prints a warning but continues.
Quick Reference
CODEBLOCK2
1. The Inbox (Capture)
Everything goes into the inbox first. No processing at capture time.
CODEBLOCK3
Inbox items carry high urgency (+15.0) to surface in default reports.
2. Triage Flow
For each item in task in:
- 1. Actionable? No → delete or annotate as reference.
- < 2 minutes? Do it now, mark done.
- Multi-step? Create a
project: and tag the first step +next. - Delegate? Tag
+waiting, add wait: date, annotate who/what. - Defer? Assign project, tag
+next, move on.
3. Project Taxonomy
CODEBLOCK4
4. Task Attributes
CODEBLOCK5
Selection pattern:
task next brainpower:L estimate:5 # Quick wins
task next brainpower:H priority:H # Deep work
5. Error & Learning Capture
Log immediately. Don't wait for review time.
| Situation | Tag | Example |
|---|
| Command / tool fails | INLINECODE8 | INLINECODE9 |
| User corrects agent |
+learning |
task add project:Internal.Learnings +learning "pnpm not npm on this project" |
| Missing capability |
+featreq |
task add project:Internal.Learnings +featreq "user wanted calendar invite generation" |
Use task annotate <id> "..." for fix details or stack traces.
Automated promotion: promote_learnings.py runs every 6 hours via cron. It scans memory/lessons/ for error-like entries that recur 3+ times in 7 days — then auto-creates a Taskwarrior task in project:Internal.Learnings with the fix description. No manual tracking needed for recurring errors.
Manual promotion rule: If the recurring error has a structural fix (not just a one-liner), promote it to TOOLS.md, AGENTS.md, or SOUL.md. Mark the Taskwarrior task done, note the promotion target in the final annotation.
CODEBLOCK7
6. Backlog Triage
Run when the task list exceeds ~20 items or burndown stalls.
Tickler / Think Pattern
# Snooze: hide until a future date
task add +tickle wait:2025-03-01 "revisit X"
# Deferred decision: force a yes/no when it resurfaces
task add +tickle +think wait:+3d "Should I do Y? (yes/no)"
No double-snooze rule: when a
+think task resurfaces, decide immediately. No re-snoozing.
Rule of 3
Pick only
3 tasks per day to actually finish during autonomous chew-through. Focus beats volume. Prioritize:
- 1. Anything blocking other tasks (dependency-first)
- Low-hanging fruit solvable in < 5 min (
exec, edit, web_search) - Highest-urgency
+next task
Priority Pivot
When project focus shifts, bulk-modify to keep the list honest:
CODEBLOCK9
Stale Task Triage Gate
Trigger: task status:pending age.before:14days count exceeds 50, halt new work and triage.
Decision Tree (for each stale task):
- 1. Unblocked + HIGH/MEDIUM priority? → Must close by next heartbeat OR deprioritize with annotation.
- Blocking other work? → Escalate now (bump to
+next, add due date). - Tagged
+waiting? → OK (delegated). Review wait condition; reschedule if stale. - Appears in high-level goals (e.g., MEMORY.md)? → Resurrect with
+next. Add sub-tasks if needed. - Old "Explore" or "Maybe"? → Delete. (It survived 14 days; it's not critical.)
- Ref task linking to closed external issue? → Delete. (Issue is resolved; task served its purpose.)
- Everything else? → Move to
memory/backlog.md (Cold Storage). Add timestamp + rationale.
Output: Run count again. If still >50, log concern and escalate to user.
Weekly Prune
Every Monday (or during review loops):
- - Age Out: Any task older than 14 days with no progress gets deleted or moved to cold storage.
- Prune the "Maybe": If a task description starts with "Maybe" or "Explore," and hasn't been touched in a week, delete it.
7. Witness Gates (High-Stakes Actions)
Tag destructive or irreversible tasks +gate. Do not auto-complete them.
CODEBLOCK10
When attempting to complete a +gate task via task_manager.py done <id>, the script will return:
CODEBLOCK11
Action: Pause and notify the human. Do not bypass autonomously. Wait for explicit approval, then use --witnessed flag:
python3 scripts/task_manager.py done <id> --witnessed
8. Session Close Protocol
Trigger: User signals end of session ("sleep", "done", "signing off") OR at the end of a review.
Goal: Produce a populated handoff — never empty next steps.
Run scripts/sleep.sh "<summary>" (validates next steps are non-empty before writing). Full runbook → references/review-runbook.md.
9. Periodic Review
Run at natural breakpoints: session start, after completing a feature, weekly.
→ See references/review-runbook.md for the full 7-step runbook.
Quick review (< 5 min):
task +in list # clear inbox
task +error list # any unresolved failures?
task next # confirm focus is right
task project:Internal.Learnings +error status:pending list # promote if 3+ recurrences
10. Session Continuity
Pick → Log (to ops/session_state.md) → Work → Done → Wipe. On session start: cat ops/session_state.md and task active to recover state. Minimal format:
[YYYY-MM-DD HH:MM] Focus: <task> (#<id>)
Last action: <what was done>
Open loops: <anything unfinished>
Blockers: <none | description>
11. Vitality Heartbeat
Monitor agent activity and alert on sustained silence during mission hours.
CODEBLOCK15
→ See references/vitality-heartbeat.md for full implementation details.
Concept: If silence exceeds threshold (default: 8 hours) during mission hours (default: 14:00-02:00 UTC), alert the human with:
- - Hours silent
- Last known active timestamp
- Last known task (from
task active or ops/session_state.md)
Scripts
This skill includes helper scripts in scripts/:
| Script | Purpose |
|---|
| INLINECODE45 | JSON API wrapper for Taskwarrior (list, capture, done, delete, witness gates) |
| INLINECODE46 |
Silence detection during mission hours |
|
sleep.sh | Session close wrapper with next-step validation |
References
- -
references/taskwarrior-schema.md — Installation, .taskrc config, UDAs, custom reports, tag taxonomy - INLINECODE50 — Periodic review loop (2 min → 20 min depth levels)
- INLINECODE51 — Agent silence detection and alerting
- INLINECODE52 — Async execution pattern: Taskwarrior → Pueue bridge (future/advanced)
Agent GTD
AI代理的完整执行功能栈。三层协同工作:
| 层级 | 工具 | 角色 |
|---|
| 内存 | Taskwarrior | 可执行任务、当前焦点、待办事项 |
| 硬盘 |
Markdown文件 | 上下文、决策、经验记录、原因 |
|
工作台 | ops/session_state.md | 5秒前我正在做什么 |
经验法则:要完成的任务 → Taskwarrior。要记住的事实 → Markdown。任务进行中的状态 → session_state。
安装
Taskwarrior(必需)
bash
Debian/Ubuntu
sudo apt install taskwarrior
macOS
brew install task
Arch
sudo pacman -S task
Python 3(辅助脚本必需)
Timewarrior(可选 — 启用活力心跳检测)
bash
Debian/Ubuntu
sudo apt install timewarrior
macOS
brew install timewarrior
ClawVault(可选 — 结构化会话交接)
如果缺失会优雅降级;task_manager.py sleep 会打印警告但继续执行。
快速参考
bash
添加到收件箱
task add +in 待处理事项
分类收件箱
task +in list
添加内部任务
task add project:Internal 描述 +next priority:M
记录失败
task add project:Internal.Learnings +error 出了什么问题
task annotate
修复:解决方案
查看下一步
task next
执行回顾
→ 参考 references/review-runbook.md
1. 收件箱(捕获)
所有内容先进入收件箱。捕获时不进行处理。
bash
task add +in 描述
task in # 自定义报告:列出所有 +in 项目
收件箱项目具有高优先级(+15.0),以便在默认报告中显示。
2. 分类流程
对 task in 中的每个项目:
- 1. 可执行? 否 → 删除或标注为参考。
- < 2分钟? 立即执行,标记完成。
- 多步骤? 创建 project: 并将第一步标记为 +next。
- 委派? 标记 +waiting,添加 wait: 日期,标注谁/什么。
- 推迟? 分配项目,标记 +next,继续。
3. 项目分类
Internal # 代理内部工作
Internal.Ops # 基础设施、配置、工具
Internal.Learnings # 错误、修正、功能缺口
Goals # 高层战略目标
# 活跃用户项目
.Ops
4. 任务属性
bash
priority:H / M / L # 影响程度
brainpower:H / M / L # 认知负荷(H=架构,L=常规)
estimate: # 时间预算
wait: # 暂停(隐藏至指定日期)
due: # 硬性截止日期
选择模式:
bash
task next brainpower:L estimate:5 # 快速获胜
task next brainpower:H priority:H # 深度工作
5. 错误与学习捕获
立即记录。不要等到回顾时间。
| 情况 | 标签 | 示例 |
|---|
| 命令/工具失败 | +error | task add project:Internal.Learnings +error git push rejected: token expired |
| 用户纠正代理 |
+learning | task add project:Internal.Learnings +learning 此项目使用pnpm而非npm |
| 缺失功能 | +featreq | task add project:Internal.Learnings +featreq 用户需要日历邀请生成功能 |
使用 task annotate ... 添加修复细节或堆栈跟踪。
自动升级: promote_learnings.py 通过 cron 每6小时运行一次。它扫描 memory/lessons/ 中7天内重复出现3次以上的错误类条目——然后自动在 project:Internal.Learnings 中创建带有修复描述的 Taskwarrior 任务。重复错误无需手动跟踪。
手动升级规则: 如果重复错误有结构性修复(不仅仅是单行修复),将其升级到 TOOLS.md、AGENTS.md 或 SOUL.md。将 Taskwarrior 任务标记为完成,在最终注释中注明升级目标。
bash
查询学习记录
task project:Internal.Learnings list
task +error list
task +error + list
6. 待办事项分类
当任务列表超过约20项或进度停滞时执行。
提醒/思考模式
bash
暂停:隐藏至未来日期
task add +tickle wait:2025-03-01 重新审视X
推迟决策:重新出现时强制做出是/否决定
task add +tickle +think wait:+3d 我应该做Y吗?(是/否)
禁止重复暂停规则: 当 +think 任务重新出现时,立即决定。不得再次暂停。
三项法则
在自主消化期间,每天只选择3项任务实际完成。专注胜过数量。优先级:
- 1. 任何阻塞其他任务的事项(依赖优先)
- 可在 < 5分钟内解决的低挂果实(exec、edit、web_search)
- 最高优先级的 +next 任务
优先级调整
当项目焦点转移时,批量修改以保持列表真实:
bash
task project:OldProject modify -next priority:L
task project:NewProject modify +next priority:H
过期任务分类门控
触发条件: task status:pending age.before:14days count 超过 50,暂停新工作并进行分类。
决策树(对每个过期任务):
- 1. 未阻塞 + 高/中优先级? → 必须在下次心跳前关闭或降级并添加注释。
- 阻塞其他工作? → 立即升级(提升为 +next,添加截止日期)。
- 标记为 +waiting? → 正常(已委派)。检查等待条件;如过期则重新安排。
- 出现在高层目标中(例如 MEMORY.md)? → 以 +next 重新激活。必要时添加子任务。
- 旧的探索或可能? → 删除。(已存活14天;不重要。)
- 引用已关闭外部问题的参考任务? → 删除。(问题已解决;任务已完成使命。)
- 其他所有情况? → 移至 memory/backlog.md(冷存储)。添加时间戳和理由。
输出: 再次运行计数。如果仍 >50,记录问题并升级给用户。
每周清理
每周一(或在回顾循环期间):
- - 过期: 任何超过14天且无进展的任务将被删除或移至冷存储。
- 清理可能: 如果任务描述以可能或探索开头,且一周内未触及,则删除。
7. 见证门控(高风险操作)
将破坏性或不可逆任务标记为 +gate。不要自动完成它们。
bash
task add project:Internal +gate 推送到主分支
当尝试通过 task_manager.py done 完成 +gate 任务时,脚本将返回:
json
{status: gated, message: Witness Gate Active..., task: {...}}
操作: 暂停并通知人类。不要自主绕过。等待明确批准,然后使用 --witnessed 标志:
bash
python3 scripts/task_manager.py done --witnessed
8. 会话关闭协议
触发条件: 用户发出会话结束信号(sleep、done、signing off)或在回顾结束时。
目标: 生成填充完整的交接——绝不留下空的下一步。
运行 scripts/sleep.sh (在写入前验证下一步非空)。完整运行手册 → references/review-runbook.md。
9. 定期回顾
在自然断点处运行:会话开始、完成功能后、每周。
→ 参见 references/review-runbook.md 获取完整的7步运行手册。
快速回顾(< 5分钟):
bash
task +in list # 清空收件箱
task +error list # 是否有未解决的失败?
task next # 确认焦点正确
task project:Internal.Learnings +error status:pending list # 如果重复3次以上则升级
10. 会话连续性
选择 → 记录(到 ops/session_state