Skip to content

Organise and tidy tags: assistant tools and a merge button in the Tags panel - #80

Merged
davior merged 2 commits into
mainfrom
claude/intelligent-sagan-ast2gp
Nov 23, 2026
Merged

davior merged 2 commits into
mainfrom
claude/intelligent-sagan-ast2gp

Conversation

@davior

@davior davior commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

What

Assistant: organise and tidy the tag vocabulary

The assistant can now propose changes to the tag vocabulary itself, not just to one asset's tags. As with every other assistant proposal, nothing is written until the person presses Apply.

  • Groups: create nested categories, move or rename existing ones, and file tags into them (propose_tag_groups). Groups are the existing TagCategory, so there's no schema change or migration. An existing category can be named by its id, or by its path when that matches only one.
  • Rename / merge: applies across every asset that carries the tag (propose_tag_rename). A rename onto a name that already exists is recorded as a merge. A merge keeps one attachment per asset and carries the source's category over to an unfiled target.
  • Delete: meant for unused tags and junk (propose_tag_delete).
  • Looking tools:
    • list_tags now shows ids, usage counts, category paths and the category tree. It pages (offset) and has uncategorised_only and max_uses filters, so a whole vocabulary can be sorted into groups.
    • find_similar_tags (new) groups tags that differ only by case, plurals, accents, punctuation or a small typo.
  • Preview: each op shows its asset count and up to 5 asset names, and has its own include toggle. A filing op can be expanded to show every tag it files.
  • Apply: runs ops in dependency order (create → move → file → rename/merge → delete). It resolves categories proposed in the same turn by ref, skips a stale op with a sentence while the rest still apply, and re-indexes the touched assets once at the end. The Tags panel and filter reload afterwards.

Tags panel: merge

  • Each tag row has a merge button. It opens a "Merge into…" step that says what will happen before anything does:
    • how many assets will carry the target instead,
    • that the source is deleted and this can't be undone,
    • whether the target takes over the source's category.
  • Renaming a tag onto a name another tag already has opens the same step, already pointed at that tag, instead of only being refused.
  • New endpoint POST /api/tags/{id}/merge {target_id}. It returns the target with its new count and re-indexes the moved assets. Merging into itself is a 400; someone else's tag is a 404.

The assistant's Apply and the new endpoint both use the same service functions: merge_tags and rename_tag (the latter is also behind PATCH /api/tags/{id}). similar_groups and category_paths are new.

Tests

  • Backend:
    • New tests/test_assistant_tags.py.
    • In test_tags.py: merge-service and merge-endpoint tests, the rename collision, and the look-alike grouping.
  • Frontend:
    • Tag-op rows in AssistantPanel.test.tsx.
    • Merge step and rename-collision tests in TagPanel.test.tsx.
    • A test for the store's non-optimistic merge in tags.test.ts.
  • The first commit is green in CI on all three jobs, including backend pytest with the real suite client.

🤖 Generated with Claude Code

https://claude.ai/code/session_01V1geD6BRzqbfoJdeGyQ4Kb

The assistant could change one asset's tags but not the vocabulary itself. It can now
propose groups (nested categories, existing ones moved or renamed, tags filed into them),
renames and merges across every asset carrying a tag, and deletes of unused tags. Each
change is a proposal row with a preview (how many assets, and a sample of their names),
and nothing is written until the person applies it.

- list_tags gives ids, counts and category paths, the category tree, and pages, so a
  whole vocabulary can be sorted into groups; find_similar_tags finds spellings of one tag.
- A rename onto an existing name is recorded as a merge. Merging keeps one attachment per
  asset and carries the source's category to an unfiled target.
- Apply runs tag ops in dependency order, resolves categories proposed in the same turn,
  skips a stale op with a sentence and re-indexes touched assets once.
- Groups are TagCategory rows: no schema change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1geD6BRzqbfoJdeGyQ4Kb
A tag row gets a merge button that opens a "Merge into" step. It says what will happen
before anything does: how many assets will carry the target instead, that the source is
deleted and this can't be undone, and whether the target takes over its category.
Renaming a tag onto a name another tag has opens the same step, already pointed at that
tag, rather than only refusing.

Backed by POST /api/tags/{id}/merge, over the same services.tags.merge_tags the
assistant's merges apply through. It returns the target with its new count and
re-indexes the moved assets. The store's merge is not optimistic: the count is the
server's, and a merge cannot be put back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V1geD6BRzqbfoJdeGyQ4Kb
@davior davior changed the title Assistant: organise and tidy the tag vocabulary Organise and tidy tags: assistant tools and a merge button in the Tags panel Nov 23, 2026
@davior
davior marked this pull request as ready for review November 23, 2026 14:15
@davior
davior merged commit 1a79800 into main Nov 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants