Skip to content

Commit a2e350b

Browse files
bwlclaude
andcommitted
Preserve existing tags when saving document segments
When editing document segments, the save routine now preserves existing tags instead of overwriting them with auto-extracted tags. This prevents manual tags from being lost when segment content is edited. Tags are only auto-extracted if the segment had no tags previously, maintaining the existing behavior for new segments while protecting user-curated tagging data. Fixes issue identified by @codex in PR review. Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ef66a25 commit a2e350b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/cli/commands/node.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,8 @@ async function applyDocumentEditSession(context: DocumentEditContext): Promise<E
13441344
for (const { segment, content, newOrder } of contentChanges) {
13451345
const combinedText = `${segment.node.title}\n${content}`;
13461346
const tokenCounts = tokenize(combinedText);
1347-
const tags = extractTags(combinedText, tokenCounts);
1347+
// Preserve existing tags - only auto-extract if node had no tags
1348+
const tags = segment.node.tags.length > 0 ? segment.node.tags : extractTags(combinedText, tokenCounts);
13481349
const embedding = await computeEmbeddingForNode({ title: segment.node.title, body: content });
13491350

13501351
await updateNode(segment.node.id, {

0 commit comments

Comments
 (0)