Repository navigation
feat(action-center): read an action's effect a week, two weeks and a month after it closed (learning B1) - #1694
Merged
Conversation
… measured result Learning phase A, A3 (the agentic learning report, gaps 2 and 4). An action's result compared its metrics before and after, but never asked the question closest to its own aim: did the signals that raised it end? Signals close as resolved (the condition gone) or resolved with `supersededBy` (still there, as another kind), and that never reached the outcome. - validate.js: when an action is measured, signalOutcome reads its signals through action_signals and keeps the counts in `validation.signals`: total, ended, replaced, dismissed, open. An action with no metric to measure keeps them too (its validation was null). An action no signal raised (sent from Content, Insights…) has none. - History's drawer says it under Result: "Of the 4 signals that raised it, when measured: 2 ended, 1 turned into another, 1 still open." - The Action Center guide says so. The outcome itself is unchanged; A4 decides what counts as improved. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pages it names, brand-wide beside
Learning phase A, A1 (the report's gap 2). The night engine's actions
were measured on the whole brand's figures, so "recover 6 prompts" was
judged by every prompt the brand tracks, and a small real effect drowned
in the rest. Their targets are in the payload already.
- validate.js: an action whose payload's targetEntity is 'prompts' or
'pages' (targetScope) is measured on those targets with the basket
measure the actions sent from Content use: every target it counts
(targetIds, else targets), prompt ids as uuids, a page written as a
path read on the brand's primary domain. The metrics are its basket
KPIs that the action names (all six when it names none). The brand-wide
figures over the same windows are kept as `brandWide`, and
`scope: { kind: 'targets', entity, prompts, pages }` says what it was.
- A basket that measured nothing (no answers in either window) leaves the
action to the brand-wide measure, as before; so does any other target
(competitors, sources…).
- History's drawer: "Measured on the 2 prompts it named." under Result, and
"Brand-wide over the same days: Citations 100 → 104" under the cards.
- The guide says so.
Stacked on feature/outcome-signals-resolved (A3): both change
validateAction.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n since it closed
Learning phase A, A2 (the report's gap 3). F01, F03 and F10 had no metric
to measure (their signals name none), so their result always read "could
not be measured", and the audit's own answer was never asked: does the
page pass now? (A1 already measures them on their pages' citations and AI
sessions, which rarely move in a week for a technical fix.)
- audit-recheck.js: for each page target that names the checks that
raised it (F03, F10…), the latest audit of the page since the action
closed, by the address asked for or ended at; it passes when every named
check does (validity's warn still fails, as the page check reads it). A
low-scored page (F01) passes once its score is past the line its signal
is raised under. `{ pages, audited, passed }`, kept as validation.audit.
- validate.js: a fix with pages audited again is judged by them: all or
some passing reads improved, none no meaningful change (A4 will say
mixed for some). With none audited again, the metrics judge, as before.
validateAction's four writes now go through one `finish`, which keeps
the signals (A3) and the audit beside the metrics.
- History's drawer: "Audited again since it closed: 1 of 2 pages pass.",
or that none was yet and the result is from the metrics.
- The guide says so.
Stacked on feature/outcome-target-basket (A1).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…akes The A1 drawer test built its metrics with unit 'count', which ActionResultMetric doesn't take: tsc failed on the test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ay "mixed" when its metrics moved both ways Learning phase A, A4 (the report's gap 4). One metric up and another down read as "improved": the verdict counted any rise as the work paying off, which is the wrong lesson to learn from. - deriveOutcome takes the action's main metric. Measured, it decides: up improved, down declined, still no meaningful change, and `mixed` when another metric moved the other way. Without it measured, every metric counts and movement both ways is `mixed`. - The main metric is the first success metric the action names (its signals' first; a basket's first it reads), else what its targets read in (citations for pages, visibility for prompts). It's kept as validation.primary. - A Site Audit fix whose pages only partly pass when audited again (A2) reads `mixed` too. - 00365 adds 'mixed' to actions_outcome_check (applied on the dev DB; schema.sql rebuilt). - Web: the outcome type and list, "Mixed" in the outcome labels, hints, explanation and History line, and the drawer's "Judged by Citations, its main metric." The MCP list_action_history description names mixed. The not_measurable explanation and hint said "this action was dismissed"; they say nothing it aims at could be read. - The guide says so. Stacked on feature/outcome-audit-kinds (A2). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…easured weeks, and don't compare past two
Learning phase A, A6 (the report's gap 4). The validation sweep compared
an action's week before and week after without asking whether tracking
ran on each night of them. A night whose collection failed (or fell short
and was discarded) leaves no stamped tracking run, and reads as fewer
mentions and citations: a decline nobody caused. The signal side guards
against collection incidents; the measure didn't.
- validate.js: when the metrics read include one from tracking's answers
(visibility, share of voice, competitor lead, mentions, citations),
missingDays counts each window's days with no stamped tracking run for
the brand, kept as validation.gaps { before, after }. Past
validation.maxGapDays (2, config/action-engine.js) in either window,
`tooMany` is set and the result reads not_measurable; the figures stay
to see. A Site Audit fix judged by its audits again (A2) isn't affected,
nor a measure of AI sessions alone.
- History's drawer, in amber: "Tracking missed 1 night of the week before
it and 2 nights of the week after it: mentions and citations read a
little low there.", or that there were too many to compare fairly.
- The guide says so.
Stacked on feature/outcome-mixed-primary (A4).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Learning phase A, A5 (the report's gap 6). Dismissing an action asked nothing, so the same definition could open again 14 days later for the reason it was turned down, and nothing learned from it. A content opportunity's dismissal already asks (CONTENT-006); this is its pattern. - 00366 adds actions.dismiss_reason: not_relevant, already_done, wrong_data or not_now, null when none was given (applied on the dev DB; schema.sql rebuilt; web/src/types/supabase.ts updated). - updateActionStatus takes the reason: kept on a dismissal, cleared on any other status (and an unknown one is kept as none). The status_changed event carries it. - Dismissing from the row menu or the drawer's status opens "Why dismiss it?" (DismissReasonDialog): four reasons, each with a hint, and "Dismiss without saying why". Closing the dialog dismisses nothing. - History's drawer says "Dismissed: The data behind it is wrong." - The guide says so. Nothing reads the reason to rank or rest actions yet: that's phase B. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eason A5 goes on the phase A chain (A3 → A1 → A2 → A4 → A6): both add lines to History's drawer, its item type and en.json. Both sides kept; the drawer test keeps every test; schema.sql rebuilt with 00365 and 00366.
…month after it closed Learning B1. A closed action was read once, over the week after it closed, which can't tell an effect that takes longer from none at all. It is now read three times, over the weeks ending 7, 14 and 30 days after the close, each against the week before it was raised; the day-30 reading is final. - validate.js: READING_DAYS / readingWindow; validateAction takes every reading due, keeps the last one's figures and verdict plus each reading's day, outcome, window and metrics, and marks the action final on day 30. The measuring itself moved unchanged into measureReading. - The outcome_measured event carries the reading's day and final flag; the drawer's History tab reads "Day 14 · Result: …". - Sweep: never-measured actions, or read but not final yet; one measured once before this keeps its result. Read in pages by id, so actions waiting for a later reading can't crowd out the ones due. - History table: "so far: day 14 of 30" until the final reading; the drawer lists the readings and says when the final one is. - Config finalReadingDay 30; docs and the MCP tool description say so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review of learning A4. A basket reads every metric it can: visibility, share of voice, the lead over the top competitor, mentions, citations and AI sessions. Any one of them drifting the other way made the result "mixed", though the action never aimed at it: visibility 20 → 30 with the lead 0.4 → 0.3 read mixed for an action that names visibility alone. - deriveOutcome takes the action's aims (its kpi_keys): given them, only those and its main metric count. The others stay in validation.metrics, to see. None of them read is not measurable. - A basket sent from Content, Insights, Mentions, AI Traffic or the editor is judged by its kpi_keys; a night-engine action measured on its targets by the ones a basket reads. The brand-wide measure reads only its kpi_keys already. - finish derives the verdict from the validation it keeps. - The guide says other metrics show beside but don't count. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… read its main metric Review of learning A4. A night-engine action measured on the prompts it names was judged by whatever its basket could read. One whose main metric is citations (G02: citations, then mentions) reads no citations on prompts, which have no pages to count them on, so its mentions decided: "improved" while the citations it aims at fell brand-wide. - validate.js: the targets decide only when their basket reads the main metric. Otherwise the whole result goes to the brand-wide measure, by the brand's main metric (its first kpi_key), reusing the brand-wide figures already read. validation.scope says why: kind 'brand', reason 'primary_not_in_basket', with the targets' entity and counts. - A basket that read nothing still leaves it brand-wide as before. - The guide says so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review of learning A4. Only a completed action is measured. 00084 set the dismissed ones of the time to not_measurable, which History now explains as "Measured after this action closed; nothing it aims at could be read." A dismissal since then stays pending_measurement, read as "The metrics below fill in once validation runs." Neither is what happened. - History's Result column and drawer read a dismissed action's status, not its outcome: "Not measured", dismissed; and in the drawer "Not measured: it was dismissed, and only a completed action is measured." A dismissed action that was measured first keeps its figures. - The guide no longer says a dismissed action is Not measurable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review of learning A4: 00365 ended without the notify every recent migration ends with. schema.sql rebuilt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a-gap # Conflicts: # docs/guides/action-center.mdx # server/src/lib/action-center/validate.js # web/src/components/action-center/history-drawer.test.tsx
…of at a full week's worth Review of learning A6. Mentions and citations add up night by night, and a meaningful change is 5%, so one missed night (a week's total down about 14%) still read as "Declined". Past two, the whole result read not measurable, though visibility, share of voice and the lead are shares of the answers there were and don't drift from a missed night. - validate.js: fullWindowCounts reads each window's counts, the action's own and the brand-wide ones beside, as the nights that ran read them per night, times the window's nights: both windows on the same scale. What was read stays as `raw`. 7 nights of 100 against 6 is no change. - Nights are counted only when a count was read; a rate alone isn't flagged. - Past maxGapDays the counts stay as read and are left out of the verdict; only an action whose main metric is a count reads not measurable. A rate still judges. - The guide and the config's note say so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eason # Conflicts: # supabase/schema.sql # web/src/components/action-center/history-drawer.test.tsx
Review of learning A5: 00366 adds actions.dismiss_reason, and PostgREST doesn't see a new column until its schema cache reloads. Every recent migration ends with the notify; this one didn't. schema.sql rebuilt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ounted for a full week The drawer's gap lines said mentions and citations "read a little low" and that too many missed nights made "the result read not measurable". Since the counts are scaled to a full week from the nights that ran, and too many missed nights only leave the counts out of the result (an action judged by a rate is still measured), the lines say so now. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…dings # Conflicts: # docs/guides/action-center.mdx # server/src/lib/action-center/validate.js # web/src/components/action-center/history-drawer.test.tsx # web/src/components/action-center/history-table.test.tsx
…l, and its latest reading's day Review of learning B1. list_action_history returned an action's outcome with no way to tell the day-7 or day-14 reading from the final one. Each row now carries `final` (the day-30 reading is in, or it was measured once, before readings began) and `reading_day` (the latest reading's day, null before the first), and the tool description says that until final is true the outcome is a reading so far, not the result. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…read, not the week after the close Review of learning B1. The drawer's gap lines counted the after-window's missed nights as "of the week after it", but with readings 14 and 30 days on, the figures kept are the latest reading's week. The lines now say "of the week of the latest reading". Co-Authored-By: Claude Opus 5.5 <[email protected]>
9 of 12 tasks
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Merged
9 of 12 tasks
10 of 12 tasks
gkhngyk
approved these changes
Oct 28, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good, with follow-ups.
What I checked:
- Own change. 52fcbb6, 5447dd7, 6c46dda and a8e2ecf, plus the merge 83652d8 (
origin/pr/1692..origin/pr/1694). I read how 83652d8 resolvedvalidate.js,action-engine.js, the docs and the two web tests. The A4–A6 fixes are all in the movedmeasureReadingbody. On today's main onlysupabase/schema.sqlconflicts. No migration. - Readings.
readingWindowgives the weeks ending on days 7, 14 and 30, and a reading is only taken once its week is over. An action that is late takes every reading due in order.validation.readingskeeps each verdict, andfinalis set once day 30 is read. Signals and the audit recheck are read once per action, not once per reading. - Sweep. The filter keeps actions measured before this change out: no
readings, so not swept again. An action with nothing due returns before any read, so the actions waiting for a later reading cost one list row each. The pages are keyed onid, so they can't repeat or skip. - Web and MCP. "so far: day 14 of 30" and the readings line show until the final one.
finalandreading_dayare on the MCP row. An action measured once before readings began reads as final, the same way in History, the MCP and (#1697) the task writer. Before the API ships, nothing changes. - CI. The red server job on this head is
content-agent.test.js› "puts thousands of sources on one line … quickly", a timing test this PR doesn't touch. The same suite passes on the PRs above it. Re-run it. - Tests. The validate tests pass on the PR's tree and on the stack merged with main, and so do
history-drawer,history-table,displayandmcp/action-history.
Follow-ups (fine after merge):
- A later reading that reads nothing replaces one that did (
server/src/lib/action-center/validate.js:445). The action'soutcomeis the last reading's verdict. Suppose tracking stops between day 7 and day 30: the brand is paused, its plan ends, or there's a long outage. Then a day-7 "Improved" becomes a final "Not measurable", and it drops out of the scorecard (#1695) and past success (#1696). Keep the latest reading with a verdict asoutcome, and keep the unmeasurable one inreadingsonly. - No nightly ceiling any more (
validate.js:679). Before, the sweep read 500 actions a night. Now it pages until the list is empty, and each due reading costs about ten reads (plus the control in #1701). At today's volume that's fine. A cap on readings taken per night, the rest left for the next night, would keep a backlog from running long. The same goes for brands whose plan has ended: the sweep doesn't skip them, as the signal pass does (activeBrandFilter). That's database reads only, no paid calls. - A reopened action keeps its first round's readings (
validate.js:404). Reopen it and complete it again, and the day-7 reading of the new close is skipped as "taken". Its later readings sit next to the old close's day 7. Store thecompleted_atthe readings belong to, and start again when it changes.
8 of 13 tasks
gkhngyk
pushed a commit
that referenced
this pull request
Nov 6, 2026
…and choose_plan (#2214) The three coach-skill fixes #1808, #1694 and #1671 left for a docs PR, in the MCP skill and its standalone copy: - A brand needs a topic before any prompt: accept_prompt_suggestion is refused on a brand without one (#1808). The skill says so, and offers a topic suggestion first. - list_action_history reads an action 7, 14 and 30 days after it closed (#1694): reading_day and final are documented, and an outcome before day 30 is reported as a reading so far. The outcome list gains mixed. - get_prompt_usage marks an ended plan with plan.ended and the choose_plan cta (#1671): no slot is left until a plan is chosen. Claude-Session: https://claude.ai/code/session_01SvzkMf5TZg7yqwaSeMFba9 (cherry picked from commit 17b7ea8) Co-authored-by: Claude <[email protected]>
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
Learning B1: an action's effect is read a week, two weeks and a month after it closed. The day-30 reading is final.
Stacked on #1692 (learning phase A, A5), the top of #1687–#1692. This PR's own commits: 52fcbb6, 5447dd7, 6c46dda and a8e2ecf (plus a merge that brings phase A's review fixes in).
One reading a week after closing was too early for most work to show.
What changed in
validate.jsvalidateActiontakes the readings that are due and not yet taken, in order:READING_DAYS = [7, 14, 30].readingWindow), compared with the 7 days before the action was raised.measureReading, which is phase A's measure body, moved as it was.readings: [{ day, outcome, afterWindow, metrics }], andfinal: trueonce day 30 is read.outcome_measuredevents carry{ outcome, day, final }.Sweep
outcome.eq.pending_measurement,and(validation->readings.not.is.null,validation->>final.is.null), read in pages of 500 by id. It was run read-only against the dev database and PostgREST accepted it.Web
Review fixes
list_action_historyrow carriesfinalandreading_day. Its description says an outcome is "a reading so far" untilfinalis true.Follow-ups:
final,reading_day) in a separate docs PR.Where people see it: Action Center › History: the Result column's hint, the drawer's readings, and the action drawer's History tab ("Day 14 · Result: …").
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd server && npx vitest run src/lib/action-center/validate.test.jscd web && npx vitest run src/components/action-center/history-drawer.test.tsx src/components/action-center/history-table.test.tsx src/lib/mcp/action-history.test.tsRelated issue
Agentic learning report, phase B. No GitHub issue. Learning stays within one brand (product decision): nothing here reads another brand's data.
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Full checks at the top of this chain (B5 part 1, 2046085):
npm test(noSUPABASE_*env, as in CI): 3,375 tests passed. Two timing tests (content-people,page-content) ran over under load; they passed alone earlier in this batch.vitest(449 files, 4,374 tests) and build: all pass.A pre-push review of B1, B3 and B4 found nothing blocking. Its small fixes are in the chain.
🤖 Generated with Claude Code