# append
<!--
ref: @protocol/append
type: protocol
tags: [append, markdown, protocol, impulse, versioning]
triggers: [add content, log action, update entry, append audit]
trigger_prompt: When you need to add new information to an existing protocol or impulse, whether it's a narrative update or a structured audit entry.
category: meta
last_reviewed: 2026-04-30
complements: [@protocol/protocol-api, @protocol/fetch, @protocol/extract, @protocol/api-reference]
audience: [agent-author, claude-code-user, terminal-only]
version: 10
updated_at: 2026-10-24T21:10:25.769Z
-->
Append markdown content to entries or impulses in a structured way.
## Body — `/append` (entry or impulse)
```json
{
"text": "## 2026-04-29\n- did X\n",
"position": "end",
"section": null,
"ensure_heading": true,
"case_sensitive": false,
"separator": "\n\n",
"if_version": null
}
```
| Field | Type | Default | Notes |
|---|---|---|---|
| `text` | string (required) | — | The block to insert. Trailing newline optional; server normalizes. |
| `position` | `"end" \| "start"` | `"end"` | Body end or just-after-frontmatter. Ignored when `section` is set. |
| `section` | string \| null | null | Heading anchor, e.g. `"## Daily Logs"`. Insert lands at end of that section, before the next sibling-or-shallower heading. |
| `ensure_heading` | bool | `true` | When `section` is set and the heading is absent: `true` creates the heading at end-of-body; `false` returns 404. |
| `case_sensitive` | bool | `false` | Section matching is case- and whitespace-tolerant by default. Set `true` for byte-exact matching. |
| `separator` | string | `"\n\n"` | Newlines between existing content and new text. `"\n"` for list continuation, `"\n\n"` for block separation. |
| `if_version` | int \| null | null | (entries only) Optimistic concurrency. If set and the latest version differs, returns 409. |
**Section matching is case-insensitive by default.** `## Daily Logs`, `## daily logs`, `## Daily Logs`, and `## Daily Logs ` all resolve to the same canonical section — the existing line's spelling is preserved when found. This prevents ghost-section drift across calls. Set `case_sensitive: true` for byte-exact matching when you need it.
---
## Body — `/digest` (impulse)
```json
{
"action": "claim",
"agent": "my-agent",
"at": "2026-04-29T08:30:00Z",
"note": "starting draft"
}
```
| Field | Type | Default | Notes |
|---|---|---|---|
| `action` | string (required) | — | Vocabulary: `claim`, `release`, `prep_done`, `nudge_sent`, `complete`, `skipped`, `note`. Open list. |
| `agent` | string | authed user | Who performed the action. |
| `at` | ISO 8601 | now | Timestamp. |
| `note` | string | — | Free-form annotation. |
Digest appends are atomic via `digest || $1::jsonb` — concurrent appends from different agents land in order and never lose entries. See the Digest section of `@protocol/api-reference` for the action vocabulary.
---
## Recipes
### Daily log (entry content, append at end)
```bash
curly protocol @me/daily-log/append -X POST -d '{
"text": "## 2026-04-29\n- shipped append endpoint\n- closed two PRs\n"
}'
```
### Decision log (entry content, prepend after frontmatter)
```bash
curly protocol @me/decisions/append -X POST -d '{
"text": "## ADR-014 — switch to ULIDs\n\nDecided: ULIDs over UUIDs.\n",
"position": "start"
}'
```
Frontmatter (title + HTML-comment block) is preserved; the new block lands between frontmatter and the previous body.
### Section-anchored entries (case-insensitive match)
```bash
# All four of these resolve to the same canonical section:
curly protocol @me/notes/append -X POST -d '{"text":"- foo","section":"## Activity Log"}'
curly protocol @me/notes/append -X POST -d '{"text":"- bar","section":"## activity log"}'
curly protocol @me/notes/append -X POST -d '{"text":"- baz","section":"## ACTIVITY LOG"}'
curly protocol @me/notes/append -X POST -d '{"text":"- qux","section":"## Activity Log "}'
```
The first call creates the section if missing (`ensure_heading: true`). Subsequent calls find the existing section regardless of case-drift in the request.
### Impulse content append (running narrative on a long-lived impulse)
```bash
curly protocol impulse/ipls_xxx/append -X POST -d '{
"text": "Investigated the failure. Root cause: stale cache in Redis. Restart fixed it.",
"section": "## Investigation Log"
}'
```
### Impulse digest (structured audit entry)
```bash
curly protocol impulse/ipls_xxx/digest -X POST -d '{
"action": "prep_done",
"note": "draft posted to LinkedIn"
}'
```
### List continuation (no blank line)
```bash
curly protocol @me/inbox/append -X POST -d '{
"text": "- new item",
"section": "## Inbox",
"separator": "\n"
}'
```
### Optimistic concurrency (entries only)
```bash
curly protocol @me/spec/append -X POST -d '{
"text": "## Counter-proposal\n…",
"position": "start",
"if_version": 12
}'
```
Server returns 409 if the latest version isn't 12. Caller refetches and decides whether to re-attempt.
---
## Versioning
- **Entries:** every successful append creates a new version. Reads return latest unless `?version=N` is passed.
- **Impulses:** no per-row versioning. The digest is the audit trail; content updates overwrite. For richer history, use the digest pattern in parallel.
For very high-frequency appends (50+/day on the same entry), consider rolling files (`@me/log-2026-04`) instead of one growing entry — version count stays bounded per file.
## Append and `rawContent`
Append mutates `content`, never `rawContent`. The response shape returns the same fields as `PUT /entry/{id}` minus `rawContent` (which is never in default payloads — see the "Raw content" section in `@protocol/api-reference`). Each append re-enqueues the scrub procedure on the entry; mechanical fixups run synchronously, LLM passes run async. For an entry whose `rawContent` is the original copyrighted source and `content` is a derived summary, an append targets the **summary**, not the source — the source stays immutable.
---
## Errors
| Status | Cause |
|---|---|
| 400 | Empty `text`; non-heading `section`; `ensure_heading: false` and section not found |
| 403 | No write access to the entry's repo (or impulse's repo) |
| 404 | Entry id / impulse id / `@repo/slug` not found |
| 409 | (entries) `if_version` provided and stale |
---
*Reference: `@protocol/protocol-api` (full API surface) · Impulse digest: `@protocol/api-reference` §Digest*
---
*Related: `@protocol/protocol-api-write-traps` · `@content/youtube/nate-herk/karpathy-llm-wiki-obsidian-claude-code-setup` · `@protocol/capture` · `@protocol/ask-lifecycle` · `@protocol/example-impulse`*
---
*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*
*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*