I want to explore adding tags to posts maybe admins of the workspace can set the tags
Tags on posts
Reading how posts, roles and memory candidates are modelled (db/schema.ts, lib/session.ts, lib/data.ts, components/post.tsx, lib/context.ts) so I can come back with a concrete design for post tags — storage, who can set them, how they show up, and whether the agent should see them — plus a recommendation and open questions before building anything.
Post tags — design proposal
Nothing built yet; this is the shape I'd go with, plus the three choices that actually change the result. Reply with answers (or "go with your recommendations") and I'll implement it on this branch.
What exists today that this touches
- Roles are
owner | member(member_roleenum); "admin" = owner.requireMember(wsId, user, "owner")inlib/session.tsis already the gate used for repos/members/invites. - Posts have a
kindbadge (task/plan/diff/…) rendered in the.whorow ofcomponents/post.tsx. Tags would sit right next to it. - The agent sees every post via
renderPost()inlib/context.tsas<post … kind="…" asked_claude="true">— tags would become one more attribute there. - General threads (
workspace_id = null) have no owner, so they'd have no tags in v1.
Recommended design
1. Storage — two tables, migration drizzle/0005_tags.sql
tags (id uuid PK, workspace_id FK cascade, name text, slug text, created_by, created_at) unique (workspace_id, slug)
post_tags (post_id FK cascade, tag_id FK cascade, added_by, added_at) PK (post_id, tag_id)
A per-workspace vocabulary rather than free text on each post, so "decision" and "Decision" and "decisions" don't drift, and renaming a tag renames it everywhere. No colour column — the palette is monochrome; tags render as outlined .badge.tag chips (lowercase, to read differently from the uppercase kind badge).
2. Permissions (as you asked: owners)
- Owners manage the vocabulary: a "Tags" card on the workspace page next to Repos/Members (
POST/PATCH/DELETE /api/workspaces/[id]/tags). - Owners apply/remove tags on any post: a small "tag" action in the post's
.whorow opens a checklist of the workspace's tags →PUT /api/threads/[id]/posts/[postId]/tags { tagIds }. - Everyone signed in sees them (read is open everywhere already).
- Loosening to "any member can apply" later is a one-argument change at the route.
3. Display
- On each post: chips after the kind badge.
- Thread lists (home + workspace): chips of the opening post under the title, so tagging the first post effectively tags the thread. That gives you thread categorisation for free without a second concept.
- Filtering:
?tag=<slug>on home/workspace lists andGET /api/threads?tag=("threads where any post carries this tag"). Cheap to add on top of the existinglistThreadsfilter object; I'd include it.
4. Agent sees tags
renderPost() emits tags="decision,gotcha" and the system prompt gets one line: "Posts tagged by owners carry tags=…; treat decision/convention/gotcha posts as authoritative and consider saving them with save_memory." This is the part I find most interesting for this product: today the agent only gets durable knowledge via the classifier's memory_candidates guess; an owner stamping a post decision is a much stronger signal. The agent would not be able to set tags in v1.
Size: 1 migration, ~3 API routes, 2 small client components (tag picker, tag manager), edits to post.tsx, thread-list.tsx, data.ts, context.ts. A few hours.
Questions
- Purpose check — is this mostly curation inside a thread (mark the post that is the decision / the gotcha / needs review) or categorising threads (bug/feature/design for the home list)? My design covers both via "opening-post tags show in lists", but if it's purely the latter I'd put tags on
threadsinstead and skip the per-post UI. - Who applies tags — owner-only as you said, or owners curate the vocabulary and any member can apply? I'd lean owner-only for v1 since that's what you asked and it's trivially loosened.
- Should Claude see tags (section 4)? I'd say yes; it's two lines. Should it also be allowed to suggest tags (e.g. tag its own
donepostneeds-review)? I'd defer that. - Any starter vocabulary to seed per workspace (e.g.
decision,gotcha,needs-review,bug,idea), or start empty and let owners add?
Alternatives considered
posts.tags text[]free-text: simplest, but no rename, no consistency, filter needs a GIN index; rejected.- Reusing
post.metaJSON: no referential integrity and can't filter efficiently; rejected. - Global (cross-workspace) tag set: wrong unit — vocabulary differs per team, and memory/search are already workspace-scoped.