{"title":"Memory Tagging Strategy","slug":"memory-tagging-strategy","category":"llm-cookbook","summary":"How to tag memories for effective search and filtering — the tagging system that scales.","audience":["llm"],"tags":["cookbook","tagging","memory","strategy"],"difficulty":"intermediate","updated":"2026-06-27","word_count":347,"read_minutes":2,"lang":"en","translated":true,"requested_lang":"en","content_markdown":"\n# Memory Tagging Strategy\n\nTags are the secret to scalable memory retrieval. This guide shows how to tag\nmemories so the right ones come back at the right time.\n\n## Why Tags Matter\n\nWithout tags, you have flat full-text search. With tags, you have structured\nnavigation:\n\n```bash\n# Without tags: search everything\nGET /memory/search?q=docker\n\n# With tags: filter by project + technology\nGET /memory/search?q=deployment&tag=synapse&tag=docker\n```\n\nTags enable:\n\n- **Fast filtering** — `GET /memory/by-tag?tag=production`\n- **Scoped search** — `?q=auth&tag=project-x`\n- **Grouping** — find all \"mistake\" memories for a project\n- **Cross-referencing** — memories sharing tags are related\n\n## Tagging Schema\n\n### Project tags\n\nUse project names as tags:\n\n```\nsynapse, synapse-mcp, synapse-chat, synapse-sdk\n```\n\n### Technology tags\n\nUse technology names:\n\n```\ndocker, kubernetes, postgres, fastify, react, typescript\n```\n\n### Topic tags\n\nUse topic categories:\n\n```\ndeployment, ci-cd, auth, database, frontend, backend, security\n```\n\n### Status tags\n\nUse status indicators:\n\n```\nactive, completed, blocked, deprecated\n```\n\n### Type tags\n\nUse type indicators:\n\n```\ndecision, mistake, pattern, reference, todo\n```\n\n## Tagging Rules\n\n### Rule 1: 2-5 tags per memory\n\nToo few tags = poor discoverability. Too many = noise.\n\n```json\n// Good: 3 relevant tags\n{ \"tags\": [\"synapse\", \"deployment\", \"docker\"] }\n\n// Bad: 1 tag (too narrow)\n{ \"tags\": [\"synapse\"] }\n\n// Bad: 10 tags (noise)\n{ \"tags\": [\"synapse\", \"deployment\", \"docker\", \"vps1\", \"2026\", \"june\", \"ssh\", \"git\", \"main\", \"production\"] }\n```\n\n### Rule 2: Lowercase, hyphenated\n\n```\n✅ ci-cd, api-key, mind-key\n❌ CI-CD, APIKey, MindKey\n```\n\n### Rule 3: Use consistent vocabulary\n\nEstablish a tagging vocabulary and stick to it:\n\n```\n# Project vocabulary\nsynapse, synapse-mcp, synapse-chat\n\n# NOT: synapse_project, synapseProject, SYNAPSE\n```\n\n### Rule 4: Tag with search intent\n\nAsk: \"How will I search for this memory?\"\n\n```json\n// Storing a deployment decision\n{\n  \"content\": \"Decided to use Docker Swarm for Synapse deployment\",\n  \"tags\": [\"synapse\", \"deployment\", \"docker\", \"swarm\", \"decision\"]\n}\n\n// You'll likely search: ?q=docker+swarm or ?tag=deployment\n```\n\n## Patterns\n\n### Pattern 1: Project + Topic\n\n```json\n{ \"tags\": [\"synapse\", \"deployment\"] }\n{ \"tags\": [\"synapse\", \"auth\"] }\n{ \"tags\": [\"synapse-mcp\", \"tools\"] }\n```\n\nSearch: `?tag=synapse` (all Synapse project memories)\nSearch: `?tag=synapse&q=deployment` (deployment memories in Synapse)\n\n### Pattern 2: Type + Domain\n\n```json\n{ \"tags\": [\"mistake\", \"deployment\"] }\n{ \"tags\": [\"decision\", \"database\"] }\n{ \"tags\": [\"pattern\", \"auth\"] }\n```\n\nSearch: `?tag=mistake` (all mistakes)\nSearch: `?tag=mistake&q=deployment` (deployment mistakes)\n\n### Pattern 3: Hierarchical\n\nFor sub-projects within a project:\n\n```json\n{ \"tags\": [\"synapse\", \"synapse-docs\", \"markdown\"] }\n{ \"tags\": [\"synapse\", \"synapse-mcp\", \"mcp\"] }\n{ \"tags\": [\"synapse\", \"synapse-admin\", \"ui\"] }\n```\n\nSearch: `?tag=synapse` (all Synapse)\nSearch: `?tag=synapse-docs` (just docs sub-project)\n\n### Pattern 4: Status tracking\n\n```json\n// Active project\n{ \"tags\": [\"synapse\", \"active\"], \"priority\": \"high\" }\n\n// Completed project\n{ \"tags\": [\"synapse-v1\", \"completed\"], \"priority\": \"low\" }\n\n// Blocked\n{ \"tags\": [\"synapse-v2\", \"blocked\"], \"priority\": \"high\" }\n```\n\n## Common Use Cases\n\n### Find all decisions about a project\n\n```bash\ncurl -H \"Authorization: Bearer $KEY\" \\\n     \".../memory/search?q=decision&tag=synapse\"\n```\n\n### Find all mistakes in a domain\n\n```bash\ncurl -H \"Authorization: Bearer $KEY\" \\\n     \".../memory/search?q=mistake&tag=deployment\"\n```\n\n### Find active work\n\n```bash\ncurl -H \"Authorization: Bearer $KEY\" \\\n     \".../memory/by-tag?tag=active\"\n```\n\n### Find memories about a technology\n\n```bash\ncurl -H \"Authorization: Bearer $KEY\" \\\n     \".../memory/search?q=postgres+performance&tag=database\"\n```\n\n## Tag Maintenance\n\n### Periodic review\n\n```python\n# Find rarely-used tags (candidates for cleanup)\ntags = requests.get(f\"{URL}/memory/tags\",\n    headers={\"Authorization\": f\"Bearer {KEY}\"}).json()\n\nfor tag, count in tags.items():\n    if count < 2:\n        print(f\"Rare tag: {tag} ({count} memories)\")\n```\n\n### Merging tags\n\nIf you have inconsistent tags (`docker` and `Docker`), merge them:\n\n```python\n# Find all memories with \"Docker\" tag\nmems = requests.get(f\"{URL}/memory/by-tag?tag=Docker\",\n    headers={\"Authorization\": f\"Bearer {KEY}\"}).json()\n\n# Update each to use \"docker\" instead\nfor mem in mems[\"results\"]:\n    tags = [t.lower() for t in mem[\"tags\"]]\n    update_memory(mem[\"id\"], tags=list(set(tags)))\n```\n\n## Best Practices\n\n> [!TIP]\n> - **Establish vocabulary early** — consistent tags from day 1\n> - **Tag for search intent** — how will you find this later?\n> - **2-5 tags is the sweet spot** — too few or too many is bad\n> - **Lowercase + hyphens** — `ci-cd` not `CI/CD`\n> - **Review periodically** — merge duplicates, remove unused\n\n## Next Steps\n\n- [Memory Best Practices](/docs/guides/memory-best-practices)\n- [FTS5 Search](/docs/concepts/fts5-search)\n- [Task-Driven Workflow](/docs/llm-cookbook/task-driven-workflow)\n","content_html":"<h1>Memory Tagging Strategy</h1>\n<p>Tags are the secret to scalable memory retrieval. This guide shows how to tag\nmemories so the right ones come back at the right time.</p>\n<h2>Why Tags Matter</h2>\n<p>Without tags, you have flat full-text search. With tags, you have structured\nnavigation:</p>\n<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># Without tags: search everything</span>\nGET /memory/search?q=docker\n\n<span class=\"hljs-comment\"># With tags: filter by project + technology</span>\nGET /memory/search?q=deployment&amp;tag=synapse&amp;tag=docker</code></pre><p>Tags enable:</p>\n<ul>\n<li><strong>Fast filtering</strong> — <code>GET /memory/by-tag?tag=production</code></li>\n<li><strong>Scoped search</strong> — <code>?q=auth&amp;tag=project-x</code></li>\n<li><strong>Grouping</strong> — find all &quot;mistake&quot; memories for a project</li>\n<li><strong>Cross-referencing</strong> — memories sharing tags are related</li>\n</ul>\n<h2>Tagging Schema</h2>\n<h3>Project tags</h3>\n<p>Use project names as tags:</p>\n<pre><code class=\"hljs language-plaintext\">synapse, synapse-mcp, synapse-chat, synapse-sdk</code></pre><h3>Technology tags</h3>\n<p>Use technology names:</p>\n<pre><code class=\"hljs language-plaintext\">docker, kubernetes, postgres, fastify, react, typescript</code></pre><h3>Topic tags</h3>\n<p>Use topic categories:</p>\n<pre><code class=\"hljs language-plaintext\">deployment, ci-cd, auth, database, frontend, backend, security</code></pre><h3>Status tags</h3>\n<p>Use status indicators:</p>\n<pre><code class=\"hljs language-plaintext\">active, completed, blocked, deprecated</code></pre><h3>Type tags</h3>\n<p>Use type indicators:</p>\n<pre><code class=\"hljs language-plaintext\">decision, mistake, pattern, reference, todo</code></pre><h2>Tagging Rules</h2>\n<h3>Rule 1: 2-5 tags per memory</h3>\n<p>Too few tags = poor discoverability. Too many = noise.</p>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-comment\">// Good: 3 relevant tags</span>\n<span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;deployment&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;docker&quot;</span><span class=\"hljs-punctuation\">]</span> <span class=\"hljs-punctuation\">}</span>\n\n<span class=\"hljs-comment\">// Bad: 1 tag (too narrow)</span>\n<span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse&quot;</span><span class=\"hljs-punctuation\">]</span> <span class=\"hljs-punctuation\">}</span>\n\n<span class=\"hljs-comment\">// Bad: 10 tags (noise)</span>\n<span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;deployment&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;docker&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;vps1&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;2026&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;june&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;ssh&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;git&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;main&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;production&quot;</span><span class=\"hljs-punctuation\">]</span> <span class=\"hljs-punctuation\">}</span></code></pre><h3>Rule 2: Lowercase, hyphenated</h3>\n<pre><code class=\"hljs language-plaintext\">✅ ci-cd, api-key, mind-key\n❌ CI-CD, APIKey, MindKey</code></pre><h3>Rule 3: Use consistent vocabulary</h3>\n<p>Establish a tagging vocabulary and stick to it:</p>\n<pre><code class=\"hljs language-plaintext\"># Project vocabulary\nsynapse, synapse-mcp, synapse-chat\n\n# NOT: synapse_project, synapseProject, SYNAPSE</code></pre><h3>Rule 4: Tag with search intent</h3>\n<p>Ask: &quot;How will I search for this memory?&quot;</p>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-comment\">// Storing a deployment decision</span>\n<span class=\"hljs-punctuation\">{</span>\n  <span class=\"hljs-attr\">&quot;content&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;Decided to use Docker Swarm for Synapse deployment&quot;</span><span class=\"hljs-punctuation\">,</span>\n  <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;deployment&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;docker&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;swarm&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;decision&quot;</span><span class=\"hljs-punctuation\">]</span>\n<span class=\"hljs-punctuation\">}</span>\n\n<span class=\"hljs-comment\">// You&#x27;ll likely search: ?q=docker+swarm or ?tag=deployment</span></code></pre><h2>Patterns</h2>\n<h3>Pattern 1: Project + Topic</h3>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;deployment&quot;</span><span class=\"hljs-punctuation\">]</span> <span class=\"hljs-punctuation\">}</span>\n<span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;auth&quot;</span><span class=\"hljs-punctuation\">]</span> <span class=\"hljs-punctuation\">}</span>\n<span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse-mcp&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;tools&quot;</span><span class=\"hljs-punctuation\">]</span> <span class=\"hljs-punctuation\">}</span></code></pre><p>Search: <code>?tag=synapse</code> (all Synapse project memories)\nSearch: <code>?tag=synapse&amp;q=deployment</code> (deployment memories in Synapse)</p>\n<h3>Pattern 2: Type + Domain</h3>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;mistake&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;deployment&quot;</span><span class=\"hljs-punctuation\">]</span> <span class=\"hljs-punctuation\">}</span>\n<span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;decision&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;database&quot;</span><span class=\"hljs-punctuation\">]</span> <span class=\"hljs-punctuation\">}</span>\n<span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;pattern&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;auth&quot;</span><span class=\"hljs-punctuation\">]</span> <span class=\"hljs-punctuation\">}</span></code></pre><p>Search: <code>?tag=mistake</code> (all mistakes)\nSearch: <code>?tag=mistake&amp;q=deployment</code> (deployment mistakes)</p>\n<h3>Pattern 3: Hierarchical</h3>\n<p>For sub-projects within a project:</p>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;synapse-docs&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;markdown&quot;</span><span class=\"hljs-punctuation\">]</span> <span class=\"hljs-punctuation\">}</span>\n<span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;synapse-mcp&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;mcp&quot;</span><span class=\"hljs-punctuation\">]</span> <span class=\"hljs-punctuation\">}</span>\n<span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;synapse-admin&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;ui&quot;</span><span class=\"hljs-punctuation\">]</span> <span class=\"hljs-punctuation\">}</span></code></pre><p>Search: <code>?tag=synapse</code> (all Synapse)\nSearch: <code>?tag=synapse-docs</code> (just docs sub-project)</p>\n<h3>Pattern 4: Status tracking</h3>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-comment\">// Active project</span>\n<span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;active&quot;</span><span class=\"hljs-punctuation\">]</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-attr\">&quot;priority&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;high&quot;</span> <span class=\"hljs-punctuation\">}</span>\n\n<span class=\"hljs-comment\">// Completed project</span>\n<span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse-v1&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;completed&quot;</span><span class=\"hljs-punctuation\">]</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-attr\">&quot;priority&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;low&quot;</span> <span class=\"hljs-punctuation\">}</span>\n\n<span class=\"hljs-comment\">// Blocked</span>\n<span class=\"hljs-punctuation\">{</span> <span class=\"hljs-attr\">&quot;tags&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-punctuation\">[</span><span class=\"hljs-string\">&quot;synapse-v2&quot;</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-string\">&quot;blocked&quot;</span><span class=\"hljs-punctuation\">]</span><span class=\"hljs-punctuation\">,</span> <span class=\"hljs-attr\">&quot;priority&quot;</span><span class=\"hljs-punctuation\">:</span> <span class=\"hljs-string\">&quot;high&quot;</span> <span class=\"hljs-punctuation\">}</span></code></pre><h2>Common Use Cases</h2>\n<h3>Find all decisions about a project</h3>\n<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer <span class=\"hljs-variable\">$KEY</span>&quot;</span> \\\n     <span class=\"hljs-string\">&quot;.../memory/search?q=decision&amp;tag=synapse&quot;</span></code></pre><h3>Find all mistakes in a domain</h3>\n<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer <span class=\"hljs-variable\">$KEY</span>&quot;</span> \\\n     <span class=\"hljs-string\">&quot;.../memory/search?q=mistake&amp;tag=deployment&quot;</span></code></pre><h3>Find active work</h3>\n<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer <span class=\"hljs-variable\">$KEY</span>&quot;</span> \\\n     <span class=\"hljs-string\">&quot;.../memory/by-tag?tag=active&quot;</span></code></pre><h3>Find memories about a technology</h3>\n<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer <span class=\"hljs-variable\">$KEY</span>&quot;</span> \\\n     <span class=\"hljs-string\">&quot;.../memory/search?q=postgres+performance&amp;tag=database&quot;</span></code></pre><h2>Tag Maintenance</h2>\n<h3>Periodic review</h3>\n<pre><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Find rarely-used tags (candidates for cleanup)</span>\ntags = requests.get(<span class=\"hljs-string\">f&quot;<span class=\"hljs-subst\">{URL}</span>/memory/tags&quot;</span>,\n    headers={<span class=\"hljs-string\">&quot;Authorization&quot;</span>: <span class=\"hljs-string\">f&quot;Bearer <span class=\"hljs-subst\">{KEY}</span>&quot;</span>}).json()\n\n<span class=\"hljs-keyword\">for</span> tag, count <span class=\"hljs-keyword\">in</span> tags.items():\n    <span class=\"hljs-keyword\">if</span> count &lt; <span class=\"hljs-number\">2</span>:\n        <span class=\"hljs-built_in\">print</span>(<span class=\"hljs-string\">f&quot;Rare tag: <span class=\"hljs-subst\">{tag}</span> (<span class=\"hljs-subst\">{count}</span> memories)&quot;</span>)</code></pre><h3>Merging tags</h3>\n<p>If you have inconsistent tags (<code>docker</code> and <code>Docker</code>), merge them:</p>\n<pre><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Find all memories with &quot;Docker&quot; tag</span>\nmems = requests.get(<span class=\"hljs-string\">f&quot;<span class=\"hljs-subst\">{URL}</span>/memory/by-tag?tag=Docker&quot;</span>,\n    headers={<span class=\"hljs-string\">&quot;Authorization&quot;</span>: <span class=\"hljs-string\">f&quot;Bearer <span class=\"hljs-subst\">{KEY}</span>&quot;</span>}).json()\n\n<span class=\"hljs-comment\"># Update each to use &quot;docker&quot; instead</span>\n<span class=\"hljs-keyword\">for</span> mem <span class=\"hljs-keyword\">in</span> mems[<span class=\"hljs-string\">&quot;results&quot;</span>]:\n    tags = [t.lower() <span class=\"hljs-keyword\">for</span> t <span class=\"hljs-keyword\">in</span> mem[<span class=\"hljs-string\">&quot;tags&quot;</span>]]\n    update_memory(mem[<span class=\"hljs-string\">&quot;id&quot;</span>], tags=<span class=\"hljs-built_in\">list</span>(<span class=\"hljs-built_in\">set</span>(tags)))</code></pre><h2>Best Practices</h2>\n<div class=\"callout callout-ok\"></div><h2>Next Steps</h2>\n<ul>\n<li><a href=\"/docs/guides/memory-best-practices\">Memory Best Practices</a></li>\n<li><a href=\"/docs/concepts/fts5-search\">FTS5 Search</a></li>\n<li><a href=\"/docs/llm-cookbook/task-driven-workflow\">Task-Driven Workflow</a></li>\n</ul>\n","urls":{"html":"/docs/llm-cookbook/memory-tagging-strategy","text":"/docs/llm-cookbook/memory-tagging-strategy?format=text","json":"/docs/llm-cookbook/memory-tagging-strategy?format=json","llm":"/docs/llm-cookbook/memory-tagging-strategy?format=llm"},"translations_available":["en","zh","hi","es","fr","ar","pt","ru","ja","de","it","ko","nl","pl","tr","sv","vi","th","id","uk"]}