Skip to content
Docs/Agent Protocols

Agent Protocols (v1)

Learn how to use vem_pack and vem_update blocks to exchange structured memory with any AI agent.

The Memory Exchange Loop

vem uses fenced code blocks to inject context into agents and extract structured updates from their responses. This allows any agent (Claude, GPT, Gemini) to participate in your project memory without custom integrations.

1. Injection (Pack)

You provide the agent with a vem_pack block containing tasks, context, and decisions.

2. Extraction (Update)

The agent returns a vem_update block which you apply with vem finalize to persist updates.

vem_pack v1

Generated via vem pack. This block should be pasted at the start of your prompt or system instructions.

```vem_pack v1
{
  "tasks": { "tasks": [...] },
  "context": "Project goals...",
  "decisions": "...",
  "current_state": "..."
}
```

vem_update v1

Instruct the agent to use this format for any memory updates. You can then pipe the response to vem finalize. For direct writes, use CLI commands like vem task ..., vem decision add, and vem context set.

```vem_update v1
{
  "tasks": [{ "id": "TASK-001", "status": "done", "evidence": ["pnpm build"], "validation_steps": ["pnpm build"], "actor": "AgentName" }],
  "new_tasks": [{ "title": "New requirement", "priority": "high" }],
  "changelog_append": ["Added auth flow"],
  "decisions_append": ["Adopted a new caching strategy"],
  "current_state": "Implementing the dashboard...",
  "context": "Full updated CONTEXT.md content goes here."
}
```

Recommended System Prompt

You are an AI engineer working on a project with VEM memory management. Whenever you complete a task or make a decision, you must provide a `vem_update v1` JSON block. Rules for updates: 1. Reference existing tasks by their TASK-XXX ID. 2. Provide specific evidence for completed tasks (files changed, tests run). 3. Include your agent name in task updates (actor). 4. Confirm validation steps (build/tests) in evidence if required by the task. 5. Append brief, high-signal entries to the changelog and decisions. 6. Include the full updated CONTEXT.md content when memory changes. 7. Update the current_state to reflect the next immediate steps. 8. Persist memory updates through vem CLI commands (`vem finalize`, `vem task ...`, `vem decision add`, `vem context set`) instead of manual file edits.

Next steps