mureo report persist

From logly/mureo · View interactive version

mureo report persist is an AI agent skill from the GitHub repository logly/mureo. mureo: daily-check persistence steps — report summary, per-window rollups, day-grain history, display contract.

How to use this skill

Skill file

mureo Report Persistence

PREREQUISITE: Read ../_mureo-shared/SKILL.md for auth, global flags, and security rules, and ../_mureo-state-schema/SKILL.md for the STATE.json schema.

Tool names below refer to the built-in platforms; a namespaced variant (see _mureo-shared → Namespaced built-in variants) is used with its prefix substituted.

This file holds the persistence steps of ../daily-check/SKILL.md — its steps 12–15, which write what the run already decided to STATE.json and the dashboard — kept here, so their numbers and every "step N" below refer to daily-check's steps and "this skill" means daily-check. Each is best-effort: a host without the tool it names skips that step, and the rest of the run still works.

Report summary

  1. Persist the report summary (best-effort): Call mureo_state_report_set with report="daily" and a concise summary object so the read-only dashboard can render this report without re-running you. Persist in incremental mode too — step 10's diff-first report is computed against this stored summary, so skipping it blinds tomorrow's run. Follow this convention:

Reflect the FINAL state, and persist this LAST. Write this summary

AFTER every STATE change and action_log entry you made this run (it is

the last persistence step — keep it after any Operation Mode switch,

campaign pause, budget edit, etc.). If you changed something, the

narrative + flags must describe the POST-change state (e.g.

"switched to EFFICIENCY_STABILIZE", not "recommend switching"; flag

{code:"custom", severity:"info", label:"Switched to EFFICIENCY_STABILIZE"}, not a now-resolved recommendation). Stamp

generated_at at the moment you write this — so the dashboard's

"Latest report" is never an older snapshot that contradicts the action

log or STRATEGY.md. (If you only recommended a change and did NOT make

it, the recommendation wording is correct — and there is then no matching

action_log entry, so nothing contradicts it.)

This is best-effort: if mureo_state_report_set is unavailable (e.g. a pure file-mode host without the context MCP), skip it silently — the rest of this skill still works.

Per-window per-platform rollups

  1. Persist per-window per-platform rollups (best-effort): so the reporting dashboard's KPI tiles AND its Yesterday / Last 30 days period toggle have data, write each platform's totals to platforms[<platform>].periods[<window>] using the canonical metric vocabulary (spend, impressions, clicks, conversions, cpa, ctr, the Meta result_indicator when present). Write every window whose numbers you already gathered this run — typically YESTERDAY (the prior-day totals) and LAST_30_DAYS (the trailing-30-day totals your step-4 health checks / step-8 goal progress already pulled). The period toggle only appears once two windows have data, so populating LAST_30_DAYS here — from numbers you already hold — is what makes the toggle show even when a separate sync-state run has not happened. On Code use Write; on Desktop / Cowork call mureo_state_platform_metrics_set (pass platform, account_id, and periods={"YESTERDAY": {…}, "LAST_30_DAYS": {…}} — include only the windows you actually have) — it merges per window key, so this never disturbs a window a prior sync-state wrote. Give every window you write a period_end — the last calendar date those figures cover, YYYY-MM-DD, in the ad account's own timezone (so a YESTERDAY window pulled for an account on JST names the JST yesterday, whatever the clock on this machine says). You are the only one who can: the server stamps fetched_at because it knows when the write happened, but it does not know the account's timezone and will not guess a date that could be off by one. Each window states its own — the windows end on different days and one date copied across them mislabels the rest. Without it the card is judged on when it was last written, which is how a run that wrote nothing leaves "Updated 14 hours ago" over figures from two days earlier. Honest scope / cost: only write a window whose numbers you actually pulled; do not fire an extra API call solely to populate a window, and write nothing at all for a platform recorded auth_error or tools_absent_for_<platform> this run — it has no numbers, and an empty tile is honest where an extrapolated one is not. In incremental mode you may only hold the window your analytics run covered — write just that one, and never mislabel a wider window as YESTERDAY. Best-effort: if mureo_state_platform_metrics_set is unavailable, skip silently. But a window you did not write is never silent in the run output. This step is conditional by design, and a run that persisted the report (step 12) and the display (step 15) and said so reads as a complete run whether or not the cards moved. So name what you persisted and what you did not, per platform, the way step 3 names a platform it skipped and step 4 names analytics_not_available_for_<platform>: report windows_not_persisted_for_<platform> with the windows and the reason (no figures gathered for that window this run, analytics run covered a wider window, auth_error, tools_absent_for_<platform>, mureo_state_platform_metrics_set unavailable). A platform whose windows all landed says so in one line and needs nothing more. For a platform you could NOT collect, record why — call mureo_state_platform_not_collected_set (platform, account_id, reason: the auth_error / tools_absent_for_<platform> finding in one actionable sentence). If what failed was resolving the account itself — no accessible ad account, no customer id configured — pass account_id as "": that is how mureo spells unknown, it is the one write tool that accepts it, and an unknown id never overwrites an id the entry already holds. Never invent a placeholder such as "unknown" or "none" — the same placeholder on two failed platforms reads as one ad account held under two keys, and the dashboard then withholds the client total rather than showing an inflated one. Writing no numbers is right, but silence alone leaves the card indistinguishable from an account that genuinely spent nothing, which is how a stale card goes unnoticed for days. Symmetrically, for every platform you DID collect, clear any note by calling the same tool with reason omitted — nothing else retires it, and a note that outlives its failure is worse than none.

