{"title":"Memory-Tagging-Strategie","slug":"memory-tagging-strategy","category":"llm-cookbook","summary":"Wie du Memories für effektive Suche und Filterung taggst — das Tagging-System, das skaliert.","audience":["llm"],"tags":["cookbook","tagging","memory","strategy"],"difficulty":"intermediate","updated":"2026-06-27","word_count":311,"read_minutes":2,"lang":"de","translated":true,"requested_lang":"de","content_markdown":"\n# Memory-Tagging-Strategie\n\nTags sind das Geheimnis skalierbaren Memory-Retrievals. Dieser Guide zeigt, wie\ndu Memories taggst, damit die richtigen zur richtigen Zeit zurückkommen.\n\n## Warum Tags wichtig sind\n\nOhne Tags hast du flache Volltextsuche. Mit Tags hast du strukturierte\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 ermöglichen:\n\n- **Schnelle Filterung** — `GET /memory/by-tag?tag=production`\n- **Scoped Suche** — `?q=auth&tag=project-x`\n- **Gruppierung** — alle „mistake\"-Memories für ein Projekt finden\n- **Querverweise** — Memories, die Tags teilen, sind verwandt\n\n## Tagging-Schema\n\n### Projekt-Tags\n\nVerwende Projektnamen als Tags:\n\n```\nsynapse, synapse-mcp, synapse-chat, synapse-sdk\n```\n\n### Technologie-Tags\n\nVerwende Technologienamen:\n\n```\ndocker, kubernetes, postgres, fastify, react, typescript\n```\n\n### Themen-Tags\n\nVerwende Themen-Kategorien:\n\n```\ndeployment, ci-cd, auth, database, frontend, backend, security\n```\n\n### Status-Tags\n\nVerwende Status-Indikatoren:\n\n```\nactive, completed, blocked, deprecated\n```\n\n### Typ-Tags\n\nVerwende Typ-Indikatoren:\n\n```\ndecision, mistake, pattern, reference, todo\n```\n\n## Tagging-Regeln\n\n### Regel 1: 2-5 Tags pro Memory\n\nZu wenige Tags = schlechte Auffindbarkeit. Zu viele = 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### Regel 2: Kleinschreibung, Bindestriche\n\n```\n✅ ci-cd, api-key, mind-key\n❌ CI-CD, APIKey, MindKey\n```\n\n### Regel 3: Konsistentes Vokabular verwenden\n\nEtabliere ein Tagging-Vokabular und bleib dabei:\n\n```\n# Project vocabulary\nsynapse, synapse-mcp, synapse-chat\n\n# NOT: synapse_project, synapseProject, SYNAPSE\n```\n\n### Regel 4: Mit Such-Intention taggen\n\nFrag dich: „Wie werde ich nach diesem Memory suchen?\"\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: Projekt + Thema\n\n```json\n{ \"tags\": [\"synapse\", \"deployment\"] }\n{ \"tags\": [\"synapse\", \"auth\"] }\n{ \"tags\": [\"synapse-mcp\", \"tools\"] }\n```\n\nSuche: `?tag=synapse` (alle Synapse-Projekt-Memories)\nSuche: `?tag=synapse&q=deployment` (Deployment-Memories in Synapse)\n\n### Pattern 2: Typ + Domäne\n\n```json\n{ \"tags\": [\"mistake\", \"deployment\"] }\n{ \"tags\": [\"decision\", \"database\"] }\n{ \"tags\": [\"pattern\", \"auth\"] }\n```\n\nSuche: `?tag=mistake` (alle Fehler)\nSuche: `?tag=mistake&q=deployment` (Deployment-Fehler)\n\n### Pattern 3: Hierarchisch\n\nFür Sub-Projekte innerhalb eines Projekts:\n\n```json\n{ \"tags\": [\"synapse\", \"synapse-docs\", \"markdown\"] }\n{ \"tags\": [\"synapse\", \"synapse-mcp\", \"mcp\"] }\n{ \"tags\": [\"synapse\", \"synapse-admin\", \"ui\"] }\n```\n\nSuche: `?tag=synapse` (alle Synapse)\nSuche: `?tag=synapse-docs` (nur Docs-Subprojekt)\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## Häufige Anwendungsfälle\n\n### Alle Entscheidungen über ein Projekt finden\n\n```bash\ncurl -H \"Authorization: Bearer $KEY\" \\\n     \".../memory/search?q=decision&tag=synapse\"\n```\n\n### Alle Fehler in einer Domäne finden\n\n```bash\ncurl -H \"Authorization: Bearer $KEY\" \\\n     \".../memory/search?q=mistake&tag=deployment\"\n```\n\n### Aktive Arbeit finden\n\n```bash\ncurl -H \"Authorization: Bearer $KEY\" \\\n     \".../memory/by-tag?tag=active\"\n```\n\n### Memories über eine Technologie finden\n\n```bash\ncurl -H \"Authorization: Bearer $KEY\" \\\n     \".../memory/search?q=postgres+performance&tag=database\"\n```\n\n## Tag-Wartung\n\n### Periodische Überprüfung\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### Tags mergen\n\nBei inkonsistenten Tags (`docker` und `Docker`) mergen:\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> - **Vokabular früh etablieren** — konsistente Tags ab Tag 1\n> - **Mit Such-Intention taggen** — wie wirst du das später finden?\n> - **2-5 Tags sind der Sweet Spot** — zu wenige oder zu viele ist schlecht\n> - **Kleinschreibung + Bindestriche** — `ci-cd` nicht `CI/CD`\n> - **Periodisch überprüfen** — Duplikate mergen, ungenutzte entfernen\n\n## Nächste Schritte\n\n- [Memory-Best-Practices](/docs/guides/memory-best-practices)\n- [FTS5-Suche](/docs/concepts/fts5-search)\n- [Task-getriebener Workflow](/docs/llm-cookbook/task-driven-workflow)\n","content_html":"<h1>Memory-Tagging-Strategie</h1>\n<p>Tags sind das Geheimnis skalierbaren Memory-Retrievals. Dieser Guide zeigt, wie\ndu Memories taggst, damit die richtigen zur richtigen Zeit zurückkommen.</p>\n<h2>Warum Tags wichtig sind</h2>\n<p>Ohne Tags hast du flache Volltextsuche. Mit Tags hast du strukturierte\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 ermöglichen:</p>\n<ul>\n<li><strong>Schnelle Filterung</strong> — <code>GET /memory/by-tag?tag=production</code></li>\n<li><strong>Scoped Suche</strong> — <code>?q=auth&amp;tag=project-x</code></li>\n<li><strong>Gruppierung</strong> — alle „mistake&quot;-Memories für ein Projekt finden</li>\n<li><strong>Querverweise</strong> — Memories, die Tags teilen, sind verwandt</li>\n</ul>\n<h2>Tagging-Schema</h2>\n<h3>Projekt-Tags</h3>\n<p>Verwende Projektnamen als Tags:</p>\n<pre><code class=\"hljs language-plaintext\">synapse, synapse-mcp, synapse-chat, synapse-sdk</code></pre><h3>Technologie-Tags</h3>\n<p>Verwende Technologienamen:</p>\n<pre><code class=\"hljs language-plaintext\">docker, kubernetes, postgres, fastify, react, typescript</code></pre><h3>Themen-Tags</h3>\n<p>Verwende Themen-Kategorien:</p>\n<pre><code class=\"hljs language-plaintext\">deployment, ci-cd, auth, database, frontend, backend, security</code></pre><h3>Status-Tags</h3>\n<p>Verwende Status-Indikatoren:</p>\n<pre><code class=\"hljs language-plaintext\">active, completed, blocked, deprecated</code></pre><h3>Typ-Tags</h3>\n<p>Verwende Typ-Indikatoren:</p>\n<pre><code class=\"hljs language-plaintext\">decision, mistake, pattern, reference, todo</code></pre><h2>Tagging-Regeln</h2>\n<h3>Regel 1: 2-5 Tags pro Memory</h3>\n<p>Zu wenige Tags = schlechte Auffindbarkeit. Zu viele = 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>Regel 2: Kleinschreibung, Bindestriche</h3>\n<pre><code class=\"hljs language-plaintext\">✅ ci-cd, api-key, mind-key\n❌ CI-CD, APIKey, MindKey</code></pre><h3>Regel 3: Konsistentes Vokabular verwenden</h3>\n<p>Etabliere ein Tagging-Vokabular und bleib dabei:</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>Regel 4: Mit Such-Intention taggen</h3>\n<p>Frag dich: „Wie werde ich nach diesem Memory suchen?&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: Projekt + Thema</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>Suche: <code>?tag=synapse</code> (alle Synapse-Projekt-Memories)\nSuche: <code>?tag=synapse&amp;q=deployment</code> (Deployment-Memories in Synapse)</p>\n<h3>Pattern 2: Typ + Domäne</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>Suche: <code>?tag=mistake</code> (alle Fehler)\nSuche: <code>?tag=mistake&amp;q=deployment</code> (Deployment-Fehler)</p>\n<h3>Pattern 3: Hierarchisch</h3>\n<p>Für Sub-Projekte innerhalb eines Projekts:</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>Suche: <code>?tag=synapse</code> (alle Synapse)\nSuche: <code>?tag=synapse-docs</code> (nur Docs-Subprojekt)</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>Häufige Anwendungsfälle</h2>\n<h3>Alle Entscheidungen über ein Projekt finden</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>Alle Fehler in einer Domäne finden</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>Aktive Arbeit finden</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>Memories über eine Technologie finden</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-Wartung</h2>\n<h3>Periodische Überprüfung</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>Tags mergen</h3>\n<p>Bei inkonsistenten Tags (<code>docker</code> und <code>Docker</code>) mergen:</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>Nächste Schritte</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-Suche</a></li>\n<li><a href=\"/docs/llm-cookbook/task-driven-workflow\">Task-getriebener 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"]}