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):

Browse filters (FilterSection):

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


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

  1. Creator clicks "Suggest Tags" in the tag picker
  2. System sends the entity's prompt text to an LLM with the full tag list and descriptions
  3. LLM returns suggested tag indices with confidence levels
  4. Suggestions appear as a highlighted group in the tag picker — pre-checked but not yet saved
  5. Creator unchecks any wrong suggestions, then confirms

Prompt Design

The LLM call includes:

This is a single, targeted LLM call — not a pipeline stage. It runs on demand when the creator clicks the button.

Guardrails


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

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:

Behavior:

Invariants:

Edges:


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

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


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

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.

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

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:

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

  1. 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).

  2. 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.

  3. 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.

  4. 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).

  5. 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.