diff --git a/src/skills/builtin/migrating-memory/SKILL.md b/src/skills/builtin/migrating-memory/SKILL.md index adb8085..01cf686 100644 --- a/src/skills/builtin/migrating-memory/SKILL.md +++ b/src/skills/builtin/migrating-memory/SKILL.md @@ -29,7 +29,6 @@ Best for: Extracting sections, cleaning up messy content, selective migration. Creates new blocks with the same content using `copy-block.ts`. After copying: - You own the copy - changes don't sync -- Use `--label` flag if you already have a block with that label - Best for: One-time migration, forking an agent ### 3. Share (Linked Blocks) @@ -40,7 +39,31 @@ Attaches the same block to multiple agents using `attach-block.ts`. After sharin - Can be read-only (target can read but not modify) - Best for: Shared knowledge bases, synchronized state -**Note:** You cannot have two blocks with the same label. When copying, use `--label` to rename if needed. +## Handling Duplicate Label Errors + +**You cannot have two blocks with the same label.** If you try to copy/attach a block and you already have one with that label, you'll get a `duplicate key value violates unique constraint` error. + +**Solutions:** + +1. **Use `--label` (copy only):** Rename the block when copying: + ```bash + npx tsx /scripts/copy-block.ts --block-id --label project-imported + ``` + +2. **Use `--override` (copy or attach):** Automatically detach your existing block first: + ```bash + npx tsx /scripts/copy-block.ts --block-id --override + npx tsx /scripts/attach-block.ts --block-id --override + ``` + If the operation fails, the original block is automatically reattached. + +3. **Manual detach first:** Use the `memory` tool to detach your existing block: + ``` + memory(agent_state, "delete", path="/memories/