Tag Improvements
Status: In Progress. Shipped: pinned tags, AI-suggested tags, search presets, tag explanations and frequent tags. Still planned: tag synonym search and co-occurrence suggestions.
Overview
Tags are the primary way users discover content and creators organize it. The current system handles the fundamentals — 448 bitfield tags across characters, modes, and lorebooks, with bitwise filtering in browse. But the experience of assigning and searching tags has friction that compounds across every entity a creator manages and every search a user runs.
Six improvements target the full tag lifecycle: assigning tags faster, discovering the right tags, understanding what tags mean, and saving searches for reuse.
1. Pinned Tags (Creator & User) — Implemented
Problem: Creators who build content in a consistent niche re-select the same 10-20 tags on every entity. Browse users rebuild the same filter combination every session.
Solution: Users can pin tags to the top of the tag picker (creator forms) and browse filter. Pinned tags persist across sessions and preserve insertion order. In browse, each pinned tag remembers its include/exclude state.
How It Works
Creator forms (TagFormSelector):
- "Pinned tags" section with pin icon appears above frequent tags when authenticated
- Pin icon on every tag in categories, search results, and frequent tags
- Click pin icon to toggle — pinned tags appear/disappear from the pinned section
- Pinned tags that overlap with frequent tags are deduplicated (shown only in pinned)
- Empty state hint: "Pin tags you use often for quick access"
Browse filters (FilterSection):
- Pinned section above the main tag selector
- Each pinned tag remembers its include/exclude state
- Clicking a pinned tag cycles through states as normal; state changes auto-save
- Unpin button on each pinned tag to remove
Storage
Stored in user_settings via direct read/write (not through the settings resolution chain, since these keys don't exist in default_settings).
Creator form — ordered JSON array of tag IDs:
Tags.PinnedCharacterTags = "[12, 45, 67]"
Tags.PinnedLorebookTags = "[3, 8]"
Tags.PinnedModeTags = "[1, 5]"
Browse filter — JSON array with include/exclude state per tag:
Browse.PinnedCharacterTags = '[{"id":12,"s":"i"},{"id":45,"s":"x"}]'
s: "i" = include, "x" = exclude.
Separate lists per entity type. Maximum 50 pinned tags per list.
Implementation
- Backend:
SettingsKeys.Tags.Pinned*andSettingsKeys.Browse.Pinned*constants. GET returns pinned tags in the metadata response when authenticated. PUT endpoints for saving. Read usesGetByKeysAsync(directuser_settingsquery, not the resolution function which requiresdefault_settingsentries). - Frontend:
useTagshook exposespinnedTags,togglePinned,setPinnedTagswith optimistic updates and revert-on-error.usePinnedBrowseTagshook for browse filters.TagFormSelectorrenders pinned section + pin icons.PinnedBrowseTagsSectionfor browseFilterSection.
2. AI-Suggested Tags (Creator)
Problem: Creators write detailed character descriptions, personality traits, and scenario prompts — then manually hunt through 400+ tags to find the ones that match. The prompts already contain the information the tags represent. A character described as "a cunning elven sorceress who manipulates shadow magic in a medieval court" clearly maps to Fantasy, Medieval, Supernatural, Elf, and several personality tags, but the creator has to find and select each one.
Solution: An "Suggest Tags" button on the tag picker analyzes the entity's prompts and suggests relevant tags. The creator reviews and accepts/rejects each suggestion.
How It Works
- Creator clicks "Suggest Tags" in the tag picker
- System sends the entity's prompt text to an LLM with the full tag list and descriptions
- LLM returns suggested tag indices with confidence levels
- Suggestions appear as a highlighted group in the tag picker — pre-checked but not yet saved
- Creator unchecks any wrong suggestions, then confirms
Prompt Design
The LLM call includes:
- The entity's prompt/description text
- The complete tag list for that entity type with names and descriptions
- Currently assigned tags (to avoid re-suggesting)
- Instruction to return tag indices ranked by relevance
This is a single, targeted LLM call — not a pipeline stage. It runs on demand when the creator clicks the button.
Guardrails
- Suggestions are never auto-applied — always require creator confirmation
- Content rating tags (SFW/NSFW) require explicit selection, never suggested
- If the prompt is too short or vague, the system says so instead of guessing
3. Search Presets (User)
Problem: Users who browse with specific preferences rebuild the same filter combination every session. A user who always wants Fantasy + SFW + Female + Romance and excludes Horror + Gore sets this up from scratch each time they open browse.
It is also how a reader blacklists tags. There is no separate tag blacklist: a reader who never wants to see Gore keeps it excluded in a preset that browse opens with (Default preset below). Today they can exclude tags in browse by hand, or pin a tag in its exclude state, but nothing applies the exclusion on its own when browse opens. Support ticket #39 asked exactly this.
Solution: Users can save the current browse filter state as a named preset and recall it with one click. One preset per entity type can be the default, applied whenever browse opens.
How It Works
- After setting up filters (tags, exclude tags, sort, content rating), a "Save Search" button appears
- User names the preset (e.g., "Cozy Fantasy", "Dark Romance")
- Saved presets appear as chips above the filter bar
- Clicking a preset restores the full filter state
- Users can delete presets they no longer need
- Default preset: a reader can mark one preset per entity type as the default. Browse opens with it applied, so excluded tags stay excluded without being re-picked. The applied preset shows as an active chip, so it's clear why some results are missing. One press clears it for this visit, and the default is unchanged.
What a Preset Stores
{
"name": "Cozy Fantasy",
"entityType": "character",
"includeTags": [12, 45, 67],
"excludeTags": [203, 289],
"sortBy": "popular",
"contentRating": "sfw"
}
Presets are per entity type (characters, modes, lorebooks) since tag sets differ.
Storage
A table, browse_presets (database/v1/156_tables_browse_presets.sql), not user_settings: each preset is a row of its own (rename, reorder or delete one), the database enforces one default per entity type, and the 20-per-type cap is counted under a lock. No impact on search performance — the preset just pre-fills the existing filter UI.
Acceptance criteria (search presets)
User use cases:
- As a signed-in reader, I can save my current browse filters as a named preset from the chat console's browse page, and get them back with one press.
- As a signed-in reader who never wants a tag, I can mark a preset that excludes it as my default, and browse opens with that tag excluded on every visit, with no picking. This is the "blacklist" from ticket #39.
Behavior:
- The default preset is applied on open and shown as an active chip. Clearing it affects this visit only.
- Presets are per entity type (characters, modes, lorebooks).
Invariants:
- A reader with no default preset sees browse exactly as today: nothing is excluded that they didn't pick.
- Signed-out browse never applies a preset.
Edges:
- A tag removed from the catalog drops out of a saved preset quietly. The preset still applies, and nothing errors.
- Deleting the default preset leaves no default.
4. Tag Explanations (Creator & User) — Implemented
Problem: Tag names are short labels. Some are obvious (Fantasy, Romance), but many are ambiguous or domain-specific. What does Proactive mean on a mode? What's the difference between Dark and Horror? How is Slow Burn different from Romance? Creators assign tags they don't fully understand, and users filter by tags they interpret differently than intended.
Solution: Every tag has a short explanation visible on hover or tap. The explanation clarifies what the tag means in the context of this platform, not a dictionary definition.
How It Works
- Hovering over a tag in the picker or browse filter shows a tooltip with the explanation
- Mobile: tapping the info icon next to a tag name shows the explanation
- Explanations are part of the tag definition, not user-generated
Explanation Style
Explanations are one to two sentences. They answer "what does selecting this tag tell the user?" for creators, and "what content does this tag filter for?" for users.
| Tag | Explanation |
|---|---|
Proactive |
The character or mode drives the story forward on its own, initiating events and decisions without waiting for the user to direct every action. |
Slow Burn |
The narrative builds relationships and tension gradually over many exchanges. Expect development, not instant payoff. |
ABO |
Alpha/Beta/Omega dynamics. A specific relationship/biology trope with defined power structures and physical traits. |
Implementation
- Storage:
[Description]attributes on C# tag enum constants inCharacterTags.cs,LorebookTags.cs,PromptModeTags.cs. Descriptions ship as part of the tag definition via the metadata API — not stored per-user. - Category descriptions: Each tag category also has a description explaining what the category groups together.
- API:
GET /api/metadata/tags/{characters|lorebooks|modes}returnsTagCategory[]with descriptions on both categories and individual tags. - UI: TagFormSelector shows descriptions as native
titletooltips on tag buttons and displays category descriptions inline when a category is expanded. - Search bonus: The tag picker search matches against descriptions in addition to tag names, partially addressing the synonym search need (Feature #5).
5. Tag Synonym Search (Creator)
Problem: Creators search the tag list by typing a name, but tags have one canonical name. A creator looking for a tag about "magic" might not find Supernatural or Magic System. Someone typing "sci-fi" won't match Science Fiction. The tag exists, but the creator's search term doesn't match the label.
Solution: Each tag has a set of synonyms/aliases that the tag picker search matches against. The canonical tag name stays the same, but the search is more forgiving.
How It Works
- Creator types in the tag picker search box
- Search matches against: tag name, tag synonyms, and tag explanation text
- Results show the canonical tag name with the matching synonym noted if it wasn't a name match
Search: "magic"
Results:
Supernatural (matches synonym: "magic")
Magic System (matches name)
Fantasy (matches explanation: "...magical worlds...")
Synonym Data
Synonyms are part of the tag definition alongside explanations. Curated, not crowd-sourced.
| Tag | Synonyms |
|---|---|
Supernatural |
magic, magical, paranormal, occult |
Science Fiction |
sci-fi, scifi, space, futuristic |
Slow Burn |
gradual, buildup, slow pace |
ABO |
alpha beta omega, omegaverse, a/b/o |
6. Commonly Used Tags (Creator) — Partially Implemented
Problem: When a creator is adding tags to a new entity, they have no signal for which tags are popular or relevant in their niche. A creator building their 10th fantasy character doesn't know which fantasy-adjacent tags other creators commonly use together. They pick the obvious ones and miss tags that would improve discoverability.
Solution: The tag picker shows the creator's most-used tags for quick selection, and highlights tags commonly used alongside the ones already selected.
Frequent Tags (Implemented)
Per-user frequent tags surface the creator's own most-used tags at the top of the picker.
- SQL:
fn_character_tag_counts(p_user_id),fn_lorebook_tag_counts(p_user_id),fn_mode_tag_counts(p_user_id)accept an optional user ID parameter. When provided, they return tag counts scoped to that user's entities. - API:
GET /api/metadata/tags/{type}returns afrequentTagsarray (top 20 by usage) when the request is authenticated. Repository resolution is lazy — unauthenticated requests skip the query entirely. - UI: TagFormSelector shows a "Your frequent tags" quick-select section at the top with the creator's top 12 most-used tags. The
useTagshook handles auth-aware cache invalidation so frequent tags appear after login.
Co-occurrence Suggestions (Remaining)
When a creator has selected some tags, the picker should surface tags that frequently appear on the same entities. If every character tagged Fantasy + Medieval also has Supernatural, that tag gets a "commonly paired" indicator.
Selected: Fantasy, Medieval
Commonly paired: Supernatural (87%), Adventure (72%), Royalty (54%)
Data Source
- Counts: Available from existing SQL functions with optional user scoping.
- Co-occurrence: A materialized view that counts tag pair frequencies across published entities, refreshed periodically via the existing maintenance job.
Materialized View Design
The view computes how often each pair of tags appears together on published entities. This is a bitwise operation on the existing tags_0..tags_6 bitfield columns — no schema changes to entity tables.
View definition:
CREATE MATERIALIZED VIEW IF NOT EXISTS mv_tag_cooccurrence AS
SELECT
entity_type,
tag_a,
tag_b,
COUNT(*) AS pair_count
FROM (
-- Unnest active tag bits into (entity, tag_index) rows,
-- then self-join to produce all pairs per entity.
-- Only published, non-deleted entities contribute.
-- Implementation: a helper function that extracts set bit
-- positions from tags_0..tags_6 columns.
)
WHERE tag_a < tag_b -- each pair stored once, canonical order
GROUP BY entity_type, tag_a, tag_b
HAVING COUNT(*) >= 3 -- prune noise — pairs appearing on fewer than 3 entities are not useful
WITH DATA;
CREATE UNIQUE INDEX IF NOT EXISTS uix_tag_cooccurrence
ON mv_tag_cooccurrence (entity_type, tag_a, tag_b);
CREATE INDEX IF NOT EXISTS ix_tag_cooccurrence_tag_a
ON mv_tag_cooccurrence (entity_type, tag_a, pair_count DESC);
CREATE INDEX IF NOT EXISTS ix_tag_cooccurrence_tag_b
ON mv_tag_cooccurrence (entity_type, tag_b, pair_count DESC);
Key decisions:
tag_a < tag_b— each pair stored once in canonical order, halving storage and avoiding duplicates.HAVING COUNT(*) >= 3— pairs that only appear on 1-2 entities are noise, not signal. Pruning keeps the view small.- Unique index — required for
REFRESH MATERIALIZED VIEW CONCURRENTLY, which allows reads during refresh. - Per-tag indexes — the runtime query looks up "given tag A, what are the top co-occurring tags?" so we index on each side with
pair_count DESCfor efficient top-N retrieval. entity_type— character, mode, and lorebook tags are separate namespaces; co-occurrence is computed per type.
Refresh schedule:
Recalculated by the periodic maintenance job (same mechanism that handles other background maintenance). Refresh runs CONCURRENTLY so the old data remains readable throughout:
REFRESH MATERIALIZED VIEW CONCURRENTLY mv_tag_cooccurrence;
Frequency: daily is sufficient — tag assignments on published entities don't change fast enough to warrant more. The maintenance job already runs on a schedule; this adds one view refresh.
Runtime query:
Given a set of selected tags, return the most commonly co-occurring tags not already selected:
SELECT
CASE WHEN tag_a = ANY(@selected) THEN tag_b ELSE tag_a END AS suggested_tag,
SUM(pair_count) AS relevance
FROM mv_tag_cooccurrence
WHERE entity_type = @entityType
AND (tag_a = ANY(@selected) OR tag_b = ANY(@selected))
AND NOT (tag_a = ANY(@selected) AND tag_b = ANY(@selected)) -- exclude pairs where both are already selected
GROUP BY suggested_tag
ORDER BY relevance DESC
LIMIT 10;
This sums across all selected tags — a tag co-occurring with multiple selected tags ranks higher than one paired with only one. The query hits the indexed view and returns in sub-millisecond time.
Percentage display:
The UI shows "Supernatural (87%)" — this percentage is relative to the selected tags, not absolute. Computed as: pair_count / total entities with selected tag * 100. The total per tag can be cached from the existing tag count functions or stored as a diagonal entry in the view (tag_a = tag_b with pair_count = total entities using that tag).
Implementation Priority
| Feature | Effort | Impact | Status |
|---|---|---|---|
| Tag Explanations | Low — static content, tooltip UI | High — reduces misuse, helps everyone | Done |
| Pinned Tags | Low — user setting + UI row | Medium — saves time for active creators | Done (creator + browse) |
| Tag Synonym Search | Low — extend search to include aliases | Medium — reduces "can't find the tag" friction | Partially addressed (description search) |
| Commonly Used Tags | Medium — co-occurrence computation | Medium — improves tag discoverability | Frequent tags done, co-occurrence planned |
| Search Presets | Medium — new storage + preset UI | Medium — saves time for repeat browsers | Done — Saved filters on chat.'s Discover (2026-10-21) and the writing client's Browse (2026-10-24, 2e2a4c02a), with a default per kind |
| AI-Suggested Tags | Medium — LLM call + suggestion UI | High — but needs explanations first for accuracy | Done — AI Suggestions button in the tag picker (unlocks at 30 characters of description, Echo-charged via the creative:tag_suggest AI task, which needs an admin-bound system preset to run; predates 2026-07-20) |
Tag explanations shipped first as planned, unlocking description-based search and providing the foundation for AI tag suggestions. Frequent tags, pinned tags and AI suggestions have shipped. Since 2026-09-05 (e5326fb5) a public character must carry a Pronouns tag (an editor-side gate; the server takes an untagged public character), and connected agents set tags by canonical name. Since 2026-12-04 (ledger F412) the gate reads: "A save may carry the missing-pronoun-tag state forward on a public work, never create it: a publish, a release, or removing the tag from a public character is held; an already-public character saved without one can still be edited, with a prompt." Search presets are built as Saved filters on chat.'s Discover (2026-10-21) and the writing client's Browse (2026-10-24). Next priorities: co-occurrence suggestions, then synonym search.
Open Questions
Tag explanation authoring: Who writes 400+ tag explanations?Resolved. Descriptions are authored as[Description]attributes on C# tag constants, co-authored with LLM assistance. They reflect platform-specific meaning. Lorebook tags were rewritten with a granular v1 taxonomy (Characters, Locations, Factions, Items, Events, Rules, History, Species, Relationships) and mode tags with a v0.2 system (Narrative Authority, Story Structure, Scope, Pacing, Interaction Focus, Tone, Setting, Approach, User).Co-occurrence scope:Resolved. Global (all published entities) via a materialized view refreshed by the maintenance job. Per-user signal is already covered by frequent tags — co-occurrence serves a different purpose: "what do other creators in this niche use?" Global gives better signal, especially for new creators, and avoids per-user computation cost.AI suggestion model: Which model handles tag suggestion? It needs the full tag list in context (400+ tags with names and descriptions). A smaller, faster model works since this is classification, not generation. Note: tag descriptions are now available via API, so the prompt can include them for better accuracy.
Preset sharing: Should users be able to share search presets? "Here's my browse filter for cozy SFW fantasy" as a link. Low effort if presets are just serialized filter state, but adds a social feature that needs moderation consideration (preset names).
Favorite tags vs. commonly used tags overlap:Resolved. Pinned (user-curated) and frequent (data-driven) complement each other. Pinned tags appear first, frequent tags below (with pinned tags deduplicated from the frequent list). Both sections are visible when authenticated.