agent-autonomy-primitivesBuild long-running autonomous agent loops using ClawVault primitives (tasks, projects, memory types, templates, heartbeats). Use when setting up agent autono...
Install via ClawdBot CLI:
clawdbot install G9Pedro/agent-autonomy-primitivesTurn any AI agent into a self-directing worker using five composable primitives: typed memory, task files, project grouping, template schemas, and heartbeat loops.
npm install -g clawvault
clawvault init
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 info, relationship context |
| commitment | commitments/ | Promise made, deliverable owed |
| preference | preferences/ | How someone likes things done |
| fact | inbox/ | Raw information to file later |
| project | projects/ | Workstream with goals and status |
Store with type:
clawvault remember decision "Chose Resend over SendGrid" --content "Lower cost, better DX, webhook support"
clawvault remember lesson "LLMs rewrite keywords during compression" --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.
A task is a markdown file with YAML frontmatter in tasks/:
---
status: open
priority: high
owner: your-agent-name
project: my-project
due: 2026-03-01
tags: [infrastructure, deploy]
estimate: 2h
---
# Deploy API to production
## Context
Server provisioned. Need Dockerfile fix.
## Next Steps
- Fix binding to 0.0.0.0
- Add health endpoint
- Push and verify
Create tasks:
clawvault task add "Deploy API to production" \
--priority high \
--owner my-agent \
--project my-project \
--due 2026-03-01 \
--tags "infrastructure,deploy"
Update status:
clawvault task update deploy-api-to-production --status in-progress
clawvault task done deploy-api-to-production --reason "Deployed, health check passing"
Statuses: open → in-progress → done (or blocked)
Priorities: critical > high > medium > low
Projects group related tasks with metadata:
clawvault project add "Outbound Engine" \
--owner pedro \
--client versatly \
--tags "gtm,sales" \
--deadline 2026-03-15
Tasks reference projects via the project field. Filter tasks by project:
clawvault task list --project outbound-engine
Templates are YAML schema definitions that control what fields exist on every primitive. They live in templates/ in your vault.
See references/template-customization.md for full customization guide.
Key points:
task.md in templates/ to change the schemasprint, effort, client) by editing the templatehigh)The heartbeat is the autonomy mechanism. Wire it into your agent's periodic wake cycle.
Every heartbeat (e.g., every 30 minutes):
1. clawvault task list --owner <agent-name> --status open
2. Sort by: priority (critical first), then due date (soonest first)
3. Pick the highest-impact task executable RIGHT NOW
4. Execute it
5. On completion: clawvault task done <slug> --reason "what was done"
6. On blocker: clawvault task update <slug> --status blocked --blocked-by "reason"
7. If new work discovered: clawvault task add "new task" --priority <p> --project <proj>
8. If lesson learned: clawvault remember lesson "what happened"
9. Go back to sleep
Implementation for OpenClaw agents:
Add to your HEARTBEAT.md:
## Task-Driven Autonomy
Every heartbeat:
1. `clawvault task list --owner <your-name> --status open` → your work queue
2. Sort by priority + due date
3. Pick highest-impact task you can execute NOW
4. Work it. Update status. Mark done. Report.
5. Check for tasks due within 24h — those get priority
For cron-based agents, schedule a recurring job:
Schedule: every 30 minutes
Action: Read task queue, pick highest priority, execute, report
The power is in composition, not any single primitive:
Wake → Read memory → Check tasks → Execute → Learn → Update memory → Sleep
↑ |
└──────────────────────────────────────┘
Each cycle compounds:
[[entity-name]]) build a knowledge graph across all filesSee references/adaptation-guide.md for detailed patterns on:
# 1. Install and init
npm install -g clawvault
clawvault init
# 2. Create your first project
clawvault project add "My Project" --owner my-agent
# 3. Create tasks
clawvault task add "Set up monitoring" --priority high --owner my-agent --project my-project
clawvault task add "Write API docs" --priority medium --owner my-agent --project my-project
# 4. Wire into heartbeat (add to HEARTBEAT.md or cron)
# "Every 30min: clawvault task list --owner my-agent --status open, pick top task, execute"
# 5. Start working
clawvault task update set-up-monitoring --status in-progress
# ... do the work ...
clawvault task done set-up-monitoring --reason "Prometheus + Grafana configured"
clawvault remember lesson "UptimeRobot free tier only checks every 5min" --content "Use Better Stack for <1min checks"
| Don't | Do Instead |
|-------|-----------|
| Store everything in one big memory file | Use typed memory — decisions/, lessons/, people/ |
| Create tasks without owner/project | Always set --owner and --project |
| Ask "what should I work on?" | Read your task queue and decide |
| Forget lessons after learning them | clawvault remember lesson immediately |
| Skip marking tasks done | Always task done --reason — the ledger tracks transitions |
| Create tasks for vague ideas | Put ideas in backlog/, promote to tasks/ when ready |
| Modify template schemas constantly | Stabilize schemas early — field renames break existing files |
Because everything is markdown + YAML frontmatter, Obsidian renders your agent's workspace as a human-readable dashboard:
all-tasks.base in Obsidian Bases, drag between status columnsblocked.base shows what needs human inputby-owner.base shows what each agent is working onby-project.base scopes views per workstreamThe same file is both the agent's data structure AND the human's UI. No sync layer needed.
Generated Mar 1, 2026
An AI agent autonomously handles customer inquiries by retrieving past decisions and preferences from memory, creating tasks for follow-ups, and logging lessons from interactions. It uses heartbeat loops to periodically check for new tickets and prioritize urgent issues based on due dates and priority levels.
An AI agent manages content creation workflows by grouping tasks under projects like 'Q2 Blog Series', using templates to standardize fields like client and effort, and updating memory with lessons on engagement metrics. Heartbeat loops ensure timely execution and adaptation based on performance data.
An AI agent coordinates development sprints by creating tasks for features and bugs, referencing project groupings for scope, and storing decisions on technical approaches in memory. It uses heartbeat loops to reassign blocked tasks and log commitments for deliverables, improving team collaboration.
An AI agent automates sales follow-ups by tracking leads as people in memory, creating tasks for outreach based on priority and due dates, and using projects to group deals by client. Heartbeat loops trigger actions like sending emails and updating task statuses based on responses.
An AI agent helps individuals manage daily tasks and projects by using typed memory for preferences and lessons, creating tasks with custom templates, and executing heartbeat loops to prioritize work. It adapts over time by learning from past decisions and optimizing schedules.
Offer a cloud-based platform with managed vaults, advanced analytics on task performance, and premium templates for industries like marketing or development. Revenue comes from monthly subscriptions based on usage tiers and number of agents.
Provide expert services to integrate these primitives into existing AI frameworks like LangChain or CrewAI, including custom template design and heartbeat loop setup. Revenue is generated through project-based fees and ongoing support contracts.
Develop courses and certifications for teams to learn how to build autonomous agents using these primitives, including hands-on labs and best practices. Revenue streams include course sales, certification exams, and corporate training packages.
💬 Integration Tip
Start by implementing task primitives and heartbeat loops first, then gradually add typed memory and templates to avoid overwhelming the agent with complexity.
Captures learnings, errors, and corrections to enable continuous improvement. Use when: (1) A command or operation fails unexpectedly, (2) User corrects Clau...
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Search and analyze your own session logs (older/parent conversations) using jq.
Typed knowledge graph for structured agent memory and composable skills. Use when creating/querying entities (Person, Project, Task, Event, Document), linking related objects, enforcing constraints, planning multi-step actions as graph transformations, or when skills need to share state. Trigger on "remember", "what do I know about", "link X to Y", "show dependencies", entity CRUD, or cross-skill data access.
Ultimate AI agent memory system for Cursor, Claude, ChatGPT & Copilot. WAL protocol + vector search + git-notes + cloud backup. Never lose context again. Vibe-coding ready.
Headless browser automation CLI optimized for AI agents with accessibility tree snapshots and ref-based element selection