[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71DVXERR7M06X683PBS79GJ":3,"skill-same:01M71DVXERR7M06X683PBS79GJ":135},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":22,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":6,"ownerHtmlUrl":49,"ownerBlogUrl":50,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M71DVXERR7M06X683PBS79GJ","daily-brief",null,"Build the user's Daily Brief across personal work and every permitted company. Reads the last brief and the user's brief preferences, sweeps sessions, PRs, CI and DMs (plus synced signals, meeting signals and fleet when a company is bound), writes brief-data.json and brief.json with a launch prompt for every action, and reports status so the desktop app can notify the user. The person's first ready brief adds a welcome edition. Run by the main local bot when the user presses Create brief, or on a schedule.","indigoai-us\u002Fhq-core","indigoai-us","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F122242446?v=4","01M71DTQ5NGD10GT1Z7E6XKWC5","HQ","01M71DTQ6BKSYYBNC9RAKT3YDK",95,"MIT","https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"brief","daily","daily brief","main","when","synced","company","app","local","across","notify","desktop app","bot","reports","ready","work","schedule","Bash","ci","create","2026-11-10 10:12:30",false,"---\nname: daily-brief\ndescription: Build the user's Daily Brief across personal work and every permitted company. Reads the last brief and the user's brief preferences, sweeps sessions, PRs, CI and DMs (plus synced signals, meeting signals and fleet when a company is bound), writes brief-data.json and brief.json with a launch prompt for every action, and reports status so the desktop app can notify the user. The person's first ready brief adds a welcome edition. Run by the main local bot when the user presses Create brief, or on a schedule.\nallowed-tools: Read, Write, Edit, Grep, Glob, Bash\n---\n\n# \u002Fdaily-brief\n\nBuilds one person's Daily Brief across personal work and every permitted company by default. The HQ desktop app starts this through the main local bot when the user presses **Create brief**. A person can also run it directly with `\u002Fdaily-brief [--all|company|--personal] [--welcome] [--today YYYY-MM-DD]`.\n\nAn explicit personal brief (`--personal`) reads only what belongs to the person on this machine and in GitHub: work sessions, PRs, main-branch CI and personal DM messages (messages with no company). The company-only sources (meetings, synced signals, meeting signals, fleet agents and integrations) are skipped and recorded as skipped, and housekeeping skips the doctor and sync checks. A new user with no company gets a useful first brief this way.\n\nThe output is a set of files the desktop app reads. This skill never posts, sends, merges or deploys anything.\n\n## Inputs\n\n| Input | Default |\n|---|---|\n| `--all` | Default: personal work plus every membership permitted by the session lock |\n| `company` | Explicit first argument selects only that company |\n| `--personal` | Build a brief with no company, even when the session has one bound |\n| `--welcome` | Add the welcome edition (Welcome edition, below). On by default for the person’s first ready run in any mode |\n| `today` | Today's local date |\n| `run_id` | `--run-id \u003Cid>`, passed by the app. If missing, generate one as `brief-\u003CYYYYMMDD-HHMMSS>` in local time |\n\nBriefs are manually triggered, so several can exist per day. Each run gets its own folder, `workspace\u002Fbrief\u002F\u003Crun_id>\u002F`. The `run_id` is `brief-\u003CYYYYMMDD-HHMMSS>` in local time.\n\n| File | Written when | What it is |\n|---|---|---|\n| `status.json` | At every step | Progress the app polls |\n| `brief-data.json` | Step 3 | Raw normalized sweep output |\n| `brief.json` | Step 4 | Synthesized items with prompts, read by the generator, plus the optional `page` the card design draws (Step 4b) |\n| `page-draft.json` | Step 4b | The page frame and card candidates from `brief_page.py skeleton`; a working file, not read by the app |\n| `housekeeping.json` | Step 5 | Cleanup results and proposed cleanup actions |\n\nWhen a run finishes, ready or failed, append one line to `workspace\u002Fbrief\u002Findex.jsonl`. The desktop app's history navigator reads this file:\n\n```json\n{\"run_id\":\"…\",\"created_at\":\"…\",\"finished_at\":\"…\",\"duration_s\":0,\"window\":{\"from\":\"…\",\"to\":\"…\"},\"state\":\"ready|failed\",\"mode\":\"company|personal\",\"company\":\"acme|null\",\"catch_up\":false,\"lead\":\"…\",\"counts\":{\"decisions\":0,\"shipped\":0,\"incidents\":0,\"carry\":0,\"recovered\":0},\"landed\":false,\"headline\":\"one plain line\"}\n```\n\n`counts.shipped` is `brief-data.json.prs_summary.merged`, the same number the loader and the brief show. `counts.carry` and `counts.recovered` are the lengths of `items.carry` and `items.recovered`; `landed` is true when the run saw at least one merged PR or a release. `brief_rank.py --check` prints `index_counts` and `landed` ready to copy.\n\n`status.json` shape:\n\n```json\n{\"run_id\":\"…\",\"state\":\"running|ready|failed\",\"step\":\"…\",\"progress\":0.0,\"started_at\":\"…\",\"updated_at\":\"…\",\"error\":null,\"sources\":{}}\n```\n\nWrite `status.json` before each step, and again after every source, so the app's progress bar stays truthful and keeps moving. Also keep a rolling `activity` list in `status.json`, newest last, capped at 12 entries. The app shows it under the sunrise so the user can see the run is alive:\n\n```json\n\"activity\":[{\"at\":\"…\",\"label\":\"Read 42 of 50 sessions\",\"state\":\"done\",\"detail\":\"only counted: 6 agent runs, 2 outside this brief\"},{\"at\":\"…\",\"label\":\"Checking GitHub PRs\",\"state\":\"running\"}]\n```\n\nAs each source lands, also update `findings` and `samples` in `status.json`. The app animates these as live counters and preview cards:\n\n```json\n\"findings\":{\"signals\":{\"decision\":0,\"action_item\":0,\"risk\":0,\"commitment\":0,\"key_point\":0},\"sessions\":0,\"meetings\":0,\"dms\":{\"total\":0,\"need_you\":0},\"prs\":{\"merged\":0,\"opened\":0,\"open\":0,\"review_requested\":0},\"ci_red\":0,\"agents\":{\"total\":0,\"attention\":0},\"integrations\":{}},\n\"samples\":[{\"kind\":\"decision\",\"title\":\"Approve release-gate fix\",\"company\":\"acme\",\"at\":\"…\"}]\n```\n\n`samples` holds at most 8 items, all from the active company only (`company` is null on a personal brief). Titles are short and plain. Never include DM body text: use the sender name and a summary instead.\n\n`state` is `running`, `done`, `skipped` or `failed`. Labels are plain, user-facing language with real counts (\"Found 31 DMs, 4 need you\"), never commands or file paths. For other-company items, give counts only. Spread progress evenly across the sweep (0.25 → 0.7) by source. Read every timestamp from the clock in the same command that writes it.\n\n## Step 1. Start\n\nWrite `status.json` with `state: running`, `step: \"Checking your setup\"` and `progress: 0.05`.\n\nCheck the session's company (`bash core\u002Fscripts\u002Fhq-session.sh current`). Never sweep a company the session is not locked to. The sweep reads the lock with `bash core\u002Fscripts\u002Fhq-session.sh get company_slugs` and refuses `--company` when that slug is outside the locked set.\n\n- Default to a person brief (`--all`), including personal work and a section for each permitted company. `--company \u003Cslug>` and `--personal` remain explicit narrow modes.\n- Membership inventory comes from the read-only `hq sync mode --show` table (the caller's memberships), intersected with `hq-session.sh get company_slugs`. Never widen the lock. Show every excluded membership as \"not included: open HQ in that company to include it\". Inventory\u002Flock failures are visible source failures, never an invented empty membership list.\n\n## Step 2. Load what we know about this person\n\n- Read `personal\u002Fbrief\u002Fbrief-prefs.yaml`. If it is missing, create it from the defaults below. Besides `density`, `engine` and the VIP and mute lists, read the widget preferences the app's picker uses: `widget_weights` (kind → -2..2), `pinned_widgets` and `muted_widgets`. Step 4 copies them into `prefs_applied.widgets`.\n- Find the last brief: the newest `ready` entry in `workspace\u002Fbrief\u002Findex.jsonl` with `mode: person` for an all-company brief; for explicit narrow modes use the same company and mode. Skip lines that name another company. A line with no `company` field is an older run: use it only when its `brief.json` or `brief-data.json` has the same `company`. Read that run's `brief.json` too: its `items` are the carry-over candidates, and its `carry` rows give `carried_since` and `briefs` for chaining (Step 4, carry).\n  - **Deliberate reset.** If `workspace\u002Fbrief\u002F` is missing or holds no earlier run (no other run folder and no `ready` line in `index.jsonl`) and a sibling `workspace\u002Fbrief-backup-*` folder exists, the owner reset brief history on purpose. It is not an incident, problem or decision, and never part of the lead. Treat the run as a first brief with no carry-over, label the activity \"Starting fresh brief history\", and leave the one-line note to housekeeping (Step 5). `brief-data.json.brief_history.reset_on_purpose` records the same check. A missing folder with no backup next to it is also only a housekeeping note, never the lead.\n  - **Window:** always the last 24 hours. The brief is a picture of the user's day, not a diff since the last run; a second run an hour later shows the same day again with the new items added. Only a catch-up brief widens the window: to the gap since the last brief, capped at 14 days.\n  - **Catch-up:** if the gap since the last brief is 3 days or more, set `catch_up: true`.\n  - Carry-over still uses the last brief: an item that was in it and is still open is marked `carry`, never dropped as \"nothing new\".\n- Read the last brief's items. Anything still open becomes a carry-over candidate. Note what was launched or dismissed, from `personal\u002Fbrief\u002Fbrief-log.jsonl`.\n\nWrite status `step: \"Reading your last brief\"`, `progress: 0.15`.\n\n## Step 3. Sweep\n\nRun the sweep script. It records each source's success or failure, and never fills a gap with an invented value.\n\n`--hours 24` is the brief's window: sessions, PRs and meetings from the last 24 hours. `--days 7` is only the per-day rollup (`days`) the week arc copies; it never widens the brief. For a catch-up brief (the user has been away 3 or more days) add `--catch-up` and set `--days` to the number of days since the last brief (at most 14), which keeps the meetings from that gap.\n\n```bash\npython3 -I .claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief-sweep.py \\\n  --all --days 7 --hours 24 --today \u003Ctoday> \\\n  --hq-root \"$PWD\" --out workspace\u002Fbrief\u002F\u003Crun_id>\u002Fbrief-data.json \\\n  --status workspace\u002Fbrief\u002F\u003Crun_id>\u002Fstatus.json\n```\n\nFor a narrow brief, replace `--all` with `--company \u003Cslug>` or `--personal`. Add `--welcome` to force the welcome edition.\n\nOn a company brief, PR search is limited to the company's GitHub owner: `--org \u003Cowner>`, or else the company's `github_org` in `companies\u002Fmanifest.yaml`. With neither, and on a personal brief, it covers every owner the user's `gh` login can see (one search, shared by every section of a person brief). Each PR row is then tagged with its company from the manifest (`scripts\u002Fbrief_company.py`), reading git remotes only for the repos of companies in the session lock: a locked company's `repos:` entries and their `origin` remotes map an owner-qualified repo to that company. A whole GitHub owner maps to a company only when it is an organization (checked with `gh api`; never a personal account and never the person's own login) whose known repos all belong to that company, or when it is the company's explicit `github_org`. Otherwise a PR matches on its full owner\u002Fname only, and an unmatched PR is the person's own. A repo listed under two companies belongs to neither section, and a PR in a repo whose folder name the manifest lists under a company outside the lock is kept out of the personal section. A company section keeps only its own rows; the personal section keeps only rows mapped to no company. Everything else is dropped and only counted in `prs_other`. The worktree scan treats worktrees the same way: they count in `detail.other` and their paths are never listed. Main-branch CI checks the repos of the user's own PRs in the window (most PRs first, at most 8); `--repos a,b` names them instead, as bare names (owner from `--org` or the PR rows) or owner-qualified names.\n\nThe script covers these sources:\n\n| Source | Read through |\n|---|---|\n| Work sessions | Sessions come from `workspace\u002Fsessions` meta files plus the Claude and Codex transcripts (title, and kind you, agent or lane), for the last 24 hours (`--hours`). Other-company sessions are a count only. |\n| Recorded meetings (company only) | `hq meetings list`. The list row supplies the title, start and participants |\n| Synced signals (company only) | The company vault's signal index, `signals\u002F_index\u002F{UTC day}.json`, for the last 24 hours (`--hours`). No integration or meeting service is called. Index rows in both shapes are read: `{key, written_at}` from the hot-channel pass and `{path, audience_key}` from `hq signals run`, which keeps the time in the signal file's `created_at`. Read: the company folders (`signals\u002F{type}\u002F`), the person's own folders (`signals\u002F@{key}\u002F{type}\u002F`, keys from the HQ login via `hq whoami --json`: key(email), also used for the sync ledger and cursors, and key(personUid); when `hq whoami` reports no personUid, it comes from `hq members --company \u003Cslug> list --json` by email; `--email` or `git config user.email` only when `hq whoami` is unavailable; the result records `identity_source`), and group folders whose `_audience.yaml` principals include the person's uid or email (email compared case-insensitively). A folder whose audience does not include the person is never read. Each line carries the `company` it was read from. A day with no index file falls back to the type folders, including the older `signals\u002Fslack-dm\u002F{type}\u002F`. Code: `scripts\u002Fbrief_signals.py` |\n| Meeting signals (company only) | Built from the synced signals whose `source_ref` is a meeting pointer (`sources\u002Fmeeting-events\u002F…`), grouped by the pointer's transcript id. Per meeting, up to 5 decisions and 5 action items carry `text` (the signal's summary line, never transcript text), `owner`, `mine` (the owner is the user, matched against `--me` or `git config user.name`), `source_ref` and `cite` |\n| DM inbox | `hq dm inbox`, then only this company's messages. A personal brief keeps messages with no company. Another company's messages are dropped and never written. Agent senders, with `agt_` IDs, are labeled. A message's company is its slug field (`company`, `companySlug` or `company_slug` on the message or its channel); an explicit field always wins. In person mode, a message with no such field is attributed by its sender: a sender who is an active member of exactly one included company (`hq members --company \u003Cslug> list --json`, read for the included companies only) belongs to that company, and the row records `company_basis: \"sender\"` (`\"tag\"` for an explicit field). A sender in two included companies, or in none, stays personal. If any included roster cannot be read, sender attribution is off for the run and `sources.dm_attribution` says so. On a company brief with attribution off, if the inbox page has messages and none carry a company slug field, the source is skipped with `skipped_reason: \"inbox has no company tag\"`. `companyUid` is an id, not that field. An empty inbox is a real empty result, not a skip. |\n| Fleet agents (company only) | `hq agents list` |\n| The user's PRs | `gh search prs --author @me` (with `author`), plus open PRs where the user is a requested reviewer (`--review-requested @me`, marked `review_requested: true` and `reviewRequests: [\"@me\"]`). Each row has `product`, `repo`, `repo_full` (the owner-qualified name), `authored_by_me` and `is_release`. Read-only |\n| Main-branch CI health | `gh run list` |\n\nEvery source has an entry in `brief-data.json.sources` with `state`: `ok` (it ran), `failed` (it ran and broke; `note` and `error` hold one plain line such as \"Couldn't read DMs.\"; the exception text goes to stderr only) or `skipped` (left out on purpose; `skipped_reason` says why). On a personal brief the company-only sources use `needs a company`. On a company brief, DMs use `inbox has no company tag` when the inbox page cannot be filtered by company. `ok` is true only for `state: ok`. A skipped source's top-level key is null. The top-level `mode` is `person`, `company` or `personal`. In person mode, `personal` holds personal sources and `companies.\u003Cslug>` holds each company sweep; `company` is null at the root. Each section has its own sources, window, derived summaries and deltas. Person history compares only previous `mode: person` runs, matching company sections by slug.\n\nA skipped source is not a failure and not an empty result. The sweep writes its activity entry with `state: skipped`, a plain label (`Skipped DMs` for the inbox) and `detail` set to `skipped_reason`. It does not write `findings.dms` as `{total: 0}`, and it does not say there were no messages. The brief copies that: when `sources.dms.state` is `skipped`, write no DM decisions, waits or people from the inbox, and do not say the inbox was empty. One clause is enough: \"DMs were skipped; the inbox has no company tag.\"\n\nThe script also writes `window.today`, `window.hours`, `window.prs_from`\u002F`prs_to`, `window.attended_meetings_from` (= `sessions_from`, or the first catch-up day), and a top-level `prs_summary: {merged, opened, open, review_requested, median_merge_hours, by_product}` for the 24-hour window, counting only the user's own PRs. The loader's PR line uses the same function, so the app and the brief show the same numbers.\n\nDerived data the sweep adds for the app's widgets (all computed, never estimated; every helper has a unit test in `scripts\u002Ftest_brief_additions.py`):\n\n| Block | What it carries |\n|---|---|\n| `sessions[]` | `project` (repo from the cwd), `product` (its human name), `cwd`, `last_activity`, `has_handoff` (a handoff thread record exists). Other-company rows keep only times and counts. On a personal brief the person's own rows, the ones bound to no company, carry `company: \"personal\"`; rows bound to any company count as `other` |\n| `prs[]` | `closed` is null on open rows, `isDraft`, `merge_hours` on merged rows, `reviewDecision` and `reviewers` on open rows (a bounded `gh pr view`, null when it did not run) |\n| `prs_summary.by_product[]` | `{product, merged, opened, open, median_merge_hours}` for the window |\n| `releases[]` | `{product, repo, version, merged_at, url, pending_count, pending_by_day: [{day, count, theme}]}`: the latest merged Release PR per repo and the merges that landed after it |\n| `main_health[repo].red[]` | `{workflow, since, merges_on_top}`; `since` is the first red run found (carried back to the previous run's value when it was already red). `delta: {newly_red, still_red, recovered}` against the previous ready run, null when there is none |\n| `fleet` | `stuck: [{name, status, phase, since}]` (setup failed or waiting, or a status that is not resting; dormant is not stuck), `delta: {newly_stuck, still_stuck, recovered}` by name, `series: [{generated_at, stuck}]` one bucket per prior ready run. `sources.fleet.count` is the agent count |\n| `meetings[]` | only meetings whose start is inside the window, deduped by title and start (`duplicate_ids` keeps the folded ids), with `participants` (names when the list row has them), `end` and `duration_min` (null when the list row has none), `attended` (the user's own recorder took it, or the user is in the participants, the title or owns one of its synced signals) and `whose` (`mine` when attended, else `team`). The `days` rollup counts the same way: `days[d].meetings` is the user's own meetings that day and `days[d].team_meetings` the teammates' ones, never added together |\n| `meeting_signals[]` | `{meeting, title, meeting_id, start, counts, decisions[], action_items[]}`; each item is `{text, owner, mine, source_ref, cite}` |\n| `synced_signals` | `lines[]` (`{signal_id, type, text, owner, source_ref, cite, written_at, key, company}`, plus `meeting: {title, transcript_id}` for meeting refs; a row with no `source_ref` is dropped and counted in `dropped_uncited`), `lag` (null when today's index exists, else `{newest_index_date, days_behind, last_run, line}` with the last sync run from `sources\u002F_runs\u002F@{key}\u002F`), `freshness[]` (`{adapter, connection, last_synced, source}` per sync cursor: `source` is `cursor` when the cursor has `updatedAt`, `mtime` when the file time was used), `legacy_days`, `keys` (own keys), `group_keys` (group folders read), and `meetings_without_signals` (`{count, line}` when meetings fall in the window but no meeting signals were synced, else null) |\n| `timings` | wall seconds per source, for finding a slow sweep. Independent sources (sessions, meetings, synced signals, DMs, fleet, PRs) run at the same time, so their seconds overlap and add up to more than the run |\n| `dms[]` | `need_you` (looks like an ask: \"?\", \"can you\", \"please\", \"need you\", \"waiting on\"; the writer confirms each one by reading the preview), `direction` and `thread_id` (null until the inbox exposes them). `sources.dms` records `truncated` and a `note` when the 40-message page did not reach back to the window start. When the source is skipped, `dms` is null and there is no truncation note |\n| `previous_run` | `{run_id, generated_at}` of the previous ready run, found through `index.jsonl`; null for a first brief |\n| `welcome` | The welcome edition (below), or null |\n\nOn a company brief, read connected apps through `brief-data.json.synced_signals` only. The sync service has already turned Slack, Gmail, meetings and the other connected apps into signals, so the brief makes no live integration calls. Record `sources.integrations` as `{ok: false, state: \"skipped\", skipped_reason: \"read from synced signals\"}`. Use the synced data this way:\n- Every line the brief writes from a signal keeps its `source_ref`, and shows its short `cite` so the user can find the source.\n- When `synced_signals.lag` is set, write its `line` once near the top, as given (\"Signals are behind: newest index is 2026-10-25 (last sync run 2026-10-25, gmail, error).\"). Do not fill the gap by calling the apps.\n- Show `synced_signals.freshness` as one \"last synced\" marker per app.\n- When `synced_signals.meetings_without_signals` is set, write its `line` once in the meetings part (\"Signals not yet generated for 2 meetings.\"). Never show those meetings as having no decisions.\n\nWrite status `step: \"Sweeping your day\"`, from `progress: 0.25` up to `0.7`. Include the per-source `sources` map so far.\n\n### Welcome edition\n\n`brief-data.json.welcome` is set when `--welcome` is passed, or on the person’s first ready run in any mode (no earlier ready run in `index.jsonl`). Otherwise it is null. It is built from local data only:\n\n```json\n\"welcome\":{\"first_run\":true,\"headline\":\"HQ found 2,263 past sessions across 41 projects on this Mac, most of them in Claude Code.\",\n \"import\":{\"path\":null,\"scanned_at\":null,\"source\":\"detected\",\"written_at\":null,\"plans\":null,\"…\":null,\n           \"sessions\":{\"total\":2262,\"claude\":2037,\"codex\":225,\"cursor\":0,\"days_seen\":96,\"first_at\":\"2026-07-14\",\"last_at\":\"2026-10-17\"},\n           \"tools\":[\"claude-code\",\"codex\"],\"projects\":41},\n \"sessions\":{\"total\":2263,\"local\":2263,\"imported\":2262,\"claude\":2038,\"codex\":225,\"days_seen\":96},\n \"harness\":{\"primary\":\"claude-code\",\"counts\":{\"claude_code\":2038,\"codex\":225,\"cursor\":3},\n            \"action\":{\"id\":\"open-hq-in-harness\",\"kind\":\"open_harness\",\"harness\":\"claude-code\",\"label\":\"Open HQ in Claude Code\",\"launch_prompt\":\"…\"}},\n \"top_projects\":[{\"name\":\"web-app\",\"path\":\"~\u002Fcode\u002Fweb-app\",\"sessions\":310,\"last_active_at\":\"2026-10-17T21:02:11Z\",\"harness\":\"claude-code\"}],\n \"top_repos\":[{\"name\":\"web-app\",\"path\":\"~\u002Fcode\u002Fweb-app\",\"sessions\":310,\"last_commit_at\":\"2026-10-17T20:55:03-07:00\"}],\n \"recent_work\":[{\"title\":\"Fix the signup redirect\",\"project\":\"web-app\",\"at\":\"2026-10-17T21:02:11Z\",\"harness\":\"claude-code\"}],\n \"repos\":[{\"name\":\"web-app\",\"sessions\":9}],\"apps\":[\"Claude Code\",\"Codex\",\"Cursor\"],\n \"tree\":{\"companies\":2,\"projects\":14,\"knowledge_files\":380},\n \"actions\":[{\"id\":\"connect-company\",\"kind\":\"connect_company\",\"label\":\"Create or join a company\",\"reason\":\"…\",\"launch_prompt\":\"\u002Fonboard\",\"primary\":true}],\n \"next_steps\":[{\"id\":\"connect-company\",\"kind\":\"connect_company\",\"reason\":\"…\"}]}\n```\n\nField names live in one constant block in `brief-sweep.py` (`WELCOME_FIELDS`, `WELCOME_SESSION_FIELDS`, `WELCOME_PROJECT_FIELDS`, `WELCOME_REPO_FIELDS`, `WELCOME_RECENT_FIELDS`, `WELCOME_TREE_FIELDS`, `WELCOME_ACTION_FIELDS`, `WELCOME_ACTION_KINDS`). The desktop app hides any absent field. `first_run`, `import`, `sessions`, `repos`, `apps` and `next_steps` keep their earlier meaning.\n\n- `headline`: one plain sentence about the person's own past work. Its project count leaves out folders with a session in another company. With zero sessions it is the first-steps line instead.\n- `import` (fields in `IMPORT_FIELDS`): `{path, scanned_at, source, written_at, \u003Ccounts>, sessions, tools, projects}`. With a report it comes from the newest `workspace\u002Fimports\u002F\u003Cstamp>\u002Freport.json` (see \"Import report contract\" below): `scanned_at` is the folder's UTC time (`2026-10-19T15:00:28Z`; the report's `scan_id` is never copied), `source` is the report's `source` (`desktop-tree-step`, else `import-context`), the per-category counts are `plans`, `commands`, `skills`, `hooks`, `policies`, `agents`, `claude_md`, `settings_fragments`, `mcp_servers`, `knowledge_dirs`, `claude_repos` and `conversations` (session stores, not sessions), `sessions` is `{total, claude, codex, cursor, days_seen, first_at, last_at}`, `tools` lists the harness ids found, and `projects` is how many project names the report lists (the names are never copied, because the report covers every company). Counts are non-negative integers; a negative, boolean, decimal or text value reads as 0 (null inside `sessions`). Without a report, when any session other than the one running the brief is on this Mac, `source` is `detected`, `path`, `scanned_at`, `written_at` and the counts are null, and `sessions`, `tools` and `projects` come from the machine inventory (`total`, `claude` and `codex` leave out the running session; `first_at` and `last_at` are dates; `projects` leaves out folders with a session in another company). Past sessions are the inventory's transcripts, so an HQ-started session and its transcript count once. The session running the brief is read from `CLAUDE_CODE_SESSION_ID`, `CLAUDE_SESSION_ID`, `CODEX_THREAD_ID` or `CODEX_SESSION_ID`. When none of those ids is in the inventory, a transcript written to in the last 10 minutes is treated as the running session and left out. Null only when there is no report and no other session.\n- `sessions`: `local` counts every session on this Mac, one per session id: HQ-started sessions, every Claude Code transcript (under `~\u002F.claude\u002Fprojects` and the `CLAUDE_CONFIG_DIR` projects folder), every Codex rollout (`CODEX_HOME`, else `~\u002F.codex`) and every Cursor workspace with chat state (one each). `imported` is `import.sessions.total` (0 when the report has no session total). `total` is the larger of the two. `claude`, `codex`, `cursor` and `days_seen` are counted across all of them.\n- `harness`: `primary` is the harness with the most sessions (null with none); `counts` covers `claude_code`, `codex` and `cursor` (Cursor counts workspaces with chat state). `action` opens HQ in that harness. Harness ids are hyphenated (`claude-code`, `codex`, `cursor`) in `harness.primary`, `harness.action.harness`, `top_projects[].harness` and `recent_work[].harness`. The underscore keys appear only inside `harness.counts`.\n- `top_projects` (up to 5): working folders ranked by sessions, then newest activity. `top_repos` (up to 5): the git repos those folders sit in, with the newest commit time. `recent_work` (up to 5, newest first): session titles, at most 80 characters, with their project and harness. A title is the Claude Code custom title or summary, or the Codex thread name; the first prompt line is the last resort. The filter is safe by default: a title is never shown when it names a credential (password, passwd, passphrase, passcode, pwd, secret, token, api key, bearer, private key, access key, auth, credential, creds, key, pass, pin, otp, 2fa, mfa, pw, cred, and passwort, contraseña or mot de passe), sets a name that holds pass, key, pwd, pw, cred, secret, token, auth or pin (such as DBPASS=), holds a known API key prefix, a private-key header or a URL with a password, or holds a hex run of 24+ characters, a run of 16+ letters and digits mixed, or a base64\u002Fbase62 run of 20+ that has a digit or capital letter. Full-width letters and accents are folded first. That session reads \"Session in \u003Cproject>\". Session-row titles from the registry, lane and thread fields go through the same filter; a secret-looking thread title leaves the registry title in place. `top_projects[].path` starts with `~\u002F` inside the home folder and is the folder name only outside it.\n- `tree`: companies in this HQ, plus projects and knowledge files of the brief's own scope.\n- `actions`: each is `{id, kind, label, reason, launch_prompt, primary}`. `kind` is one of `open_harness`, `connect_ai_apps`, `connect_integration`, `connect_company`, `import_history`, `open_tree`. `import_history` (\"Bring in your past work\") appears only when `import` is null: no report and no session other than the current one. `open_harness` adds `harness`; `connect_integration` adds `integration: {slug, name}`; `connect_ai_apps` has no `integration`. Exactly one action has `primary: true`: `connect_ai_apps` with zero sessions, else `import_history` when `import` is null, else `connect_company` when there is no company, else `open_harness`.\n- `getting_started`: set only when there are zero sessions, or with the membership copy below.\n- Company isolation: every session is counted, but names, paths and titles come only from the brief's own company (and the person brief's included companies). Each session's company comes from the scan row, then its HQ `meta.yaml` `company_slug`, then a folder under `companies\u002F\u003Cslug>`; a folder under `companies\u002F\u003Cslug>` is that company's even when the session is recorded as personal. A folder is named only when every one of its sessions resolves to an included company. A session inside HQ with no record of its company (the HQ root, `repos\u002F`, worktrees) is counted and never named, and so is a repo whose GitHub owner is another company's `github_org`.\n- Reads are bounded: a 30-second inventory budget (sessions past it are still counted, without their project), at most 60 project folders checked, 5-second git reads within a 30-second git budget (past it, repos are not named), title reads within a 20-second budget (at most 1 MB from the start of a long transcript and 16 MB of the Codex thread index), and 20,000 tree entries. The whole welcome step stays well under 3 minutes.\n- `next_steps` holds `connect_company` (no company), `import` (only when `import` is null), and `connect_integration` and `sync` (company briefs).\n- On failure, `welcome` is `{first_run, note}` with one plain `note` (\"Couldn't read welcome history.\") and the rest of the brief is unaffected. A partly read inventory, or a failed title or tree read, adds a plain `note` and leaves that part out. Exception text never appears in `welcome`; it goes to stderr.\n\n#### Import report contract\n\nAgreed between Core and Desktop on 2026-10-19.\n\n- Writer: Desktop. At the end of the tree step, the desktop writes `\u003Chq>\u002Fworkspace\u002Fimports\u002F\u003CYYYY-MM-DDTHH-MM-SS>\u002Freport.json` atomically from the scan's done summary. Later, `hq import scan --output \u003Cpath>` can take over the write with the same shape. `\u002Fimport-context` keeps writing `\u003Chq>\u002Fworkspace\u002Fimports\u002F\u003CYYYYMMDDTHHMMSSZ>\u002Freport.json`. Both folder names are UTC times. A second import in the same second adds `-2`, `-3`, ... to the folder name. The reader parses both formats into UTC times, sorts by time and then by the numeric suffix (the base name counts as 1), and skips folders that match neither format.\n- Fields: the existing `{scan_id, counts{the 12 keys}, categories, discovery{ok, errors}}`, plus `sessions{total, claude, codex, cursor, days_seen, first_at, last_at}`, `tools[]` (harnesses found), `projects[]` (top project names, never paths), `source: \"desktop-tree-step\"` and `written_at`.\n- Reader limits: a `report.json` over 1 MB, nested deeper than 32 levels, not UTF-8 or not a JSON object is skipped and the next newest report is tried. A symlinked `imports` folder, stamp folder or `report.json` is not followed. Reading never fails the brief: with no usable report, direct detection applies.\n- Reader: prefer `sessions.total`. An older report has no `sessions` block; its total is the sum of `categories.conversations[].sessions`. `counts.conversations` counts session stores and is never used as a session count. Missing fields are tolerated.\n- Transcripts stay where the harness wrote them. With no report, direct detection uses the machine inventory.\n- Once a report exists or any session other than the current one is found, the welcome edition never shows \"Bring in your past work\". Project names shown in the brief still go through the title filter and company isolation.\n\nKeep one welcome block at the root of a person brief; never duplicate it in company or personal sections. Suggest connecting a company only when membership lookup confirms zero companies. A failed lookup still shows the getting-started copy with one plain source error line. A failed company pass leaves a plain error in its own section and does not stop other passes. Status progress updates after each pass. History reads open at most the newest 14 candidate run files.\n\nFor zero memberships or a failed membership lookup, include this getting-started copy verbatim: \"HQ brings your work, shared context and AI tools together. Start with a personal task, then create or join a company with \u002Fonboard when you are ready.\"\n\n## Step 4. Synthesize brief.json\n\nFirst start housekeeping in the background (Step 5's command), so it runs while you write. Then turn `brief-data.json` and the prefs into these items. The reader is the person the brief is for, who may not be a developer. Every list holds **at most 5 items**, and only things that truly need them.\n\nFor `mode: person`, apply the synthesis below separately to `personal` and each `companies.\u003Cslug>` section. Preserve those sections in `brief.json`, copy `not_included`, and keep every item’s company. Run `brief_rank.py --check` on the aggregate; inspect every section report and require no `isolation_problems` and no `welcome_problems`. Company PRs remain in their company sections, rather than being dropped from the person brief. Use only the previous person run for carry-over, matching both company and item identity. Record `mode: person` in the ready index entry.\n\n### Status while writing\n\nThe writing step must never go quiet. Before each section, append an activity entry to `status.json` and move `progress`, so the app never goes more than about 30 seconds without a new entry. Use these labels and progress values, in order:\n\n| Activity label | progress |\n|---|---|\n| Writing decisions | 0.72 |\n| Writing what shipped | 0.78 |\n| Writing problems | 0.83 |\n| Writing meetings | 0.87 |\n| Writing priorities | 0.91 |\n| Housekeeping | 0.95 |\n\nMark the previous entry `done` with a plain detail (\"4 decisions\") when the next one starts. If a section takes longer than 30 seconds, update its `detail` (\"3 of 5 written\"). The Housekeeping entry is the one `housekeeping.py` writes; if it has not finished, add the entry yourself as `running` and let the script complete it. Read the clock in the same command that writes each entry.\n\n### Item fields\n\nEvery item carries `id` (short and unique within the brief, like `d1`, `p2`, `m3`), `title`, `why`, `company` (the slug, or null on a personal brief), `product` (the human name, see Product names), `source` (where it came from), and `origin: {repo, number, url}` when it comes from GitHub. Actionable items also carry `unlocks[]`, `people_waiting` (a count), `revenue` (true when money waits on it), `effort` (`quick`, `medium` or `large`), `risk`, `age_hours` and `prompt`. The app shows the company logo and the `product` label, never a repo chip.\n\n`age_hours` is always computed from a timestamp in `brief-data.json`, never estimated: the meeting start, the PR `created`, the earliest matching DM `at`, or the `since` of a red workflow (the first prior run that listed it red). `source` is required on decisions and incidents: `meeting_signals`, `synced_signals`, `dms`, `main_health`, `prs` or `fleet`. An item from a signal also carries its `source_ref`. The app folds the sweep's own red-main risk into the decision or incident with `source: main_health` on the same repo or product, so write exactly one item per red repo.\n\n`action` is required on every decision and names the kind of call, which decides the button the app shows and how the picker treats it:\n\n| `action` | When |\n|---|---|\n| `cut` | Drop or hold work: cut a change from a release, stop a project, skip a run. A `cut` with `source: prs` is the release call, so the Release train card yields to Needs you. |\n| `go` | Approve something ready: merge, ship, deploy, sign off, say yes. |\n| `decide` | Pick between options; carries `choices: [a, b]`. |\n| `reply` | Answer a person: a DM, a question from a meeting, an email. |\n| `prep` | Get something ready before a call or a deadline: read, draft, review. |\n\nThe app defaults a missing or unknown `action` to `decide`; `brief_rank.py --check` reports it under `field_problems` so it never ships that way.\n\n### Root fields\n\n- `today`: `YYYY-MM-DD` local, copied from `brief-data.json.window.today`. The app's only weekday source; never derive it from `generated_at`.\n- `prefs_applied.widgets`: `{pinned: [kind], muted: [kind], weights: {kind: -2..2}, density: auto|calm|full}` copied from `brief-prefs.yaml` (`pinned_widgets`, `muted_widgets`, `widget_weights`, `density`). `sunrise`, `needs` and `catchup` may not be muted: drop the entry and add one `learned_notes` line saying so. Clamp weights to -2..2 with a note. `brief_rank.apply_widget_prefs` does both.\n- `mode`: `company` or `personal`, copied from `brief-data.json.mode`. Write `mode` and `company` on the run's `index.jsonl` line too.\n- `welcome`: copied from `brief-data.json.welcome` when it is set; omit it or write null otherwise. The writer may shorten each `next_steps[].reason` but adds no new steps. On a first run where `welcome.sessions.total` is above 0, the brief writes no empty-state lines anywhere: no \"Nothing owed\", \"No sessions\", \"Nothing needs a call from you today\" or similar. Lead with the person's own work from `headline`, `top_projects` and `recent_work`, and turn quiet lists into the `actions` (primary first). The first brief has no technical sentences.\n- `week`: `[{date, sessions, meetings, merged, opened, beat?}]`, the last 7 local days of the active company (or of the person's own work on a personal brief), copied from `brief-data.json.days` (that is what `--days 7` is for). `meetings` there is the user's own meetings only; never add `team_meetings` into it. `beat` is optional: `{kind: turn|crisis|resolution|push, label, evidence}` where `crisis` is the day an incident opened, `resolution` the day something in `items.recovered` recovered, `push` the day with the most merges, and `turn` the event that led into the crisis. One beat per day at most.\n- `landed_days`: `[YYYY-MM-DD]` days in `week` with at least one merged PR or release.\n- `time_to_clear_min`: the sum over decisions of effort minutes (`quick` 2, `medium` 6, `large` 15).\n\n### Titles and why\n\nThese rules apply to decisions, incidents (problems), watch, waiting and priorities.\n\n- `title` is the ask in plain English, the way a person would say it. Verb first, 8 words or fewer. No repo names, PR numbers, conventional-commit prefixes (`feat(...)`, `fix:`), file paths, flags or code. Good: \"Approve the desktop 0.11.3 release\", \"Decide: can cloud placeholders ever count as deletes?\", \"Unblock Jamie's billing dashboard\", \"Fix the red release gate on staging\". Bad: \"web-api #919: feat(sync): cloud-only placeholders\".\n- The repo, PR number and URL go in `origin`, and may be named in `why` or the prompt, never in the title.\n- `why` is one plain sentence a non-engineer understands: what it is, who is waiting, and what happens if it waits.\n- Shipped groups use product names too: \"Desktop app: 17 changes shipped\", not \"desktop-app: 17 merged\".\n\n### Product names\n\nUse human product names everywhere instead of repo slugs. They come from data files, never from the skill itself:\n\n- `companies\u002F\u003Ccompany>\u002Fsettings\u002Fbrief-products.json`, read on a company brief only.\n- `workspace\u002Fbrief\u002Fproducts.json`, the person's own names. It wins when both files name the same repo.\n\nEach file is a JSON object of repo slug to product name, for example `{\"web-app\": \"Web app\", \"billing-api\": \"Billing\"}`. A file that is missing or does not parse is ignored. An unknown repo becomes its slug in plain words (\"some-new-repo\" becomes \"Some new repo\"). `scripts\u002Fbrief_rank.py` (`load_product_names`) reads the files, and each PR row in `brief-data.json` already carries `product`.\n\n### Lists\n\n- **decisions:** only these four kinds:\n  - (a) DMs from humans (not `agt_` senders) asking the user something;\n  - (b) PRs where the user is the author (`authored_by_me`) or an explicitly requested reviewer (`review_requested`), or whose title starts with Release (`is_release`), or that block a release. A PR they did not author and were not asked to review is never a decision on other grounds;\n  - (c) red main-branch workflows (`main_health[*].red`);\n  - (d) meeting action items and questions assigned to the user (`mine: true` in `meeting_signals[*].action_items`).\n  Rank by what each one unblocks (`people_waiting`, `unlocks`, `revenue`), then by age. Keep the top 5. Everything else goes to **shipped**, **incidents** or **watch**.\n  Each decision also carries:\n  - `blocks`: `[{who, what, kind: person|work, origin?}]`, the people and work waiting on the call: DM askers, action-item owners waiting on it, \"held until\" items, PR authors awaiting the user's review. Names only inside the locked company. Without named blocks the app says \"unlocks N things\", never \"people\", so leave `blocks` empty rather than guess.\n  - `action`: one of `cut`, `go`, `decide`, `reply`, `prep` (see Item fields). Required.\n  - `choices`: `[a, b]` when `action` is `decide`, two words each (\"Ship Monday\", \"Hold a week\").\n- **waiting:** things the user asked for that have no answer yet, and the user's PRs waiting on review. At most 5. Each row is a person and a thing: `who` (the first name, or the agent's name) and `what` (what you wait for, plain: \"to review the pricing page\", \"an answer on the memo folder\"), plus `age_hours`, `kind` (`dm`, `review`, `handoff` or `other`) and `origin`. The app reads `title` as `what` when `what` is missing but drops a row with no `who`, so a wait with nobody to name is not a wait; `brief_rank.py --check` reports a row missing `who` or `what` under `field_problems`. `what` follows the title rules (no repo names, PR numbers or prefixes).\n- **shipped:** merged PRs grouped by product and theme, plus releases and deploys. Mark firsts. Counts come from `prs_summary` (see Counts). Each row carries `id` (`s1..`), `product`, up to 5 `highlights` (plain lines, no PR numbers or commit prefixes, one per change or theme) and `merge_hours_median` for the rollup (copy `prs_summary.by_product[].median_merge_hours`). The app merges rollup rows onto the sweep's per-product counts by `product`, so rollup titles use the product name exactly.\n- **incidents** (the app calls them problems): red main branches, agents that are not active, risk signals, and outages named in sessions. At most 5. A missing or empty `workspace\u002Fbrief\u002F` with a sibling `workspace\u002Fbrief-backup-*` folder is a deliberate reset and never an incident (Step 2).\n- **watch:** open PRs and threads worth knowing about that do not need the user yet. At most 5. Each carries `kind` (`ci`, `pr`, `thread` or `fleet`) and an optional `prompt`.\n- **people:** the latest work-level status for each teammate, with agents labeled. Use a summary, never the message text, unless the item is marked very important. Each carries `uid` (`prs_` or `agt_`), `load` (`clear`, `steady`, `heavy` or `storm`: `storm` owns an incident or a red main, `heavy` has 3+ meetings or 2+ open asks), `owes` (plain action items they own, from meeting signals and DMs) and `thanks` (one plain line about a win, or null).\n- **meetings:** lead with the user's own meetings (`whose: mine`). Teammates' meetings (`whose: team`) get no item of their own; mention them only as one plain count line (\"4 team meetings you weren't in\") or when one carries an action item the user owns. Only meetings whose start is inside the window (`brief-data.json.meetings[]` is already filtered to `window.attended_meetings_from..sessions_to`, deduped, and marked `attended`); a catch-up brief widens that to the gap. Each meeting item carries:\n  - `attended` (copied), `duration_min` (copied), `with`: the other participants in plain words (\"Robin Bell\", \"Alex and Jamie\");\n  - `decided`: up to 3 lines from `meeting_signals[*].decisions[*].text`, each shortened to one plain line;\n  - `todo`: up to 3 `{text, owner, mine}` from `action_items`, the user's own first.\n  The app's meeting hover shows the title, the decided lines and the to-do lines (the user's own marked), nothing else. Every action item with `mine: true` is also a decision candidate under (d), with a launch prompt. Meeting signals cover only signals synced inside the window, so an older meeting's action items appear only while they are inside it.\n- **carry:** open items from the last brief that are still open. Each carries `carried_from` (the last run id), `carried_since` (the `created_at` of the first run that listed it, from `index.jsonl`), `briefs` (consecutive runs it has appeared in, chained through `origin.url` or `origin.number`, else the normalized title, using the last brief's own `carry` rows), `item_id` (today's decision or incident that continues it, or null) and `prompt`.\n- **handoffs** (new): `{id: h1.., object, from, to, me, production, since, receipts: {access, ack, active}, note, company, product, origin, prompt}`. From DM ownership verbs (owns, handed, took over, needs to acknowledge), `\u002Fdelegate` events and board assignee changes. `me` is true when the user is the receiver; `production` when the object is live. Each receipt is `true`, `false` or `null` (unknown); `access` stays null unless a grants source exists. `note` is work-level, never message text. `object` follows the title rules.\n- **recovered** (new): `{id: f1.., title, what, at, source: main_health|fleet|session, company, product, origin, timeline?: [{at, text}], post_incident?: {broke, did, changes}}`. From `brief-data.json.main_health[*].delta.recovered`, `fleet.delta.recovered`, and outages a session names as closed. `at` is the run's `generated_at` when nothing more precise exists.\n- **releases** (new): `{product, version, released_at, pending: [{day, count, theme}], pending_count, held: [{title, why}], light: ok|warn|red, prompt, origin}`. Copy `brief-data.json.releases[]` (`merged_at` → `released_at`, `pending_by_day` → `pending`); `held` lists decisions whose `why` says the work is held until the release; `light` is `red` when the repo's main is red, `warn` when `pending_count` is 3 or more or the release is older than a day, else `ok`.\n- **reminders** (new): `{id: r1.., text, said_at, where, due_at, prompt}`. From `hq dm` reminders the user sent to themselves; later from \"remind me\" lines once outbound DM history is in the sweep. `text` is the user's own words, verbatim, and is exempt from the title lint.\n- **other_company:** a count only.\n\n### Counts\n\nThe brief's merged and opened numbers come from `brief-data.json.prs_summary` (`merged`, `opened`, `open`): the 24-hour window (`window.hours`), the user's own PRs. The loader shows the same numbers. Never add up `days` for these: the `days` rollup buckets by local date and is only for the week arc.\n\n### Priorities\n\n`priorities` is an ordered list of at most 5 one-line directives for the day:\n\n```json\n\"priorities\":[{\"rank\":1,\"text\":\"Give Alex a go\u002Fno-go on desktop 0.11.3\",\"item_id\":\"d2\",\"because\":\"the release waits on the answer\",\"score\":3}]\n```\n\n- Derive them strictly from decisions and incidents already in the brief. Add no new facts.\n- Rank by how many people or how much revenue each unblocks, then by age, then by effort. A quick win goes last unless it unblocks someone. `brief_rank.py --check` returns this order from the item fields; follow it unless you can state the reason in `because`.\n- `item_id` must be the id of an item in `items.decisions`, `items.incidents`, `items.handoffs` or `items.carry`. `--check` reports a dangling id under `dangling_priorities`; fix it or drop the priority.\n- `score` is the unblock score `--check` prints under `scores` for that `item_id` (people waiting + things unlocked, revenue counts double). Copy it; `priority_problems` reports a missing or different value.\n- `text` follows the title rules. `because` is one clause.\n- `lead_hint` starts with priority 1's `text` verbatim, then one clause: \"Sign the renewal contract first; the vendor and the launch date wait on it.\" The hero quotes it, so the first clause must match exactly (`--check` reports `lead_hint_problem` otherwise).\n\n#### How the app uses priorities\n\nEach priority pulls the card that contains its item onto the grid (the decisions card for a decision, the problems card for an incident, the handoffs or carry card for those), and the card's reason sentence quotes the priority's `text` in the writer's words: \"Shown for priority 1, \"Sign the renewal contract\": it and 4 more calls wait on you.\" So `text` must be the exact directive, not a summary, and `because` one clause that reads after it. The needs rows are ordered by priority rank first, then by what they unblock, so the ranks are the order the user sees.\n\n### Prompts\n\nEvery actionable item gets a `prompt` that starts a Claude, Codex or Grok session. The prompt must:\n- name the exact repo, PR, commit or person\n- say what to check first\n- say what done looks like\n- end by showing the result before anything irreversible\n\nUse the user's `engine` preference as the default. Then apply the preferences: boost VIP people and repos, drop muted items, and treat `density` as a ceiling (never above 5 per list).\n\n### Write and check\n\nWrite `brief.json` as `{run_id, generated_at, today, mode, company, window, catch_up, lead_hint, priorities, counts, week, landed_days, time_to_clear_min, items, prefs_applied, learned_notes, welcome}`, where `company` copies `brief-data.json.company` (null on a personal brief), `counts` copies `prs_summary` and `prefs_applied` holds `density`, `engine`, `vip_people`, `muted` and `widgets`. Then run:\n\n```bash\npython3 -I .claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief_rank.py --check workspace\u002Fbrief\u002F\u003Crun_id>\u002Fbrief.json\n```\n\nFix every `title_problems` entry (it now covers `shipped[].title`, `shipped[].highlights`, `handoffs[].object`, `recovered[].title`, `releases[].held[].title` and `waiting[].what`; reminders are exempt), every `field_problems` entry (a decision without a valid `action`, a wait without `who` or `what`), every `over_cap` list, every `dangling_priorities` and `priority_problems` entry, `lead_hint_problem`, `widget_problems`, `today_problem` and `welcome_problems` (empty-state lines on a first run with sessions, or exception text in `welcome`), and write the file again. Write status `step: \"Writing your brief\"`, `progress: 0.9`.\n\n## Step 4b. Write the page\n\nThe desktop app draws the brief as cards from `brief.json.page`, a BriefPage. Write it after `brief.json` passes `brief_rank.py --check`, from the same data. The page is optional and additive: everything in Step 4 stays as it is.\n\n### Frame and candidates (deterministic)\n\n```bash\npython3 -I .claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief_page.py skeleton \\\n  --data workspace\u002Fbrief\u002F\u003Crun_id>\u002Fbrief-data.json --person \"\u003Cfirst name>\" \\\n  --hq-root \"$PWD\" --out workspace\u002Fbrief\u002F\u003Crun_id>\u002Fpage-draft.json\n```\n\n`page-draft.json` holds `page` (the frame) and `candidates`. The frame already has `version`, `companies` (each included company by slug with its manifest name, plus `personal`), `person`, `window` (`from` is the previous brief, `hoursAway`, `zoom` and a plain `label`), `theme: {style: \"merged\"}`, the lead card with the window's real numbers (your meetings, people waiting on you in DMs, your to-dos when there are any, the \"your day\" line of your meetings, work sessions and asks, and chart labels in local time such as \"Fri morning\" or \"Mon 3 pm\"), and the cards beside the lead with real data and empty titles. Each candidate is one card's worth of computed facts: `company`, `type`, `kind`, `size`, `symbol`, `data` (hours from timestamps, counts from rows, people), `drill.signals`, `facts`, `rank`, and for asks `dropped_candidate` (waited a day or more) and `basis` (`sender` when the DM's company came from its sender). Candidates come ranked, most important first: cards about people, meetings and tasks first (dropped-ball candidates by longest wait, then asks, your tasks, meetings, broke), then cards whose evidence is only PRs or CI (review requests, red builds, stalled and merged PRs). Most people do not run builds: keep PR and CI cards in the stream, never the lead or the summary band, and write the lead's headline about people, meetings and decisions rather than merges. A suggested `data.visual` is kept only when the card holds what that drawing reads.\n\nPeople's names are display first names. The sweep resolves each DM sender (`from_name`) and PR author (`author_name`) from the member list of that section's own company only (the personal section uses none), the GitHub profile name of a login, a full name on a member list whose login shape matches, or an email of the form first.last. A handle is kept only when nothing resolves.\n\n### What you write\n\nTurn candidates into cards. You choose which cards appear, their title, `why`, kind, size and order, and you may merge candidates (two asks from one person) or drop them. You never add a number or a fact that is not in a candidate or in `brief-data.json`.\n\n- **The lead.** `summary[0]` is the frame's lead card: kind `focus`, size `XL`, type `summary`. Write its `title` and `data.headline` (one short line about where today's attention goes, with an `accent` word) and up to three `data.bets` (`{label, symbol, share, itemId}`, shares summing to at most 1, `itemId` naming a card on the page). Keep its stats, spark and chart labels. Chart labels anywhere on the page read like \"Fri morning\" or \"Mon 3 pm\", never a timestamp.\n- **Beside the lead.** The lead takes four of the six columns and two rows, so the summary band needs cards that fill the other two columns by two rows with no gap: M + S + S, M + M, or one L (S is 1 cell, M 2, L 4; 4 in all). The frame already has them: the people waiting on you in one company, and counts that span the page. Write their titles. You may swap one for a better card from the candidates, but keep the band at exactly 4 cells. A count-only summary card may leave `company` out; a card that names a person or quotes anyone carries its company.\n- **Caps are hard.** The app draws at most 5 dropped balls and 12 stream cards and drops the rest without a \"+N more\", so fill each band in rank order and leave out what does not fit.\n- **Dropped balls.** At most 5, longest wait first: asks where this person is the one not moving (`dropped_candidate`, carry-over items still open, owed meeting actions). Each is kind `ball`, type `dropped`, size `M`, with `data.pickup` (the one-press action in plain words, such as \"Reply to Ann about the memo\"), `data.hours` and `data.people`. Zero dropped balls is a real result: leave the band empty.\n- **The stream.** At most 12 cards, ranked by how much this person would care, size following rank (L for the top one or two, then M, then S). At most 3 per type.\n- **Colour is meaning, so do not set `field`.** The type picks the colour, one meaning each: pink dropped, sunset broke or due (a launch, or a task due within 7 days), violet your move (asks, client, your tasks), teal landed or learned, graphite for the record (decided, moved, stalled, meetings, waiting on someone else). A card whose type does not fit its meaning gets a different type, never a different colour.\n- **Every card carries its company:** the candidate's slug (`personal` for the person's own work), which must be a key of `page.companies`. A card holds one company's facts only. Never name one company's people, work or words on another company's card, and never merge candidates from two companies into one card. Treat a `basis: sender` ask with care: if its words are clearly about another of the person's companies, leave it out.\n- **A drawing holds real information.** Set `data.visual` only to a recipe the card can fill: `clock`, `dial` and `tide` need `hours`; `letters` and `lock` need a person (`mailbox`, `constellation` and `drawers` two or more); `tally` and `stack` a whole `value`; `sparkline` 3 or more `spark` points (`skyline` 4 or more); `checklist` 2 or more `steps`; `track`, `fuse` and `rocket` steps, milestones or days; `compare` hours with `usual`, or 2 to 5 `bars`; `trace` and `breaker` a `to`; `agenda` a meeting; `fork` and `switch` a decided or moved note; `bell` a landed note; `book` a learning note; `siren` and `lighthouse` a broke `value`. Leave `visual` out when unsure, and the app picks one and varies the page. Name the same drawing at most twice a page, and at most 3 pixel scenes and 2 iso objects.\n- **Names.** Use the candidate's people names as given (resolved first names). Never write a login or handle when the candidate, `from_name` or `author_name` has a name; `check` warns on handle-looking names.\n- **Titles** follow the Step 4 title rules: verb first, 8 words or fewer, product names, no repo names, PR numbers, prefixes or paths. `why` is one sentence for this reader.\n- **Drill-in.** `drill.signals` (at most 4, `{source, text, at}`, `source` one of dm, meeting, session, pr, ci, calendar, task, email, analytics, doc), `drill.prompt` (the item's launch prompt from Step 4, same rules) and `drill.bot` (one line for Ask my bot). Summarize DM text in your own words; quote at most a short phrase in `data.quote`.\n\n### Check and attach (fail soft)\n\nWrite the page to `workspace\u002Fbrief\u002F\u003Crun_id>\u002Fpage.json`, then:\n\n```bash\npython3 -I .claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief_page.py check workspace\u002Fbrief\u002F\u003Crun_id>\u002Fpage.json\n```\n\nFix every error and check again, at most twice. Then attach it:\n\n```bash\npython3 -I .claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief_page.py attach \\\n  --brief workspace\u002Fbrief\u002F\u003Crun_id>\u002Fbrief.json --page workspace\u002Fbrief\u002F\u003Crun_id>\u002Fpage.json\n```\n\n`attach` validates again. A valid page is written into `brief.json` as `page`. An invalid or missing page is left out, every other field of `brief.json` stays as it was, and the reasons go to `brief.json.page_problems` and stderr. Never fail the brief because of the page; add a `learned_notes` line when it was left out. `brief_rank.py --check` also reports `page_problems` for a page already in `brief.json`.\n\n## Step 5. Housekeeping\n\nHousekeeping runs every time, through one script. Start it in the background at the beginning of Step 4 so it runs while you write; it never blocks `brief.json`. Do not run the checks by hand, and do not skip the script.\n\n```bash\npython3 -I .claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fhousekeeping.py \\\n  --company \u003Ccompany> --hq-root \"$PWD\" --run-dir workspace\u002Fbrief\u002F\u003Crun_id>\n```\n\nIn person mode, run housekeeping separately for personal and each included company, writing into separate temporary run directories and copying each result into its matching section. This keeps company worktree paths within their own section. Never run company housekeeping for an excluded company. On an explicit personal brief, leave `--company` off. The doctor and sync checks need a company, so the script records both as `skipped` with the reason `needs a company` and runs only the worktree scan.\n\nThe script runs the every-run checks in parallel, each under a hard time budget, with stdin closed and every prompt pre-answered:\n\n| Check | Command | Budget |\n|---|---|---|\n| `hq_doctor` | `hq doctor --json --company \u003Ccompany>`. Exit 1 only means some checks fail; the run still counts as finished | 40s |\n| `hq_sync` | `hq sync now --company \u003Ccompany> --on-conflict abort --lock-timeout 0`. Never prompts, never overwrites, never waits on the HQ Sync app's lock | 30s |\n| `worktree_scan` | read-only `git status` and `git log -1` in each `workspace\u002Fworktrees` checkout | 20s |\n\nA check that reaches its budget is stopped (SIGTERM, then SIGKILL) and recorded as skipped. Every task ends with exactly one status: `ran clean`, `found N things`, `skipped (took too long)` or `failed: \u003Creason>`. The script writes `housekeeping.json` (`tasks`, `notes`, `headline`, `proposals`) and `status.json.housekeeping`, completes the \"Housekeeping\" activity entry, and never prints command output or secrets. Use its `headline` as the Housekeeping card's line, unchanged. Never write \"did not finish\" or \"not run\" for a check the script reported otherwise.\n\nThe script also adds the deliberate-reset note when it applies (\"Brief history was reset on purpose; the old briefs are backed up in workspace\u002Fbrief-backup-…\"). That one line in `notes` is the only place a reset appears.\n\n**Optional checks.** Only when time allows, each recorded in `tasks` with one of the four statuses: search reindex (`qmd update`) when content changed since the last brief; `\u002Fgarden` audit-only, weekly; stale-session scan (working state, no `\u002Fhandoff`, older than 24h); orphan-process scan (HQ-related processes with no live parent, ranked by memory); error harvest (repeated failures in HQ logs and hook errors since the last brief). The error harvest ignores a missing or reset `workspace\u002Fbrief\u002F` when a `workspace\u002Fbrief-backup-*` folder sits next to it.\n\nHousekeeping never deletes files, kills processes, removes worktrees or files bugs.\n\n**Proposals.** Anything destructive or outward-facing becomes an item in `housekeeping.json.proposals` with a launch prompt. Add proposals to the file the script wrote and keep its `tasks`, `notes` and `headline`. The brief shows these on a Housekeeping card, and the user starts each one:\n- Hand off and archive stale sessions.\n- Quit orphan processes. List the PID, command, memory and why each looks orphaned. Never include the user's own apps or HQ.app.\n- Remove idle worktrees listed in `tasks.worktree_scan.detail.stale_paths`, after confirming each is merged and has no unpushed commits.\n- File one bug per distinct repeated error through `\u002Fhq-bug`, with the log excerpt.\n- Apply garden fixes.\n\nEach proposal states, in plain words, what it frees or fixes and its risk.\n\n## Step 6. Finish\n\n- Write status `state: ready`, `progress: 1.0`, as soon as `brief.json` is written and Step 4b's `attach` has run (it never blocks: a failed page is simply left out). Housekeeping updates `status.json.housekeeping` afterwards without changing `state`.\n- Append the run to `workspace\u002Fbrief\u002Findex.jsonl`.\n- Print one line: `BRIEF READY \u003Crun_id> \u003Cpath to brief.json>`. The desktop app watches `status.json` and shows the notification.\n- When run outside the app, also send the user a short HQ DM to themselves: \"Your daily brief is ready.\"\n\nIf any step fails, write `state: failed` with a plain-language `error` and stop. Partial files are fine, because the app shows what it has and marks what is missing.\n\n## Learning, weekly\n\nWhen `brief-log.jsonl` has 7 or more days since the last fold, fold it into `brief-prefs.yaml`:\n- If a widget is dismissed 3 or more times in a row, `widget_weights[kind] -= 1` (floor -2).\n- If sessions are launched from one widget 3 or more times in a week, `widget_weights[kind] += 1` (ceiling +2).\n- If the user says \"always show X\", add the kind to `pinned_widgets`; \"never show X\" adds it to `muted_widgets`.\n- Refuse to mute `sunrise`, `needs`, `catchup` or the priorities list: leave the prefs unchanged and add a `learned_notes` line saying why.\n- If an engine is chosen 70% of the time or more, make it the default.\n- If a sender's items are always launched, mark them VIP.\n\nAdd each change as one plain line to `learned_notes`, so the next brief can say what changed.\n\nThe app appends to `brief-log.jsonl` through a host command that writes only that file (`append_brief_log_line`, HQ Desktop 0.11.7 and later). One JSON object per line, keys in this order: `at` (ISO time), `event`, `run_id` (the run folder name, or null for a brief with no run), then only the fields the event carries: `kind` (the widget kind from the catalogue), `item_id`, `engine` (`claude`, `codex` or `grok`), `widgets` (a list of kinds). Events: `shown` once per run with `widgets` (the cards on the page); `dismiss` when the person cleared an item without a launch (`item_id`, `kind`); `launch` when a prompt started a session or was copied (`item_id`, `kind`, `engine`); `pin` and `hide` with `kind`. Decisions and action items log as `needs`; a prompt the catalogue does not know (a peek's resume, a thank-you) logs with `kind: null`. Skip a line that does not parse. Older desktop builds wrote nothing, so a short log is normal. The writer itself never writes `brief-log.jsonl` or the app's plan files.\n\n## Rules\n\n- **Company isolation.** In person mode, synthesize each `companies.\u003Cslug>` section separately and keep every item’s `company` slug. Personal rows use `company: null`. Drop any brief item whose existing company conflicts with its section and record an isolation error; never relabel a conflicting row. Tag only brief-item collections, leaving nested participant and metadata rows intact. Never move content between company headings. Excluded companies get only the exclusion notice. Explicit narrow modes retain their existing count-only treatment of other companies.\n- **At most 5 per list.** Decisions, waiting, incidents, watch, priorities, carry, handoffs, recovered, releases and reminders never hold more than 5 items; the app shows \"+N more\" past that, never a sixth row.\n- **Plain titles.** Titles follow Step 4: verb first, 8 words or fewer, product names, no repo slugs or PR numbers. The same rule covers shipped titles and highlights, handoff objects, recovered titles and held release items. Reminders are the user's own words and are exempt.\n- **Unmutable widgets.** `sunrise`, `needs` and `catchup` are never written into `prefs_applied.widgets.muted`, whatever `brief-prefs.yaml` says; drop the entry with a `learned_notes` line.\n- **No app files.** The writer never writes `brief-log.jsonl` or the app's plan files; it reads the log and writes `brief-prefs.yaml` only in the weekly fold.\n- **Retention.** Use product usage only. Never use payments.\n- **Secrets.** Never read or print secrets.\n- **The page is additive.** `brief.json.page` is optional. Never drop or rename an existing field to make room for it; an app that does not read `page` keeps working from the rest of the file.\n- **Read-only, except housekeeping.** Do not post, send, merge, deploy or change anything outside `workspace\u002Fbrief\u002F` and `personal\u002Fbrief\u002F`. The only exceptions are the Step 5 auto-run tasks. Destructive cleanup is always a proposal the user launches.\n\n## Default brief-prefs.yaml\n\n```yaml\nversion: 1\nlast_brief_at: null\ndensity: auto            # auto | calm | full. full keeps the same 8-card ceiling as auto.\nengine: claude           # claude | codex | grok\nquiet_hours: \"20:00-07:00\"\nvip_people: []\nvip_repos: []\nmuted_repos: []\nmuted_senders: []\nintegrations: []         # extra connected apps to always check\n# Widget preferences the app's picker reads (copied into brief.json prefs_applied.widgets).\n# Kinds: oneThing blockedByMe incident fleetRecovery resolved risk waiting carry handoffs\n# shipped firsts releaseTrain meetings decided weekArc team agenda runway focus reminders.\npinned_widgets: []       # \"always show X\": shown whenever it has data, below the cards a priority needs\nmuted_widgets: []        # \"never show X\": left off the grid. sunrise, catchup and needs cannot be muted\nwidget_weights: {}       # kind: -2..2 whole numbers; each point moves the card five score points\nlearned_notes: []\n```\n\n`density: full` keeps the same 8-card ceiling as `auto` (the larger templates are not shipped); `calm` lowers it.\n","# \u002Fdaily-brief\n\nBuilds one person's Daily Brief across personal work and every permitted company by default. The HQ desktop app starts this through the main local bot when the user presses **Create brief**. A person can also run it directly with `\u002Fdaily-brief [--all|company|--personal] [--welcome] [--today YYYY-MM-DD]`.\n\nAn explicit personal brief (`--personal`) reads only what belongs to the person on this machine and in GitHub: work sessions, PRs, main-branch CI and personal DM messages (messages with no company). The company-only sources (meetings, synced signals, meeting signals, fleet agents and integrations) are skipped and recorded as skipped, and housekeeping skips the doctor and sync checks. A new user with no company gets a useful first brief this way.\n\nThe output is a set of files the desktop app reads. This skill never posts, sends, merges or deploys anything.\n\n## Inputs\n\n| Input | Default |\n|---|---|\n| `--all` | Default: personal work plus every membership permitted by the session lock |\n| `company` | Explicit first argument selects only that company |\n| `--personal` | Build a brief with no company, even when the session has one bound |\n| `--welcome` | Add the welcome edition (Welcome edition, below). On by default for the person’s first ready run in any mode |\n| `today` | Today's local date |\n| `run_id` | `--run-id \u003Cid>`, passed by the app. If missing, generate one as `brief-\u003CYYYYMMDD-HHMMSS>` in local time |\n\nBriefs are manually triggered, so several can exist per day. Each run gets its own folder, `workspace\u002Fbrief\u002F\u003Crun_id>\u002F`. The `run_id` is `brief-\u003CYYYYMMDD-HHMMSS>` in local time.\n\n| File | Written when | What it is |\n|---|---|---|\n| `status.json` | At every step | Progress the app polls |\n| `brief-data.json` | Step 3 | Raw normalized sweep output |\n| `brief.json` | Step 4 | Synthesized items with prompts, read by the generator, plus the optional `page` the card design draws (Step 4b) |\n| `page-draft.json` | Step 4b | The page frame and card candidates from `brief_page.py skeleton`; a working file, not read by the app |\n| `housekeeping.json` | Step 5 | Cleanup results and proposed cleanup actions |\n\nWhen a run finishes, ready or failed, append one line to `workspace\u002Fbrief\u002Findex.jsonl`. The desktop app's history navigator reads this file:\n\n```json\n{\"run_id\":\"…\",\"created_at\":\"…\",\"finished_at\":\"…\",\"duration_s\":0,\"window\":{\"from\":\"…\",\"to\":\"…\"},\"state\":\"ready|failed\",\"mode\":\"company|personal\",\"company\":\"acme|null\",\"catch_up\":false,\"lead\":\"…\",\"counts\":{\"decisions\":0,\"shipped\":0,\"incidents\":0,\"carry\":0,\"recovered\":0},\"landed\":false,\"headline\":\"one plain line\"}\n```\n\n`counts.shipped` is `brief-data.json.prs_summary.merged`, the same number the loader and the brief show. `counts.carry` and `counts.recovered` are the lengths of `items.carry` and `items.recovered`; `landed` is true when the run saw at least one merged PR or a release. `brief_rank.py --check` prints `index_counts` and `landed` ready to copy.\n\n`status.json` shape:\n\n```json\n{\"run_id\":\"…\",\"state\":\"running|ready|failed\",\"step\":\"…\",\"progress\":0.0,\"started_at\":\"…\",\"updated_at\":\"…\",\"error\":null,\"sources\":{}}\n```\n\nWrite `status.json` before each step, and again after every source, so the app's progress bar stays truthful and keeps moving. Also keep a rolling `activity` list in `status.json`, newest last, capped at 12 entries. The app shows it under the sunrise so the user can see the run is alive:\n\n```json\n\"activity\":[{\"at\":\"…\",\"label\":\"Read 42 of 50 sessions\",\"state\":\"done\",\"detail\":\"only counted: 6 agent runs, 2 outside this brief\"},{\"at\":\"…\",\"label\":\"Checking GitHub PRs\",\"state\":\"running\"}]\n```\n\nAs each source lands, also update `findings` and `samples` in `status.json`. The app animates these as live counters and preview cards:\n\n```json\n\"findings\":{\"signals\":{\"decision\":0,\"action_item\":0,\"risk\":0,\"commitment\":0,\"key_point\":0},\"sessions\":0,\"meetings\":0,\"dms\":{\"total\":0,\"need_you\":0},\"prs\":{\"merged\":0,\"opened\":0,\"open\":0,\"review_requested\":0},\"ci_red\":0,\"agents\":{\"total\":0,\"attention\":0},\"integrations\":{}},\n\"samples\":[{\"kind\":\"decision\",\"title\":\"Approve release-gate fix\",\"company\":\"acme\",\"at\":\"…\"}]\n```\n\n`samples` holds at most 8 items, all from the active company only (`company` is null on a personal brief). Titles are short and plain. Never include DM body text: use the sender name and a summary instead.\n\n`state` is `running`, `done`, `skipped` or `failed`. Labels are plain, user-facing language with real counts (\"Found 31 DMs, 4 need you\"), never commands or file paths. For other-company items, give counts only. Spread progress evenly across the sweep (0.25 → 0.7) by source. Read every timestamp from the clock in the same command that writes it.\n\n## Step 1. Start\n\nWrite `status.json` with `state: running`, `step: \"Checking your setup\"` and `progress: 0.05`.\n\nCheck the session's company (`bash core\u002Fscripts\u002Fhq-session.sh current`). Never sweep a company the session is not locked to. The sweep reads the lock with `bash core\u002Fscripts\u002Fhq-session.sh get company_slugs` and refuses `--company` when that slug is outside the locked set.\n\n- Default to a person brief (`--all`), including personal work and a section for each permitted company. `--company \u003Cslug>` and `--personal` remain explicit narrow modes.\n- Membership inventory comes from the read-only `hq sync mode --show` table (the caller's memberships), intersected with `hq-session.sh get company_slugs`. Never widen the lock. Show every excluded membership as \"not included: open HQ in that company to include it\". Inventory\u002Flock failures are visible source failures, never an invented empty membership list.\n\n## Step 2. Load what we know about this person\n\n- Read `personal\u002Fbrief\u002Fbrief-prefs.yaml`. If it is missing, create it from the defaults below. Besides `density`, `engine` and the VIP and mute lists, read the widget preferences the app's picker uses: `widget_weights` (kind → -2..2), `pinned_widgets` and `muted_widgets`. Step 4 copies them into `prefs_applied.widgets`.\n- Find the last brief: the newest `ready` entry in `workspace\u002Fbrief\u002Findex.jsonl` with `mode: person` for an all-company brief; for explicit narrow modes use the same company and mode. Skip lines that name another company. A line with no `company` field is an older run: use it only when its `brief.json` or `brief-data.json` has the same `company`. Read that run's `brief.json` too: its `items` are the carry-over candidates, and its `carry` rows give `carried_since` and `briefs` for chaining (Step 4, carry).\n  - **Deliberate reset.** If `workspace\u002Fbrief\u002F` is missing or holds no earlier run (no other run folder and no `ready` line in `index.jsonl`) and a sibling `workspace\u002Fbrief-backup-*` folder exists, the owner reset brief history on purpose. It is not an incident, problem or decision, and never part of the lead. Treat the run as a first brief with no carry-over, label the activity \"Starting fresh brief history\", and leave the one-line note to housekeeping (Step 5). `brief-data.json.brief_history.reset_on_purpose` records the same check. A missing folder with no backup next to it is also only a housekeeping note, never the lead.\n  - **Window:** always the last 24 hours. The brief is a picture of the user's day, not a diff since the last run; a second run an hour later shows the same day again with the new items added. Only a catch-up brief widens the window: to the gap since the last brief, capped at 14 days.\n  - **Catch-up:** if the gap since the last brief is 3 days or more, set `catch_up: true`.\n  - Carry-over still uses the last brief: an item that was in it and is still open is marked `carry`, never dropped as \"nothing new\".\n- Read the last brief's items. Anything still open becomes a carry-over candidate. Note what was launched or dismissed, from `personal\u002Fbrief\u002Fbrief-log.jsonl`.\n\nWrite status `step: \"Reading your last brief\"`, `progress: 0.15`.\n\n## Step 3. Sweep\n\nRun the sweep script. It records each source's success or failure, and never fills a gap with an invented value.\n\n`--hours 24` is the brief's window: sessions, PRs and meetings from the last 24 hours. `--days 7` is only the per-day rollup (`days`) the week arc copies; it never widens the brief. For a catch-up brief (the user has been away 3 or more days) add `--catch-up` and set `--days` to the number of days since the last brief (at most 14), which keeps the meetings from that gap.\n\n```bash\npython3 -I .claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief-sweep.py \\\n  --all --days 7 --hours 24 --today \u003Ctoday> \\\n  --hq-root \"$PWD\" --out workspace\u002Fbrief\u002F\u003Crun_id>\u002Fbrief-data.json \\\n  --status workspace\u002Fbrief\u002F\u003Crun_id>\u002Fstatus.json\n```\n\nFor a narrow brief, replace `--all` with `--company \u003Cslug>` or `--personal`. Add `--welcome` to force the welcome edition.\n\nOn a company brief, PR search is limited to the company's GitHub owner: `--org \u003Cowner>`, or else the company's `github_org` in `companies\u002Fmanifest.yaml`. With neither, and on a personal brief, it covers every owner the user's `gh` login can see (one search, shared by every section of a person brief). Each PR row is then tagged with its company from the manifest (`scripts\u002Fbrief_company.py`), reading git remotes only for the repos of companies in the session lock: a locked company's `repos:` entries and their `origin` remotes map an owner-qualified repo to that company. A whole GitHub owner maps to a company only when it is an organization (checked with `gh api`; never a personal account and never the person's own login) whose known repos all belong to that company, or when it is the company's explicit `github_org`. Otherwise a PR matches on its full owner\u002Fname only, and an unmatched PR is the person's own. A repo listed under two companies belongs to neither section, and a PR in a repo whose folder name the manifest lists under a company outside the lock is kept out of the personal section. A company section keeps only its own rows; the personal section keeps only rows mapped to no company. Everything else is dropped and only counted in `prs_other`. The worktree scan treats worktrees the same way: they count in `detail.other` and their paths are never listed. Main-branch CI checks the repos of the user's own PRs in the window (most PRs first, at most 8); `--repos a,b` names them instead, as bare names (owner from `--org` or the PR rows) or owner-qualified names.\n\nThe script covers these sources:\n\n| Source | Read through |\n|---|---|\n| Work sessions | Sessions come from `workspace\u002Fsessions` meta files plus the Claude and Codex transcripts (title, and kind you, agent or lane), for the last 24 hours (`--hours`). Other-company sessions are a count only. |\n| Recorded meetings (company only) | `hq meetings list`. The list row supplies the title, start and participants |\n| Synced signals (company only) | The company vault's signal index, `signals\u002F_index\u002F{UTC day}.json`, for the last 24 hours (`--hours`). No integration or meeting service is called. Index rows in both shapes are read: `{key, written_at}` from the hot-channel pass and `{path, audience_key}` from `hq signals run`, which keeps the time in the signal file's `created_at`. Read: the company folders (`signals\u002F{type}\u002F`), the person's own folders (`signals\u002F@{key}\u002F{type}\u002F`, keys from the HQ login via `hq whoami --json`: key(email), also used for the sync ledger and cursors, and key(personUid); when `hq whoami` reports no personUid, it comes from `hq members --company \u003Cslug> list --json` by email; `--email` or `git config user.email` only when `hq whoami` is unavailable; the result records `identity_source`), and group folders whose `_audience.yaml` principals include the person's uid or email (email compared case-insensitively). A folder whose audience does not include the person is never read. Each line carries the `company` it was read from. A day with no index file falls back to the type folders, including the older `signals\u002Fslack-dm\u002F{type}\u002F`. Code: `scripts\u002Fbrief_signals.py` |\n| Meeting signals (company only) | Built from the synced signals whose `source_ref` is a meeting pointer (`sources\u002Fmeeting-events\u002F…`), grouped by the pointer's transcript id. Per meeting, up to 5 decisions and 5 action items carry `text` (the signal's summary line, never transcript text), `owner`, `mine` (the owner is the user, matched against `--me` or `git config user.name`), `source_ref` and `cite` |\n| DM inbox | `hq dm inbox`, then only this company's messages. A personal brief keeps messages with no company. Another company's messages are dropped and never written. Agent senders, with `agt_` IDs, are labeled. A message's company is its slug field (`company`, `companySlug` or `company_slug` on the message or its channel); an explicit field always wins. In person mode, a message with no such field is attributed by its sender: a sender who is an active member of exactly one included company (`hq members --company \u003Cslug> list --json`, read for the included companies only) belongs to that company, and the row records `company_basis: \"sender\"` (`\"tag\"` for an explicit field). A sender in two included companies, or in none, stays personal. If any included roster cannot be read, sender attribution is off for the run and `sources.dm_attribution` says so. On a company brief with attribution off, if the inbox page has messages and none carry a company slug field, the source is skipped with `skipped_reason: \"inbox has no company tag\"`. `companyUid` is an id, not that field. An empty inbox is a real empty result, not a skip. |\n| Fleet agents (company only) | `hq agents list` |\n| The user's PRs | `gh search prs --author @me` (with `author`), plus open PRs where the user is a requested reviewer (`--review-requested @me`, marked `review_requested: true` and `reviewRequests: [\"@me\"]`). Each row has `product`, `repo`, `repo_full` (the owner-qualified name), `authored_by_me` and `is_release`. Read-only |\n| Main-branch CI health | `gh run list` |\n\nEvery source has an entry in `brief-data.json.sources` with `state`: `ok` (it ran), `failed` (it ran and broke; `note` and `error` hold one plain line such as \"Couldn't read DMs.\"; the exception text goes to stderr only) or `skipped` (left out on purpose; `skipped_reason` says why). On a personal brief the company-only sources use `needs a company`. On a company brief, DMs use `inbox has no company tag` when the inbox page cannot be filtered by company. `ok` is true only for `state: ok`. A skipped source's top-level key is null. The top-level `mode` is `person`, `company` or `personal`. In person mode, `personal` holds personal sources and `companies.\u003Cslug>` holds each company sweep; `company` is null at the root. Each section has its own sources, window, derived summaries and deltas. Person history compares only previous `mode: person` runs, matching company sections by slug.\n\nA skipped source is not a failure and not an empty result. The sweep writes its activity entry with `state: skipped`, a plain label (`Skipped DMs` for the inbox) and `detail` set to `skipped_reason`. It does not write `findings.dms` as `{total: 0}`, and it does not say there were no messages. The brief copies that: when `sources.dms.state` is `skipped`, write no DM decisions, waits or people from the inbox, and do not say the inbox was empty. One clause is enough: \"DMs were skipped; the inbox has no company tag.\"\n\nThe script also writes `window.today`, `window.hours`, `window.prs_from`\u002F`prs_to`, `window.attended_meetings_from` (= `sessions_from`, or the first catch-up day), and a top-level `prs_summary: {merged, opened, open, review_requested, median_merge_hours, by_product}` for the 24-hour window, counting only the user's own PRs. The loader's PR line uses the same function, so the app and the brief show the same numbers.\n\nDerived data the sweep adds for the app's widgets (all computed, never estimated; every helper has a unit test in `scripts\u002Ftest_brief_additions.py`):\n\n| Block | What it carries |\n|---|---|\n| `sessions[]` | `project` (repo from the cwd), `product` (its human name), `cwd`, `last_activity`, `has_handoff` (a handoff thread record exists). Other-company rows keep only times and counts. On a personal brief the person's own rows, the ones bound to no company, carry `company: \"personal\"`; rows bound to any company count as `other` |\n| `prs[]` | `closed` is null on open rows, `isDraft`, `merge_hours` on merged rows, `reviewDecision` and `reviewers` on open rows (a bounded `gh pr view`, null when it did not run) |\n| `prs_summary.by_product[]` | `{product, merged, opened, open, median_merge_hours}` for the window |\n| `releases[]` | `{product, repo, version, merged_at, url, pending_count, pending_by_day: [{day, count, theme}]}`: the latest merged Release PR per repo and the merges that landed after it |\n| `main_health[repo].red[]` | `{workflow, since, merges_on_top}`; `since` is the first red run found (carried back to the previous run's value when it was already red). `delta: {newly_red, still_red, recovered}` against the previous ready run, null when there is none |\n| `fleet` | `stuck: [{name, status, phase, since}]` (setup failed or waiting, or a status that is not resting; dormant is not stuck), `delta: {newly_stuck, still_stuck, recovered}` by name, `series: [{generated_at, stuck}]` one bucket per prior ready run. `sources.fleet.count` is the agent count |\n| `meetings[]` | only meetings whose start is inside the window, deduped by title and start (`duplicate_ids` keeps the folded ids), with `participants` (names when the list row has them), `end` and `duration_min` (null when the list row has none), `attended` (the user's own recorder took it, or the user is in the participants, the title or owns one of its synced signals) and `whose` (`mine` when attended, else `team`). The `days` rollup counts the same way: `days[d].meetings` is the user's own meetings that day and `days[d].team_meetings` the teammates' ones, never added together |\n| `meeting_signals[]` | `{meeting, title, meeting_id, start, counts, decisions[], action_items[]}`; each item is `{text, owner, mine, source_ref, cite}` |\n| `synced_signals` | `lines[]` (`{signal_id, type, text, owner, source_ref, cite, written_at, key, company}`, plus `meeting: {title, transcript_id}` for meeting refs; a row with no `source_ref` is dropped and counted in `dropped_uncited`), `lag` (null when today's index exists, else `{newest_index_date, days_behind, last_run, line}` with the last sync run from `sources\u002F_runs\u002F@{key}\u002F`), `freshness[]` (`{adapter, connection, last_synced, source}` per sync cursor: `source` is `cursor` when the cursor has `updatedAt`, `mtime` when the file time was used), `legacy_days`, `keys` (own keys), `group_keys` (group folders read), and `meetings_without_signals` (`{count, line}` when meetings fall in the window but no meeting signals were synced, else null) |\n| `timings` | wall seconds per source, for finding a slow sweep. Independent sources (sessions, meetings, synced signals, DMs, fleet, PRs) run at the same time, so their seconds overlap and add up to more than the run |\n| `dms[]` | `need_you` (looks like an ask: \"?\", \"can you\", \"please\", \"need you\", \"waiting on\"; the writer confirms each one by reading the preview), `direction` and `thread_id` (null until the inbox exposes them). `sources.dms` records `truncated` and a `note` when the 40-message page did not reach back to the window start. When the source is skipped, `dms` is null and there is no truncation note |\n| `previous_run` | `{run_id, generated_at}` of the previous ready run, found through `index.jsonl`; null for a first brief |\n| `welcome` | The welcome edition (below), or null |\n\nOn a company brief, read connected apps through `brief-data.json.synced_signals` only. The sync service has already turned Slack, Gmail, meetings and the other connected apps into signals, so the brief makes no live integration calls. Record `sources.integrations` as `{ok: false, state: \"skipped\", skipped_reason: \"read from synced signals\"}`. Use the synced data this way:\n- Every line the brief writes from a signal keeps its `source_ref`, and shows its short `cite` so the user can find the source.\n- When `synced_signals.lag` is set, write its `line` once near the top, as given (\"Signals are behind: newest index is 2026-10-25 (last sync run 2026-10-25, gmail, error).\"). Do not fill the gap by calling the apps.\n- Show `synced_signals.freshness` as one \"last synced\" marker per app.\n- When `synced_signals.meetings_without_signals` is set, write its `line` once in the meetings part (\"Signals not yet generated for 2 meetings.\"). Never show those meetings as having no decisions.\n\nWrite status `step: \"Sweeping your day\"`, from `progress: 0.25` up to `0.7`. Include the per-source `sources` map so far.\n\n### Welcome edition\n\n`brief-data.json.welcome` is set when `--welcome` is passed, or on the person’s first ready run in any mode (no earlier ready run in `index.jsonl`). Otherwise it is null. It is built from local data only:\n\n```json\n\"welcome\":{\"first_run\":true,\"headline\":\"HQ found 2,263 past sessions across 41 projects on this Mac, most of them in Claude Code.\",\n \"import\":{\"path\":null,\"scanned_at\":null,\"source\":\"detected\",\"written_at\":null,\"plans\":null,\"…\":null,\n           \"sessions\":{\"total\":2262,\"claude\":2037,\"codex\":225,\"cursor\":0,\"days_seen\":96,\"first_at\":\"2026-07-14\",\"last_at\":\"2026-10-17\"},\n           \"tools\":[\"claude-code\",\"codex\"],\"projects\":41},\n \"sessions\":{\"total\":2263,\"local\":2263,\"imported\":2262,\"claude\":2038,\"codex\":225,\"days_seen\":96},\n \"harness\":{\"primary\":\"claude-code\",\"counts\":{\"claude_code\":2038,\"codex\":225,\"cursor\":3},\n            \"action\":{\"id\":\"open-hq-in-harness\",\"kind\":\"open_harness\",\"harness\":\"claude-code\",\"label\":\"Open HQ in Claude Code\",\"launch_prompt\":\"…\"}},\n \"top_projects\":[{\"name\":\"web-app\",\"path\":\"~\u002Fcode\u002Fweb-app\",\"sessions\":310,\"last_active_at\":\"2026-10-17T21:02:11Z\",\"harness\":\"claude-code\"}],\n \"top_repos\":[{\"name\":\"web-app\",\"path\":\"~\u002Fcode\u002Fweb-app\",\"sessions\":310,\"last_commit_at\":\"2026-10-17T20:55:03-07:00\"}],\n \"recent_work\":[{\"title\":\"Fix the signup redirect\",\"project\":\"web-app\",\"at\":\"2026-10-17T21:02:11Z\",\"harness\":\"claude-code\"}],\n \"repos\":[{\"name\":\"web-app\",\"sessions\":9}],\"apps\":[\"Claude Code\",\"Codex\",\"Cursor\"],\n \"tree\":{\"companies\":2,\"projects\":14,\"knowledge_files\":380},\n \"actions\":[{\"id\":\"connect-company\",\"kind\":\"connect_company\",\"label\":\"Create or join a company\",\"reason\":\"…\",\"launch_prompt\":\"\u002Fonboard\",\"primary\":true}],\n \"next_steps\":[{\"id\":\"connect-company\",\"kind\":\"connect_company\",\"reason\":\"…\"}]}\n```\n\nField names live in one constant block in `brief-sweep.py` (`WELCOME_FIELDS`, `WELCOME_SESSION_FIELDS`, `WELCOME_PROJECT_FIELDS`, `WELCOME_REPO_FIELDS`, `WELCOME_RECENT_FIELDS`, `WELCOME_TREE_FIELDS`, `WELCOME_ACTION_FIELDS`, `WELCOME_ACTION_KINDS`). The desktop app hides any absent field. `first_run`, `import`, `sessions`, `repos`, `apps` and `next_steps` keep their earlier meaning.\n\n- `headline`: one plain sentence about the person's own past work. Its project count leaves out folders with a session in another company. With zero sessions it is the first-steps line instead.\n- `import` (fields in `IMPORT_FIELDS`): `{path, scanned_at, source, written_at, \u003Ccounts>, sessions, tools, projects}`. With a report it comes from the newest `workspace\u002Fimports\u002F\u003Cstamp>\u002Freport.json` (see \"Import report contract\" below): `scanned_at` is the folder's UTC time (`2026-10-19T15:00:28Z`; the report's `scan_id` is never copied), `source` is the report's `source` (`desktop-tree-step`, else `import-context`), the per-category counts are `plans`, `commands`, `skills`, `hooks`, `policies`, `agents`, `claude_md`, `settings_fragments`, `mcp_servers`, `knowledge_dirs`, `claude_repos` and `conversations` (session stores, not sessions), `sessions` is `{total, claude, codex, cursor, days_seen, first_at, last_at}`, `tools` lists the harness ids found, and `projects` is how many project names the report lists (the names are never copied, because the report covers every company). Counts are non-negative integers; a negative, boolean, decimal or text value reads as 0 (null inside `sessions`). Without a report, when any session other than the one running the brief is on this Mac, `source` is `detected`, `path`, `scanned_at`, `written_at` and the counts are null, and `sessions`, `tools` and `projects` come from the machine inventory (`total`, `claude` and `codex` leave out the running session; `first_at` and `last_at` are dates; `projects` leaves out folders with a session in another company). Past sessions are the inventory's transcripts, so an HQ-started session and its transcript count once. The session running the brief is read from `CLAUDE_CODE_SESSION_ID`, `CLAUDE_SESSION_ID`, `CODEX_THREAD_ID` or `CODEX_SESSION_ID`. When none of those ids is in the inventory, a transcript written to in the last 10 minutes is treated as the running session and left out. Null only when there is no report and no other session.\n- `sessions`: `local` counts every session on this Mac, one per session id: HQ-started sessions, every Claude Code transcript (under `~\u002F.claude\u002Fprojects` and the `CLAUDE_CONFIG_DIR` projects folder), every Codex rollout (`CODEX_HOME`, else `~\u002F.codex`) and every Cursor workspace with chat state (one each). `imported` is `import.sessions.total` (0 when the report has no session total). `total` is the larger of the two. `claude`, `codex`, `cursor` and `days_seen` are counted across all of them.\n- `harness`: `primary` is the harness with the most sessions (null with none); `counts` covers `claude_code`, `codex` and `cursor` (Cursor counts workspaces with chat state). `action` opens HQ in that harness. Harness ids are hyphenated (`claude-code`, `codex`, `cursor`) in `harness.primary`, `harness.action.harness`, `top_projects[].harness` and `recent_work[].harness`. The underscore keys appear only inside `harness.counts`.\n- `top_projects` (up to 5): working folders ranked by sessions, then newest activity. `top_repos` (up to 5): the git repos those folders sit in, with the newest commit time. `recent_work` (up to 5, newest first): session titles, at most 80 characters, with their project and harness. A title is the Claude Code custom title or summary, or the Codex thread name; the first prompt line is the last resort. The filter is safe by default: a title is never shown when it names a credential (password, passwd, passphrase, passcode, pwd, secret, token, api key, bearer, private key, access key, auth, credential, creds, key, pass, pin, otp, 2fa, mfa, pw, cred, and passwort, contraseña or mot de passe), sets a name that holds pass, key, pwd, pw, cred, secret, token, auth or pin (such as DBPASS=), holds a known API key prefix, a private-key header or a URL with a password, or holds a hex run of 24+ characters, a run of 16+ letters and digits mixed, or a base64\u002Fbase62 run of 20+ that has a digit or capital letter. Full-width letters and accents are folded first. That session reads \"Session in \u003Cproject>\". Session-row titles from the registry, lane and thread fields go through the same filter; a secret-looking thread title leaves the registry title in place. `top_projects[].path` starts with `~\u002F` inside the home folder and is the folder name only outside it.\n- `tree`: companies in this HQ, plus projects and knowledge files of the brief's own scope.\n- `actions`: each is `{id, kind, label, reason, launch_prompt, primary}`. `kind` is one of `open_harness`, `connect_ai_apps`, `connect_integration`, `connect_company`, `import_history`, `open_tree`. `import_history` (\"Bring in your past work\") appears only when `import` is null: no report and no session other than the current one. `open_harness` adds `harness`; `connect_integration` adds `integration: {slug, name}`; `connect_ai_apps` has no `integration`. Exactly one action has `primary: true`: `connect_ai_apps` with zero sessions, else `import_history` when `import` is null, else `connect_company` when there is no company, else `open_harness`.\n- `getting_started`: set only when there are zero sessions, or with the membership copy below.\n- Company isolation: every session is counted, but names, paths and titles come only from the brief's own company (and the person brief's included companies). Each session's company comes from the scan row, then its HQ `meta.yaml` `company_slug`, then a folder under `companies\u002F\u003Cslug>`; a folder under `companies\u002F\u003Cslug>` is that company's even when the session is recorded as personal. A folder is named only when every one of its sessions resolves to an included company. A session inside HQ with no record of its company (the HQ root, `repos\u002F`, worktrees) is counted and never named, and so is a repo whose GitHub owner is another company's `github_org`.\n- Reads are bounded: a 30-second inventory budget (sessions past it are still counted, without their project), at most 60 project folders checked, 5-second git reads within a 30-second git budget (past it, repos are not named), title reads within a 20-second budget (at most 1 MB from the start of a long transcript and 16 MB of the Codex thread index), and 20,000 tree entries. The whole welcome step stays well under 3 minutes.\n- `next_steps` holds `connect_company` (no company), `import` (only when `import` is null), and `connect_integration` and `sync` (company briefs).\n- On failure, `welcome` is `{first_run, note}` with one plain `note` (\"Couldn't read welcome history.\") and the rest of the brief is unaffected. A partly read inventory, or a failed title or tree read, adds a plain `note` and leaves that part out. Exception text never appears in `welcome`; it goes to stderr.\n\n#### Import report contract\n\nAgreed between Core and Desktop on 2026-10-19.\n\n- Writer: Desktop. At the end of the tree step, the desktop writes `\u003Chq>\u002Fworkspace\u002Fimports\u002F\u003CYYYY-MM-DDTHH-MM-SS>\u002Freport.json` atomically from the scan's done summary. Later, `hq import scan --output \u003Cpath>` can take over the write with the same shape. `\u002Fimport-context` keeps writing `\u003Chq>\u002Fworkspace\u002Fimports\u002F\u003CYYYYMMDDTHHMMSSZ>\u002Freport.json`. Both folder names are UTC times. A second import in the same second adds `-2`, `-3`, ... to the folder name. The reader parses both formats into UTC times, sorts by time and then by the numeric suffix (the base name counts as 1), and skips folders that match neither format.\n- Fields: the existing `{scan_id, counts{the 12 keys}, categories, discovery{ok, errors}}`, plus `sessions{total, claude, codex, cursor, days_seen, first_at, last_at}`, `tools[]` (harnesses found), `projects[]` (top project names, never paths), `source: \"desktop-tree-step\"` and `written_at`.\n- Reader limits: a `report.json` over 1 MB, nested deeper than 32 levels, not UTF-8 or not a JSON object is skipped and the next newest report is tried. A symlinked `imports` folder, stamp folder or `report.json` is not followed. Reading never fails the brief: with no usable report, direct detection applies.\n- Reader: prefer `sessions.total`. An older report has no `sessions` block; its total is the sum of `categories.conversations[].sessions`. `counts.conversations` counts session stores and is never used as a session count. Missing fields are tolerated.\n- Transcripts stay where the harness wrote them. With no report, direct detection uses the machine inventory.\n- Once a report exists or any session other than the current one is found, the welcome edition never shows \"Bring in your past work\". Project names shown in the brief still go through the title filter and company isolation.\n\nKeep one welcome block at the root of a person brief; never duplicate it in company or personal sections. Suggest connecting a company only when membership lookup confirms zero companies. A failed lookup still shows the getting-started copy with one plain source error line. A failed company pass leaves a plain error in its own section and does not stop other passes. Status progress updates after each pass. History reads open at most the newest 14 candidate run files.\n\nFor zero memberships or a failed membership lookup, include this getting-started copy verbatim: \"HQ brings your work, shared context and AI tools together. Start with a personal task, then create or join a company with \u002Fonboard when you are ready.\"\n\n## Step 4. Synthesize brief.json\n\nFirst start housekeeping in the background (Step 5's command), so it runs while you write. Then turn `brief-data.json` and the prefs into these items. The reader is the person the brief is for, who may not be a developer. Every list holds **at most 5 items**, and only things that truly need them.\n\nFor `mode: person`, apply the synthesis below separately to `personal` and each `companies.\u003Cslug>` section. Preserve those sections in `brief.json`, copy `not_included`, and keep every item’s company. Run `brief_rank.py --check` on the aggregate; inspect every section report and require no `isolation_problems` and no `welcome_problems`. Company PRs remain in their company sections, rather than being dropped from the person brief. Use only the previous person run for carry-over, matching both company and item identity. Record `mode: person` in the ready index entry.\n\n### Status while writing\n\nThe writing step must never go quiet. Before each section, append an activity entry to `status.json` and move `progress`, so the app never goes more than about 30 seconds without a new entry. Use these labels and progress values, in order:\n\n| Activity label | progress |\n|---|---|\n| Writing decisions | 0.72 |\n| Writing what shipped | 0.78 |\n| Writing problems | 0.83 |\n| Writing meetings | 0.87 |\n| Writing priorities | 0.91 |\n| Housekeeping | 0.95 |\n\nMark the previous entry `done` with a plain detail (\"4 decisions\") when the next one starts. If a section takes longer than 30 seconds, update its `detail` (\"3 of 5 written\"). The Housekeeping entry is the one `housekeeping.py` writes; if it has not finished, add the entry yourself as `running` and let the script complete it. Read the clock in the same command that writes each entry.\n\n### Item fields\n\nEvery item carries `id` (short and unique within the brief, like `d1`, `p2`, `m3`), `title`, `why`, `company` (the slug, or null on a personal brief), `product` (the human name, see Product names), `source` (where it came from), and `origin: {repo, number, url}` when it comes from GitHub. Actionable items also carry `unlocks[]`, `people_waiting` (a count), `revenue` (true when money waits on it), `effort` (`quick`, `medium` or `large`), `risk`, `age_hours` and `prompt`. The app shows the company logo and the `product` label, never a repo chip.\n\n`age_hours` is always computed from a timestamp in `brief-data.json`, never estimated: the meeting start, the PR `created`, the earliest matching DM `at`, or the `since` of a red workflow (the first prior run that listed it red). `source` is required on decisions and incidents: `meeting_signals`, `synced_signals`, `dms`, `main_health`, `prs` or `fleet`. An item from a signal also carries its `source_ref`. The app folds the sweep's own red-main risk into the decision or incident with `source: main_health` on the same repo or product, so write exactly one item per red repo.\n\n`action` is required on every decision and names the kind of call, which decides the button the app shows and how the picker treats it:\n\n| `action` | When |\n|---|---|\n| `cut` | Drop or hold work: cut a change from a release, stop a project, skip a run. A `cut` with `source: prs` is the release call, so the Release train card yields to Needs you. |\n| `go` | Approve something ready: merge, ship, deploy, sign off, say yes. |\n| `decide` | Pick between options; carries `choices: [a, b]`. |\n| `reply` | Answer a person: a DM, a question from a meeting, an email. |\n| `prep` | Get something ready before a call or a deadline: read, draft, review. |\n\nThe app defaults a missing or unknown `action` to `decide`; `brief_rank.py --check` reports it under `field_problems` so it never ships that way.\n\n### Root fields\n\n- `today`: `YYYY-MM-DD` local, copied from `brief-data.json.window.today`. The app's only weekday source; never derive it from `generated_at`.\n- `prefs_applied.widgets`: `{pinned: [kind], muted: [kind], weights: {kind: -2..2}, density: auto|calm|full}` copied from `brief-prefs.yaml` (`pinned_widgets`, `muted_widgets`, `widget_weights`, `density`). `sunrise`, `needs` and `catchup` may not be muted: drop the entry and add one `learned_notes` line saying so. Clamp weights to -2..2 with a note. `brief_rank.apply_widget_prefs` does both.\n- `mode`: `company` or `personal`, copied from `brief-data.json.mode`. Write `mode` and `company` on the run's `index.jsonl` line too.\n- `welcome`: copied from `brief-data.json.welcome` when it is set; omit it or write null otherwise. The writer may shorten each `next_steps[].reason` but adds no new steps. On a first run where `welcome.sessions.total` is above 0, the brief writes no empty-state lines anywhere: no \"Nothing owed\", \"No sessions\", \"Nothing needs a call from you today\" or similar. Lead with the person's own work from `headline`, `top_projects` and `recent_work`, and turn quiet lists into the `actions` (primary first). The first brief has no technical sentences.\n- `week`: `[{date, sessions, meetings, merged, opened, beat?}]`, the last 7 local days of the active company (or of the person's own work on a personal brief), copied from `brief-data.json.days` (that is what `--days 7` is for). `meetings` there is the user's own meetings only; never add `team_meetings` into it. `beat` is optional: `{kind: turn|crisis|resolution|push, label, evidence}` where `crisis` is the day an incident opened, `resolution` the day something in `items.recovered` recovered, `push` the day with the most merges, and `turn` the event that led into the crisis. One beat per day at most.\n- `landed_days`: `[YYYY-MM-DD]` days in `week` with at least one merged PR or release.\n- `time_to_clear_min`: the sum over decisions of effort minutes (`quick` 2, `medium` 6, `large` 15).\n\n### Titles and why\n\nThese rules apply to decisions, incidents (problems), watch, waiting and priorities.\n\n- `title` is the ask in plain English, the way a person would say it. Verb first, 8 words or fewer. No repo names, PR numbers, conventional-commit prefixes (`feat(...)`, `fix:`), file paths, flags or code. Good: \"Approve the desktop 0.11.3 release\", \"Decide: can cloud placeholders ever count as deletes?\", \"Unblock Jamie's billing dashboard\", \"Fix the red release gate on staging\". Bad: \"web-api #919: feat(sync): cloud-only placeholders\".\n- The repo, PR number and URL go in `origin`, and may be named in `why` or the prompt, never in the title.\n- `why` is one plain sentence a non-engineer understands: what it is, who is waiting, and what happens if it waits.\n- Shipped groups use product names too: \"Desktop app: 17 changes shipped\", not \"desktop-app: 17 merged\".\n\n### Product names\n\nUse human product names everywhere instead of repo slugs. They come from data files, never from the skill itself:\n\n- `companies\u002F\u003Ccompany>\u002Fsettings\u002Fbrief-products.json`, read on a company brief only.\n- `workspace\u002Fbrief\u002Fproducts.json`, the person's own names. It wins when both files name the same repo.\n\nEach file is a JSON object of repo slug to product name, for example `{\"web-app\": \"Web app\", \"billing-api\": \"Billing\"}`. A file that is missing or does not parse is ignored. An unknown repo becomes its slug in plain words (\"some-new-repo\" becomes \"Some new repo\"). `scripts\u002Fbrief_rank.py` (`load_product_names`) reads the files, and each PR row in `brief-data.json` already carries `product`.\n\n### Lists\n\n- **decisions:** only these four kinds:\n  - (a) DMs from humans (not `agt_` senders) asking the user something;\n  - (b) PRs where the user is the author (`authored_by_me`) or an explicitly requested reviewer (`review_requested`), or whose title starts with Release (`is_release`), or that block a release. A PR they did not author and were not asked to review is never a decision on other grounds;\n  - (c) red main-branch workflows (`main_health[*].red`);\n  - (d) meeting action items and questions assigned to the user (`mine: true` in `meeting_signals[*].action_items`).\n  Rank by what each one unblocks (`people_waiting`, `unlocks`, `revenue`), then by age. Keep the top 5. Everything else goes to **shipped**, **incidents** or **watch**.\n  Each decision also carries:\n  - `blocks`: `[{who, what, kind: person|work, origin?}]`, the people and work waiting on the call: DM askers, action-item owners waiting on it, \"held until\" items, PR authors awaiting the user's review. Names only inside the locked company. Without named blocks the app says \"unlocks N things\", never \"people\", so leave `blocks` empty rather than guess.\n  - `action`: one of `cut`, `go`, `decide`, `reply`, `prep` (see Item fields). Required.\n  - `choices`: `[a, b]` when `action` is `decide`, two words each (\"Ship Monday\", \"Hold a week\").\n- **waiting:** things the user asked for that have no answer yet, and the user's PRs waiting on review. At most 5. Each row is a person and a thing: `who` (the first name, or the agent's name) and `what` (what you wait for, plain: \"to review the pricing page\", \"an answer on the memo folder\"), plus `age_hours`, `kind` (`dm`, `review`, `handoff` or `other`) and `origin`. The app reads `title` as `what` when `what` is missing but drops a row with no `who`, so a wait with nobody to name is not a wait; `brief_rank.py --check` reports a row missing `who` or `what` under `field_problems`. `what` follows the title rules (no repo names, PR numbers or prefixes).\n- **shipped:** merged PRs grouped by product and theme, plus releases and deploys. Mark firsts. Counts come from `prs_summary` (see Counts). Each row carries `id` (`s1..`), `product`, up to 5 `highlights` (plain lines, no PR numbers or commit prefixes, one per change or theme) and `merge_hours_median` for the rollup (copy `prs_summary.by_product[].median_merge_hours`). The app merges rollup rows onto the sweep's per-product counts by `product`, so rollup titles use the product name exactly.\n- **incidents** (the app calls them problems): red main branches, agents that are not active, risk signals, and outages named in sessions. At most 5. A missing or empty `workspace\u002Fbrief\u002F` with a sibling `workspace\u002Fbrief-backup-*` folder is a deliberate reset and never an incident (Step 2).\n- **watch:** open PRs and threads worth knowing about that do not need the user yet. At most 5. Each carries `kind` (`ci`, `pr`, `thread` or `fleet`) and an optional `prompt`.\n- **people:** the latest work-level status for each teammate, with agents labeled. Use a summary, never the message text, unless the item is marked very important. Each carries `uid` (`prs_` or `agt_`), `load` (`clear`, `steady`, `heavy` or `storm`: `storm` owns an incident or a red main, `heavy` has 3+ meetings or 2+ open asks), `owes` (plain action items they own, from meeting signals and DMs) and `thanks` (one plain line about a win, or null).\n- **meetings:** lead with the user's own meetings (`whose: mine`). Teammates' meetings (`whose: team`) get no item of their own; mention them only as one plain count line (\"4 team meetings you weren't in\") or when one carries an action item the user owns. Only meetings whose start is inside the window (`brief-data.json.meetings[]` is already filtered to `window.attended_meetings_from..sessions_to`, deduped, and marked `attended`); a catch-up brief widens that to the gap. Each meeting item carries:\n  - `attended` (copied), `duration_min` (copied), `with`: the other participants in plain words (\"Robin Bell\", \"Alex and Jamie\");\n  - `decided`: up to 3 lines from `meeting_signals[*].decisions[*].text`, each shortened to one plain line;\n  - `todo`: up to 3 `{text, owner, mine}` from `action_items`, the user's own first.\n  The app's meeting hover shows the title, the decided lines and the to-do lines (the user's own marked), nothing else. Every action item with `mine: true` is also a decision candidate under (d), with a launch prompt. Meeting signals cover only signals synced inside the window, so an older meeting's action items appear only while they are inside it.\n- **carry:** open items from the last brief that are still open. Each carries `carried_from` (the last run id), `carried_since` (the `created_at` of the first run that listed it, from `index.jsonl`), `briefs` (consecutive runs it has appeared in, chained through `origin.url` or `origin.number`, else the normalized title, using the last brief's own `carry` rows), `item_id` (today's decision or incident that continues it, or null) and `prompt`.\n- **handoffs** (new): `{id: h1.., object, from, to, me, production, since, receipts: {access, ack, active}, note, company, product, origin, prompt}`. From DM ownership verbs (owns, handed, took over, needs to acknowledge), `\u002Fdelegate` events and board assignee changes. `me` is true when the user is the receiver; `production` when the object is live. Each receipt is `true`, `false` or `null` (unknown); `access` stays null unless a grants source exists. `note` is work-level, never message text. `object` follows the title rules.\n- **recovered** (new): `{id: f1.., title, what, at, source: main_health|fleet|session, company, product, origin, timeline?: [{at, text}], post_incident?: {broke, did, changes}}`. From `brief-data.json.main_health[*].delta.recovered`, `fleet.delta.recovered`, and outages a session names as closed. `at` is the run's `generated_at` when nothing more precise exists.\n- **releases** (new): `{product, version, released_at, pending: [{day, count, theme}], pending_count, held: [{title, why}], light: ok|warn|red, prompt, origin}`. Copy `brief-data.json.releases[]` (`merged_at` → `released_at`, `pending_by_day` → `pending`); `held` lists decisions whose `why` says the work is held until the release; `light` is `red` when the repo's main is red, `warn` when `pending_count` is 3 or more or the release is older than a day, else `ok`.\n- **reminders** (new): `{id: r1.., text, said_at, where, due_at, prompt}`. From `hq dm` reminders the user sent to themselves; later from \"remind me\" lines once outbound DM history is in the sweep. `text` is the user's own words, verbatim, and is exempt from the title lint.\n- **other_company:** a count only.\n\n### Counts\n\nThe brief's merged and opened numbers come from `brief-data.json.prs_summary` (`merged`, `opened`, `open`): the 24-hour window (`window.hours`), the user's own PRs. The loader shows the same numbers. Never add up `days` for these: the `days` rollup buckets by local date and is only for the week arc.\n\n### Priorities\n\n`priorities` is an ordered list of at most 5 one-line directives for the day:\n\n```json\n\"priorities\":[{\"rank\":1,\"text\":\"Give Alex a go\u002Fno-go on desktop 0.11.3\",\"item_id\":\"d2\",\"because\":\"the release waits on the answer\",\"score\":3}]\n```\n\n- Derive them strictly from decisions and incidents already in the brief. Add no new facts.\n- Rank by how many people or how much revenue each unblocks, then by age, then by effort. A quick win goes last unless it unblocks someone. `brief_rank.py --check` returns this order from the item fields; follow it unless you can state the reason in `because`.\n- `item_id` must be the id of an item in `items.decisions`, `items.incidents`, `items.handoffs` or `items.carry`. `--check` reports a dangling id under `dangling_priorities`; fix it or drop the priority.\n- `score` is the unblock score `--check` prints under `scores` for that `item_id` (people waiting + things unlocked, revenue counts double). Copy it; `priority_problems` reports a missing or different value.\n- `text` follows the title rules. `because` is one clause.\n- `lead_hint` starts with priority 1's `text` verbatim, then one clause: \"Sign the renewal contract first; the vendor and the launch date wait on it.\" The hero quotes it, so the first clause must match exactly (`--check` reports `lead_hint_problem` otherwise).\n\n#### How the app uses priorities\n\nEach priority pulls the card that contains its item onto the grid (the decisions card for a decision, the problems card for an incident, the handoffs or carry card for those), and the card's reason sentence quotes the priority's `text` in the writer's words: \"Shown for priority 1, \"Sign the renewal contract\": it and 4 more calls wait on you.\" So `text` must be the exact directive, not a summary, and `because` one clause that reads after it. The needs rows are ordered by priority rank first, then by what they unblock, so the ranks are the order the user sees.\n\n### Prompts\n\nEvery actionable item gets a `prompt` that starts a Claude, Codex or Grok session. The prompt must:\n- name the exact repo, PR, commit or person\n- say what to check first\n- say what done looks like\n- end by showing the result before anything irreversible\n\nUse the user's `engine` preference as the default. Then apply the preferences: boost VIP people and repos, drop muted items, and treat `density` as a ceiling (never above 5 per list).\n\n### Write and check\n\nWrite `brief.json` as `{run_id, generated_at, today, mode, company, window, catch_up, lead_hint, priorities, counts, week, landed_days, time_to_clear_min, items, prefs_applied, learned_notes, welcome}`, where `company` copies `brief-data.json.company` (null on a personal brief), `counts` copies `prs_summary` and `prefs_applied` holds `density`, `engine`, `vip_people`, `muted` and `widgets`. Then run:\n\n```bash\npython3 -I .claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief_rank.py --check workspace\u002Fbrief\u002F\u003Crun_id>\u002Fbrief.json\n```\n\nFix every `title_problems` entry (it now covers `shipped[].title`, `shipped[].highlights`, `handoffs[].object`, `recovered[].title`, `releases[].held[].title` and `waiting[].what`; reminders are exempt), every `field_problems` entry (a decision without a valid `action`, a wait without `who` or `what`), every `over_cap` list, every `dangling_priorities` and `priority_problems` entry, `lead_hint_problem`, `widget_problems`, `today_problem` and `welcome_problems` (empty-state lines on a first run with sessions, or exception text in `welcome`), and write the file again. Write status `step: \"Writing your brief\"`, `progress: 0.9`.\n\n## Step 4b. Write the page\n\nThe desktop app draws the brief as cards from `brief.json.page`, a BriefPage. Write it after `brief.json` passes `brief_rank.py --check`, from the same data. The page is optional and additive: everything in Step 4 stays as it is.\n\n### Frame and candidates (deterministic)\n\n```bash\npython3 -I .claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief_page.py skeleton \\\n  --data workspace\u002Fbrief\u002F\u003Crun_id>\u002Fbrief-data.json --person \"\u003Cfirst name>\" \\\n  --hq-root \"$PWD\" --out workspace\u002Fbrief\u002F\u003Crun_id>\u002Fpage-draft.json\n```\n\n`page-draft.json` holds `page` (the frame) and `candidates`. The frame already has `version`, `companies` (each included company by slug with its manifest name, plus `personal`), `person`, `window` (`from` is the previous brief, `hoursAway`, `zoom` and a plain `label`), `theme: {style: \"merged\"}`, the lead card with the window's real numbers (your meetings, people waiting on you in DMs, your to-dos when there are any, the \"your day\" line of your meetings, work sessions and asks, and chart labels in local time such as \"Fri morning\" or \"Mon 3 pm\"), and the cards beside the lead with real data and empty titles. Each candidate is one card's worth of computed facts: `company`, `type`, `kind`, `size`, `symbol`, `data` (hours from timestamps, counts from rows, people), `drill.signals`, `facts`, `rank`, and for asks `dropped_candidate` (waited a day or more) and `basis` (`sender` when the DM's company came from its sender). Candidates come ranked, most important first: cards about people, meetings and tasks first (dropped-ball candidates by longest wait, then asks, your tasks, meetings, broke), then cards whose evidence is only PRs or CI (review requests, red builds, stalled and merged PRs). Most people do not run builds: keep PR and CI cards in the stream, never the lead or the summary band, and write the lead's headline about people, meetings and decisions rather than merges. A suggested `data.visual` is kept only when the card holds what that drawing reads.\n\nPeople's names are display first names. The sweep resolves each DM sender (`from_name`) and PR author (`author_name`) from the member list of that section's own company only (the personal section uses none), the GitHub profile name of a login, a full name on a member list whose login shape matches, or an email of the form first.last. A handle is kept only when nothing resolves.\n\n### What you write\n\nTurn candidates into cards. You choose which cards appear, their title, `why`, kind, size and order, and you may merge candidates (two asks from one person) or drop them. You never add a number or a fact that is not in a candidate or in `brief-data.json`.\n\n- **The lead.** `summary[0]` is the frame's lead card: kind `focus`, size `XL`, type `summary`. Write its `title` and `data.headline` (one short line about where today's attention goes, with an `accent` word) and up to three `data.bets` (`{label, symbol, share, itemId}`, shares summing to at most 1, `itemId` naming a card on the page). Keep its stats, spark and chart labels. Chart labels anywhere on the page read like \"Fri morning\" or \"Mon 3 pm\", never a timestamp.\n- **Beside the lead.** The lead takes four of the six columns and two rows, so the summary band needs cards that fill the other two columns by two rows with no gap: M + S + S, M + M, or one L (S is 1 cell, M 2, L 4; 4 in all). The frame already has them: the people waiting on you in one company, and counts that span the page. Write their titles. You may swap one for a better card from the candidates, but keep the band at exactly 4 cells. A count-only summary card may leave `company` out; a card that names a person or quotes anyone carries its company.\n- **Caps are hard.** The app draws at most 5 dropped balls and 12 stream cards and drops the rest without a \"+N more\", so fill each band in rank order and leave out what does not fit.\n- **Dropped balls.** At most 5, longest wait first: asks where this person is the one not moving (`dropped_candidate`, carry-over items still open, owed meeting actions). Each is kind `ball`, type `dropped`, size `M`, with `data.pickup` (the one-press action in plain words, such as \"Reply to Ann about the memo\"), `data.hours` and `data.people`. Zero dropped balls is a real result: leave the band empty.\n- **The stream.** At most 12 cards, ranked by how much this person would care, size following rank (L for the top one or two, then M, then S). At most 3 per type.\n- **Colour is meaning, so do not set `field`.** The type picks the colour, one meaning each: pink dropped, sunset broke or due (a launch, or a task due within 7 days), violet your move (asks, client, your tasks), teal landed or learned, graphite for the record (decided, moved, stalled, meetings, waiting on someone else). A card whose type does not fit its meaning gets a different type, never a different colour.\n- **Every card carries its company:** the candidate's slug (`personal` for the person's own work), which must be a key of `page.companies`. A card holds one company's facts only. Never name one company's people, work or words on another company's card, and never merge candidates from two companies into one card. Treat a `basis: sender` ask with care: if its words are clearly about another of the person's companies, leave it out.\n- **A drawing holds real information.** Set `data.visual` only to a recipe the card can fill: `clock`, `dial` and `tide` need `hours`; `letters` and `lock` need a person (`mailbox`, `constellation` and `drawers` two or more); `tally` and `stack` a whole `value`; `sparkline` 3 or more `spark` points (`skyline` 4 or more); `checklist` 2 or more `steps`; `track`, `fuse` and `rocket` steps, milestones or days; `compare` hours with `usual`, or 2 to 5 `bars`; `trace` and `breaker` a `to`; `agenda` a meeting; `fork` and `switch` a decided or moved note; `bell` a landed note; `book` a learning note; `siren` and `lighthouse` a broke `value`. Leave `visual` out when unsure, and the app picks one and varies the page. Name the same drawing at most twice a page, and at most 3 pixel scenes and 2 iso objects.\n- **Names.** Use the candidate's people names as given (resolved first names). Never write a login or handle when the candidate, `from_name` or `author_name` has a name; `check` warns on handle-looking names.\n- **Titles** follow the Step 4 title rules: verb first, 8 words or fewer, product names, no repo names, PR numbers, prefixes or paths. `why` is one sentence for this reader.\n- **Drill-in.** `drill.signals` (at most 4, `{source, text, at}`, `source` one of dm, meeting, session, pr, ci, calendar, task, email, analytics, doc), `drill.prompt` (the item's launch prompt from Step 4, same rules) and `drill.bot` (one line for Ask my bot). Summarize DM text in your own words; quote at most a short phrase in `data.quote`.\n\n### Check and attach (fail soft)\n\nWrite the page to `workspace\u002Fbrief\u002F\u003Crun_id>\u002Fpage.json`, then:\n\n```bash\npython3 -I .claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief_page.py check workspace\u002Fbrief\u002F\u003Crun_id>\u002Fpage.json\n```\n\nFix every error and check again, at most twice. Then attach it:\n\n```bash\npython3 -I .claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief_page.py attach \\\n  --brief workspace\u002Fbrief\u002F\u003Crun_id>\u002Fbrief.json --page workspace\u002Fbrief\u002F\u003Crun_id>\u002Fpage.json\n```\n\n`attach` validates again. A valid page is written into `brief.json` as `page`. An invalid or missing page is left out, every other field of `brief.json` stays as it was, and the reasons go to `brief.json.page_problems` and stderr. Never fail the brief because of the page; add a `learned_notes` line when it was left out. `brief_rank.py --check` also reports `page_problems` for a page already in `brief.json`.\n\n## Step 5. Housekeeping\n\nHousekeeping runs every time, through one script. Start it in the background at the beginning of Step 4 so it runs while you write; it never blocks `brief.json`. Do not run the checks by hand, and do not skip the script.\n\n```bash\npython3 -I .claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fhousekeeping.py \\\n  --company \u003Ccompany> --hq-root \"$PWD\" --run-dir workspace\u002Fbrief\u002F\u003Crun_id>\n```\n\nIn person mode, run housekeeping separately for personal and each included company, writing into separate temporary run directories and copying each result into its matching section. This keeps company worktree paths within their own section. Never run company housekeeping for an excluded company. On an explicit personal brief, leave `--company` off. The doctor and sync checks need a company, so the script records both as `skipped` with the reason `needs a company` and runs only the worktree scan.\n\nThe script runs the every-run checks in parallel, each under a hard time budget, with stdin closed and every prompt pre-answered:\n\n| Check | Command | Budget |\n|---|---|---|\n| `hq_doctor` | `hq doctor --json --company \u003Ccompany>`. Exit 1 only means some checks fail; the run still counts as finished | 40s |\n| `hq_sync` | `hq sync now --company \u003Ccompany> --on-conflict abort --lock-timeout 0`. Never prompts, never overwrites, never waits on the HQ Sync app's lock | 30s |\n| `worktree_scan` | read-only `git status` and `git log -1` in each `workspace\u002Fworktrees` checkout | 20s |\n\nA check that reaches its budget is stopped (SIGTERM, then SIGKILL) and recorded as skipped. Every task ends with exactly one status: `ran clean`, `found N things`, `skipped (took too long)` or `failed: \u003Creason>`. The script writes `housekeeping.json` (`tasks`, `notes`, `headline`, `proposals`) and `status.json.housekeeping`, completes the \"Housekeeping\" activity entry, and never prints command output or secrets. Use its `headline` as the Housekeeping card's line, unchanged. Never write \"did not finish\" or \"not run\" for a check the script reported otherwise.\n\nThe script also adds the deliberate-reset note when it applies (\"Brief history was reset on purpose; the old briefs are backed up in workspace\u002Fbrief-backup-…\"). That one line in `notes` is the only place a reset appears.\n\n**Optional checks.** Only when time allows, each recorded in `tasks` with one of the four statuses: search reindex (`qmd update`) when content changed since the last brief; `\u002Fgarden` audit-only, weekly; stale-session scan (working state, no `\u002Fhandoff`, older than 24h); orphan-process scan (HQ-related processes with no live parent, ranked by memory); error harvest (repeated failures in HQ logs and hook errors since the last brief). The error harvest ignores a missing or reset `workspace\u002Fbrief\u002F` when a `workspace\u002Fbrief-backup-*` folder sits next to it.\n\nHousekeeping never deletes files, kills processes, removes worktrees or files bugs.\n\n**Proposals.** Anything destructive or outward-facing becomes an item in `housekeeping.json.proposals` with a launch prompt. Add proposals to the file the script wrote and keep its `tasks`, `notes` and `headline`. The brief shows these on a Housekeeping card, and the user starts each one:\n- Hand off and archive stale sessions.\n- Quit orphan processes. List the PID, command, memory and why each looks orphaned. Never include the user's own apps or HQ.app.\n- Remove idle worktrees listed in `tasks.worktree_scan.detail.stale_paths`, after confirming each is merged and has no unpushed commits.\n- File one bug per distinct repeated error through `\u002Fhq-bug`, with the log excerpt.\n- Apply garden fixes.\n\nEach proposal states, in plain words, what it frees or fixes and its risk.\n\n## Step 6. Finish\n\n- Write status `state: ready`, `progress: 1.0`, as soon as `brief.json` is written and Step 4b's `attach` has run (it never blocks: a failed page is simply left out). Housekeeping updates `status.json.housekeeping` afterwards without changing `state`.\n- Append the run to `workspace\u002Fbrief\u002Findex.jsonl`.\n- Print one line: `BRIEF READY \u003Crun_id> \u003Cpath to brief.json>`. The desktop app watches `status.json` and shows the notification.\n- When run outside the app, also send the user a short HQ DM to themselves: \"Your daily brief is ready.\"\n\nIf any step fails, write `state: failed` with a plain-language `error` and stop. Partial files are fine, because the app shows what it has and marks what is missing.\n\n## Learning, weekly\n\nWhen `brief-log.jsonl` has 7 or more days since the last fold, fold it into `brief-prefs.yaml`:\n- If a widget is dismissed 3 or more times in a row, `widget_weights[kind] -= 1` (floor -2).\n- If sessions are launched from one widget 3 or more times in a week, `widget_weights[kind] += 1` (ceiling +2).\n- If the user says \"always show X\", add the kind to `pinned_widgets`; \"never show X\" adds it to `muted_widgets`.\n- Refuse to mute `sunrise`, `needs`, `catchup` or the priorities list: leave the prefs unchanged and add a `learned_notes` line saying why.\n- If an engine is chosen 70% of the time or more, make it the default.\n- If a sender's items are always launched, mark them VIP.\n\nAdd each change as one plain line to `learned_notes`, so the next brief can say what changed.\n\nThe app appends to `brief-log.jsonl` through a host command that writes only that file (`append_brief_log_line`, HQ Desktop 0.11.7 and later). One JSON object per line, keys in this order: `at` (ISO time), `event`, `run_id` (the run folder name, or null for a brief with no run), then only the fields the event carries: `kind` (the widget kind from the catalogue), `item_id`, `engine` (`claude`, `codex` or `grok`), `widgets` (a list of kinds). Events: `shown` once per run with `widgets` (the cards on the page); `dismiss` when the person cleared an item without a launch (`item_id`, `kind`); `launch` when a prompt started a session or was copied (`item_id`, `kind`, `engine`); `pin` and `hide` with `kind`. Decisions and action items log as `needs`; a prompt the catalogue does not know (a peek's resume, a thank-you) logs with `kind: null`. Skip a line that does not parse. Older desktop builds wrote nothing, so a short log is normal. The writer itself never writes `brief-log.jsonl` or the app's plan files.\n\n## Rules\n\n- **Company isolation.** In person mode, synthesize each `companies.\u003Cslug>` section separately and keep every item’s `company` slug. Personal rows use `company: null`. Drop any brief item whose existing company conflicts with its section and record an isolation error; never relabel a conflicting row. Tag only brief-item collections, leaving nested participant and metadata rows intact. Never move content between company headings. Excluded companies get only the exclusion notice. Explicit narrow modes retain their existing count-only treatment of other companies.\n- **At most 5 per list.** Decisions, waiting, incidents, watch, priorities, carry, handoffs, recovered, releases and reminders never hold more than 5 items; the app shows \"+N more\" past that, never a sixth row.\n- **Plain titles.** Titles follow Step 4: verb first, 8 words or fewer, product names, no repo slugs or PR numbers. The same rule covers shipped titles and highlights, handoff objects, recovered titles and held release items. Reminders are the user's own words and are exempt.\n- **Unmutable widgets.** `sunrise`, `needs` and `catchup` are never written into `prefs_applied.widgets.muted`, whatever `brief-prefs.yaml` says; drop the entry with a `learned_notes` line.\n- **No app files.** The writer never writes `brief-log.jsonl` or the app's plan files; it reads the log and writes `brief-prefs.yaml` only in the weekly fold.\n- **Retention.** Use product usage only. Never use payments.\n- **Secrets.** Never read or print secrets.\n- **The page is additive.** `brief.json.page` is optional. Never drop or rename an existing field to make room for it; an app that does not read `page` keeps working from the rest of the file.\n- **Read-only, except housekeeping.** Do not post, send, merge, deploy or change anything outside `workspace\u002Fbrief\u002F` and `personal\u002Fbrief\u002F`. The only exceptions are the Step 5 auto-run tasks. Destructive cleanup is always a proposal the user launches.\n\n## Default brief-prefs.yaml\n\n```yaml\nversion: 1\nlast_brief_at: null\ndensity: auto            # auto | calm | full. full keeps the same 8-card ceiling as auto.\nengine: claude           # claude | codex | grok\nquiet_hours: \"20:00-07:00\"\nvip_people: []\nvip_repos: []\nmuted_repos: []\nmuted_senders: []\nintegrations: []         # extra connected apps to always check\n# Widget preferences the app's picker reads (copied into brief.json prefs_applied.widgets).\n# Kinds: oneThing blockedByMe incident fleetRecovery resolved risk waiting carry handoffs\n# shipped firsts releaseTrain meetings decided weekArc team agenda runway focus reminders.\npinned_widgets: []       # \"always show X\": shown whenever it has data, below the cards a priority needs\nmuted_widgets: []        # \"never show X\": left off the grid. sunrise, catchup and needs cannot be muted\nwidget_weights: {}       # kind: -2..2 whole numbers; each point moves the card five score points\nlearned_notes: []\n```\n\n`density: full` keeps the same 8-card ceiling as `auto` (the larger templates are not shipped); `calm` lowers it.\n",{"name":5,"description":7,"allowed-tools":44},"Read, Write, Edit, Grep, Glob, Bash","205cf61728a27ef15e9153aa38df5856fc8d82f5",".claude\u002Fskills\u002Fdaily-brief",18,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core","https:\u002F\u002Fgithub.com\u002Findigoai-us","https:\u002F\u002Fhqforwork.com\u002F","The AI Context Layer for Teams","2026-11-12 06:53:38",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add indigoai-us\u002Fhq-core --skill daily-brief",{"tool":59,"command":60},"bunx","bunx skills add indigoai-us\u002Fhq-core --skill daily-brief",{"tool":62,"command":63},"pnpm","pnpm dlx skills add indigoai-us\u002Fhq-core --skill daily-brief","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002FSKILL.md",true,[67,73,79,83,87,91,95,99,103,107,111,115,119,123,127,131],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"agents\u002Fopenai.yaml","REFERENCE","参考文档",121,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fagents\u002Fopenai.yaml",{"path":74,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":77,"sourceHtmlUrl":78},"scripts\u002Fbrief_company.py","SCRIPT","脚本",20403,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief_company.py",{"path":80,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":81,"sourceHtmlUrl":82},"scripts\u002Fbrief_page.py",51379,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief_page.py",{"path":84,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":85,"sourceHtmlUrl":86},"scripts\u002Fbrief_rank.py",20102,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief_rank.py",{"path":88,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":89,"sourceHtmlUrl":90},"scripts\u002Fbrief_signals.py",21465,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief_signals.py",{"path":92,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":93,"sourceHtmlUrl":94},"scripts\u002Fbrief-sweep.py",123801,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fbrief-sweep.py",{"path":96,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":97,"sourceHtmlUrl":98},"scripts\u002Ffixtures\u002Fdm-inbox-no-company.json",1120,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Ffixtures\u002Fdm-inbox-no-company.json",{"path":100,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":101,"sourceHtmlUrl":102},"scripts\u002Fhousekeeping.py",18055,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Fhousekeeping.py",{"path":104,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":105,"sourceHtmlUrl":106},"scripts\u002Flocal_sessions.py",34164,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Flocal_sessions.py",{"path":108,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":109,"sourceHtmlUrl":110},"scripts\u002Ftest_brief_additions.py",149167,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Ftest_brief_additions.py",{"path":112,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":113,"sourceHtmlUrl":114},"scripts\u002Ftest_brief_company.py",16923,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Ftest_brief_company.py",{"path":116,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":117,"sourceHtmlUrl":118},"scripts\u002Ftest_brief_helpers.py",19998,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Ftest_brief_helpers.py",{"path":120,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":121,"sourceHtmlUrl":122},"scripts\u002Ftest_brief_page.py",32537,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Ftest_brief_page.py",{"path":124,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":125,"sourceHtmlUrl":126},"scripts\u002Ftest_brief_signals.py",35014,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Ftest_brief_signals.py",{"path":128,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":129,"sourceHtmlUrl":130},"scripts\u002Ftest_local_sessions.py",5056,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Ftest_local_sessions.py",{"path":132,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":133,"sourceHtmlUrl":134},"scripts\u002Ftest_person_brief.py",17154,"https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdaily-brief\u002Fscripts\u002Ftest_person_brief.py",[136,144,151,158,165,172],{"skillNo":137,"name":138,"nameZh":6,"description":139,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":140,"categories":141,"keywords":142,"publishedAt":143},"01M73NTNKZ3T2KJNDP2ZF23645","job","Deprecated alias for \u002Fschedule — Outpost recurring agent jobs. Prefer \u002Fschedule.","https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fjob\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":143},"01M73NTE0H9DQTT6DNHDKRWTXW","import-claude","Deprecated alias for \u002Fimport-context — bootstrap HQ from your prior AI footprint (Claude Code, Codex, Grok, claude.ai history plus on-disk artifacts).","https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimport-claude\u002FSKILL.md",[],[],{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":157,"publishedAt":143},"01M73NT67433KKX96CCJWDQQ0X","hq-whoami","Show current HQ Cognito identity and session expiry.","https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fhq-whoami\u002FSKILL.md",[],[],{"skillNo":159,"name":160,"nameZh":6,"description":161,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":162,"categories":163,"keywords":164,"publishedAt":143},"01M73NT17SVXZV2QPT14C2RPJP","hq-share","Share HQ vault paths through single-use links or direct ACL grants.","https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fhq-share\u002FSKILL.md",[],[],{"skillNo":166,"name":167,"nameZh":6,"description":168,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":169,"categories":170,"keywords":171,"publishedAt":143},"01M73NSXYFMD7EHGT8TFDZA3C8","hq-secrets","Use HQ CLI secrets safely through env injection or one-off exec.","https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fhq-secrets\u002FSKILL.md",[],[],{"skillNo":173,"name":174,"nameZh":6,"description":175,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":176,"categories":177,"keywords":178,"publishedAt":143},"01M73NSWCXJK29Q8CNG8AS3ZZQ","hq-logout","Sign out of HQ Cognito and clear local tokens.","https:\u002F\u002Fgithub.com\u002Findigoai-us\u002Fhq-core\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fhq-logout\u002FSKILL.md",[],[]]