Day-grain history

  1. Persist the day-grain history (best-effort, zero extra platform API calls): step 4's delivery-collapse check already pulled a day-grain delivery report for the platforms it checked that way, and those rows are discarded the moment the check returns — so platforms[<platform>].periods can say what yesterday was and nothing can say whether it beat the day before. Fold the rows you already hold into platforms[<platform>].daily, a map keyed by calendar date (YYYY-MM-DD) whose values are totals-shaped rollups in the same canonical metric vocabulary (spend, impressions, clicks, conversions, cpa, ctr): sum that platform's per-campaign rows per date, one bucket per day. On Desktop / Cowork call mureo_state_platform_daily_set (pass platform, account_id, and days={"2026-08-20": {…}, "2026-08-19": {…}}); on Code use Write. It merges per date key, so a day already stored survives this write and re-writing a day just replaces that day. Never fire a platform call to fill this in — this step writes what step 4 fetched and nothing else; a platform whose collapse check ran server-side (mureo_analytics_run) returns findings, not rows, so you hold no daily rows for it and write none. Write only complete PAST days — today is still being spent into, and a part-spent day stored as a whole one is a false low that nothing ever corrects; the tool refuses today and any later date. Omit a day you have no figures for — never write zeros for it: a zero-filled day is indistinguishable from an account that stopped spending, and both the trend line and the collapse detector's baseline read it as one. Nothing needs backfilling: the history accumulates one run at a time, and mureo keeps the most recent 35 days in STATE.json and archives the days past that under history/daily/<YYYY-MM>.json rather than dropping them. Best-effort: if mureo_state_platform_daily_set is unavailable, skip silently.

Display contract

  1. Persist the display contract (best-effort): Call mureo_state_display_set with what the DASHBOARD shows. This is a different audience from the summary above — STATE.json is written for the next agent, and this small bounded section is the only thing the operator's screen reads. Write it in the SAME pass as the report, from the SAME figures, and reach no new verdict here: every value below is one you already decided, and this step only renders it.

A verdict hedged in the report stays hedged here. This step renders the verdicts you already reached — including the reservations attached to them. If the narrative says you cannot tell, nav_message and highlights may not say you can: a finding must not read as certain merely because it moved to a shorter field. A chip holds 60 characters and the nav line 80, so there is no room for the reservation, and dropping it is exactly what turns "we cannot attribute this" into "this is today's top risk". The finding loses the slot, not the reservation — give the line to something you can state plainly, and leave the hedged finding in the report, where it is stated in full. Nothing is lost: narrative and flags are both on the drill-down.

The bounds, verbatim from the tool: The dashboard reads THIS section and nothing else — keep your reasoning where it already goes. Every bound below refuses the write rather than truncating it, because a sentence cut in half is worse than a long one. nav_message: one line, at most 80 characters. highlights: at most 3 items of {tone, text}, tone one of good/watch/bad, text at most 60 characters. proposals: {title, body, status, date}, title at most 30 and body at most 80 characters, status one of proposed/done. breakdown.campaigns / breakdown.adgroups: rows of {name, spend, mcpa, target_cpa, state, note} — the three figures are raw numbers, state is one of target_met/improving/watch/worsening/no_data, note at most 40 characters. stated_values: {label, value}, label at most 24 characters and value a raw number or a string of at most 12 characters — a sentence there is refused, because it lands in a numeric column. Do NOT write the KPI funnel or the daily chart: mureo computes both from the stored totals.

Over a bound the write is REFUSED — shorten and rewrite, do not re-send the same sentence trimmed. Lead with the point and drop the connectives; a noun phrase is fine (CPA 12% over target, not The CPA is currently running about 12% above the target we agreed). Trimming one character at a time and calling again spends the run's context on a bound one rewrite would have met.

One writer per run — and you may not be the first today. Within your own run the contract has ONE writer: mureo_state_display_set REPLACES the whole section rather than merging into it, so compose every section you want on screen before calling, and never call twice. Across runs on the same day that same replacement is what the rule below is about — the morning's screen is what you are overwriting.

You may not be the first writer today. `display is REPLACED WHOLE and the last writer wins — there is no merge. Before you write it, read the current one (mureo_state_get). Of what another skill wrote TODAY, carry exactly one thing into your own write: its proposals that are still live — not yet done, and not contradicted by what you just found. Everything else you write from your own run alone, because a screen assembled from two runs shows a moment that never happened. And carry over NOTHING ELSE: never copy another skill's nav_message, highlights, breakdown or stated_values, which would put its judgement under your name when you cannot vouch for it. Name yourself in source` so the screen says whose answer it is.

This is best-effort: if mureo_state_display_set is unavailable (e.g. a pure file-mode host without the context MCP), skip it silently — the rest of this skill still works.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.