Repository navigation
feat(prompts): prompt workflow — work status, notes, target URLs with cited tracking - #511
Merged
Merged
Conversation
The prompts list only measured; the act side of the AEO loop (which prompts got content work, which are queued, which URLs we're pushing to get cited) lived outside the product. v1 of the prompt workflow: - 00031: prompts.work_status (todo / in_progress / done, nullable) plus prompt_notes (author, timestamped thread) and prompt_target_urls (multiple per prompt, unique per URL, structured so a later iteration can auto-check them against the prompt's citations). RLS mirrors the prompts policies: members read, admin/manager write. Applied to the hosted project. - All Prompts: a Work column with a shared WorkStatusBadge — dropdown picker for admin/manager (optimistic update with rollback), read-only badge for members — and a work-status filter (All / To do / In progress / Done / No status) next to the search box. - Prompt detail: the status picker sits in the header next to the Active badge; Notes (thread with author + timestamp) and Target URLs (add/remove, normalized and validated, opens in a new tab) cards at the end of the page, outside the date-range refetch overlay since they're window-independent.
The base-ui SelectValue renders the raw option value unless given a render function — the picker read 'in_progress' once selected. Map values through WORK_FILTER_LABELS like the insights filter selects do.
v2 of the prompt workflow: the product now answers 'did the page we published actually start getting cited for this prompt?' on its own. - 00032: denormalized cited_count / first_cited_at / last_cited_at on prompt_target_urls, so list surfaces read stats without scanning result citations. Applied to the hosted project. - Server: updateTargetUrlStats matches each freshly saved result's citations against the prompt's target URLs (protocol / www / query / fragment / trailing-slash insensitive) and bumps the stats. Hooked into both insert paths — the Cloro result handler and the tracking worker's API-model path — as a best-effort step that can never fail the result insert. - Web: adding a target URL backfills its stats from the prompt's existing results (paged, capped) so pre-existing citations count from day one; live tracking keeps them current. The matcher is duplicated web/server with a stay-in-sync note. - UI: each target URL shows 'Cited ×N' (with first/last dates and a 'was already cited before targeting' nuance in the tooltip) or a dashed 'Not cited yet'. The All Prompts Work column gains an 'X/Y cited' line under the status badge via a cheap prompt_target_urls(cited_count) embed — green once any target URL is cited, so 'work done but nothing cited yet' rows stand out.
7 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The prompts list only measured; the act side of the AEO loop (which prompts got content work, which are queued, which URLs we're pushing to get cited) lived outside the product. This adds the prompt workflow, v1 + v2:
Data (
00031+00032, applied to the hosted project)prompts.work_status—todo / in_progress / done, nullable.prompt_notes— author + timestamped notes thread per prompt.prompt_target_urls— multiple URLs per prompt (unique per URL), with denormalizedcited_count/first_cited_at/last_cited_atso list surfaces read citation status without scanning results.All Prompts
WorkStatusBadge— dropdown picker for admin/manager (optimistic update with rollback), read-only badge for members — plus an "X/Y cited" line (green once any target URL is cited) via a cheapprompt_target_urls(cited_count)embed, so "work done but nothing cited yet" rows stand out.Prompt detail
Closed-loop citation tracking (v2)
updateTargetUrlStatsmatches each freshly saved result's citations against the prompt's target URLs (protocol / www / query / fragment / trailing-slash insensitive) and bumps the stats. Hooked into both insert paths — the Cloro result handler and the tracking worker's API-model path — as a best-effort step that can never fail the result insert.The URL matcher is intentionally duplicated web (TS) / server (JS) with stay-in-sync notes on both sides.
Related issue
—
Type of change
feat— New featureHow to test
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)