daily-brief
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.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 95
- Forks
- 18
01 前言 Front Matter
- name
- daily-brief
- description
- 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.
- allowed-tools
- Read, Write, Edit, Grep, Glob, Bash
02 资源文件 16
- 参考文档agents/openai.yaml121 B
- 脚本scripts/brief_company.py19.9 KB
- 脚本scripts/brief_page.py50.2 KB
- 脚本scripts/brief_rank.py19.6 KB
- 脚本scripts/brief_signals.py21.0 KB
- 脚本scripts/brief-sweep.py120.9 KB
- 脚本scripts/fixtures/dm-inbox-no-company.json1.1 KB
- 脚本scripts/housekeeping.py17.6 KB
- 脚本scripts/local_sessions.py33.4 KB
- 脚本scripts/test_brief_additions.py145.7 KB
- 脚本scripts/test_brief_company.py16.5 KB
- 脚本scripts/test_brief_helpers.py19.5 KB
- 脚本scripts/test_brief_page.py31.8 KB
- 脚本scripts/test_brief_signals.py34.2 KB
- 脚本scripts/test_local_sessions.py4.9 KB
- 脚本scripts/test_person_brief.py16.8 KB
03 SKILL.md 正文
/daily-brief
Builds 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 /daily-brief [--all|company|--personal] [--welcome] [--today YYYY-MM-DD].
An 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.
The output is a set of files the desktop app reads. This skill never posts, sends, merges or deploys anything.
Inputs
| Input | Default |
|---|---|
--all |
Default: personal work plus every membership permitted by the session lock |
company |
Explicit first argument selects only that company |
--personal |
Build a brief with no company, even when the session has one bound |
--welcome |
Add the welcome edition (Welcome edition, below). On by default for the person’s first ready run in any mode |
today |
Today's local date |
run_id |
--run-id <id>, passed by the app. If missing, generate one as brief-<YYYYMMDD-HHMMSS> in local time |
Briefs are manually triggered, so several can exist per day. Each run gets its own folder, workspace/brief/<run_id>/. The run_id is brief-<YYYYMMDD-HHMMSS> in local time.
| File | Written when | What it is |
|---|---|---|
status.json |
At every step | Progress the app polls |
brief-data.json |
Step 3 | Raw normalized sweep output |
brief.json |
Step 4 | Synthesized items with prompts, read by the generator, plus the optional page the card design draws (Step 4b) |
page-draft.json |
Step 4b | The page frame and card candidates from brief_page.py skeleton; a working file, not read by the app |
housekeeping.json |
Step 5 | Cleanup results and proposed cleanup actions |
When a run finishes, ready or failed, append one line to workspace/brief/index.jsonl. The desktop app's history navigator reads this file:
{"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"}
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.
status.json shape:
{"run_id":"…","state":"running|ready|failed","step":"…","progress":0.0,"started_at":"…","updated_at":"…","error":null,"sources":{}}
Write 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:
"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"}]
As each source lands, also update findings and samples in status.json. The app animates these as live counters and preview cards:
"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":{}},
"samples":[{"kind":"decision","title":"Approve release-gate fix","company":"acme","at":"…"}]
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.
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.
Step 1. Start
Write status.json with state: running, step: "Checking your setup" and progress: 0.05.
Check the session's company (bash core/scripts/hq-session.sh current). Never sweep a company the session is not locked to. The sweep reads the lock with bash core/scripts/hq-session.sh get company_slugs and refuses --company when that slug is outside the locked set.
- Default to a person brief (
--all), including personal work and a section for each permitted company.--company <slug>and--personalremain explicit narrow modes. - Membership inventory comes from the read-only
hq sync mode --showtable (the caller's memberships), intersected withhq-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/lock failures are visible source failures, never an invented empty membership list.
Step 2. Load what we know about this person
- Read
personal/brief/brief-prefs.yaml. If it is missing, create it from the defaults below. Besidesdensity,engineand the VIP and mute lists, read the widget preferences the app's picker uses:widget_weights(kind → -2..2),pinned_widgetsandmuted_widgets. Step 4 copies them intoprefs_applied.widgets. - Find the last brief: the newest
readyentry inworkspace/brief/index.jsonlwithmode: personfor an all-company brief; for explicit narrow modes use the same company and mode. Skip lines that name another company. A line with nocompanyfield is an older run: use it only when itsbrief.jsonorbrief-data.jsonhas the samecompany. Read that run'sbrief.jsontoo: itsitemsare the carry-over candidates, and itscarryrows givecarried_sinceandbriefsfor chaining (Step 4, carry).- Deliberate reset. If
workspace/brief/is missing or holds no earlier run (no other run folder and noreadyline inindex.jsonl) and a siblingworkspace/brief-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_purposerecords the same check. A missing folder with no backup next to it is also only a housekeeping note, never the lead. - 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.
- Catch-up: if the gap since the last brief is 3 days or more, set
catch_up: true. - 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".
- Deliberate reset. If
- Read the last brief's items. Anything still open becomes a carry-over candidate. Note what was launched or dismissed, from
personal/brief/brief-log.jsonl.
Write status step: "Reading your last brief", progress: 0.15.
Step 3. Sweep
Run the sweep script. It records each source's success or failure, and never fills a gap with an invented value.
--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.
python3 -I .claude/skills/daily-brief/scripts/brief-sweep.py \
--all --days 7 --hours 24 --today <today> \
--hq-root "$PWD" --out workspace/brief/<run_id>/brief-data.json \
--status workspace/brief/<run_id>/status.json
For a narrow brief, replace --all with --company <slug> or --personal. Add --welcome to force the welcome edition.
On a company brief, PR search is limited to the company's GitHub owner: --org <owner>, or else the company's github_org in companies/manifest.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/brief_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/name 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.
The script covers these sources:
| Source | Read through |
|---|---|
| Work sessions | Sessions come from workspace/sessions 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. |
| Recorded meetings (company only) | hq meetings list. The list row supplies the title, start and participants |
| Synced signals (company only) | The company vault's signal index, signals/_index/{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/{type}/), the person's own folders (signals/@{key}/{type}/, 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 <slug> 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/slack-dm/{type}/. Code: scripts/brief_signals.py |
| Meeting signals (company only) | Built from the synced signals whose source_ref is a meeting pointer (sources/meeting-events/…), 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 |
| 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 <slug> 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. |
| Fleet agents (company only) | hq agents list |
| 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 |
| Main-branch CI health | gh run list |
Every 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.<slug> 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.
A 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."
The script also writes window.today, window.hours, window.prs_from/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.
Derived data the sweep adds for the app's widgets (all computed, never estimated; every helper has a unit test in scripts/test_brief_additions.py):
| Block | What it carries |
|---|---|
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 |
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) |
prs_summary.by_product[] |
{product, merged, opened, open, median_merge_hours} for the window |
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 |
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 |
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 |
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 |
meeting_signals[] |
{meeting, title, meeting_id, start, counts, decisions[], action_items[]}; each item is {text, owner, mine, source_ref, cite} |
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/_runs/@{key}/), 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) |
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 |
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 |
previous_run |
{run_id, generated_at} of the previous ready run, found through index.jsonl; null for a first brief |
welcome |
The welcome edition (below), or null |
On 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:
- Every line the brief writes from a signal keeps its
source_ref, and shows its shortciteso the user can find the source. - When
synced_signals.lagis set, write itslineonce 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. - Show
synced_signals.freshnessas one "last synced" marker per app. - When
synced_signals.meetings_without_signalsis set, write itslineonce in the meetings part ("Signals not yet generated for 2 meetings."). Never show those meetings as having no decisions.
Write status step: "Sweeping your day", from progress: 0.25 up to 0.7. Include the per-source sources map so far.
Welcome edition
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:
"welcome":{"first_run":true,"headline":"HQ found 2,263 past sessions across 41 projects on this Mac, most of them in Claude Code.",
"import":{"path":null,"scanned_at":null,"source":"detected","written_at":null,"plans":null,"…":null,
"sessions":{"total":2262,"claude":2037,"codex":225,"cursor":0,"days_seen":96,"first_at":"2026-07-14","last_at":"2026-10-17"},
"tools":["claude-code","codex"],"projects":41},
"sessions":{"total":2263,"local":2263,"imported":2262,"claude":2038,"codex":225,"days_seen":96},
"harness":{"primary":"claude-code","counts":{"claude_code":2038,"codex":225,"cursor":3},
"action":{"id":"open-hq-in-harness","kind":"open_harness","harness":"claude-code","label":"Open HQ in Claude Code","launch_prompt":"…"}},
"top_projects":[{"name":"web-app","path":"~/code/web-app","sessions":310,"last_active_at":"2026-10-17T21:02:11Z","harness":"claude-code"}],
"top_repos":[{"name":"web-app","path":"~/code/web-app","sessions":310,"last_commit_at":"2026-10-17T20:55:03-07:00"}],
"recent_work":[{"title":"Fix the signup redirect","project":"web-app","at":"2026-10-17T21:02:11Z","harness":"claude-code"}],
"repos":[{"name":"web-app","sessions":9}],"apps":["Claude Code","Codex","Cursor"],
"tree":{"companies":2,"projects":14,"knowledge_files":380},
"actions":[{"id":"connect-company","kind":"connect_company","label":"Create or join a company","reason":"…","launch_prompt":"/onboard","primary":true}],
"next_steps":[{"id":"connect-company","kind":"connect_company","reason":"…"}]}
Field 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.
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.import(fields inIMPORT_FIELDS):{path, scanned_at, source, written_at, <counts>, sessions, tools, projects}. With a report it comes from the newestworkspace/imports/<stamp>/report.json(see "Import report contract" below):scanned_atis the folder's UTC time (2026-10-19T15:00:28Z; the report'sscan_idis never copied),sourceis the report'ssource(desktop-tree-step, elseimport-context), the per-category counts areplans,commands,skills,hooks,policies,agents,claude_md,settings_fragments,mcp_servers,knowledge_dirs,claude_reposandconversations(session stores, not sessions),sessionsis{total, claude, codex, cursor, days_seen, first_at, last_at},toolslists the harness ids found, andprojectsis 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 insidesessions). Without a report, when any session other than the one running the brief is on this Mac,sourceisdetected,path,scanned_at,written_atand the counts are null, andsessions,toolsandprojectscome from the machine inventory (total,claudeandcodexleave out the running session;first_atandlast_atare dates;projectsleaves 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 fromCLAUDE_CODE_SESSION_ID,CLAUDE_SESSION_ID,CODEX_THREAD_IDorCODEX_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.sessions:localcounts every session on this Mac, one per session id: HQ-started sessions, every Claude Code transcript (under~/.claude/projectsand theCLAUDE_CONFIG_DIRprojects folder), every Codex rollout (CODEX_HOME, else~/.codex) and every Cursor workspace with chat state (one each).importedisimport.sessions.total(0 when the report has no session total).totalis the larger of the two.claude,codex,cursoranddays_seenare counted across all of them.harness:primaryis the harness with the most sessions (null with none);countscoversclaude_code,codexandcursor(Cursor counts workspaces with chat state).actionopens HQ in that harness. Harness ids are hyphenated (claude-code,codex,cursor) inharness.primary,harness.action.harness,top_projects[].harnessandrecent_work[].harness. The underscore keys appear only insideharness.counts.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/base62 run of 20+ that has a digit or capital letter. Full-width letters and accents are folded first. That session reads "Session in <project>". 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[].pathstarts with~/inside the home folder and is the folder name only outside it.tree: companies in this HQ, plus projects and knowledge files of the brief's own scope.actions: each is{id, kind, label, reason, launch_prompt, primary}.kindis one ofopen_harness,connect_ai_apps,connect_integration,connect_company,import_history,open_tree.import_history("Bring in your past work") appears only whenimportis null: no report and no session other than the current one.open_harnessaddsharness;connect_integrationaddsintegration: {slug, name};connect_ai_appshas nointegration. Exactly one action hasprimary: true:connect_ai_appswith zero sessions, elseimport_historywhenimportis null, elseconnect_companywhen there is no company, elseopen_harness.getting_started: set only when there are zero sessions, or with the membership copy below.- 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.yamlcompany_slug, then a folder undercompanies/<slug>; a folder undercompanies/<slug>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/, worktrees) is counted and never named, and so is a repo whose GitHub owner is another company'sgithub_org. - 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.
next_stepsholdsconnect_company(no company),import(only whenimportis null), andconnect_integrationandsync(company briefs).- On failure,
welcomeis{first_run, note}with one plainnote("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 plainnoteand leaves that part out. Exception text never appears inwelcome; it goes to stderr.
Import report contract
Agreed between Core and Desktop on 2026-10-19.
- Writer: Desktop. At the end of the tree step, the desktop writes
<hq>/workspace/imports/<YYYY-MM-DDTHH-MM-SS>/report.jsonatomically from the scan's done summary. Later,hq import scan --output <path>can take over the write with the same shape./import-contextkeeps writing<hq>/workspace/imports/<YYYYMMDDTHHMMSSZ>/report.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. - Fields: the existing
{scan_id, counts{the 12 keys}, categories, discovery{ok, errors}}, plussessions{total, claude, codex, cursor, days_seen, first_at, last_at},tools[](harnesses found),projects[](top project names, never paths),source: "desktop-tree-step"andwritten_at. - Reader limits: a
report.jsonover 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 symlinkedimportsfolder, stamp folder orreport.jsonis not followed. Reading never fails the brief: with no usable report, direct detection applies. - Reader: prefer
sessions.total. An older report has nosessionsblock; its total is the sum ofcategories.conversations[].sessions.counts.conversationscounts session stores and is never used as a session count. Missing fields are tolerated. - Transcripts stay where the harness wrote them. With no report, direct detection uses the machine inventory.
- 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.
Keep 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.
For 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 /onboard when you are ready."
Step 4. Synthesize brief.json
First 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.
For mode: person, apply the synthesis below separately to personal and each companies.<slug> 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.
Status while writing
The 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:
| Activity label | progress |
|---|---|
| Writing decisions | 0.72 |
| Writing what shipped | 0.78 |
| Writing problems | 0.83 |
| Writing meetings | 0.87 |
| Writing priorities | 0.91 |
| Housekeeping | 0.95 |
Mark 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.
Item fields
Every 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.
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.
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:
action |
When |
|---|---|
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. |
go |
Approve something ready: merge, ship, deploy, sign off, say yes. |
decide |
Pick between options; carries choices: [a, b]. |
reply |
Answer a person: a DM, a question from a meeting, an email. |
prep |
Get something ready before a call or a deadline: read, draft, review. |
The app defaults a missing or unknown action to decide; brief_rank.py --check reports it under field_problems so it never ships that way.
Root fields
today:YYYY-MM-DDlocal, copied frombrief-data.json.window.today. The app's only weekday source; never derive it fromgenerated_at.prefs_applied.widgets:{pinned: [kind], muted: [kind], weights: {kind: -2..2}, density: auto|calm|full}copied frombrief-prefs.yaml(pinned_widgets,muted_widgets,widget_weights,density).sunrise,needsandcatchupmay not be muted: drop the entry and add onelearned_notesline saying so. Clamp weights to -2..2 with a note.brief_rank.apply_widget_prefsdoes both.mode:companyorpersonal, copied frombrief-data.json.mode. Writemodeandcompanyon the run'sindex.jsonlline too.welcome: copied frombrief-data.json.welcomewhen it is set; omit it or write null otherwise. The writer may shorten eachnext_steps[].reasonbut adds no new steps. On a first run wherewelcome.sessions.totalis 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 fromheadline,top_projectsandrecent_work, and turn quiet lists into theactions(primary first). The first brief has no technical sentences.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 frombrief-data.json.days(that is what--days 7is for).meetingsthere is the user's own meetings only; never addteam_meetingsinto it.beatis optional:{kind: turn|crisis|resolution|push, label, evidence}wherecrisisis the day an incident opened,resolutionthe day something initems.recoveredrecovered,pushthe day with the most merges, andturnthe event that led into the crisis. One beat per day at most.landed_days:[YYYY-MM-DD]days inweekwith at least one merged PR or release.time_to_clear_min: the sum over decisions of effort minutes (quick2,medium6,large15).
Titles and why
These rules apply to decisions, incidents (problems), watch, waiting and priorities.
titleis 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".- The repo, PR number and URL go in
origin, and may be named inwhyor the prompt, never in the title. whyis one plain sentence a non-engineer understands: what it is, who is waiting, and what happens if it waits.- Shipped groups use product names too: "Desktop app: 17 changes shipped", not "desktop-app: 17 merged".
Product names
Use human product names everywhere instead of repo slugs. They come from data files, never from the skill itself:
companies/<company>/settings/brief-products.json, read on a company brief only.workspace/brief/products.json, the person's own names. It wins when both files name the same repo.
Each 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/brief_rank.py (load_product_names) reads the files, and each PR row in brief-data.json already carries product.
Lists
- decisions: only these four kinds:
- (a) DMs from humans (not
agt_senders) asking the user something; - (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; - (c) red main-branch workflows (
main_health[*].red); - (d) meeting action items and questions assigned to the user (
mine: trueinmeeting_signals[*].action_items). 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. Each decision also carries: 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 leaveblocksempty rather than guess.action: one ofcut,go,decide,reply,prep(see Item fields). Required.choices:[a, b]whenactionisdecide, two words each ("Ship Monday", "Hold a week").
- (a) DMs from humans (not
- 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) andwhat(what you wait for, plain: "to review the pricing page", "an answer on the memo folder"), plusage_hours,kind(dm,review,handofforother) andorigin. The app readstitleaswhatwhenwhatis missing but drops a row with nowho, so a wait with nobody to name is not a wait;brief_rank.py --checkreports a row missingwhoorwhatunderfield_problems.whatfollows the title rules (no repo names, PR numbers or prefixes). - shipped: merged PRs grouped by product and theme, plus releases and deploys. Mark firsts. Counts come from
prs_summary(see Counts). Each row carriesid(s1..),product, up to 5highlights(plain lines, no PR numbers or commit prefixes, one per change or theme) andmerge_hours_medianfor the rollup (copyprs_summary.by_product[].median_merge_hours). The app merges rollup rows onto the sweep's per-product counts byproduct, so rollup titles use the product name exactly. - 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/brief/with a siblingworkspace/brief-backup-*folder is a deliberate reset and never an incident (Step 2). - watch: open PRs and threads worth knowing about that do not need the user yet. At most 5. Each carries
kind(ci,pr,threadorfleet) and an optionalprompt. - 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_oragt_),load(clear,steady,heavyorstorm:stormowns an incident or a red main,heavyhas 3+ meetings or 2+ open asks),owes(plain action items they own, from meeting signals and DMs) andthanks(one plain line about a win, or null). - 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 towindow.attended_meetings_from..sessions_to, deduped, and markedattended); a catch-up brief widens that to the gap. Each meeting item carries:attended(copied),duration_min(copied),with: the other participants in plain words ("Robin Bell", "Alex and Jamie");decided: up to 3 lines frommeeting_signals[*].decisions[*].text, each shortened to one plain line;todo: up to 3{text, owner, mine}fromaction_items, the user's own first. 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 withmine: trueis 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.
- carry: open items from the last brief that are still open. Each carries
carried_from(the last run id),carried_since(thecreated_atof the first run that listed it, fromindex.jsonl),briefs(consecutive runs it has appeared in, chained throughorigin.urlororigin.number, else the normalized title, using the last brief's owncarryrows),item_id(today's decision or incident that continues it, or null) andprompt. - 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),/delegateevents and board assignee changes.meis true when the user is the receiver;productionwhen the object is live. Each receipt istrue,falseornull(unknown);accessstays null unless a grants source exists.noteis work-level, never message text.objectfollows the title rules. - recovered (new):
{id: f1.., title, what, at, source: main_health|fleet|session, company, product, origin, timeline?: [{at, text}], post_incident?: {broke, did, changes}}. Frombrief-data.json.main_health[*].delta.recovered,fleet.delta.recovered, and outages a session names as closed.atis the run'sgenerated_atwhen nothing more precise exists. - releases (new):
{product, version, released_at, pending: [{day, count, theme}], pending_count, held: [{title, why}], light: ok|warn|red, prompt, origin}. Copybrief-data.json.releases[](merged_at→released_at,pending_by_day→pending);heldlists decisions whosewhysays the work is held until the release;lightisredwhen the repo's main is red,warnwhenpending_countis 3 or more or the release is older than a day, elseok. - reminders (new):
{id: r1.., text, said_at, where, due_at, prompt}. Fromhq dmreminders the user sent to themselves; later from "remind me" lines once outbound DM history is in the sweep.textis the user's own words, verbatim, and is exempt from the title lint. - other_company: a count only.
Counts
The 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.
Priorities
priorities is an ordered list of at most 5 one-line directives for the day:
"priorities":[{"rank":1,"text":"Give Alex a go/no-go on desktop 0.11.3","item_id":"d2","because":"the release waits on the answer","score":3}]
- Derive them strictly from decisions and incidents already in the brief. Add no new facts.
- 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 --checkreturns this order from the item fields; follow it unless you can state the reason inbecause. item_idmust be the id of an item initems.decisions,items.incidents,items.handoffsoritems.carry.--checkreports a dangling id underdangling_priorities; fix it or drop the priority.scoreis the unblock score--checkprints underscoresfor thatitem_id(people waiting + things unlocked, revenue counts double). Copy it;priority_problemsreports a missing or different value.textfollows the title rules.becauseis one clause.lead_hintstarts with priority 1'stextverbatim, 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 (--checkreportslead_hint_problemotherwise).
How the app uses priorities
Each 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.
Prompts
Every actionable item gets a prompt that starts a Claude, Codex or Grok session. The prompt must:
- name the exact repo, PR, commit or person
- say what to check first
- say what done looks like
- end by showing the result before anything irreversible
Use 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).
Write and check
Write 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:
python3 -I .claude/skills/daily-brief/scripts/brief_rank.py --check workspace/brief/<run_id>/brief.json
Fix 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.
Step 4b. Write the page
The 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.
Frame and candidates (deterministic)
python3 -I .claude/skills/daily-brief/scripts/brief_page.py skeleton \
--data workspace/brief/<run_id>/brief-data.json --person "<first name>" \
--hq-root "$PWD" --out workspace/brief/<run_id>/page-draft.json
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.
People'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.
What you write
Turn 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.
- The lead.
summary[0]is the frame's lead card: kindfocus, sizeXL, typesummary. Write itstitleanddata.headline(one short line about where today's attention goes, with anaccentword) and up to threedata.bets({label, symbol, share, itemId}, shares summing to at most 1,itemIdnaming 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. - 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
companyout; a card that names a person or quotes anyone carries its company. - 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.
- 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 kindball, typedropped, sizeM, withdata.pickup(the one-press action in plain words, such as "Reply to Ann about the memo"),data.hoursanddata.people. Zero dropped balls is a real result: leave the band empty. - 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.
- 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. - Every card carries its company: the candidate's slug (
personalfor the person's own work), which must be a key ofpage.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 abasis: senderask with care: if its words are clearly about another of the person's companies, leave it out. - A drawing holds real information. Set
data.visualonly to a recipe the card can fill:clock,dialandtideneedhours;lettersandlockneed a person (mailbox,constellationanddrawerstwo or more);tallyandstacka wholevalue;sparkline3 or moresparkpoints (skyline4 or more);checklist2 or moresteps;track,fuseandrocketsteps, milestones or days;comparehours withusual, or 2 to 5bars;traceandbreakerato;agendaa meeting;forkandswitcha decided or moved note;bella landed note;booka learning note;sirenandlighthousea brokevalue. Leavevisualout 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. - Names. Use the candidate's people names as given (resolved first names). Never write a login or handle when the candidate,
from_nameorauthor_namehas a name;checkwarns on handle-looking names. - Titles follow the Step 4 title rules: verb first, 8 words or fewer, product names, no repo names, PR numbers, prefixes or paths.
whyis one sentence for this reader. - Drill-in.
drill.signals(at most 4,{source, text, at},sourceone of dm, meeting, session, pr, ci, calendar, task, email, analytics, doc),drill.prompt(the item's launch prompt from Step 4, same rules) anddrill.bot(one line for Ask my bot). Summarize DM text in your own words; quote at most a short phrase indata.quote.
Check and attach (fail soft)
Write the page to workspace/brief/<run_id>/page.json, then:
python3 -I .claude/skills/daily-brief/scripts/brief_page.py check workspace/brief/<run_id>/page.json
Fix every error and check again, at most twice. Then attach it:
python3 -I .claude/skills/daily-brief/scripts/brief_page.py attach \
--brief workspace/brief/<run_id>/brief.json --page workspace/brief/<run_id>/page.json
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.
Step 5. Housekeeping
Housekeeping 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.
python3 -I .claude/skills/daily-brief/scripts/housekeeping.py \
--company <company> --hq-root "$PWD" --run-dir workspace/brief/<run_id>
In 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.
The script runs the every-run checks in parallel, each under a hard time budget, with stdin closed and every prompt pre-answered:
| Check | Command | Budget |
|---|---|---|
hq_doctor |
hq doctor --json --company <company>. Exit 1 only means some checks fail; the run still counts as finished |
40s |
hq_sync |
hq sync now --company <company> --on-conflict abort --lock-timeout 0. Never prompts, never overwrites, never waits on the HQ Sync app's lock |
30s |
worktree_scan |
read-only git status and git log -1 in each workspace/worktrees checkout |
20s |
A 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: <reason>. 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.
The script also adds the deliberate-reset note when it applies ("Brief history was reset on purpose; the old briefs are backed up in workspace/brief-backup-…"). That one line in notes is the only place a reset appears.
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; /garden audit-only, weekly; stale-session scan (working state, no /handoff, 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/brief/ when a workspace/brief-backup-* folder sits next to it.
Housekeeping never deletes files, kills processes, removes worktrees or files bugs.
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:
- Hand off and archive stale sessions.
- Quit orphan processes. List the PID, command, memory and why each looks orphaned. Never include the user's own apps or HQ.app.
- Remove idle worktrees listed in
tasks.worktree_scan.detail.stale_paths, after confirming each is merged and has no unpushed commits. - File one bug per distinct repeated error through
/hq-bug, with the log excerpt. - Apply garden fixes.
Each proposal states, in plain words, what it frees or fixes and its risk.
Step 6. Finish
- Write status
state: ready,progress: 1.0, as soon asbrief.jsonis written and Step 4b'sattachhas run (it never blocks: a failed page is simply left out). Housekeeping updatesstatus.json.housekeepingafterwards without changingstate. - Append the run to
workspace/brief/index.jsonl. - Print one line:
BRIEF READY <run_id> <path to brief.json>. The desktop app watchesstatus.jsonand shows the notification. - When run outside the app, also send the user a short HQ DM to themselves: "Your daily brief is ready."
If 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.
Learning, weekly
When brief-log.jsonl has 7 or more days since the last fold, fold it into brief-prefs.yaml:
- If a widget is dismissed 3 or more times in a row,
widget_weights[kind] -= 1(floor -2). - If sessions are launched from one widget 3 or more times in a week,
widget_weights[kind] += 1(ceiling +2). - If the user says "always show X", add the kind to
pinned_widgets; "never show X" adds it tomuted_widgets. - Refuse to mute
sunrise,needs,catchupor the priorities list: leave the prefs unchanged and add alearned_notesline saying why. - If an engine is chosen 70% of the time or more, make it the default.
- If a sender's items are always launched, mark them VIP.
Add each change as one plain line to learned_notes, so the next brief can say what changed.
The 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.
Rules
- Company isolation. In person mode, synthesize each
companies.<slug>section separately and keep every item’scompanyslug. Personal rows usecompany: 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. - 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.
- 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.
- Unmutable widgets.
sunrise,needsandcatchupare never written intoprefs_applied.widgets.muted, whateverbrief-prefs.yamlsays; drop the entry with alearned_notesline. - No app files. The writer never writes
brief-log.jsonlor the app's plan files; it reads the log and writesbrief-prefs.yamlonly in the weekly fold. - Retention. Use product usage only. Never use payments.
- Secrets. Never read or print secrets.
- The page is additive.
brief.json.pageis optional. Never drop or rename an existing field to make room for it; an app that does not readpagekeeps working from the rest of the file. - Read-only, except housekeeping. Do not post, send, merge, deploy or change anything outside
workspace/brief/andpersonal/brief/. The only exceptions are the Step 5 auto-run tasks. Destructive cleanup is always a proposal the user launches.
Default brief-prefs.yaml
version: 1
last_brief_at: null
density: auto # auto | calm | full. full keeps the same 8-card ceiling as auto.
engine: claude # claude | codex | grok
quiet_hours: "20:00-07:00"
vip_people: []
vip_repos: []
muted_repos: []
muted_senders: []
integrations: [] # extra connected apps to always check
# Widget preferences the app's picker reads (copied into brief.json prefs_applied.widgets).
# Kinds: oneThing blockedByMe incident fleetRecovery resolved risk waiting carry handoffs
# shipped firsts releaseTrain meetings decided weekArc team agenda runway focus reminders.
pinned_widgets: [] # "always show X": shown whenever it has data, below the cards a priority needs
muted_widgets: [] # "never show X": left off the grid. sunrise, catchup and needs cannot be muted
widget_weights: {} # kind: -2..2 whole numbers; each point moves the card five score points
learned_notes: []
density: full keeps the same 8-card ceiling as auto (the larger templates are not shipped); calm lowers it.
04 同仓库更多 Skills
job
Deprecated alias for /schedule — Outpost recurring agent jobs. Prefer /schedule.
import-claude
Deprecated alias for /import-context — bootstrap HQ from your prior AI footprint (Claude Code, Codex, Grok, claude.ai history plus on-disk artifacts).
hq-whoami
Show current HQ Cognito identity and session expiry.
hq-share
Share HQ vault paths through single-use links or direct ACL grants.
hq-secrets
Use HQ CLI secrets safely through env injection or one-off exec.
hq-logout
Sign out of HQ Cognito and clear local tokens.