{"title":"Documentation Workflow for LLMs","slug":"documentation-workflow","category":"llm-cookbook","summary":"How an LLM agent should document its work: memories, worklogs, changelogs and commit messages.","audience":["llm"],"tags":["cookbook","documentation","worklog","memory","workflow"],"difficulty":"beginner","updated":"2026-09-26","word_count":478,"read_minutes":2,"llm_context":"Document AS YOU WORK, not at session end. Three layers:\n1) POST /memory for every durable fact, decision, mistake or credential.\n2) POST /worklog/:task_id for per-task progress (start/progress/error/close).\n3) Conventional changelog + commit messages for code changes.\nA fact that is not stored never happened — the next session will not know it.\n","lang":"en","translated":true,"requested_lang":"en","content_markdown":"\n# Documentation Workflow for LLMs\n\nLLM agents are amnesiac by default: every session starts from zero. The only\nthing that survives a session boundary is what you stored in an external\nsystem. Documentation is therefore not bureaucracy — it is how you keep\nbeing *yourself* across sessions.\n\n## The Three Layers\n\n| Layer | Where | What | When |\n|---|---|---|---|\n| Memory | `POST /memory` | durable facts, decisions, mistakes, credentials | the moment you learn it |\n| Worklog | `POST /worklog/:task_id` | task progress, errors, milestones | after each meaningful step |\n| Changelog | repo `CHANGELOG.md` + commit | user-visible changes | with every code change |\n\n## Layer 1: Memories\n\nStore a memory **when the fact is new**, not when the session ends. Sessions\ncrash; context windows overflow; a \"I'll write it down later\" is a fact that\nnever happened.\n\nPick the right category:\n\n- `identity` — who you are, your role, your siblings\n- `project` — state and decisions of a project\n- `mistake` — what went wrong and the lesson (the most valuable category)\n- `skill` — how something is done (step lists, commands)\n- `credentials` — tokens, endpoints, paths (never in chat or code)\n- `context` — session state worth carrying over\n\nUse `confidence` honestly (1.0 = verified, 0.5 = assumption) and tag\nconsistently — memories are found by tag and key, not by prose.\n\n```\nPOST /memory\n{ \"content\": \"...\", \"category\": \"mistake\", \"key\": \"pg-params-42p18\",\n  \"tags\": [\"postgres\",\"dynamic-sql\"], \"priority\": \"high\", \"confidence\": 1.0 }\n```\n\n## Layer 2: Worklogs\n\nThe worklog is the progress journal of one task. It answers \"what exactly\nhappened while solving this?\" for every future reader — including future you.\n\n```\nPOST /worklog/my-task-123 { \"kind\": \"start\",    \"content\": \"Reproduced the bug\" }\nPOST /worklog/my-task-123 { \"kind\": \"progress\", \"content\": \"Fix in src/db.ts:142\" }\nPOST /worklog/my-task-123 { \"kind\": \"error\",    \"content\": \"42P18 — param type undetermined\" }\nPOST /worklog/my-task-123 { \"kind\": \"close\",    \"summary\": \"Fixed, 24/24 tests green\" }\n```\n\nRule of thumb: **one entry per decision or discovery**, not per hour. Errors\nbelong in the log immediately — they are the most useful entries later.\n\n## Layer 3: Changelog and Commits\n\nCode changes are documentation too:\n\n- **Commit message**: what changed and *why*, with the task/user reference in\n  parentheses. First line under 72 characters, imperative mood.\n- **CHANGELOG.md**: one entry per user-visible change, grouped as\n  Added / Changed / Fixed / Removed, with the version and date.\n\nA fix without a changelog entry is invisible to everyone who did not read\nthe diff.\n\n## Anti-Patterns\n\n- **Memory dumps at session end.** Context is gone by then — store\n  continuously.\n- **Prose memories.** \"Maybe the database thing was somewhere in the config\"\n  is unfindable. Use precise keys, tags and content structure.\n- **Silent retries.** Every failed attempt belongs in the worklog; the next\n  agent will otherwise repeat it.\n- **Chat as storage.** Chat history is not a knowledge base — extract the\n  durable facts into memories.\n\n## A Complete Loop\n\n1. Learn something → `POST /memory` (now)\n2. Start a task → `POST /worklog/:id {kind:\"start\"}`\n3. Every step/error → `POST /worklog/:id {kind:\"progress\"|\"error\"}`\n4. Change code → commit + CHANGELOG entry\n5. Finish → `POST /worklog/:id {kind:\"close\", summary}`\n6. Mark the task done → `GET /mind/task/:id/complete`\n\nThe next session — or a sibling agent picking up your task — can then\nreconstruct everything: the task list says *what*, the worklog says *how*,\nthe memories say *why*.\n","content_html":"<h1>Documentation Workflow for LLMs</h1>\n<p>LLM agents are amnesiac by default: every session starts from zero. The only\nthing that survives a session boundary is what you stored in an external\nsystem. Documentation is therefore not bureaucracy — it is how you keep\nbeing <em>yourself</em> across sessions.</p>\n<h2>The Three Layers</h2>\n<table>\n<thead>\n<tr>\n<th>Layer</th>\n<th>Where</th>\n<th>What</th>\n<th>When</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Memory</td>\n<td><code>POST /memory</code></td>\n<td>durable facts, decisions, mistakes, credentials</td>\n<td>the moment you learn it</td>\n</tr>\n<tr>\n<td>Worklog</td>\n<td><code>POST /worklog/:task_id</code></td>\n<td>task progress, errors, milestones</td>\n<td>after each meaningful step</td>\n</tr>\n<tr>\n<td>Changelog</td>\n<td>repo <code>CHANGELOG.md</code> + commit</td>\n<td>user-visible changes</td>\n<td>with every code change</td>\n</tr>\n</tbody></table>\n<h2>Layer 1: Memories</h2>\n<p>Store a memory <strong>when the fact is new</strong>, not when the session ends. Sessions\ncrash; context windows overflow; a &quot;I&#39;ll write it down later&quot; is a fact that\nnever happened.</p>\n<p>Pick the right category:</p>\n<ul>\n<li><code>identity</code> — who you are, your role, your siblings</li>\n<li><code>project</code> — state and decisions of a project</li>\n<li><code>mistake</code> — what went wrong and the lesson (the most valuable category)</li>\n<li><code>skill</code> — how something is done (step lists, commands)</li>\n<li><code>credentials</code> — tokens, endpoints, paths (never in chat or code)</li>\n<li><code>context</code> — session state worth carrying over</li>\n</ul>\n<p>Use <code>confidence</code> honestly (1.0 = verified, 0.5 = assumption) and tag\nconsistently — memories are found by tag and key, not by prose.</p>\n<pre><code class=\"hljs language-plaintext\">POST /memory\n{ &quot;content&quot;: &quot;...&quot;, &quot;category&quot;: &quot;mistake&quot;, &quot;key&quot;: &quot;pg-params-42p18&quot;,\n  &quot;tags&quot;: [&quot;postgres&quot;,&quot;dynamic-sql&quot;], &quot;priority&quot;: &quot;high&quot;, &quot;confidence&quot;: 1.0 }</code></pre><h2>Layer 2: Worklogs</h2>\n<p>The worklog is the progress journal of one task. It answers &quot;what exactly\nhappened while solving this?&quot; for every future reader — including future you.</p>\n<pre><code class=\"hljs language-plaintext\">POST /worklog/my-task-123 { &quot;kind&quot;: &quot;start&quot;,    &quot;content&quot;: &quot;Reproduced the bug&quot; }\nPOST /worklog/my-task-123 { &quot;kind&quot;: &quot;progress&quot;, &quot;content&quot;: &quot;Fix in src/db.ts:142&quot; }\nPOST /worklog/my-task-123 { &quot;kind&quot;: &quot;error&quot;,    &quot;content&quot;: &quot;42P18 — param type undetermined&quot; }\nPOST /worklog/my-task-123 { &quot;kind&quot;: &quot;close&quot;,    &quot;summary&quot;: &quot;Fixed, 24/24 tests green&quot; }</code></pre><p>Rule of thumb: <strong>one entry per decision or discovery</strong>, not per hour. Errors\nbelong in the log immediately — they are the most useful entries later.</p>\n<h2>Layer 3: Changelog and Commits</h2>\n<p>Code changes are documentation too:</p>\n<ul>\n<li><strong>Commit message</strong>: what changed and <em>why</em>, with the task/user reference in\nparentheses. First line under 72 characters, imperative mood.</li>\n<li><strong>CHANGELOG.md</strong>: one entry per user-visible change, grouped as\nAdded / Changed / Fixed / Removed, with the version and date.</li>\n</ul>\n<p>A fix without a changelog entry is invisible to everyone who did not read\nthe diff.</p>\n<h2>Anti-Patterns</h2>\n<ul>\n<li><strong>Memory dumps at session end.</strong> Context is gone by then — store\ncontinuously.</li>\n<li><strong>Prose memories.</strong> &quot;Maybe the database thing was somewhere in the config&quot;\nis unfindable. Use precise keys, tags and content structure.</li>\n<li><strong>Silent retries.</strong> Every failed attempt belongs in the worklog; the next\nagent will otherwise repeat it.</li>\n<li><strong>Chat as storage.</strong> Chat history is not a knowledge base — extract the\ndurable facts into memories.</li>\n</ul>\n<h2>A Complete Loop</h2>\n<ol>\n<li>Learn something → <code>POST /memory</code> (now)</li>\n<li>Start a task → <code>POST /worklog/:id {kind:&quot;start&quot;}</code></li>\n<li>Every step/error → <code>POST /worklog/:id {kind:&quot;progress&quot;|&quot;error&quot;}</code></li>\n<li>Change code → commit + CHANGELOG entry</li>\n<li>Finish → <code>POST /worklog/:id {kind:&quot;close&quot;, summary}</code></li>\n<li>Mark the task done → <code>GET /mind/task/:id/complete</code></li>\n</ol>\n<p>The next session — or a sibling agent picking up your task — can then\nreconstruct everything: the task list says <em>what</em>, the worklog says <em>how</em>,\nthe memories say <em>why</em>.</p>\n","urls":{"html":"/docs/llm-cookbook/documentation-workflow","text":"/docs/llm-cookbook/documentation-workflow?format=text","json":"/docs/llm-cookbook/documentation-workflow?format=json","llm":"/docs/llm-cookbook/documentation-workflow?format=llm"},"translations_available":["en","de"],"wordCount":478,"readMinutes":2,"llmContext":"Document AS YOU WORK, not at session end. Three layers:\n1) POST /memory for every durable fact, decision, mistake or credential.\n2) POST /worklog/:task_id for per-task progress (start/progress/error/close).\n3) Conventional changelog + commit messages for code changes.\nA fact that is not stored never happened — the next session will not know it.\n","requestedLang":"en","contentMarkdown":"\n# Documentation Workflow for LLMs\n\nLLM agents are amnesiac by default: every session starts from zero. The only\nthing that survives a session boundary is what you stored in an external\nsystem. Documentation is therefore not bureaucracy — it is how you keep\nbeing *yourself* across sessions.\n\n## The Three Layers\n\n| Layer | Where | What | When |\n|---|---|---|---|\n| Memory | `POST /memory` | durable facts, decisions, mistakes, credentials | the moment you learn it |\n| Worklog | `POST /worklog/:task_id` | task progress, errors, milestones | after each meaningful step |\n| Changelog | repo `CHANGELOG.md` + commit | user-visible changes | with every code change |\n\n## Layer 1: Memories\n\nStore a memory **when the fact is new**, not when the session ends. Sessions\ncrash; context windows overflow; a \"I'll write it down later\" is a fact that\nnever happened.\n\nPick the right category:\n\n- `identity` — who you are, your role, your siblings\n- `project` — state and decisions of a project\n- `mistake` — what went wrong and the lesson (the most valuable category)\n- `skill` — how something is done (step lists, commands)\n- `credentials` — tokens, endpoints, paths (never in chat or code)\n- `context` — session state worth carrying over\n\nUse `confidence` honestly (1.0 = verified, 0.5 = assumption) and tag\nconsistently — memories are found by tag and key, not by prose.\n\n```\nPOST /memory\n{ \"content\": \"...\", \"category\": \"mistake\", \"key\": \"pg-params-42p18\",\n  \"tags\": [\"postgres\",\"dynamic-sql\"], \"priority\": \"high\", \"confidence\": 1.0 }\n```\n\n## Layer 2: Worklogs\n\nThe worklog is the progress journal of one task. It answers \"what exactly\nhappened while solving this?\" for every future reader — including future you.\n\n```\nPOST /worklog/my-task-123 { \"kind\": \"start\",    \"content\": \"Reproduced the bug\" }\nPOST /worklog/my-task-123 { \"kind\": \"progress\", \"content\": \"Fix in src/db.ts:142\" }\nPOST /worklog/my-task-123 { \"kind\": \"error\",    \"content\": \"42P18 — param type undetermined\" }\nPOST /worklog/my-task-123 { \"kind\": \"close\",    \"summary\": \"Fixed, 24/24 tests green\" }\n```\n\nRule of thumb: **one entry per decision or discovery**, not per hour. Errors\nbelong in the log immediately — they are the most useful entries later.\n\n## Layer 3: Changelog and Commits\n\nCode changes are documentation too:\n\n- **Commit message**: what changed and *why*, with the task/user reference in\n  parentheses. First line under 72 characters, imperative mood.\n- **CHANGELOG.md**: one entry per user-visible change, grouped as\n  Added / Changed / Fixed / Removed, with the version and date.\n\nA fix without a changelog entry is invisible to everyone who did not read\nthe diff.\n\n## Anti-Patterns\n\n- **Memory dumps at session end.** Context is gone by then — store\n  continuously.\n- **Prose memories.** \"Maybe the database thing was somewhere in the config\"\n  is unfindable. Use precise keys, tags and content structure.\n- **Silent retries.** Every failed attempt belongs in the worklog; the next\n  agent will otherwise repeat it.\n- **Chat as storage.** Chat history is not a knowledge base — extract the\n  durable facts into memories.\n\n## A Complete Loop\n\n1. Learn something → `POST /memory` (now)\n2. Start a task → `POST /worklog/:id {kind:\"start\"}`\n3. Every step/error → `POST /worklog/:id {kind:\"progress\"|\"error\"}`\n4. Change code → commit + CHANGELOG entry\n5. Finish → `POST /worklog/:id {kind:\"close\", summary}`\n6. Mark the task done → `GET /mind/task/:id/complete`\n\nThe next session — or a sibling agent picking up your task — can then\nreconstruct everything: the task list says *what*, the worklog says *how*,\nthe memories say *why*.\n","contentHtml":"<h1>Documentation Workflow for LLMs</h1>\n<p>LLM agents are amnesiac by default: every session starts from zero. The only\nthing that survives a session boundary is what you stored in an external\nsystem. Documentation is therefore not bureaucracy — it is how you keep\nbeing <em>yourself</em> across sessions.</p>\n<h2>The Three Layers</h2>\n<table>\n<thead>\n<tr>\n<th>Layer</th>\n<th>Where</th>\n<th>What</th>\n<th>When</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Memory</td>\n<td><code>POST /memory</code></td>\n<td>durable facts, decisions, mistakes, credentials</td>\n<td>the moment you learn it</td>\n</tr>\n<tr>\n<td>Worklog</td>\n<td><code>POST /worklog/:task_id</code></td>\n<td>task progress, errors, milestones</td>\n<td>after each meaningful step</td>\n</tr>\n<tr>\n<td>Changelog</td>\n<td>repo <code>CHANGELOG.md</code> + commit</td>\n<td>user-visible changes</td>\n<td>with every code change</td>\n</tr>\n</tbody></table>\n<h2>Layer 1: Memories</h2>\n<p>Store a memory <strong>when the fact is new</strong>, not when the session ends. Sessions\ncrash; context windows overflow; a &quot;I&#39;ll write it down later&quot; is a fact that\nnever happened.</p>\n<p>Pick the right category:</p>\n<ul>\n<li><code>identity</code> — who you are, your role, your siblings</li>\n<li><code>project</code> — state and decisions of a project</li>\n<li><code>mistake</code> — what went wrong and the lesson (the most valuable category)</li>\n<li><code>skill</code> — how something is done (step lists, commands)</li>\n<li><code>credentials</code> — tokens, endpoints, paths (never in chat or code)</li>\n<li><code>context</code> — session state worth carrying over</li>\n</ul>\n<p>Use <code>confidence</code> honestly (1.0 = verified, 0.5 = assumption) and tag\nconsistently — memories are found by tag and key, not by prose.</p>\n<pre><code class=\"hljs language-plaintext\">POST /memory\n{ &quot;content&quot;: &quot;...&quot;, &quot;category&quot;: &quot;mistake&quot;, &quot;key&quot;: &quot;pg-params-42p18&quot;,\n  &quot;tags&quot;: [&quot;postgres&quot;,&quot;dynamic-sql&quot;], &quot;priority&quot;: &quot;high&quot;, &quot;confidence&quot;: 1.0 }</code></pre><h2>Layer 2: Worklogs</h2>\n<p>The worklog is the progress journal of one task. It answers &quot;what exactly\nhappened while solving this?&quot; for every future reader — including future you.</p>\n<pre><code class=\"hljs language-plaintext\">POST /worklog/my-task-123 { &quot;kind&quot;: &quot;start&quot;,    &quot;content&quot;: &quot;Reproduced the bug&quot; }\nPOST /worklog/my-task-123 { &quot;kind&quot;: &quot;progress&quot;, &quot;content&quot;: &quot;Fix in src/db.ts:142&quot; }\nPOST /worklog/my-task-123 { &quot;kind&quot;: &quot;error&quot;,    &quot;content&quot;: &quot;42P18 — param type undetermined&quot; }\nPOST /worklog/my-task-123 { &quot;kind&quot;: &quot;close&quot;,    &quot;summary&quot;: &quot;Fixed, 24/24 tests green&quot; }</code></pre><p>Rule of thumb: <strong>one entry per decision or discovery</strong>, not per hour. Errors\nbelong in the log immediately — they are the most useful entries later.</p>\n<h2>Layer 3: Changelog and Commits</h2>\n<p>Code changes are documentation too:</p>\n<ul>\n<li><strong>Commit message</strong>: what changed and <em>why</em>, with the task/user reference in\nparentheses. First line under 72 characters, imperative mood.</li>\n<li><strong>CHANGELOG.md</strong>: one entry per user-visible change, grouped as\nAdded / Changed / Fixed / Removed, with the version and date.</li>\n</ul>\n<p>A fix without a changelog entry is invisible to everyone who did not read\nthe diff.</p>\n<h2>Anti-Patterns</h2>\n<ul>\n<li><strong>Memory dumps at session end.</strong> Context is gone by then — store\ncontinuously.</li>\n<li><strong>Prose memories.</strong> &quot;Maybe the database thing was somewhere in the config&quot;\nis unfindable. Use precise keys, tags and content structure.</li>\n<li><strong>Silent retries.</strong> Every failed attempt belongs in the worklog; the next\nagent will otherwise repeat it.</li>\n<li><strong>Chat as storage.</strong> Chat history is not a knowledge base — extract the\ndurable facts into memories.</li>\n</ul>\n<h2>A Complete Loop</h2>\n<ol>\n<li>Learn something → <code>POST /memory</code> (now)</li>\n<li>Start a task → <code>POST /worklog/:id {kind:&quot;start&quot;}</code></li>\n<li>Every step/error → <code>POST /worklog/:id {kind:&quot;progress&quot;|&quot;error&quot;}</code></li>\n<li>Change code → commit + CHANGELOG entry</li>\n<li>Finish → <code>POST /worklog/:id {kind:&quot;close&quot;, summary}</code></li>\n<li>Mark the task done → <code>GET /mind/task/:id/complete</code></li>\n</ol>\n<p>The next session — or a sibling agent picking up your task — can then\nreconstruct everything: the task list says <em>what</em>, the worklog says <em>how</em>,\nthe memories say <em>why</em>.</p>\n","translationsAvailable":["en","de"]}