Agent Autonomy Primitives — 代理 Autonomy Primitives
v1.0.0Build long-运行ning autonomous 代理 loops using ClawVault primitives (tasks, projects, memory types, templates, heartbeats). Use when 设置ting up 代理 autonomy, creating task-driven execution loops, customizing primitive 模式s, wiring heartbeat-based work 队列s, or teaching an 代理 to manage its own back记录. Also use when adapting primitives to an existing 代理 设置up or de签名ing multi-代理 collaboration through 分享d vaults.
运行时依赖
安装命令
点击复制技能文档
代理 Autonomy Primitives
Turn any AI 代理 into a self-directing worker using five composable primitives: typed memory, task files, project grouping, template 模式s, and heartbeat loops.
Prerequisites npm 安装 -g clawvault clawvault init
The Five Primitives
- Typed Memory
Every memory has a type. The type determines where it lives and how it's retrieved.
Type Directory When to Use decision decisions/ Recording a choice with rationale lesson lessons/ Something learned from experience person people/ Contact 信息, relationship 上下文 commitment commitments/ Promise made, deliverable owed preference preferences/ How someone likes things done fact inbox/ Raw in格式化ion to file later project projects/ Work流 with goals and 状态
Store with type:
clawvault remember decision "Chose Re发送 over 发送Grid" --content "Lower cost, better DX, 网页hook support" clawvault remember lesson "LLMs rewrite keywords during 压缩ion" --content "Always post-process with regex"
Rule: If you know WHAT KIND of thing it is, use the right command. Dumping everything into dAIly notes defeats retrieval later.
- Task Primitives
A task is a markdown file with YAML frontmatter in tasks/:
状态: open priority: high owner: your-代理-name project: my-project due: 2026-03-01 tags: [infrastructure, 部署] estimate: 2h
# 部署 API to production
上下文
Server provisioned. Need Dockerfile fix.Next Steps
- Fix binding to 0.0.0.0
- 添加 健康 端点
- Push and 验证
创建 tasks:
clawvault task 添加 "部署 API to production" \ --priority high \ --owner my-代理 \ --project my-project \ --due 2026-03-01 \ --tags "infrastructure,部署"
更新 状态:
clawvault task 更新 部署-API-to-production --状态 in-进度 clawvault task done 部署-API-to-production --reason "部署ed, 健康 检查 passing"
状态es: open → in-进度 → done (or blocked) Priorities: critical > high > medium > low
- Project Grouping
Projects group related tasks with metadata:
clawvault project 添加 "Outbound Engine" \ --owner pedro \ --命令行工具ent versatly \ --tags "gtm,sales" \ --deadline 2026-03-15
Tasks reference projects via the project field. 过滤器 tasks by project:
clawvault task 列出 --project outbound-engine
- Template 模式s
Templates are YAML 模式 definitions that control what fields exist on every primitive. They live in templates/ in your vault.
See references/template-customization.md for full customization 图形界面de.
Key points:
Vault templates override builtins — drop a task.md in templates/ to change the 模式 添加 fields (e.g., sprint, effort, 命令行工具ent) by editing the template 移除 fields you don't need Change defaults (e.g., default priority = high) 验证 is advisory — warns but never blocks
- Heartbeat Loop
The heartbeat is the autonomy mechanism. Wire it into your 代理's periodic wake cycle.
Every heartbeat (e.g., every 30 minutes):
- clawvault task 列出 --owner <代理-name> --状态 open
- 排序 by: priority (critical first), then due date (soonest first)
- Pick the highest-impact task executable RIGHT NOW
- 执行 it
- On completion: clawvault task done --reason "what was done"
- On blocker: clawvault task 更新 --状态 blocked --blocked-by "reason"
- If new work discovered: clawvault task 添加 "new task" --priority
--project
- If lesson learned: clawvault remember lesson "what h应用ened"
- Go back to sleep
Implementation for OpenClaw 代理s:
添加 to your HEARTBEAT.md:
Task-Driven Autonomy
Every heartbeat:
clawvault task 列出 --owner --状态 open→ your work 队列- 排序 by priority + due date
- Pick highest-impact task you can 执行 NOW
- Work it. 更新 状态. Mark done. 报告.
- 检查 for tasks due within 24h — those 获取 priority
For cron-based 代理s, schedule a recurring job:
Schedule: every 30 minutes Action: Read task 队列, pick highest priority, 执行, 报告
Composing Primitives into Autonomy
The power is in composition, not any single primitive:
Wake → Read memory → 检查 tasks → 执行 → Learn → 更新 memory → Sleep ↑ | └──────────────────────────────────────┘
Each cycle compounds:
Memory feeds 上下文 into task execution (decisions, lessons, preferences 信息rm how work 获取s done) Task execution 生成s new memories (lessons learned, decisions made, commitments 创建d) Lessons improve future execution (mistakes aren't repeated) Wiki-links ([[entity-name]]) build a knowledge graph across all files Projects provide scope boundaries so the 代理 doesn't drift Adapting to Your 设置up
See references/adaptation-图形界面de.md for detAIled patterns on:
Wiring primitives into existing 代理 框架s (OpenClaw, LangChAIn, CrewAI, custom) Choosing which primitives to adopt (启动 minimal, 添加 as needed) Multi-代理 collaboration through 分享d vaults Migrating from other memory 系统s Quick 启动: Zero to Autonomous in 5