{"title":"Strategia tagowania pamięci","slug":"memory-tagging-strategy","category":"llm-cookbook","summary":"Jak tagować wspomnienia do skutecznego wyszukiwania i filtrowania — system tagowania, który się skaluje.","audience":["llm"],"tags":["cookbook","tagging","memory","strategy"],"difficulty":"intermediate","updated":"2026-06-27","word_count":337,"read_minutes":2,"lang":"pl","translated":true,"requested_lang":"pl","content_markdown":"\n# Strategia tagowania pamięci\n\nTagi są sekretem skalowalnego pobierania wspomnień. Ten przewodnik pokazuje, jak\ntagować wspomnienia, aby właściwe wracały we właściwym czasie.\n\n## Dlaczego tagi mają znaczenie\n\nBez tagów ma się płaskie wyszukiwanie pełnotekstowe. Z tagami ma się\nustrukturyzowaną nawigację:\n\n```bash\n# Bez tagów: przeszukiwanie wszystkiego\nGET /memory/search?q=docker\n\n# Z tagami: filtrowanie po projekcie i technologii\nGET /memory/search?q=deployment&tag=synapse&tag=docker\n```\n\nTagi umożliwiają:\n\n- **Szybkie filtrowanie** — `GET /memory/by-tag?tag=production`\n- **Wyszukiwanie w zakresie** — `?q=auth&tag=project-x`\n- **Grupowanie** — znalezienie wszystkich wspomnień „mistake\" dla projektu\n- **Odsyłanie krzyżowe** — wspomnienia współdzielące tagi są powiązane\n\n## Schemat tagowania\n\n### Tagi projektów\n\nUżywać nazw projektów jako tagów:\n\n```\nsynapse, synapse-mcp, synapse-chat, synapse-sdk\n```\n\n### Tagi technologii\n\nUżywać nazw technologii:\n\n```\ndocker, kubernetes, postgres, fastify, react, typescript\n```\n\n### Tagi tematyczne\n\nUżywać kategorii tematycznych:\n\n```\ndeployment, ci-cd, auth, database, frontend, backend, security\n```\n\n### Tagi statusu\n\nUżywać wskaźników statusu:\n\n```\nactive, completed, blocked, deprecated\n```\n\n### Tagi typów\n\nUżywać wskaźników typów:\n\n```\ndecision, mistake, pattern, reference, todo\n```\n\n## Zasady tagowania\n\n### Zasada 1: 2-5 tagów na wspomnienie\n\nZbyt mało tagów = słaba wykrywalność. Zbyt wiele = szum.\n\n```json\n// Dobrze: 3 istotne tagi\n{ \"tags\": [\"synapse\", \"deployment\", \"docker\"] }\n\n// Źle: 1 tag (zbyt wąsko)\n{ \"tags\": [\"synapse\"] }\n\n// Źle: 10 tagów (szum)\n{ \"tags\": [\"synapse\", \"deployment\", \"docker\", \"vps1\", \"2026\", \"june\", \"ssh\", \"git\", \"main\", \"production\"] }\n```\n\n### Zasada 2: małe litery, z myślnikami\n\n```\n✅ ci-cd, api-key, mind-key\n❌ CI-CD, APIKey, MindKey\n```\n\n### Zasada 3: używać spójnego słownictwa\n\nUstanowić słownik tagowania i się go trzymać:\n\n```\n# Słownik projektów\nsynapse, synapse-mcp, synapse-chat\n\n# NIE: synapse_project, synapseProject, SYNAPSE\n```\n\n### Zasada 4: tagować z intencją wyszukiwania\n\nZapytać: „Jak będę szukać tego wspomnienia?\"\n\n```json\n// Zapis decyzji wdrożeniowej\n{\n  \"content\": \"Decided to use Docker Swarm for Synapse deployment\",\n  \"tags\": [\"synapse\", \"deployment\", \"docker\", \"swarm\", \"decision\"]\n}\n\n// Prawdopodobne wyszukiwania: ?q=docker+swarm lub ?tag=deployment\n```\n\n## Wzorce\n\n### Wzorzec 1: projekt + temat\n\n```json\n{ \"tags\": [\"synapse\", \"deployment\"] }\n{ \"tags\": [\"synapse\", \"auth\"] }\n{ \"tags\": [\"synapse-mcp\", \"tools\"] }\n```\n\nWyszukiwanie: `?tag=synapse` (wszystkie wspomnienia projektu Synapse)\nWyszukiwanie: `?tag=synapse&q=deployment` (wspomnienia wdrożeniowe w Synapse)\n\n### Wzorzec 2: typ + domena\n\n```json\n{ \"tags\": [\"mistake\", \"deployment\"] }\n{ \"tags\": [\"decision\", \"database\"] }\n{ \"tags\": [\"pattern\", \"auth\"] }\n```\n\nWyszukiwanie: `?tag=mistake` (wszystkie błędy)\nWyszukiwanie: `?tag=mistake&q=deployment` (błędy wdrożeniowe)\n\n### Wzorzec 3: hierarchiczny\n\nDla podprojektów w projekcie:\n\n```json\n{ \"tags\": [\"synapse\", \"synapse-docs\", \"markdown\"] }\n{ \"tags\": [\"synapse\", \"synapse-mcp\", \"mcp\"] }\n{ \"tags\": [\"synapse\", \"synapse-admin\", \"ui\"] }\n```\n\nWyszukiwanie: `?tag=synapse` (cały Synapse)\nWyszukiwanie: `?tag=synapse-docs` (tylko podprojekt dokumentów)\n\n### Wzorzec 4: śledzenie statusu\n\n```json\n// Aktywny projekt\n{ \"tags\": [\"synapse\", \"active\"], \"priority\": \"high\" }\n\n// Ukończony projekt\n{ \"tags\": [\"synapse-v1\", \"completed\"], \"priority\": \"low\" }\n\n// Zablokowany\n{ \"tags\": [\"synapse-v2\", \"blocked\"], \"priority\": \"high\" }\n```\n\n## Typowe przypadki użycia\n\n### Znalezienie wszystkich decyzji o projekcie\n\n```bash\ncurl -H \"Authorization: Bearer $KEY\" \\\n     \".../memory/search?q=decision&tag=synapse\"\n```\n\n### Znalezienie wszystkich błędów w domenie\n\n```bash\ncurl -H \"Authorization: Bearer $KEY\" \\\n     \".../memory/search?q=mistake&tag=deployment\"\n```\n\n### Znalezienie aktywnej pracy\n\n```bash\ncurl -H \"Authorization: Bearer $KEY\" \\\n     \".../memory/by-tag?tag=active\"\n```\n\n### Znalezienie wspomnień o technologii\n\n```bash\ncurl -H \"Authorization: Bearer $KEY\" \\\n     \".../memory/search?q=postgres+performance&tag=database\"\n```\n\n## Utrzymanie tagów\n\n### Okresowy przegląd\n\n```python\n# Znalezienie rzadko używanych tagów (kandydatów do czyszczenia)\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### Scalanie tagów\n\nJeśli istnieją niespójne tagi (`docker` i `Docker`), scalić je:\n\n```python\n# Znalezienie wszystkich wspomnień z tagiem „Docker\"\nmems = requests.get(f\"{URL}/memory/by-tag?tag=Docker\",\n    headers={\"Authorization\": f\"Bearer {KEY}\"}).json()\n\n# Aktualizacja każdego na „docker\"\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## Najlepsze praktyki\n\n> [!TIP]\n> - **Ustanowić słownik wcześnie** — spójne tagi od pierwszego dnia\n> - **Tagować z intencją wyszukiwania** — jak to znajdziesz później?\n> - **2-5 tagów to złoty środek** — zbyt mało lub zbyt wiele jest złe\n> - **Małe litery + myślniki** — `ci-cd`, nie `CI/CD`\n> - **Przeglądać okresowo** — scalać duplikaty, usuwać nieużywane\n\n## Następne kroki\n\n- [Najlepsze praktyki pamięci](/docs/guides/memory-best-practices)\n- [Wyszukiwanie FTS5](/docs/concepts/fts5-search)\n- [Przepływ oparty na zadaniach](/docs/llm-cookbook/task-driven-workflow)\n","content_html":"<h1>Strategia tagowania pamięci</h1>\n<p>Tagi są sekretem skalowalnego pobierania wspomnień. Ten przewodnik pokazuje, jak\ntagować wspomnienia, aby właściwe wracały we właściwym czasie.</p>\n<h2>Dlaczego tagi mają znaczenie</h2>\n<p>Bez tagów ma się płaskie wyszukiwanie pełnotekstowe. Z tagami ma się\nustrukturyzowaną nawigację:</p>\n<pre><code class=\"hljs language-bash\"><span class=\"hljs-comment\"># Bez tagów: przeszukiwanie wszystkiego</span>\nGET /memory/search?q=docker\n\n<span class=\"hljs-comment\"># Z tagami: filtrowanie po projekcie i technologii</span>\nGET /memory/search?q=deployment&amp;tag=synapse&amp;tag=docker</code></pre><p>Tagi umożliwiają:</p>\n<ul>\n<li><strong>Szybkie filtrowanie</strong> — <code>GET /memory/by-tag?tag=production</code></li>\n<li><strong>Wyszukiwanie w zakresie</strong> — <code>?q=auth&amp;tag=project-x</code></li>\n<li><strong>Grupowanie</strong> — znalezienie wszystkich wspomnień „mistake&quot; dla projektu</li>\n<li><strong>Odsyłanie krzyżowe</strong> — wspomnienia współdzielące tagi są powiązane</li>\n</ul>\n<h2>Schemat tagowania</h2>\n<h3>Tagi projektów</h3>\n<p>Używać nazw projektów jako tagów:</p>\n<pre><code class=\"hljs language-plaintext\">synapse, synapse-mcp, synapse-chat, synapse-sdk</code></pre><h3>Tagi technologii</h3>\n<p>Używać nazw technologii:</p>\n<pre><code class=\"hljs language-plaintext\">docker, kubernetes, postgres, fastify, react, typescript</code></pre><h3>Tagi tematyczne</h3>\n<p>Używać kategorii tematycznych:</p>\n<pre><code class=\"hljs language-plaintext\">deployment, ci-cd, auth, database, frontend, backend, security</code></pre><h3>Tagi statusu</h3>\n<p>Używać wskaźników statusu:</p>\n<pre><code class=\"hljs language-plaintext\">active, completed, blocked, deprecated</code></pre><h3>Tagi typów</h3>\n<p>Używać wskaźników typów:</p>\n<pre><code class=\"hljs language-plaintext\">decision, mistake, pattern, reference, todo</code></pre><h2>Zasady tagowania</h2>\n<h3>Zasada 1: 2-5 tagów na wspomnienie</h3>\n<p>Zbyt mało tagów = słaba wykrywalność. Zbyt wiele = szum.</p>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-comment\">// Dobrze: 3 istotne tagi</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\">// Źle: 1 tag (zbyt wąsko)</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\">// Źle: 10 tagów (szum)</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>Zasada 2: małe litery, z myślnikami</h3>\n<pre><code class=\"hljs language-plaintext\">✅ ci-cd, api-key, mind-key\n❌ CI-CD, APIKey, MindKey</code></pre><h3>Zasada 3: używać spójnego słownictwa</h3>\n<p>Ustanowić słownik tagowania i się go trzymać:</p>\n<pre><code class=\"hljs language-plaintext\"># Słownik projektów\nsynapse, synapse-mcp, synapse-chat\n\n# NIE: synapse_project, synapseProject, SYNAPSE</code></pre><h3>Zasada 4: tagować z intencją wyszukiwania</h3>\n<p>Zapytać: „Jak będę szukać tego wspomnienia?&quot;</p>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-comment\">// Zapis decyzji wdrożeniowej</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\">// Prawdopodobne wyszukiwania: ?q=docker+swarm lub ?tag=deployment</span></code></pre><h2>Wzorce</h2>\n<h3>Wzorzec 1: projekt + temat</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>Wyszukiwanie: <code>?tag=synapse</code> (wszystkie wspomnienia projektu Synapse)\nWyszukiwanie: <code>?tag=synapse&amp;q=deployment</code> (wspomnienia wdrożeniowe w Synapse)</p>\n<h3>Wzorzec 2: typ + domena</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>Wyszukiwanie: <code>?tag=mistake</code> (wszystkie błędy)\nWyszukiwanie: <code>?tag=mistake&amp;q=deployment</code> (błędy wdrożeniowe)</p>\n<h3>Wzorzec 3: hierarchiczny</h3>\n<p>Dla podprojektów w projekcie:</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>Wyszukiwanie: <code>?tag=synapse</code> (cały Synapse)\nWyszukiwanie: <code>?tag=synapse-docs</code> (tylko podprojekt dokumentów)</p>\n<h3>Wzorzec 4: śledzenie statusu</h3>\n<pre><code class=\"hljs language-json\"><span class=\"hljs-comment\">// Aktywny projekt</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\">// Ukończony projekt</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\">// Zablokowany</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>Typowe przypadki użycia</h2>\n<h3>Znalezienie wszystkich decyzji o projekcie</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>Znalezienie wszystkich błędów w domenie</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>Znalezienie aktywnej pracy</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>Znalezienie wspomnień o technologii</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>Utrzymanie tagów</h2>\n<h3>Okresowy przegląd</h3>\n<pre><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Znalezienie rzadko używanych tagów (kandydatów do czyszczenia)</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>Scalanie tagów</h3>\n<p>Jeśli istnieją niespójne tagi (<code>docker</code> i <code>Docker</code>), scalić je:</p>\n<pre><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Znalezienie wszystkich wspomnień z tagiem „Docker&quot;</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\"># Aktualizacja każdego na „docker&quot;</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>Najlepsze praktyki</h2>\n<div class=\"callout callout-ok\"></div><h2>Następne kroki</h2>\n<ul>\n<li><a href=\"/docs/guides/memory-best-practices\">Najlepsze praktyki pamięci</a></li>\n<li><a href=\"/docs/concepts/fts5-search\">Wyszukiwanie FTS5</a></li>\n<li><a href=\"/docs/llm-cookbook/task-driven-workflow\">Przepływ oparty na zadaniach</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"]}