# Changelog All notable changes to Agent-HQ will be documented in this file. ## [Unreleased] - CLI: `hq focus list|add|park|remove` keeps the few lanes of work you chose to move forward (3 by default, up to 5). Stays on this device. - Approvals: an owner approval nobody has answered is pushed a second time after 15 minutes, and one that expires unanswered says so in the chat that asked ("nothing ran"), once each. - Web: after a chat has read outside text, a session may fetch at most 30 pages; the next is refused with a message. - Helpers: starting, handing off to or delegating to a helper no longer waits for approval. After the chat has read outside text the helper starts narrowed: strict sandbox and a brief built from the task's stored text. The approval list is now a zone table (A never asked, B asked at the edge, C asked for HQ itself). - Agent host: `agent_host.sandbox.strict_paths` runs any session whose working directory lies under a listed folder under the `strict` profile, whatever the default profile is. `hq doctor` lists the strict paths and the network allowlist in force. - Web: a chat that has read outside text no longer asks about hosts. `web_fetch` runs for an address HQ saw arrive from outside (search results, fetched pages, the owner's own words) and is refused, with guidance and no inbox item, for an address the model composed. `web_search` is refused above 300 characters instead of asking above 150. - Relays: link previews are off on every outbound Telegram message and embeds are suppressed on Discord replies, so a link the model writes cannot make Telegram's or Discord's servers fetch it. The Jina Reader fallback of `web_fetch` is now off unless `HQ_WEB_FETCH_JINA=1`. - Tasks: moving a task to review raises an inbox card only when the task is assigned to the owner (`owner`) or waits on them. Other reviews are silent. - Web push: `web_push.quiet_hours_utc` holds pushes during a window and sends them when it ends; non-urgent items fold into one push an hour and stop at `web_push.non_urgent_per_day` (default 5). Approvals, `notify_owner` and reminders are not limited by the budget. - Inbox: one audience function (`hq_db::inbox_prefs::audience`) decides whether an item is for the owner or the agents. The default list, the badge and web push hold only the owner's items; `?include_agent=1` lists the rest. ### Added - **The web and desktop app, restructured around Vault, Chat, Inbox and Settings.** The Vault has a location bar, a folder tree (drag a note or folder onto a folder to move it, with Undo), Back and Forward, and a Move button for notes and folders (`POST /api/note/move`, `POST /api/folder/move`; links to a moved note follow it). Chat shows one live line while HQ works, puts the result first with the steps folded under it, keeps one slot above the box for an approval or an offer, and has a work pane that opens by itself once per chat when HQ makes a note, with Result, Context and Helpers tabs. Sheets, slides and dashboards made by the HQ Suite open in read-only-by-default viewers you can edit cell by cell, and `@` and `#` in the box point HQ at notes, tasks, helpers and folders. Ctrl or Cmd K is one palette (search, actions, Ask HQ, preview); Ctrl or Cmd `/` lists every key. The Inbox opens its first decision on a wide screen, folds helper requests, adds Later and a catch-up card that clears a pile of old helper requests (`POST /api/notifications/restore-cleared` puts back an unanswered agent question; a decision never comes back that way). Settings follows the phone's six groups, has a search box and a Chat page. HQ now names a new chat after its first reply (turn off under Settings, Chat; click a title to rename), and **Helpers ask me for** is a real choice on the Safety page (`GET` and `PUT /api/prefs`, migration 139, `owner_prefs`), overriding `inbox.fleet.helper_policy`. The desktop app's menu bar and Dock badge rules are tested data in `hq-desktop` and are not yet wired into the Mac shell. Plan and open items: `docs/plans/web-restructure.md`. - **Remote MCP reads no longer ask.** A tool a remote MCP server marks `readOnlyHint: true` runs without waiting for your approval in your own clean sessions only; every other remote tool, including one with no mark, any call in a tainted session, and every remote call through the claude.ai connector, still asks. Set `governance.remote_mcp_ask: all` to ask for all of them as before. See `docs/security/OWNER_APPROVAL.md`. - **HQ Suite, first slice: make a document smaller, safely.** `hq suite shrink ` turns a document in the vault into a note (text, tables, and its pictures stored once and recompressed), shows what is saved and what is left out, and sets the original aside in the vault's trash for 30 days only after the note is written and checked and you say yes. `hq suite confirm | abandon | undo | jobs | recover` finish, cancel, reverse and list jobs; a crash at any step leaves the original or the finished record, never neither (tested by injecting a failure at every step). `hq suite measure ` reports what shrinking a folder would save, per format and per picture encoder, with numbers only (no names, paths or content). The notes use hqmd, CommonMark with typed `sheet`, `tile`, `plot` and `chart` blocks and flat `suite_*` frontmatter keys, which a plain editor leaves intact. The suite lives under `crates/suite/` behind the on-by-default `suite` feature and a test keeps it free of the rest of HQ. Photographs are recompressed as lossy WebP (libwebp, quality 80), chosen by measuring real folders and a Galaxy A32. A storage governor (`suite:` config, `hq suite storage [--tidy]`, a six-hourly daemon task) removes pictures no note uses, marks notes whose original the trash has cleaned up, and keeps to an optional budget without ever taking an original whose record is not whole. A file already imported keeps its own note when shrunk. In the Android note reader a note made from an office file gets one bar to make it smaller, agree or not, and undo (`/api/suite/*`). The reader draws a record's pictures, and in a chat HQ can do the same with the `office_file` tool (moving an original asks you first). Docs: `docs/suite/`, plan `docs/plans/hq-suite.md`. - **A scroll trace for the chat.** Open the web or desktop app with `?scrolldebug` in the address and a small overlay lists every scroll, size change and follow decision of the thread, for chasing jumps that only one webview shows. A scroll up that was not yours, while following the newest message, now puts the view back at the end. - **A chat keeps your place.** A finished reply no longer collapses the chat for a moment, a late scroll report no longer stops it following new text (the desktop app's WebKit), older messages added above stay put, and on the phone a reload keeps the older pages you had loaded. - **Schedule a suggested next step.** A next step under a reply now has **Schedule** beside Yes and Not now, with Later today, Tomorrow morning and Next week. At that time the step comes back as a new offer at the end of that chat, with an inbox note that names no task and is never web-pushed. Nothing runs until you tap it and send the request. Only next steps can be scheduled, up to 90 days ahead, and scheduling one does not count toward a mute (migration 121, `offer_schedule`, daemon task `scheduled-offers`). - **Chat has no per-turn budget.** The owner typing in the web, desktop, phone or a messaging app is no longer stopped by `budget.session_cap_usd` (default $0.50), which an Anthropic key could reach on one request. The spending limits you set in Settings still apply, and coding jobs, questions from tools, unattended runs and guests keep their caps. - **Security updates.** `rmcp` moves to 3.9.0 and `rusqlite` to 0.41 (SQLite through `libsqlite3-sys` 0.39), closing RUSTSEC-2026-0457, 0459, 0461 and 0462. - **A suggested next step for the task you just worked on.** When a turn in the web or phone chat creates or updates a task and no other offer fits, HQ compares the task with a built-in set of invented examples using the on-device embedder. If its three nearest examples all point to the same capability, the reply carries one line such as "I can also look something up on the internet." **Yes** puts a prefilled request in the composer and nothing runs until you send it; **Not now** twice in a row mutes that suggestion for 30 days. It follows the same spacing as the existing offers, and appears only for what is ready on this install. No language model takes part, no text leaves the device, and only the suggestion's kind is logged. It needs the local embedder, so an instance using `embedding_provider: remote` and Lite show none. - **HQ Coder from chat.** The `hq_coder` tool starts a job with its task list, linked vault notes, budget, Copilot credit cap and model, then reads, steers, stops, retries or sends it back; anything but reading waits for the owner. A job now keeps one budget across retries and its child agents. A phone restart or provider error is a counted retry instead of a parked task, CI is waited on without a model running, and every `github_read` action works on a private repository without `gh`. Helpers shows each job with its spend, pull request and controls. Plan: `docs/plans/hq-coder-sprint.md`. - **Fewer fetch requests.** Answered requests leave the chat. A request can allow a whole site, three approved fetches of a site allow the rest of it in that chat, and a site approved in three chats stops asking and is listed in Settings to remove. A very long address still asks. - **Start a helper shows what is really there.** Each computer reports which agents it can really start, so the phone and web list only those (Antigravity, Copilot and Pi included), and HQ Coder is a choice in the same list. Any helper can start connected to a note, a task or a repository. Finishing GitHub's install page offers a way back to HQ on a phone, and the sheet says the connection worked. "Code from this phone" is now called HQ Coder everywhere. - **HQ Coder: real work on GitHub from a phone.** Helpers, Code from this phone, Connect GitHub makes the person's own private GitHub App through GitHub's manifest flow, and `hq github connect|status|disconnect` does the same from a computer. No App or key belongs to the HQ project. The key stays in `/github/` (mode 0600, outside the vault, denied to file tools), and each token covers one repository and one step's permissions for an hour, held in memory only. `github_read`, `github_clone` and `github_write` use the App first and `HQ_GITHUB_WRITE_TOKEN` second. `github_write.dispatch_tasks` now defaults to on and does nothing until GitHub is connected or `github_write.repos` is listed. Repositories whose workflows use secrets, or that have a preview host, wait for the owner; the first task after connecting waits for their yes; every task has a budget (`github_write.task_budget_usd`, default $0.50) and is parked when it runs out. `spawn_subagents` takes `allowed_paths`, so the worker's coding child is confined to its checkout. The worker runs under its own preset: only the task, GitHub, skill and sub-agent tools by name, and every child gets file tools and no shell. The Code from this phone sheet (also under Settings, on the phone and the web) takes the job itself: pick a repository, say what should change, press Start. Plan and phone results: `docs/plans/mobile-helpers.md`. - **Pair a computer for the phone's helpers with one line.** With no computer paired, the phone's "Start a helper" sheet shows `curl -fsSL https://agent-hq.online/install.sh | bash -s -- --pair` with Copy and "Send to my computer", and a **Scan the code** button. On the computer that line installs `hq` from a signed release without the web UI and runs `hq bridge pair --setup`: it turns the host's gate on at `127.0.0.1:7747` (unless set by hand), starts the host as a login service, shows the QR code, takes the six digits the phone shows and then keeps `hq bridge serve` running as a login service (`com.hq.bridge` on macOS, `hq-bridge.service` on Linux), named after the computer and on the phone app's relay unless `--relay` says otherwise. `hq bridge join --setup` does the same from a link. `hq bridge pair` and `join` no longer print a fresh database's migration log over the code. Guide: "One command, for the phone app" in `docs/JOIN_A_MACHINE.md`. - **Long chats fold instead of forgetting.** Web, phone, Telegram and Discord chats used to drop everything older than about 20 messages. Older messages are now folded into append-only summary blocks written by the `bulk` model (migration 115, `thread_folds`); the originals stay in `chat_messages`, an edit that deletes messages drops the blocks built on them, and a second tier distills old blocks when they pass a budget. `session_search` now ranks with FTS5 over every chat message and matches summaries (by meaning too, with the local Model2Vec embedder only; migration 116), and `history_restore` returns a block's original messages; HQ's own chat sessions now have both, and `tool_output_read`, which were MCP-only (a family or Telegram guest gets none of them). Claude models on OpenRouter get `cache_control`. `context_fold.stable_prompt: true` moves recent memories and concept matches out of the system prompt into a note before the user's message, with a cache breakpoint before the note on Anthropic models; it is off by default because on a real vault it cost more cache writes than it saved. Fold summaries may record relations as graph edges that cite the chat message (`chat:/` evidence, re-checked by `graph_paths` and context packets). The in-turn compactor is incremental, never splits a tool call from its results and never drops messages silently; full tool output is spilled to `_data/spill` for `tool_output_read`, pruned after 7 days. Settings: `context_fold:`. Plan: `docs/plans/context-fold.md`. - **"I can also do this for you", under a reply.** After a reply to the person's own message on the web or the phone, HQ may draw one line under it, such as "I can also turn a list you paste into separate tasks.", with **Yes** and **Not now**. It is chosen on the device by the tuned detectors (a photo or document, a short list of things to do, a to-do with a day, a request for a PDF to send or print, the same question a third time in two weeks), only for a capability ready on this install, never for one the turn already used, at most one per reply, the same offer at most every three days and any offer at most once a day. Yes sends the request ("Make that a task due on Friday 6 November 2026."), or puts it in the composer when it needs the person's words. Not now twice in a row mutes that offer for 30 days. The model never decides or sees an offer; the answers stay in a device-only table (migration 109, `offer_log`), and the weekly adoption digest and `hq adoption` report them per offer (shown, yes, not now, muted). - **Reminders for to-dos made in chat.** A daily-cadence `due-reminders` daemon task (hourly, acting between 08:00 and 21:00 local time) puts one inbox item a day for each open task created in the person's own chat that is due today or tomorrow, or overdue by up to a week. Tasks agents file through MCP have no chat origin and are never reminded. Reminders are pushed like `notify_owner` items (`due_reminder` is always pushed) and show on the phone. - **Offer counts read from a release phone, and the detectors tuned.** `GET /api/adoption` and `GET /api/offers/replay` return the two counts-only reports (web or device token; MCP keys never reach them), and `scripts/phone-hq.sh` now signs a computer in as a device with a one-time code and reads them over the bridge, because a release build is not debuggable and `run-as` cannot reach it. `hq offers replay` prints the phase 1 rules beside tuned ones: only what the person typed (an MCP client's `hq_ask` question no longer counts, here or in the adoption report), only capabilities ready on this install, the same offer at most every three days and any offer at most once a day, cues matched as whole words (`print` no longer matches `println`), a list only when it is short items and most of the message, a dated to-do only with "remind me" or in a short message, and a file format only with a request to make one. - **HQ shows what it can do, and the owner can see whether it helps.** One list in the person's words (`crates/hq-tools/assets/capabilities.yaml`), checked against the install (model key, OCR, `gws`, registered tools), now fills the empty chat on the web and Android apps through `GET /api/capabilities`: four things that work here, ones the person has not tried first (the phone keeps its three fixed chips until HQ answers). The owner's own chat sessions get a short "Things you can offer" block so the model can mention a capability when it fits. A weekly `adoption-digest` daemon task puts one item in the inbox with time to first useful result, capabilities used and never tried, corrections ("shorter", "that's wrong"), active days and whether HQ was used again in week four, read from local records with no model (`daemon.adoption_digest: false` turns it off; Lite does not run it). Plan: `docs/plans/simple-hq.md`. - **`hq adoption` and `hq offers replay`.** The first prints the adoption report on the command line (`--json` for a program). The second runs the detectors for the planned "I can also do this for you" offers over past chats (`--days`, default 56) and prints, per detector, how often it fired, how often HQ did that thing anyway within ten minutes, and how often it would have been the one offer under a reply, so the offers can be tuned on real history before the apps show any. Both print counts and the catalog's wording only. `scripts/phone-hq.sh adoption` runs them on a phone over `adb`, inside the app's sandbox. - **Adoption data stays on the device.** What the person uses HQ for is never sent to a model provider, a push service, a relay or any third party. The model's block takes no usage, the digest is never web-pushed even with `push_all`, and a guard test fails if the adoption code imports a way out. See `docs/security/ADOPTION_DATA.md`. - **A worktree can start at a ref, bring its ignored files along, and report where it stands.** `worktree: {"branch": "", "from": ""}` (and `hq sessions spawn --branch --from `) starts a new branch at that ref. A repository's `.worktreeinclude` names gitignored files (`.env`, `node_modules/`) that a new worktree gets as copy-on-write clones, listed in the reply's `worktree.copied`. Every session's environment has a stable `HQ_PORT`, and `harness_session_status` (and `harness_session_list` with `worktree_status: true`) reports changed files and distance from the session's start. The host gains `worktree.status` and a `from` param on `worktree.add`. See "Agents that share a repository" in `docs/AGENT_SESSIONS.md`. - **The numbers behind a team's run.** `harness_session_stats` and `hq sessions stats [] [--task ]` read a team's or a task's event log into how long dialogs waited, how many you answered and how many a command policy or Drive settled, the policy's allows, denies and escalations, host outages, and finished turns, commits and exits: the measures `docs/plans/remote-driven-teams.md` judges the work by. Every answer to a dialog is now recorded with who gave it. A session's task gets one summary of its command policy's decisions when it finishes a turn or exits, and a task blocked by a dialog at launch says it waits on the owner. - **A remote client runs one team, moves it through a plan, and sees what it waits on.** `team: ` on `harness_session_spawn` and `harness_session_handoff` starts the new session under that root, with the team's roster, messages, stop-with-root and limits, for the owner, a web chat, or a claude.ai connection on a team it started. A reviewer joining a team observes its writers. `harness_session_link` moving a session to the next task moves its goal too, and its reply carries the one line to send ("Continue with : . Its acceptance is on the task."), which `continue: true` sends. `task_decisions` and the task page's "Waiting for you" list the dialogs a task's agents wait on you for, with Allow once and Decline. See "A team run from outside" in `docs/AGENT_SESSIONS.md`. - **Follow a team by events instead of reading screens.** The supervisor writes what happens to every session to its event log: blocked (with the dialog), question, unblocked (and how long it waited), finished, exited, commit, the command policy's decisions and escalations, and a host going silent and coming back. `harness_session_events` reads it as one stream for a set of sessions, a task with its teams, or a team, after a cursor, and can wait up to 45 seconds for the next event, so a remote client makes one call instead of rereading a screen a minute. A claude.ai connection sees the teams it started, and an agent only its own team. Reading events counts as reading untrusted content. See "Following sessions by events" in `docs/AGENT_SESSIONS.md`. - **Command policies: commands a policy allows go ahead, ones it denies are refused, and only the rest reach you.** A coding session now starts under the `builder` policy and a review under `reviewer` (`agent_host.command_policies` replaces or adds policies; `policy` on spawn, handoff, `agent_delegate` and `hq sessions spawn --policy` picks one, `none` turns it off). Copilot gets the policy's denies at launch, and Claude Code, which runs with its permission bypass, gets a hook that refuses what the policy denies. When an agent still stops at a command, edit or path dialog, the supervisor answers it: the one-time yes for what is allowed, a decline naming the rule for what is denied, and the usual alert, with the reason, for anything else. A session started by another may not run under a wider policy, Drive never answers a command dialog the policy decided, and every decision is a `policy_decision` event. The built-in `builder` denies `git push`, `git stash`, `git reset --hard`, `git clean`, `git checkout --`, `git restore`, `rm -r`, `env` and `printenv`: a Claude Code session that used to push its own branch now needs the `reviewer` policy, `policy: none`, or `deny_remove: ["git push"]` in your `builder`. Migration 105 (`session_policies`). See "Command policies" in `docs/AGENT_SESSIONS.md`. - **Each agent can get a git worktree of its own, and two agents never write to one tree unknowingly.** `harness_session_spawn`, `harness_session_handoff`, `agent_delegate` (`worktree: true` gives a branch named for the worker's sub-task), `hq sessions spawn --branch` and the web's New agent dialog start an agent in a worktree of the folder's repository under the host's HQ folder: on a branch for a writer (one writer per branch), or a commit checked out detached for a reviewer. Without one, a coding session in a folder another coding session writes in is refused unless both name `owns` paths that do not overlap; reviewers, monitors and the session's own parent are not counted. When a writer finishes a turn with a new commit, the alert and the messages to its delegator and observers name the sha, so a reviewer checks out exactly that. A clean worktree is removed at stop or exit and made again on resume; one with uncommitted changes is kept and its path reported. Migration 104 (`session_checkouts`). See "Agents that share a repository" in `docs/AGENT_SESSIONS.md`. - **HQ tells you when a host stops answering, and a laptop can stay awake while agents run.** A host with running sessions that has been silent for `agent_host.unreachable_alert_minutes` (default 5, 0 turns it off) raises one "not answering" alert naming its sessions, on the phone and in web push like any other. When it answers again the alert leaves the inbox and a notice says it is back. A short silence says nothing, and a daemon restart neither repeats nor forgets the alert (migration 103, `host_outages`). `agent_host.keep_awake: while_sessions` (off by default) makes `hq host serve` hold a sleep assertion while an agent runs, with `caffeinate` on macOS and `systemd-inhibit` on Linux; it watches the host's pid, so a host that dies lets go. `hq doctor` lists silent hosts and suggests it. See "Behavior worth knowing" in `docs/AGENT_SESSIONS.md`. - **Answer an agent's question from the notification.** When a coding agent waits at a dialog HQ can read, the alert on the Android app and the web push say what it asks (the question and the command or path) and have buttons: **Allow once**, only when the agent has a plain yes-once answer, and **Decline**. A tap answers that exact dialog: an answer given elsewhere, or one the agent has moved past, shows as already answered instead of answering whatever came next, and no button ever picks a "don't ask again" or "remember" option. The phone and the web app answer through `POST /api/notifications/{id}/answer` with their usual token. A web push button carries its own token instead (an HMAC with the install's approval key over the item, the dialog's number and the choice, valid 15 minutes, good once), so the service worker never holds the web token. Telegram keeps a plain notice. Migration 102 (`dialog_alerts`). See "Answering an agent's question from the notification" in `docs/WEB_PUSH.md`. - **A blocked session's dialog is data, and it is answered by option.** The host reads the dialog Claude Code, Codex or Copilot is waiting at (its kind, question, the command or path it is about, and its options, flagging the ones that would let the agent do it again without asking) and numbers it. `harness_session_pending` returns it (and, like the logs, counts as reading untrusted content), `harness_session_status`, `_list` and `_wait` give its number and kind, and `harness_session_answer` picks an option or declines (optionally with a message sent as the next prompt). An answer names the dialog's number, so one that changed in between is refused instead of answered. The host moves the agent's cursor and presses Enter only once the screen shows it on the chosen option, and the reply says when the dialog stayed open. Only the owner may pick a "don't ask again" or "remember" option: Drive, a session's own token, a claude.ai connection and an `hq_ask` reply are refused them. The web Sessions panel shows one button per option; its old Approve button pressed Enter, which on Copilot's path dialog picked "remember this path". Rule files describe dialog shapes in `[dialogs]` tables (engine version 4), and `harness_session_logs` takes a `since` cursor that returns only the lines that scrolled off since the last read. See "Dialogs as data" in `docs/AGENT_HOST.md`. - **The Android app hears from your HQ on a server.** The app only asked the HQ on the phone, so a coding agent's question on a server HQ never reached it. Settings, Notifications, **Your HQ on a server** signs the phone in to that HQ with a one-time code from its Settings, Devices (https only; the device token is sealed with the app's Keystore key). The app then asks it once a minute, its questions get the same Allow and Not now buttons, the answer goes back to the HQ that asked, and tapping one opens that HQ's web app. Signing the phone out there stops it, and the app says so once. See `apps/android/README.md`. - **`GET /api/notifications` answers with an ETag.** A client that sends it back as `If-None-Match` gets 304 and no body while the list has not changed, so a phone polling over mobile data pays a few hundred bytes a poll instead of the whole list. - **GitHub Copilot sessions report their state, and owners can fix state rules without a release.** Copilot had no state rules, so every Copilot pane read `unknown`: no block alert, `harness_session_wait` never settled, and Drive never saw a dialog. A new rule file, written from screens of Copilot CLI 1.0.105, reads its command, file, path and question dialogs as `blocked`, its working and loading footers as `working`, and its idle footer as `idle`; any other screen reads `unknown`, never `idle`. The host now also loads rule files from `~/.hq/detect` at start (same format, same id replaces a built-in), and `hq doctor` lists what it loaded and what it skipped. - **A folder request blocks the spawn until you answer.** A claude.ai connector or the handoff key asking for a folder you have not approved used to get an error back at once that read "this is not a failure", and nothing retried after you approved, so the caller carried on as if a session had started. `harness_session_spawn` and `harness_session_handoff` now wait for your answer inside the call (55 seconds less `launch_bound_secs`, at most 30): approving starts the session in that call, dismissing fails it at once, and no answer fails with `BLOCKED: no session was started` and tells the caller to say so and call again. See "Folders the owner approves" in `docs/AGENT_SESSIONS.md`. - **A macOS desktop app, the first desktop of the Native Bridge sprint.** A small Tauri 2 app (`apps/desktop`, built with `bun run build` there, unsigned for now) that starts and stops the local `hq` host, shows the pairing QR code and takes the six digits the other device shows (the host pairs only when they match, three tries, never a yes button), lists paired devices and revokes one (open connections close at once), and has a Connect Claude screen that opens the connector's window. HQ's web app is its main window, shown through a loopback-only proxy that adds no credential; the web window has no way to call the app and can navigate nowhere else. Nothing starts when the app opens and it registers no login item. All logic is in the new `hq-desktop` crate, tested with the workspace; the Tauri shell is its own workspace so Linux CI needs no web view. Consent on the app's own address still waits on a loopback-friendly `authorize_url` (W6). See `docs/DESKTOP.md` and `docs/security/DESKTOP.md`. - **HQ can verify finished tasks itself, so you review exceptions instead of every result.** Off by default (`tasks.verification.mode: off`), so nothing changes until you turn it on; `shadow` records verdicts that move nothing, `enforce` gates completion. When an agent hands work over, the daemon's `verify-dispatch` (every minute) reads evidence the agent could not have written (pull request state, check runs and the branch's required checks, a diff scan for tests skipped or CI weakened, a note's content hash, a guarded URL probe), settles what the facts settle without a model, and asks a reviewer model only about what remains, with a monthly dollar ceiling (none set: no model is called). A pass completes the task as a verifier, never as the worker; a fail or a task with nothing to check returns to `to_do` keeping its assignees, with the findings as the checkpoint `task_next` hands back, and the third return goes to you once. A reviewer pass must cite recorded facts, tier 2 (security, payments, deploy, migration, outbound, deletion, or a change that weakens tests) needs reviewers from two model families and then waits a veto window (24 hours) before it completes, and a verdict is dropped if the pull request, the note or the submission changes while it is checked. An agent that asks for `complete` is not refused: the call becomes `ready_for_review` and the reply says verification is queued. At handover a code task with nothing HQ can find gets a reply naming what to link (`release_check: warn`, or `enforce` to refuse). `task_get` shows `waiting_for` (worker, ci, verifier, budget or owner), and a task that verification will handle raises no review item for you. Trust is measured, not assumed: canaries (planted defects and clean controls put to the real reviewer), audits (a weekly floor and as many as you pull, `hq verify pull`; a disagreement reopens the task), and escapes (reopened or regression follow-ups) decide per tier and per reviewer configuration whether auto-completion is earned, has too little data (shown with counts) or is withdrawn, in which case it waits for you and one alert says which numbers did it. Migrations 095 to 097. `hq verify` shows status, audits and veto windows. It is not an agent tool, so an agent cannot agree with an audit of its own work. A lease now stays alive on any lease-bearing call, `task_next` offers orphaned in-progress work first, and the acceptance label that feeds skill outcomes counts only a completer who is not the worker. The "HQ never marks a task complete" statements in the session, stack and sub-agent docs and prompts now say who does. Clearing a backlog is a sweep: HQ plans it from the evidence with no model and no spend, you run it, read the groups (passed, failed, nothing to check, could not decide, need you) and apply once, with an explicit confirmation above `sweep_confirm_over`; each task is checked again before it moves, every change carries the sweep id, and undo restores what has not changed since. Turning enforcement on leaves older work to a sweep instead of bulk-processing it. `hq verify briefing` and `hq verify queue`, and the tasks page (built for a phone), give an exception-first briefing, the queue by who it waits on, a veto and a second opinion, and an audit stack with a running error estimate. Turning it on is gated on numbers: `hq verify rollout` compares what shadow mode would have done with what someone other than the worker then did, checks the reviewer against planted defects, and names the one setting that takes the next step. Operator guide: `docs/TASK_VERIFICATION.md`; plan: `docs/plans/task-verification.md`. - **Files in the vault that are not Markdown can be turned into notes, from the terminal and over MCP.** `hq vault inventory` lists them with a status (`pending`, `imported`, `changed`, `blocked`), and `hq vault import <file> | <folder> | --all` converts them: a folder is a dry run until `--apply`, leaves pictures out unless `--images` (they are counted, not silently dropped), `--format pdf,docx` picks formats, `--archive` moves originals to `_archive/originals/`, and a repeat run skips what is done, even after the note was moved or renamed. Agents get the same through the new `vault_inventory` and `vault_import` tools. Each note's frontmatter names its source file and hash, and the result says what was kept, flattened or read by OCR. `convert_to_markdown` now returns the same report, takes vault-relative paths, and reads scanned PDFs and images by OCR when the host has it. From claude.ai an import is held for approval only when it reads from or writes into a system folder, and its preview taints the session like any other document read. See `docs/NOTE_IMPORT.md`. - **Spreadsheets import the way they look.** A cell stored as 0.097 under a `0.0%` format now reads `9.7%`, 2700000 under `"UGX" #,##0` reads `UGX 2,700,000`, a negative under `(#,##0)` keeps its brackets, dates read as `2026-07-01` and a time of day as `15:36` (it used to read as 1899-12-30). XLSX styles are read for this, ODS files are read from the text the sheet shows, and an old `.xls` is re-saved as `.xlsx` by LibreOffice when it is installed (otherwise its numbers show as stored and the report says so). Formats this does not model (fractions, conditions, engineering notation) fall back to the plain number. - **Two reader fixes.** RTF tables that sit side by side with nothing between them (as LibreOffice saves a Word document with two tables in a row) are two tables again instead of one padded table. An ODT saved from a Word multi-level list, which LibreOffice writes as one list per level, keeps its levels: a list that follows another with a deeper indent is read as the next level down. - **OCR says how sure it was.** An imported scan or photo now reports its average confidence and the words tesseract doubted most (numbers first, at most eight, cut to short plain tokens), per page for a PDF, in place of the same generic warning for every file; `ocr_extract_text` returns the same as `confidence`. It also says plainly that OCR can be confidently wrong. Tesseract now runs one thread per picture with a three-minute limit: left alone it starts a thread per core in every process, and four photos at once took two minutes on a four-core machine instead of under half a second. - **`hq doctor` says what a machine can import.** A new "Importing files as notes" section reports OCR (and pdftoppm for scanned PDFs), pdftotext for tables in PDFs, and LibreOffice for old `.doc`, `.ppt` and `.xls` files, each with what it buys and the `apt` or `brew` command to add it. It replaces the old PDF OCR check, which covered only scanned PDFs in `web_fetch`. `deploy/README.md` lists the optional packages for a server. - **A new document reader replaces the generic extractor for imports.** The format is decided from the file's content before its name. DOCX, PPTX, ODT, ODP, RTF, HTML (UTF-8, UTF-16 and Latin-1 pages), XML, CSV and TSV are read natively into one Markdown writer, spreadsheets (XLSX, XLS, ODS) through `calamine` with dates kept as dates, tables in PDFs are rebuilt from the page layout (including a table that runs across pages), and old `.doc` and `.ppt` open through LibreOffice when it is installed. Before, ODT, RTF, XML, XLS, ODS, ODP, DOC and PPT failed or lost their structure, and a scanned PDF returned nothing. Zip bombs, oversized parts, XML entity bombs and password-protected files are refused, and the chat upload path (`attachments`) uses the same reader. Fixtures are invented documents in `crates/hq-convert/tests/fixtures/corpus/`, and `scripts/fetch-conversion-corpus.sh` fetches about seventy real public files for an opt-in check (`cargo test -p hq-convert --test real_corpus -- --ignored`). - **Old completed tasks can archive themselves.** Set `tasks: { auto_archive_after_days: 90 }` in the config and the daemon archives completed tasks that finished more than that many days ago, once a day (the value is kept between 7 and 3650; absent or 0 leaves it off, which is the default). It is the Tidy up sweep on a timer: it hides tasks from the web lists only, never touches open work, a task with an open sub-task or one an agent holds, and leaves one web inbox item with the count and how to undo it (Tasks, Archived, then Unarchive, or `task_unshelve`). - **Archive old tasks and lists to quiet the web view, without hiding them from agents.** The Tasks page loads only what is not archived, so a long history no longer grows the page. Pick tasks and press **Archive**, use **Tidy up** to archive completed tasks older than 14, 30, 60, 90 or 180 days in one step (it counts first, and every archive has an **Undo**), or archive a whole list from the sidebar; archived lists and tasks live under the **Archived** tab and **Archived lists**, and an archived task opens from any link. This is display only: agents, `task_next`, claims, dependencies, the graph and search see an archived task exactly as before (`task_list` includes it unless you pass `shelf=exclude`), it keeps its status and its `updated_at`, and claiming or reopening it brings it and its list back. New MCP tools `task_shelve`, `task_unshelve`, `task_shelve_completed` and `initiative_shelve`, REST routes under `/api/tasks/shelve*` and `/api/initiatives/{id}/shelf`, and migration 095. The old Archived tab, which lists removed tasks, is now called **Deleted**. See "Archiving for the view" in `docs/plans/native-tasks.md`. - **An evaluation for context packets on multi-agent tasks.** `cargo test -p hq-memory --test context_packet_eval` scores packets on six labelled scenarios (relevance, missing context, stale context, budget use, citation accuracy, a note containing instructions, and a failed search and graph) and asserts that nothing stale is shown as current, no needed note is missing without a gap, and every fabricated or changed citation is caught. See `docs/architecture/vault-context-packets.md`. - **Context packets can be built from a task, and say who wrote each source.** `context_packet` and a sub-agent's `context_need` take a `task_id`: the packet then carries the task's record (description, acceptance criteria, status, owner, dependencies, what its last session left open), the notes it links, and the notes written under it or by its linked sessions, within the same `budget_chars`. Each entry also shows the actor, source kind, task, session and review state of the exact version it quotes, with `unknown` where nothing was recorded and `unreviewed` or `disputed` plainly visible. If the task, search or the graph index cannot be read, the packet says so as a gap and is labelled partial. See `docs/architecture/vault-context-packets.md`. - **`hq skills evidence` turns skill use into reviewable proposals.** It reports, per skill and per version, loads, sessions, outcome mix and repeating patterns (reworked outcomes, harmful verdicts, loaded but unused, rework by kind of work, hints that did not activate the skill). A pattern is evidence only at 5 loads across 3 sessions in the window (30 days by default); smaller ones are shown as too small, a skill with none is "insufficient evidence", and version comparisons carry their sample sizes. `--propose` writes `skills/_proposed/<name>/PROPOSAL.md` with counts, range, example loads by id, the likely change and the fixtures a change must keep passing. A proposal has no replacement text: `hq skills approve` refuses it and `reject` dismisses it. See `docs/SKILL_FLYWHEEL.md`. - **Skill telemetry ages out, and you can delete it.** The daily cleanup folds raw invocation rows older than 90 days into monthly counts with no ids (migration 094), and counts and mean outcomes read them too. `hq skills evidence purge --id | --skill | --from/--before` deletes records (a preview until `--yes`; never unbounded). It is a command-line action only, and never touches skills or the audit trail. - **Skill loads record which version ran, for which task, and how it turned out.** `skill_invocations` gains the skill's hash (the digest the skill audit trail keeps), the task, a coarse purpose taken from the task's tags, whether the skill was used, and a categorical outcome with a reference to the record behind it (migration 093). Only ids, hashes and values from fixed lists are stored; the database refuses free text, so no prompt, document or task title can end up there. Existing rows keep NULLs. - **Skill outcomes come from what happened to the work, not from the session exit.** A daemon task, `skill-outcomes`, settles each load from the task (reviewed then completed is accepted, reviewed then reopened is reworked), from sub-agent run reviews, and from corrections of notes by someone other than their writer. A session that exits cleanly while its task is reopened now scores 0.5, not 1.0; the session result stays as weak evidence and never overwrites an observed outcome. - **Regression fixtures for skills.** `skills/<name>/fixtures.yaml` lists phrases that must and must not trigger the skill's hints and steps the body must keep. `hq skills validate` reports failures, and a change from the post-session skill review that fails them is held in `skills/_proposed/` for `hq skills approve|reject` instead of going live. Skills without fixtures are unaffected. See `docs/SKILL_FLYWHEEL.md`. - **Edits made outside HQ are searchable within seconds.** The daemon now watches `Notebooks/` (an editor, git, a coding agent's shell) and re-reads a changed note after a short quiet period, so fifty saves are one index operation and a new note, an atomic-replace save, a folder move and a delete each showed up in search in about 0.3 seconds when measured against real file events on Linux. Events are only hints: the 30-minute scan still runs as the correctness floor, a full queue is replaced by one scan, and a Windows drive under WSL2, which delivers no events, falls back to polling. Settings: `vault_watch.enabled` (default on), `mode` (`auto`, `native`, `poll`), `debounce_ms`, `poll_secs`. `hq doctor` gains a **Search index** section (watcher state, indexed against on-disk notes, stale embeddings, the embedding worker's last error), the daemon writes the same figures to `_system/.daemon-metrics.json`, and `hq vault repair [--apply]` finds and removes orphaned index and embedding rows. Embeddings are now made in the background as notes change and re-made when a note's text does. See `docs/architecture/vault-events.md`. - **Every version of a note remembers who wrote it.** Writes through HQ (the vault write, append, patch and frontmatter tools, person facts, the note shortcut, moves, the web app and `hq vault write`) record the actor, source kind, session and task against the version they produced (migration 092). A note written inside a leased task is linked to it as `produced`, and a write never changes the task's status. Nothing is guessed: a version nobody recorded, such as a file edited in an editor, stays unattributed. A deleted note's records are kept for 90 days. - **`note_review` and `note_provenance`.** Review state (`reviewed`, `accepted`, `disputed`, `superseded`) changes only through `note_review`, with the reviewer, a reason and the whole history kept. An agent in a session can flag a version but cannot accept it or review its own work; the owner and an approved connector call can accept. `note_review` waits for the owner's approval when called from claude.ai. `note_provenance` reads the versions of a note with their authors and decisions. - **A generated activity view for tasks and initiatives.** `task_activity`, `GET /api/tasks/{id}/activity` and `GET /api/initiatives/{id}/activity` return a task's status, holders, linked sessions, the notes tied to it with author and review state, decisions and findings split by review state, recorded open questions, a freshness time per source and explicit gaps (unknown authors, files edited outside HQ, unregistered sessions, an in-progress task nobody holds). It never infers completion or ownership from edits. The task drawer shows it as **Activity** and a selected initiative has a **Briefing**. It is refused to restricted audiences and to the spark, handoff and tasks keys, and is not served under `profile: lite`. - **A Get started checklist on the home screen.** After setup, the home screen lists the steps nobody would otherwise find: open HQ on your phone (signing it in with a code from Settings > Devices and adding it to the home screen), connect Telegram or Discord, and turn on notifications (left out when the browser has no Push API or `web_push.enabled` is off, since the owner can't finish it from the web). Each step links to its place in Settings or Notifications and ticks itself off from live state where it can: the installed app, a chat app with a saved token and a paired owner, and a push subscription on this device; on a computer the phone step has a **Mark done** button. **Hide** puts the card away on that device, and it retires itself once every step is done. Settings now scrolls to `#devices`, `#chat-apps` and other section links even when the section renders after its data loads, and its side nav lists Devices and Chat apps. - **Replace or add a model key from Settings.** The Provider keys section now has **Replace** (or **Add**) for OpenRouter, Anthropic and Google AI, so an owner whose key ran out of credit or was revoked no longer needs `hq env` or a shell. `POST /api/settings/provider-key` tests the key with a one-token call and saves it only if it works, needs a web token like first-run setup, and leaves the model choice alone (a first key ever still gets setup's low-cost default). A key pinned by the server's environment shows as "Set by the server's environment" and is refused with 409. A replaced Anthropic or Google key now reaches the running server on the next message: HQ used to copy those keys into its own environment once and never update the copy until a restart. See "Changing your model key" in `docs/OWNER_GUIDE.md`. - **Sign in on another device with a code or a QR code.** Settings now has a Devices section: **Sign in another device** shows a one-time code (`XXXXX-XXXXX`, ten minutes, works once) and a QR code of the login link. On the phone, the sign-in banner takes the code, so nobody has to paste a 64-character token or ask the operator for a shell. The new `POST /api/auth/exchange` is the only `/api` route the web token does not guard; it is still origin checked, keeps only a salted hash of the code in memory, limits wrong codes per client and globally (a code is burned after 20 wrong guesses from anyone), and notifies the owner (inbox, chat and Web Push when they are set up) when a device signs in. See "Signing in another device" in `docs/security/WEB_AUTH.md` and `docs/OWNER_GUIDE.md`. - **Sign a lost phone out, or sign out everywhere, from Settings.** Every sign-in (a one-time code, the QR code, `/login` from Telegram or Discord, and the new `hq web link`) now gets its own device token, shown once and stored only as a SHA-256 in the database (migration 090). Settings, Devices lists them with when each signed in and was last used, a **Sign out** button per device, and **Sign out everywhere** behind a confirm step: it signs out every device and the operator's original link in one transaction, closes open chat sockets, voids a pending sign-in code, signs the device that asked back in, and notifies the owner. The QR code now carries the one-time code instead of a token. An operator recovers with `hq web link` (prints a new login link; run it as the vault's owner) or `sudo hq-join --print-link`, which now runs it as the `hq` user. An instance that never signs anything out behaves as before. New routes `GET /api/auth/devices`, `DELETE /api/auth/devices/{id}` and `POST /api/auth/rotate`. See "Device tokens and signing out" in `docs/security/WEB_AUTH.md`. - **Sign in on another device with a code or a QR code.** Settings now has a Devices section: **Sign in another device** shows a one-time code (`XXXXX-XXXXX`, ten minutes, works once) and a QR code of a link carrying that code. On the phone, the sign-in banner takes the code, so nobody has to paste a 64-character token or ask the operator for a shell. The new `POST /api/auth/exchange` is the only `/api` route the web token does not guard; it is still origin checked, keeps only a salted hash of the code in memory, limits wrong codes per client and globally (a code is burned after 20 wrong guesses from anyone), and notifies the owner (inbox, chat and Web Push when they are set up) when a device signs in. See "Signing in another device" in `docs/security/WEB_AUTH.md` and `docs/OWNER_GUIDE.md`. - **`/login` from Telegram or Discord.** A signed-out owner can send `/login` to their HQ bot (Telegram, or `!login` and the `/login` slash command on Discord) and get their web login link back, built from the first `web_allowed_origins` entry and the web token, so getting back in no longer needs the person who set up the server. Owner only and private chat or DM only: Telegram guests, group chats, Discord server channels and the family channel and its threads are refused, and family users never get it. The Discord slash command answers with a reply only the owner sees. The sign-in banner now mentions it first. - **The web app says when it can't reach HQ, and why that usually is.** A phone with Tailscale switched off is still online, so the app opened with saved data and only a small "saved" label in the header. After 8 seconds without a connection it now shows "Can't reach your HQ" with what to check (Tailscale on this device first, then a restart or update in progress, then the server in the Tailscale admin console), or "This device is offline" when there is no network at all. A sign-in problem keeps its own prompt. The owner guide gains a matching troubleshooting table, and the onboarding plan a list of situations an owner can run into. - **Connect Telegram and Discord from Settings, with no shell.** A new Chat apps section walks the owner through creating a bot, checks the pasted token with the platform (Telegram `getMe`; Discord `users/@me` and `oauth2/applications/@me`, which also shows whether Message Content Intent is on) before saving it, writes the token and the relay's enable flag to `config.yaml`, restarts HQ and pairs the owner. Telegram pairing is one tap: the card opens `t.me/<bot>?start=<code>`, and the relay now treats `/start <code>` like `/pair <code>`; an unpaired bot also answers a bare `/start` and a refused code with how to pair instead of staying silent. Discord gets a generated invite link with only the permissions the relay uses. Cards show relay status, refuse to touch a token set through `HQ_RELAY__*` environment variables, and can re-pair or disconnect. New routes `GET /api/chat-apps`, `POST`/`DELETE /api/chat-apps/{platform}`, `POST /api/chat-apps/{platform}/verify` and `.../pair`; every write needs a configured web token. See `docs/TELEGRAM-ACCESS.md` and `docs/DISCORD-ACCESS.md`. - **HQ can restart itself from the web app.** `POST /api/system/restart` runs the normal shutdown and exits with status 75, so systemd (`Restart=always` or `on-failure`) starts it again; on macOS it kickstarts the configured launchd job. It is offered only when one of those supervisors runs HQ; elsewhere the web app asks the owner to restart HQ by hand. - **A guide for people who get an HQ server set up for them.** `docs/OWNER_GUIDE.md` covers Tailscale setup before the join, signing in, adding HQ to a phone's home screen and getting back in. `hq-join` now ends with a block the operator can forward as is, and `sudo hq-join --print-link` prints the login link again without touching the tailnet or restarting HQ. The plan for the rest of the journey is `docs/plans/owner-onboarding.md`. - **Claude can start coding agents in the HQ folder with no setup.** A claude.ai connector may now start sessions inside the HQ folder of the machine they run on (`~/Documents/HQ`, where HQ already starts a session given no folder), on every host. `agent_host.handoff_cwd_allow` adds other folders; anything outside both is still refused. - **The web app says when it needs signing in.** With `web_auth_token` set, a browser with no token, or a token that was rotated, used to keep showing data saved on the device with only a red sync dot to show for it. Once the server answers 401, the app now shows a "Sign in to HQ" banner that takes the pasted login link (or just its token), stored like a `#token=` link and followed by a reload. It tells someone whose server was set up for them to ask for `sudo hq-join --print-link`. Responses the service worker serves from its cache do not count. - **Push notifications to the web app, and `notify_owner` for agents.** HQ, and any agent reaching it over MCP, can send the owner a notification with `notify_owner` (title, body, an optional link to a page of the web app, a dedup key, and `channels: web` or `web_and_chat`). It lands in the inbox and is pushed to every browser or phone that turned push on from the Notifications page, even with HQ closed; approvals waiting on you are pushed too, and `web_push.push_all` pushes everything. Off until `web_push.enabled: true`. The server creates its VAPID key on first start, encrypts each push end to end (RFC 8291), accepts subscriptions only on the known push services, removes ones the push service reports gone, and never replays items older than an hour. Links must be paths on HQ itself, agents are limited to `web_push.max_agent_per_hour` (default 20), and under `profile: lite` push needs `web-push` in `lite.allow_egress`. Migration 088. On iPhone, push needs HQ added to the Home Screen. See `docs/WEB_PUSH.md`. - **Twenty sessions in parallel.** A session may now have 20 delegated children running at once (was 3) and start 60 in an hour (was 10). `hq host serve` defaults rise to match: `--max-agents` 64 (was 16) and `--max-starts` 50 per 10 minutes (was 10), so filling every child slot at once no longer trips the lockdown breaker. `spawn_subagents` runs up to 20 children at once when `max_concurrent` is not given (was 3). A running host keeps its old caps until it restarts. - **The pre-commit hook formats Rust before you commit.** `scripts/pre-commit` now runs rustfmt over the staged `.rs` files and re-stages them, so the CI format check (now a blocking gate) doesn't fail on formatting. `./scripts/install-hooks.sh` installs it in one step; `HQ_SKIP_FMT=1` skips formatting for a single commit. - **Bulk status and priority changes in the web task list.** A **Select** button in the list view ticks tasks (one card, an initiative's box, or **Select all** for everything the filters show), and a bar at the foot sets their status or priority at once. Each task is its own update with the usual `expected_status` check, four at a time, so a task someone else moved in the meantime is skipped and named while the rest go through, and it stays ticked for a retry. Only tasks on screen count as ticked, and tasks already at the target are left alone. Archive and restore are not bulk actions yet, since they depend on sub-task order. - **Collapsible sections in the web task list.** Each initiative header folds its tasks away, and **Collapse all** / **Expand all** fold every section at once. Which sections are folded is kept per device in the browser. A folded section is left out of bulk selection: **Select all** counts only what is shown, folding a section un-ticks what was ticked in it, and its box is disabled until it is expanded. - **A clock in the web app header.** Every screen, phone and desktop, shows the time (24-hour) and the zone's short name in the header. It follows the device's zone until Settings > Clock pins it to any IANA zone; the choice is kept per device in the browser and reaches every open tab at once. Tapping the clock opens that setting, which stays usable when the gateway's settings cannot load. - **A guide to running personal agents under HQ.** `docs/PERSONAL_AGENTS.md` covers Hermes Agent and OpenClaw end to end: what HQ does and never does with them, giving each its own provider key, keeping OpenClaw's gateway daemon off an HQ host, the egress allowlist, interactive use, the Agentic Stack, known limits and removal. The README, `docs/AGENT_SESSIONS.md`, the site's compare page and the homepage now say HQ can run them. - **A kill switch for coding agents.** `hq host lockdown "<reason>"`, the `host.lockdown` method and HQ's `host_lockdown` tool (every host when none is named) kill every agent a host runs (whole process group, no grace), forget them so unlocking brings none back by itself, and leave the host refusing every start, resume and restore. The lockdown is a file in the host directory, so it holds across restarts and while the host is wedged; only `hq host unlock` on that machine lifts it, and no method unlocks. `hq host serve` also locks itself when more than `--max-starts` (default 50) agents start within 10 minutes, without stopping running ones (only successful new starts count, not resumes after a restart), and caps agents at `--max-agents` (default 64). A lockdown is a host event; the daemon turns it into an inbox item and an interrupting relay alert, and `host_list` and `hq host status` show it. The web app's Workbench has a **Stop all** button beside New agent (brand green outline, a bottom sheet on phones, every computer by default) and names any locked computer above the agent list. A cargo test binary can no longer talk to a real host: `NativeBackend` refuses calls to the machine's own host directory and to remotes over the real `ssh`. See "Lockdown" in `docs/AGENT_HOST.md`. - **The Agentic Stack: general-purpose agents that pull their tasks.** A `stack:` block names specialists (`name`, `harness: hermes|openclaw` or a profile, `purposes`, `cwd`, `host`, `run_minutes`, `runs_per_day`). Assign a task to a specialist's name and the daemon's `stack-dispatch` (every minute) starts one run for it: the harness's one-shot command (`hermes chat --oneshot -q "<brief>"`, `openclaw agent --local --message "<brief>"`, or a profile's `one_shot_args`) in the host's sandbox, with a brief built from the task, its initiative and its last checkpoint. The queue is the `task_next` pick less code-shaped work (tagged `code`, or linked to a commit or pull request), which a general-purpose specialist is never offered (`NextTaskQuery::no_code_work`). The process ending is the completion signal: the supervisor keeps the final screen, closes the pane and records `RunEnded`, which moves the task to ready for review with its lease released; a non-zero exit code (`RunFailed`) blocks the task like a crash, with a `blocked_reason` that names the run and quotes the short last paragraph of its screen (a plain session exiting, or stopping at a startup dialog, now records a reason too), and a run is never resumed. One run per specialist at a time, a rolling-day run budget, a stop past `run_minutes` (task blocked with the reason), a 30-minute back-off after a failed launch with one comment on the task. `hq stack list` and `hq stack run <specialist> <task>`. A pane whose process ended now counts as gone on every host (`AgentInfo::exited`), is read once more for its output and is closed, instead of staying `running` with status `unknown`. NanoClaw is no longer a harness: it has no CLI to drive. Plan and the language it borrows from Paperclip and Kola Academy's Agentic Freelancing programme: `docs/plans/agentic-stack.md`; setup in "The Agentic Stack" in `docs/AGENT_SESSIONS.md`. - **General-purpose agents as a second kind of host agent.** Hermes (`hermes chat`) and OpenClaw (`openclaw tui --local`, since the sandbox refuses the loopback gateway; do not run OpenClaw's gateway daemon on an HQ host) run in the built-in host, the process sandbox and the session registry like the coding agents, through the same `harness_session_*` tools, the Workbench page (grouped under "General-purpose agents", with a purpose menu) and `hq sessions spawn` (`--purpose`, `--task`, `--observe`). Every session now records a `purpose` (`code`, `monitor`, `research`, `review` or `general`; migration 086). A general-purpose agent defaults to `general` and refuses `code` before anything starts, so HQ cannot hand it a coding task; a coding agent takes any purpose. A `monitor` or `review` session linked to a task comments on it but never holds its lease or moves its status. A monitor or reviewer with a task can be given sessions to `observe`: when one finishes a turn, blocks or exits, the supervisor leaves the observer a message on its task thread and types it in when the observer is next idle, the route delegated children already use. General-purpose agents get their own writable state directory (`~/.hermes`, `~/.openclaw`), no default egress beyond what `allow_domains` grants, and no HQ session token. Session views and launch reports carry `category` and `purpose`, and HQ's chat prompt is told which kind takes what. See "General-purpose agents" in `docs/AGENT_SESSIONS.md`. - **Tasks any agent can work, whatever harness it runs in.** Every status change is logged, lists are paged, and updates are one transaction. `task_claim`, `task_next`, `task_heartbeat` and `task_release` give a session a work lease, so a task has one holder, time on it is recorded from leases, events and `estimate_minutes`, and a checkpoint left on a heartbeat or release is the resume point the next session gets. Tasks carry typed links (notes, chats, sessions, commits, pull requests, URLs, other tasks), assignees apart from tags, a blocked reason, a long-running flag, and archive in place of delete (`task_restore`, purge only from the archive); `task_stale` and a daily digest report in-progress work nobody touches, without changing it. `task_create_many` and `task_update_many` file or move up to 100 at once. The protocol reaches agents three ways: the MCP server instructions, a one-time hint in the first reply, and `hq task install-skill`. The tasks-scoped key can now work tasks under a lease too, named `mcp:tasks/<name>`, with no mailbox, assignee or approval side effects. `hq task` gains `next`, `claim`, `heartbeat`, `release` and `time`. The web board shows who is working now, live work chips, time, links, the resume point and an Archived tab. Migrations 080 to 085; rollbacks are in `docs/plans/native-tasks.md`. - **A tasks-only MCP key and scope.** `AGENTHQ_TASKS_API_KEY` opens `/mcp` to the task tools only (list, get, create, update, comment, and folders and initiatives), with no vault tools, no sessions, no `hq_ask`, no deletes. On that scope the task tools set no routing tags, write to no agent's mailbox, raise no approval item, attribute writes to `mcp:tasks`, edit a title or description only on tasks the scope filed itself, and cap text sizes, so it cannot put text in front of your chat or an agent by those routes. It can still change the status of and comment on your tasks, and it has no rate limit; see `docs/security/WEB_AUTH.md` for what remains. `hq mcp install --target <client> --scope tasks` installs a stdio server limited the same way (`hq mcp-serve --scope`); a scoped server sends no tool catalog in its instructions, and a later plain `hq mcp install` keeps an existing entry (a narrowed one, a remote one, or one with a scope it does not recognize) instead of widening it. `hq mcp status` shows how far each entry reaches. - **`hq mcp install --url <https-url>` writes VS Code's remote form**, with a `promptString` input so VS Code asks for the key and it never lands in the file. The URL is parsed and checked: `https://` only, except `http://` for localhost, and no credentials, query or fragment. - **HQ Lite: `profile: lite`.** One setting turns an instance into a restricted one for a machine you do not fully control. The web app, tasks and notes are served; `/mcp` registers only the task tools; chat turns are refused over the socket (and `hq chat`, `hq sessions`, `hq host` and `hq agents` refuse); sessions, the Workbench, settings, setup, admin, usage and the Gmail webhook answer the same JSON 404 as a path that does not exist; and `_system`, `_data` and other `_` or `.` folders are unreadable and unwritable through the web app. The scheduler keeps six housekeeping tasks and no startup loops. Commands that serve, run the daemon or could call out refuse to start while anything that sends data to another service is configured (model API keys in the config or the environment, `providers:` and `backends:`, relay tokens, `remote_mcp:`, `decisions:` routes, Gmail through `gws`, remote agent hosts, self-update, a remote `OLLAMA_HOST`), unless `lite.allow_egress` names it by id or host, and the running daemon applies the same check when it reloads the config. `hq doctor --egress` lists every destination a config can reach and exits non-zero under Lite when one is refused. Chat relays are never enabled under Lite, whatever `lite.allow_egress` says. The `github-copilot-api` backend is refused too, since it signs in through Copilot's internal token endpoint; only `lite.allow_unofficial_copilot` lifts that. See `docs/HQ_LITE.md`. - **A Scoop bucket in this repo.** `scoop bucket add hq https://github.com/CalvinMagezi/hq` and `scoop install hq/hq-lite` install the signed Lite build `v0.9.1-main.136` into the user profile with no administrator rights. The manifest is pinned and not auto-updated; the installer remains the way to get the newest build. - **HQ Lite downloads are signed, and the installer checks the signature.** The `Windows Lite` workflow now has a `sign` job in the protected `release` environment (read-only, no build code) that signs each zip's checksum with the release minisign key and attaches `<zip>.sha256.minisig`. `install.ps1` verifies it with a built-in BLAKE2b and Ed25519 verifier (Windows PowerShell 5.1 has neither) before trusting the SHA-256 or unpacking anything, refuses any release without a signature, and has no skip switch. `hq update` only offers signed builds. The self-test checks the verifier against real minisign signatures, including the production release key, on PowerShell 5.1 and 7. Not Authenticode: AppLocker and Smart App Control publisher rules still need a code-signing certificate. - **Every main release gets its Lite zip.** The `Windows Lite` workflow now also runs after each successful Release run on main, builds from that commit, and attaches `hq-lite-<version>-<commit>-windows-x86_64.zip` and its `.sha256` to the matching release. It still does not touch the signed manifest or the update channels, and the zip is unsigned. - **Lite housekeeping commands.** `hq autostart on|off|status` (one per-user startup value, opt-in), `hq uninstall lite`, `hq lite export|import <folder>` (notes only, never overwriting), `hq doctor --windows` (read-only), and on Windows `hq update [--apply]`, which looks for a newer Lite zip and runs the installer. `docs/api/lite-local-api.yaml` is an OpenAPI description of the REST slice Lite keeps, and `packaging/` holds Scoop and winget templates. Windows CI now also runs the Lite tests and checks that gated routes answer 404. - **Lite's editor tools are task tools only.** The note tools are no longer registered under `profile: lite`, because they could read `_system` and the other hidden folders; a plain `hq mcp install` under Lite writes the tasks scope. Search results (web and CLI) are also filtered by where a note really is, so a link or Windows junction into a hidden folder shows nothing. The Windows daemon now holds its single-instance lock, and a task's routing tags no longer write mailbox files under Lite. - **`hq copilot link`.** Finds which Copilot model a seat can use by trying `github_copilot.model_preference` (default `gpt-6-luna`, `claude-haiku-5.5`) through `gh copilot`, and prints or writes (`--write`, with a `.bak`) the `github-copilot-cli` backend for the first that answers. It never falls back to an unlisted model. - **`hq task` and `--json`.** Task commands for agents with a terminal and no MCP (`list`, `get`, `create`, `update`, `comment`, `comments`, `spaces`), run through the tasks-scoped gateway. `hq search --json`, `hq vault list|tree|read --json`, `hq vault write <path> -` (text from stdin). `hq copilot init [--agents]` writes an idempotent HQ section into `.github/copilot-instructions.md` or `AGENTS.md`. Under `profile: lite`, `hq vault` and `hq search` now hide the same folders the web app hides, and `hq vault context` is refused. With `task` or `--json`, logs go to stderr at `warn`. - **Native Windows build (HQ Lite).** `hq.exe` compiles for Windows with the C runtime linked in (no Visual C++ redistributable) and is always `profile: lite`. The coding-agent host, pairing, the updater and self-apply are Unix-only and answer that plainly on Windows. `hq web --detach`, `status` and `stop` work through `taskkill` and `tasklist`, and the browser opens with `rundll32`. A Windows CI job builds `hq.exe` and smoke-tests tasks, the web server and the refusals; the manual `Windows Lite` workflow packages `hq-lite-<version>-windows-x86_64.zip` (unsigned, SHA-256) and does not touch the signed release pipeline. - **`install.ps1`, the Windows installer (`irm https://agent-hq.online/install.ps1 | iex`).** Looks at the computer read-only (WSL2, administrator, virtualization), recommends Full HQ in WSL2 where it works or HQ Lite where it does not, and lets you choose either (`-Edition full|lite`, `-DryRun`, `-Yes`). Full runs the WSL2 setup steps one by one, each shown and skippable; Lite downloads the zip, checks its SHA-256, unpacks it under `%LOCALAPPDATA%\hq-lite`, starts it once, and if a program-blocking policy refuses it removes it and lists the alternatives. It never elevates, changes system settings or tries to get past a policy. A CI job runs its self-test in Windows PowerShell 5.1 and PowerShell 7. New guide `docs/CORPORATE_WORKSTATION.md`; `docs/WINDOWS.md` now starts with the choice between the two editions. - **The note viewer has an Export menu.** The PDF button is now a labelled Export button that opens a menu: PDF, Word, web page, Markdown, PNG and SVG, plus Excel, CSV and JSON when the note contains a table (a note with no tables never offers them). Downloads work as before, with the share sheet on a phone, and a note with several tables saved as CSV arrives as a `.zip`. See `docs/NOTE_EXPORT.md`. - **A guide to the first-run model key screen**, `docs/FIRST_RUN.md`: when it appears, what the button does, what protects the key, and fixes for each error. The screen's hint now shows `hq env` as code instead of with literal backticks. - **A recorded walkthrough and a step-by-step quick start for the Hetzner deploy.** The README, the install page and `docs/HETZNER.md` now show the form in a short animation and list the six steps, what you need beforehand and what it costs. - **The Workbench terminal is live and in color.** The page now opens a server-sent stream of the agent's screen instead of polling plain text, shows the colors the agent printed, and falls back to polling if the stream cannot open. - **The Sessions page is now Workbench, and you can start agents from it.** Pick a computer, a folder and an agent, and HQ starts it there. Every computer that joins gets a `Documents/HQ` folder (on macOS, Linux, Ubuntu servers and inside WSL2 on Windows) that agents start in by default, and folders can be browsed and created inside it from the page. Agents that are waiting for you are listed first with Approve and Decline buttons, and past agents can be stopped, resumed, renamed and archived. The page is served at the same `/sessions` address. - **A fresh server can take its first model key from the web UI.** With no key configured, the web app opens a setup screen that tests an OpenRouter key and saves it, so a server nobody has a shell on yet needs no `hq env`. It works only on an instance with a web token, and only until a key exists. Anthropic and Google keys are not offered there yet because the chat router does not read them from config. ### Fixed - **A key added on the phone answers chat, shows as set, and can be replaced or removed.** The Android app hands its sealed keys to HQ as environment variables and never writes a model, so the stock `relay` default stayed put and, with only an OpenRouter key, `relay` had a single free route; chat failed with "No provider could serve model 'relay'". On the Mobile profile a default nobody chose now follows the keys at load, by the rule `hq env` uses, without writing anything back, and `relay`, `premium`, `plan` and `code` have a paid OpenRouter route (setup's cheap model) behind the free one. Settings, "Your keys" counts a key set in its conventional variable (`OPENROUTER_API_KEY`, `DEEPSEEK_API_KEY`, ...) as set instead of "Not set". On "Keys on this phone", Remove opens its confirmation (it was drawn off screen) and Replace moves to the key field and says what to do. The helper sheet says helpers run on a paired computer instead of "HQ cannot reach this phone". - **Quoting someone else in Telegram or Discord marks the turn as having read untrusted text.** A reply to another person's message, another bot's, a webhook post or a forwarded message put that text into the owner's turn as if the owner had written it, and any bot's message was quoted to the model as "assistant". Such a turn now starts tainted, so secret files and outbound network from bash are refused in it as after a web fetch, and only HQ's own messages are labelled "assistant". - **`background_turn_status` in a chat finds only that chat's turns.** It returned any chat's turn, prompt and result excerpt included, to whoever gave a short ref, while `watch_list` and `watch_cancel` were already bound to the chat. In a Telegram or Discord chat another chat's turn now reads as not found; the web app, the CLI and MCP clients still look across every chat. - **No session can post to the owner's Discord channel through the mailbox any more.** `agent_send_message` to `@all` reached the relay mailbox, and the caller could name itself `family-confirm`, the one sender the Discord relay posts from there, so any session (or text it read) could put arbitrary words in the owner's channel. A broadcast now skips the relay mailbox, and `agent_send_message` refuses the sender ids HQ reserves for itself (`hq_core::mailbox::RESERVED_SENDERS`). - **A Telegram document's name can no longer write outside the media folder.** The name the sender gave a document was joined onto `_media/<date>/` as is, so `../../_system/.telegram-auth-chat` or an absolute path wrote wherever the HQ user can. It is now cut to one plain file name with control characters removed, stored as `doc_<telegram id>_<name>`, and every download refuses a name that is not a single path component. Discord already kept only the base name. - **A guest can no longer schedule a turn that runs with the owner's tools.** A watch firing and a sub-agent follow-up ran as the owner (no Telegram guest profile, no Discord family role, no one to approve calls), so a Telegram guest or Discord family member who typed `/watch` got the owner's full toolset on every firing. `/watch` and `resume` are now refused for a Telegram guest and in the Discord family channel and its threads, `watch_create` is denied to guests, and every firing and follow-up checks first that the chat is the owner's: a watch stored for a guest's chat stops with a notice, and a follow-up for one goes to the owner's inbox. In the owner's own chats `watch_create` now asks the owner first, like `skill_manage`, because a watch keeps running with nobody to ask. - **Other Discord bots are no longer answered as the owner.** A bot account that @mentioned HQ skipped the allowlist, and whatever passes that check is treated as the owner: it saw what the owner sees and could run `!permission` and `!model`. Bots now go through `discord_allowed_user_ids` (or the paired owner) like everyone else; list a bot's id there to keep talking to it. HQ also never answers its own messages. - **A page on another local port can no longer use HQ.** With sign-in off (the default loopback install), the origin guard and CORS trusted every loopback origin, so a dev server, a notebook or a downloaded HTML file served on another port could open `/ws`, read every chat and tool frame and send turns as the owner, and call `/api`. A browser `Origin` is now accepted only when it is the server's own (its authority equals `Host`) or listed in `web_allowed_origins`, with or without sign-in. Requests with no `Origin` (curl, MCP clients, `hq chat --server`) are unchanged, and the Vite dev server and the desktop app's proxy stay same-origin (the desktop proxy now passes the window's `Host` on the chat socket too). A separate front end that talks to HQ directly must be listed in `web_allowed_origins`. See "Cross-origin requests" in `docs/security/WEB_AUTH.md`. - **Approving in the inbox approves exactly that request.** The web and phone route matched the id as a prefix, so one approve with a short id approved and signed every delivered item sharing it, owner-approval requests included. It also marked an item that had not been delivered yet as approved without signing it, so the inbox said "approved" while the call stayed blocked, and it overwrote items already answered, which could put a spent approval back in force. `POST /api/notifications/{id}/action` now takes the exact id only, signs every approval it records, and answers 409 for an item that was already answered, expired or spent. The short refs of chat buttons and `hq queue approve` stay prefixes but refuse one that matches more than one waiting item. - **Notices that went nowhere now reach the inbox, or stop being made.** Since chat relays became chat only, several producers still posted to the relay mailbox, where every notice was dropped. An email that needs a reply now carries its draft and the `send <token>` / `skip <token>` commands in its inbox item; before, the draft and token were only in the dropped notice, so a drafted reply could not be sent. A tool that governance refuses (one open item per tool) and a coding session that finished its turn and waits (one open item per session) are now inbox items too, and a session exit that left its task blocked is marked as needing action rather than as news. `agent_send_message` refuses the recipient `relay` and points to `notify_owner`; its description used to tell agents that `relay` reached the owner. The rest are gone without a replacement, because the inbox or the vault already had them: the relay copies of host lockdowns and session exits, the agent worker's event summaries (the event note stays), email FYIs, and the provider-fallback notice (the reply is still marked). The email FYI gate (`decisions.sites.email_fyi`) went with them: it spent a model call per FYI email deciding whether to post a notice that was then dropped, and a config that still names the site is ignored. - **Three places that cut text at a byte offset no longer panic on non-English text.** The daemon's status file cut each task's last error at byte 60, and HQ's own errors carry em dashes, so an error with one at the cut stopped the status writer. A failed streaming LLM request quoted the provider's error body cut at byte 300, which panicked on a Chinese or other non-Latin error message. A theme accent colour that was not hex panicked the DOCX export. `hq config` also masks an API key by characters rather than bytes. An audit of every string slice in the workspace (`clippy::string_slice`) found no others that cut arbitrary text. - **NVIDIA machines get local models again.** `hq models` and the LLM router recommended no Ollama models on any machine with an NVIDIA GPU, keeping that path for a TurboQuant server that no standard build could reach, so `hq models recommend` told the user to use something they did not have. NVIDIA cards now get the same Ollama recommendations as other machines, sized by the card's VRAM (less about 1GB) rather than system memory: a 12GB card gets `qwen3:8b` and `qwen3:1.7b`, a 24GB card `qwen3:14b` as well. The router's startup line also names the GPU instead of calling it CPU. - **Dialogs on a paired machine can be read and answered.** The host's gate, which a server HQ goes through to reach agents on a paired laptop, did not let `agent.pending`, `agent.answer` or `agent.read_since` through, so `harness_session_pending`, `harness_session_answer`, `harness_session_logs` with `since`, and the answer buttons on the phone and in web push failed for agents on another machine. They pass now; the laptop's `hq` needs this release too. - **Allow and Not now show on the phone for real agent questions.** The session supervisor wraps the screen excerpt in `----- session output -----` lines, but the Android app looked for `<hq-output>`, which only its own fixtures used, so a real question never got its buttons. The app now reads the server's markers, and offers Allow only when the highlighted choice is a plain yes once (Copilot's path dialog highlights "Yes, and remember this path", which now opens the helper instead). - **Text sent to a session at a dialog is refused instead of answering it.** The host typed text and pressed Enter whatever the screen showed, so a message sent while an agent waited at a dialog picked whichever option was highlighted, and Copilot's path dialog highlights "Yes, and remember this path for this session". The host now refuses text with `agent_blocked` while the agent reads blocked; keys still answer a dialog on purpose. - **A launch whose agent is still loading is no longer reported as waiting at a dialog.** Copilot can spend a minute on a slow MCP server; that launch used to be reported as blocked and recorded as blocked at launch on its task. It is now reported as still starting, with a note on whether the prompt was typed. - **`harness_session_wait` stays under an MCP client's one-minute limit.** It waited up to 300 seconds; it now waits 40 by default and 45 at most. - **Drive cannot paste a session's brief back into it.** A driver instruction that repeats most of the session's goal, definition of done or task description is refused, after a pasted brief contradicted later instructions and stalled an agent on a question for over an hour. - **`convert_from_markdown` only writes the formats it lists.** The format used to be handed to pandoc as written, so a name that was a path to a script was run by pandoc as a custom writer. It now accepts only `pdf`, `docx`, `pptx`, `html`, `epub` and `rtf` (and the aliases `word` and `powerpoint`) and refuses anything else with a message naming them, before pandoc starts. The Markdown is also read with raw TeX and raw attributes off, so a document can no longer make `xelatex` read a file named in it, and `xelatex` runs with shell escape off. Notes exported through `vault_export` or `hq vault export` were never affected: they use the built-in renderer. - **A deleted note outside `Notebooks/` no longer stays in the index forever.** The scan only covers `Notebooks/`, so the rows for a skill or other note removed behind HQ's back were never cleared, and the embedding worker skipped the missing file on every start and counted it as unreadable. The worker now drops what is held for a file that is gone (not when `Notebooks/` itself is missing, which may be an unmounted vault). Rows left by older versions are still cleared with `hq vault repair --apply`. - **`hq doctor` names the notes the embedder is skipping**, up to five, instead of only counting them. `note_provenance` returns a `writer_note` that says why an author is unknown: the file was changed outside the tools, or the caller (a local client with only the API key) did not identify itself. - **A note named in chat opens as a sheet, on a phone and in the chat overlay.** HQ usually names a note as inline code (`Notebooks/Projects/Plan.md`), which had no click handler: only `[[wikilinks]]`, `vault:` links and plain `.md` links did. A backticked vault path (it needs a folder and a `.md` ending, so `README.md` and shell snippets stay plain code) is now a tappable chip. The note sheet was also mounted inside every chat view below the full-screen chat overlay, so from the overlay it opened out of sight and on `/chat` two copies stacked. There is now one sheet for the whole app, above the overlay, and Escape closes the note before the chat. Links to notes whose names have spaces or end in `#heading` open the right note instead of a dead path. - **Deleting a note now removes everything derived from it.** Its embedding, sync state, cached copy and graph links used to survive a delete, and semantic search could return the dead note. Moves keep the note's related-note links. A symlinked note, a hidden file and anything under `_trash` are no longer indexed. - **Native agent sessions no longer pass model-supplied `_hq_*` arguments to tools.** A model could write the reserved identity arguments (`_hq_connector`, `_hq_caller_session`, and so on) into a tool call and they reached the tool unchanged. They are dropped, and the session sets its own. No exploit was demonstrated, but identity must never be something a model can write. - **Owners are no longer told to ask for `hq-join --print-link`, which most servers lack.** Updates replace the `hq` binary but never `hq-join`, so servers set up earlier have no such flag. The sign-in banner and `/login` now just say to ask whoever set up the server for a new link, and `docs/HETZNER.md` gives the operator the direct `hq web link` command for those servers. - **The header no longer says "offline" on a device that is online.** It read the network state once into React state, which could go stale; it now reads it live, the same way the new reachability banner does. - **`hq onboard` turns on the relays it configures.** It wrote the Discord and Telegram tokens but never `relay.discord_enabled` or `relay.telegram_enabled`, so the relay never started and said nothing. It also appended the tokens as text, which landed under the wrong section when `relay:` was not the last block; it now writes through the config writer. - **Agents can start a session without knowing a folder.** `harness_session_spawn`, `harness_session_handoff` and `hq sessions spawn` required a `cwd`, so a caller that did not know the path on a computer (a laptop, say) could not start anything. With no `cwd`, or one the computer does not have, the session now starts in a folder inside that computer's own `Documents/HQ`, which its host creates. A missing folder keeps its name there; no folder gives the agent a folder of its own. The result carries a `cwd_note` saying where it went. A folder that exists is used as before, home and root directories are still refused, and the deny list, handoff allow list and vault guard judge the requested folder first. See `docs/AGENT_SESSIONS.md`. - **`hq mcp install` writes the file VS Code reads.** The workspace `.vscode/mcp.json` used the key `mcpServers`, which VS Code ignores, and the user config went to `settings.json` under a flat `mcp.servers` key on every platform. HQ now writes `servers` (with `"type": "stdio"`) to `.vscode/mcp.json` and to the user's `Code/User/mcp.json`, resolves the VS Code user directory per platform (including `%APPDATA%` on Windows), and moves an old entry out of the two places it used to write. - **An Anthropic or Google key in `config.yaml` now reaches the chat router.** Only OpenRouter and a few other keys did, so a server configured with just an Anthropic or Google key (through `hq onboard`, `hq env` or the first-run screen) answered "No LLM providers available". The router now builds a direct Anthropic provider from `anthropic_api_key` (serving `anthropic/claude-haiku-5.5`, `anthropic/claude-sonnet-5.5` and `anthropic/claude-opus-5.5`) and routes `google/gemini-2.5-flash` and `google/gemini-2.5-pro` to Gemini from `google_ai_api_key`. Other ids are not pinned to those providers, so an OpenRouter-style slug still reaches OpenRouter as before. Claude ids written with a dot are sent to Anthropic's own host in its form (`claude-haiku-5-5`). `GOOGLE_AI_API_KEY` is accepted for Gemini as well as `GEMINI_API_KEY`. The first-run screen offers all three providers again. - **A `#token=` sign-in link on the web app's root no longer loses the token.** The root route redirected to the vault before the token was read, so a fresh server's link left the browser signed out with 401 errors. The app now stores the token before it routes, and `hq-join` prints a link to `/vault`. ### Changed - **`hq mcp` on its own now only reports.** It used to install: running it rewrote every client's MCP config. It now prints status, and `hq mcp install` changes files. An install keeps an entry that relays to another HQ (`mcp-serve --remote`), and any change leaves the previous file beside it as `<file>.hq-backup`. Copilot CLI's entry now goes to `~/.copilot/mcp-config.json`, the file it reads, so add `agent-hq` to the `--disable-mcp-server` list of any lean profile. HQ no longer writes `~/.claude/settings.json`, where Claude Code does not read MCP servers. - **Note embeddings now stay on the device by default.** `daemon.embedding_provider` defaults to `local` (Model2Vec `potion-base-8M`) instead of `remote`, so note text no longer goes to OpenRouter or Ollama unless an owner sets `remote`. `vault_search` queries are embedded too, so `hybrid` and `semantic` search match by meaning, and inbox triage asks no model. On first use HQ downloads about 31 MB from a pinned, hash-checked revision, and an install coming from `remote` embeds every note again once. A phone embeds on the device even with the data saver on. Lite still embeds nothing and now never loads the model for a search. - **GitHub Copilot sessions start with their tools allowed and a deny list.** In manual approval every command a Copilot session ran waited on a dialog, while Claude Code starts with its permission bypass for that reason. `github-copilot` now starts with `--allow-all-tools` and `--deny-tool` rules for `git push`, `git stash`, `git reset`, `git clean`, `rm`, `env` and `printenv` (deny wins over allow). Copilot's rules name a command or subcommand, not a flag, so `rm` is denied outright; `git rm` still works. A harness profile with its own `args` replaces these, so list them there to keep them. - **Coding agents in the sandbox now work the way they would in your terminal.** The built-in host's sandbox has two profiles, `agent_host.sandbox.profile`: `open` (the new default) and `strict` (the policy there was before, still available). An open agent reads and writes anywhere your user can, uses the machine's network directly with no proxy or domain allowlist, shares `/tmp` and `/run`, sees the real devices, and can edit a project's own `.git/hooks`, `.git/config`, `.mcp.json` and `.claude/settings.json`, so `git push -u`, a repository's hook installer, `brew install` and a dev server on localhost all work. Still out of reach: the host directory and its tokens, `~/.hq`, other processes' environments, other Claude accounts and other coding agents' logins, your credential stores (`~/.ssh`, `~/.aws`, `~/.config/gh` and the rest) and the files your own tools run later (shell startup files, `~/.gitconfig`, Claude's `settings.json` and hooks). `agent_host.sandbox.hide_credentials: false` hands the credential stores to agents as well. Set `profile: strict` to keep the old policy; `allow_domains`, `writable`, `readable` and `loopback_ports` only apply there. A host that predates profiles applies the strict policy. `hq host status` and Settings show each agent's profile. See `docs/AGENT_HOST.md`. - **First start after this update re-indexes and re-embeds.** Notes are now hashed with BLAKE3 (`b3:`) instead of the old scheme, so the first scan re-indexes every note and the embedding worker makes every embedding once more. On a large vault with an embedding provider that bills per call, expect that cost once. - **`vault_watch` needs a restart to take effect**, like any daemon task. It is on by default; set `vault_watch.enabled: false` to keep only the scheduled scan. - **Claude's connector no longer asks before everyday notes and tasks.** `task_create`, `task_update` and the bulk variants run at once, and `vault_delete` is no longer in `CONNECTOR_CONFIRM_TOOLS` (a deleted note goes to `_trash/` for 30 days). A vault write, move or delete still waits for approval when `path`, `from` or `to` is inside `skills/`, `_skills/`, `_commands/`, `agents/` (notes there become instructions), `_system/`, `_threads/`, `_data/`, `_trash/` or `_mailboxes/`; `from` was not checked before, so moving a skill out of its folder skipped the gate. In place of the old tag and assignee check, a connector's task writes now mail no one: tags and assignees stay as labels, but no agent mailbox or chat hears of a create, update or unblock. `task_delete` still asks. An agent that pulls tasks (`task_next`, the Agentic Stack dispatcher) reads a connector task's text when it takes it; see `docs/CLAUDE_CONNECTOR.md`. - **Coding agents start in their run-without-asking modes again.** Claude Code and Antigravity start with `--dangerously-skip-permissions` and Cursor with `--force`, as before, and a harness profile may set its own flags. Starting them in a manual mode left unattended sessions stuck at the first approval dialog with nobody to answer it. These sessions can run any command on their computer, so keep `agent_host.spawn_cwd_deny` and `agent_host.handoff_cwd_allow` tight; see `docs/AGENT_SESSIONS.md`. - **The low-cost default for an Anthropic key is Claude Haiku 5.5** (was Haiku 4), and the `haiku` chat alias points at it. An OpenRouter or OpenAI-routed install still starts on `gpt-6-luna`. Both defaults now have prices in the model registry, so their cost shows up in usage. - **The vault copy menu in the web UI can copy a note's content**, next to the relative and absolute path options. - **`hq host install` gives `hq` a stable signature on macOS**, so the folder-access approval macOS asks for (Documents, Desktop, Downloads) survives updates instead of being asked again, and a session started with nobody at the screen no longer hangs on it. Re-run `hq host install` after replacing the binary. - **Each coding agent gets its own state directory and network hosts in the sandbox** (Antigravity could not start because `~/.gemini` was read-only). An agent writes only its own login and history directory, never another agent's, and reaches the HTTPS hosts it signs in through; other hosts go in `agent_host.sandbox.allow_domains`. - **Windows is documented end to end**: `docs/WINDOWS.md` covers WSL2 setup (systemd, sandbox settings, Tailscale inside WSL2), running HQ on a Windows PC, and pairing a Windows PC as a coding-agent machine for an HQ elsewhere. The README, the install page, `llms.txt` and `AGENTS-SETUP.md` point to it, and `AGENTS-SETUP.md` now tells an agent how to detect WSL2 and set up a host. - **The `herdr` names are gone from the repo and the product.** The config section is `agent_host:` (a config that still says `herdr:` keeps loading, and `hq host add` renames the heading when it edits the file), the MCP tools are `host_list`, `host_agents`, `host_read` and `host_send` (the old `herdr_*` names no longer exist, so clients that called them must switch), the web settings API key is `agent_host`, `docs/HERDR_HARNESS.md` is `docs/AGENT_SESSIONS.md`, and CI fails if the retired name reappears outside NOTICE, provenance records and migrations. ### Removed - **Leftovers from relay notifications.** The Discord relay no longer lists the guild's channels at startup to write `_system/DISCORD-CHANNELS.md`, which nothing read since relays became chat only. The config keys `relay.discord_notification_categories` and `relay.notifications_token` did nothing and are now ignored if present. Unused code went with them: the `hq_core::discord_notify` module, `hq_convert::DetectedFormat`, the model-card aggregates in `hq_db::tool_usage`, `hq_db::task_outcomes::leaderboard` and about twenty other functions no caller used. - **The TurboQuant provider.** It was an OpenAI-compatible client with a fixed `localhost:14747` default, behind an `hq-llm/turboquant` feature that no build turned on and CI never compiled. `TURBOQUANT_BASE_URL` is no longer read, and the `tq/*` model entries are gone. A TurboQuant server, or any other OpenAI-compatible local server, is configured as a `backends:` entry with `kind: openai-compatible`; one on localhost is still priced as local and free. - **Herdr is retired.** Coding-agent sessions run only on HQ's built-in host (`hq host`); the herdr backend, `deploy/herdr.service` and `scripts/hq-herdr-gate` are gone. A host named `local` now means the built-in host on this machine. Config keys from the old setup (`herdr.binary`, `herdr.session`, a host's `kind` and `session`) are ignored; a configured remote host must be paired again with `hq host join` and `hq host add`. ### Changed - **New coding-agent sessions start on the built-in host by default** (`herdr.default_host` is now `native`; set `local` to keep using herdr for now). The web app's session page shows `hq host status` (on the session's host) in place of the herdr attach command, and Settings lists the agent sandbox, extra allowed sites and the idle limit. ### Added - **Notes export to more than PDF, with no external tools.** A new `hq-export` crate renders PDF, PNG and SVG through an embedded Typst engine (no pandoc, browser or LaTeX), and writes DOCX, HTML, Markdown, XLSX, CSV, JSON, JSONL, XML, LaTeX, Jupyter notebooks, Jira markup and extracted code blocks. Use `hq vault export <note> --format <fmt>`, the `vault_export` tool or `/api/note/export?format=`; `export-pdf`, `vault_export_pdf` and `/api/note/pdf` keep working and now use the built-in renderer (`HQ_PDF_ENGINE` still selects the old pandoc pipeline). Callouts print as coloured boxes, and extra fonts (for example CJK) can go in `~/.hq/fonts` or `HQ_EXPORT_FONT_DIR`. See `docs/NOTE_EXPORT.md`. - **Vault notes export as shareable PDFs.** The web note viewer's Export PDF button now renders on the server (frontmatter dropped, `[[wikilinks]]` as plain text, images from the vault included) and opens the share sheet on a phone or downloads on a desktop. `hq vault export-pdf <note> [-o file.pdf] [--brand slug]` and the `vault_export_pdf` agent tool do the same from a terminal or a chat. It needs pandoc plus a Chromium-family browser, WeasyPrint or `xelatex` (`HQ_PDF_ENGINE` and `HQ_PDF_BROWSER` pick one); without an engine the web button falls back to the browser print window. Images outside the vault and remote images are never embedded. See `docs/NOTE_EXPORT.md`. - **A hosted form deploys HQ on Hetzner.** `apps/deploy` creates a private, self-updating server in your own Hetzner project from an API token, a size and an SSH key, using the same pinned bootstrap as `deploy/hetzner/hcloud.sh`. The install page links to it. - **`hq web` hosts the web UI with one command.** It starts only the web server (no daemon or relays), finds or builds the UI, and opens the browser. `--detach` runs it in the background, `hq web status` and `hq web stop` manage it, `--lan` makes it reachable from a phone or another machine with a generated token, and `--json` prints one object (`url`, `login_url`, `token`, `pid`) for agents that set HQ up for someone. Running it twice reuses the server already listening. `hq pwa` and `hq dashboard` are now aliases for it, and `hq pwa --port` still works. - **Built-in web search**: `web_search` runs in-process with no key and no Docker. General (Google, DuckDuckGo, Brave, Mojeek, Wikipedia), news, science (arXiv, OpenAlex, Crossref, Europe PMC), images and code categories; SearxNG-style merging plus a relevance factor with title and phrase boosts; a 10-minute cache with single-flight; early return once a main engine answers; per-engine suspensions and the Mojeek cookie kept in `~/.hq/search_state.db`; `web_search_peer` to ask another HQ when local engines are blocked. SearxNG is optional and no longer the default. Guide: `docs/WEB_SEARCH.md`. - **Safer search results**: queries that look like credentials are refused before they leave the process, and results are sanitised (invisible characters stripped, instruction-like text flagged). - **Better page reading**: `web_fetch` extracts main content, recovers embedded page data, and uses the Jina Reader only as a last resort (`HQ_WEB_FETCH_JINA=0` never sends a URL to it). - **Process sandbox for built-in host agents**: each agent runs under `sandbox-exec` (macOS) or `bwrap` with the host's tokens and its siblings' configs unreadable, other processes' environments hidden, writes limited to its project and tool directories, and a network limited to a per-agent egress proxy with a domain allowlist (`herdr.sandbox`: `mode`, `allow_domains`, `writable`). A launch fails when the sandbox cannot be applied. Denied hosts are logged (`agent.egress`). See `docs/AGENT_HOST.md`. `hq host serve` refuses unsandboxed agents unless started with `--allow-unsandboxed`, and stops sessions that sit idle past `herdr.idle_reap_hours` (default 24; they stay resumable). - **`hq host`**: a built-in host for long-lived coding agents (pseudo-terminals with a readable screen, a JSON control socket with an operator token). `hq host serve|status|stop`; it also detects whether Claude Code and Codex are idle, working or blocked from the screen. It brings agents spawned with a resume command back after a restart or crash (`session.json`, mode 0600) and reports when its binary has been replaced on disk. See `docs/AGENT_HOST.md`. With `herdr.agent_mcp_url` set, a Claude Code session launched on the built-in host connects back to HQ with its own session token, so what it does is attributed to a session HQ launched (task comments carry the session as author); see `docs/security/AGENT_IDENTITY.md`. A session can delegate part of its task to a new session (`agent_delegate`) and is told when the worker finishes; stopping a session stops its children. Agent sessions working on the same task can message each other (`agent_message_send`, stored on the task thread and typed into the recipient when it is idle); see `docs/AGENT_MESSAGING.md`. A built-in host on another machine is reachable over ssh through `hq host gate` (`herdr.hosts.<name>.kind: native`, optional `port`). The host sends state changes as events and tracks `done`, so HQ's supervisor reacts within seconds instead of the next minute sweep. Claude Code launched on it reports its own state and conversation id through per-launch hooks (`hq host report`). New sessions can run on it with `herdr.default_host: native`; the default is still herdr. ### Upgrading from 0.9.0 or earlier - **`HTTP-Referer` is no longer sent by default.** It used to be a hardcoded URL. To keep OpenRouter app attribution, set `http_referer: <your url>` in `config.yaml` (or `HQ_HTTP_REFERER`) before upgrading. - **Agent bash now needs a sandbox by default.** `governance.bash.sandbox` defaults to `required`. On a host without bubblewrap (Linux) or sandbox-exec (macOS) the `bash` tool refuses every command. Before upgrading such a host, run `apt install bubblewrap` (then restart HQ), or set `governance.bash.sandbox: best_effort` explicitly to keep running commands unwrapped. HQ logs an error at startup and files an owner notification when it is refusing; `hq doctor` shows the state. - **Chat relays no longer adopt the first sender as owner.** Set the owner in config, or run `hq pair` and send `/pair <code>` (Telegram, private chat) or `!pair <code>` (Discord DM). Existing owners recorded earlier keep working. - **Self-update install needs owner approval**, and the tools stay off unless `self_update.enabled` is true. - **Removed: `companies[].budget` (`monthly_usd`, `alert_at`).** Nothing ever read these settings. A config that still has them keeps loading, the keys are ignored, and they are dropped from `config.yaml` the next time HQ saves its config. ## [0.9.0] - 2026-05-24 ### Agent Sessions - **Extended runtime limits**: sessions now default to 500 turns and a 5-hour wall-clock limit. When either is hit the relay receives a `TimeLimitReached` or `MaxTurnsReached` summary with elapsed time and files touched. - **Graceful cancel**: send `!cancel` in Discord or Telegram to interrupt the active session at the next tool boundary. The agent replies with a summary before halting. - **Cancel handle**: `AgentSession::cancel_handle()` returns an `Arc<AtomicBool>` that relay adapters hold to trigger the interrupt without locking the session. - **File tracking**: `AgentSession` now records every file path written during a session for inclusion in cancel/timeout summaries. ### Relay - **Richer heartbeat**: Discord and Telegram heartbeat tickers now show turn count and the currently executing tool name. - **!cancel command**: both Discord (`hq-relay`) and Telegram (`hq-relay`) relay bots now accept `!cancel` mid-session. - **`ChannelState::active_cancel`**: typed cancel-flag field on the shared relay channel state. ### Daemon - **NotebookLM morning brief**: feature-flagged daily task (`daemon.notebooklm_morning_brief: true`) that pipes vault context into NotebookLM via the `nlm` CLI and pushes the audio URL to Telegram. Timeout is 600 s. - **Orphan CC task detection**: on daemon startup, any Claude Code sentinel files left by crashed sessions are detected and a relay notification is fired so you can resume. - **`notebooklm_morning_brief` MCP tool**: accessible as `hq_call({tool: "notebooklm_morning_brief", ...})`. ### Agent Intelligence - **Mood engine** (`hq-agent/src/session/mood.rs`): classifies the user's last message into `UserEmotion` (Delighted/Stressed/Focused/Confused/Neutral) and picks a matching `AgentMood` (Celebratory/Supportive/Calm/Clarifying/Default). - **Persona sharing** (`hq-agent/src/sharing.rs`): `package_agent_persona` zips an agent profile into a `.hqap` archive, stripping API keys, tokens, and `[private]` blocks before packaging. ### Desktop App (Tauri) - **Active window context** (`active_context.rs`): queries the focused macOS application and window title via `osascript`, exposed as a Tauri command for agent context injection. - **Enhanced vault watcher** (`vault_watcher.rs`): debounced (300 ms), stability-checked, and wired to the search engine so changed notes are re-indexed immediately. - **TypeScript bindings** (`bindings.ts`): new `ActiveWindowContext` type added to the generated bindings. ### Chrome Extension - **Branded icons**: 16/32/48/128 px icon set for the browser toolbar and extension page. - **Tab groups**: agents can now create, rename, and navigate Chrome tab groups. - **Activity banner**: overlay shown when an agent session is active. - **Cursor overlay**: visualises agent pointer position during automated interactions. ### Canvas / DrawIt - **DrawIt v2 engine**: `DiagramViewer` rewritten to use the DrawIt engine's React bindings directly, replacing the v1 script-tag approach. Full edit mode with undo/redo, tool palette, and save-to-vault. - **DrawitToolbar**: new event-driven toolbar (undo/redo, zoom, tool selection, SVG/PNG export, dirty indicator). All state driven by `DiagramEngine` events — no polling. - **Agent diagram push**: `diagram_push` and `diagram_read` MCP tools broadcast diagram documents over a dedicated `/ws/canvas` WebSocket endpoint. Connected `/drawit` tabs load the document instantly. New tabs receive the last-pushed document on connect. - **New diagram creation**: sidebar "+ New diagram" button creates a `.drawit` file directly in `Notebooks/Diagrams/` and immediately opens it for editing. - **Canvas nav link**: `/drawit` added to the desktop header and mobile bottom nav. ### Evening Brief - **Rich evening context**: `gather_evening_context` now collects news headlines, git commits (EAT-aware midnight), recently modified vault notes, active/stalled plans, and tomorrow's calendar events. - **`format_evening_digest`**: structured Evening Brief message with NEWS, TODAY, and TOMORROW sections; capped at 3 headlines and 5 commits. - **LLM script generation**: evening audio brief uses the full `EveningContext` as prompt context for a 3-minute two-speaker dialogue. ### Bug Fixes - **`canvas_ws` race**: WebSocket handler now subscribes to the broadcast channel before reading `canvas_last`, closing a race where a diagram push between the two operations was silently lost. - **`handleSave` data loss**: save handler now checks `writeNote`'s `{ success }` response; dirty flag is no longer cleared on a rejected write. - **`handleNewDiagram` phantom file**: diagram creation now checks `writeNote`'s `{ success }` response before adding the file to the sidebar. Also strips path separators from the diagram name to prevent writing outside `Notebooks/Diagrams/`. - **`get_git_activity_today` working directory**: git log now runs with `current_dir(repo_root)` so the daemon finds the `.git` directory regardless of its launch working directory. - **`get_git_activity_today` timezone**: `--since=00:00` replaced with `--since=@<unix_timestamp>` computed from EAT midnight, so launchd's inherited TZ does not affect the result. - **Evening brief unconditional delivery**: brief is now skipped when all context sections (news, git, vault notes, stalled plans) are empty, matching the intent of the old `items.is_empty()` guard. - **TTS fallback injection**: fallback dialogue no longer embeds raw `context_str`, which could contain `[S1]`/`[S2]` tokens that corrupt speaker-tag parsing. - **Ollama provider prefix**: the `ollama/` prefix is now stripped before the model name is sent to the Ollama API, fixing model-not-found errors when using the `ollama/<model>` routing alias. ## [0.8.9] - 2026-05-17 ### Security Patch — Open-Source Hardening #### Security - **Telegram bot authorization** (`hq-relay`): Incoming messages are now gated to the authorized owner chat. On the very first message the chat ID is recorded in `_system/.telegram-auth-chat`; subsequent messages from any other chat ID are silently dropped. The config-level `relay.telegram_authorized_chat_id` field provides an explicit override for users who want to hard-code the authorized ID. Previously, any Telegram user who discovered the bot token could invoke `/screenshot` (capturing the owner's screen) or approve self-agency proposals. - **Telegram notifications bot authorization** (`hq-relay`): The separate notifications approval handler (`run_notifications_approval_handler`) now applies the same chat-ID guard before processing any `approve`/`skip` commands. - **Web server binds to 127.0.0.1, not 0.0.0.0** (`hq-cli`): The WebSocket/REST server now listens on loopback only. Previously it accepted connections from any device on the local network, exposing unauthenticated write endpoints (note delete, relay config) to network neighbors. - **XSS: `onclick` removed from DOMPurify allowlist** (`hq-desktop`): The Markdown renderer no longer allows inline `onclick` attributes through DOMPurify. Code-copy buttons now use a `data-copy-text` attribute with a delegated container listener, eliminating a stored-XSS vector in vault notes rendered inside the Tauri WebView. - **XSS: Mermaid SVG sanitized** (`hq-desktop`): Mermaid diagram output is now passed through `DOMPurify.sanitize()` before being written to `innerHTML`. Previously, Mermaid diagrams (a known XSS vector) could execute arbitrary JavaScript in the Tauri context. - **XSS: KaTeX output sanitized** (`hq-desktop`): Math render output now passes through DOMPurify before `innerHTML` injection, consistent with the Mermaid fix. - **XSS: PDF print popup escapes filename and sanitizes HTML** (`hq-desktop`, `hq-web`): The print-to-PDF handler now HTML-escapes the note filename and runs `DOMPurify.sanitize()` on the rendered HTML before writing to the popup window. Previously a note named `<script>...`.md` could execute JavaScript in the popup. - **Path traversal via symlink in `note_delete_handler`** (`hq-web`): Added `std::fs::canonicalize` before the `starts_with(vault_path)` containment check. The previous string-based `..` filter did not catch symlink-based traversals. - **Path traversal bounds check in desktop notes server** (`hq-desktop`): Added `assertInVault()` guard to `getNote`, `getNoteOrDir`, and `updateNote`. Previously, a path like `../../.ssh/id_rsa` was passed directly to the Tauri `read_file` command with no validation. - **Personal OAuth client ID removed from plugin defaults** (`plugins/obsidian-vault-sync`): The gws CLI OAuth client ID (`759142433452-...`) was shipped as the default in `types.ts`. Users now supply their own OAuth credentials. See the plugin README for how to create a Desktop app credential in Google Cloud Console. - **Zombie process prevention in Claude cron runner** (`hq-cli`): Spawned `claude -p` processes are now awaited with a 5-minute timeout. Previously each cron tick that fired a task leaked a zombie process until daemon restart. #### Added - **GitHub Copilot harness** (`hq-core`, `hq-relay`): New `GitHubCopilotConfig` struct and `"github-copilot"` harness entry. The `gh copilot` extension is treated as available when `gh auth status` succeeds. Telegram `/harness github-copilot` (or aliases `copilot`, `ghc`, `gh-copilot`) activates it. - **`SocialConfig`** (`hq-core`): New `[social]` config section for the multi-agent bulletin discussion system — `tick_interval_hours`, `max_rounds_per_day`, `max_agents_per_round`, `ollama_model`, `prefer_free_tier`. - **Telegram slash-command autocomplete** (`hq-relay`): `setMyCommands` is called at bot startup to register `/new`, `/reset`, `/focus`, `/harness`, `/model`, `/status`, `/benchmark`, `/screenshot`, `/computer`, `/help` for Telegram's autocomplete UI. - **`/focus [topic]`** command (`hq-relay`): Clears conversation history and per-harness session IDs while keeping the current harness and model override. An optional topic argument seeds the new thread with a context hint. - **`/screenshot`** command (`hq-relay`): Captures a macOS screenshot via `screencapture` and sends it directly to the authorized Telegram chat. Auth-gated by the new chat-ID guard above. - **`/computer <task>`** command (`hq-relay`): Initiates a supervised computer-use session, taking an initial screenshot and guiding the user through instructions. - **Proposal quick-action keyboard** (`hq-relay`): Code proposals are now sent with a `ReplyKeyboardMarkup` showing `approve <id>` / `skip <id>` buttons so the user can tap instead of copying the hex ID. - **`/new` alias** (`hq-relay`): `/new` now works as an alias for `/reset`. - **Progress heartbeat** (`hq-relay`): During a running proposal implementation, heartbeat messages are sent at 90 s, 3 min, and 5 min so the user knows CC is still working. - **Bulletin fast-cycle router** (`hq-cli`): New `tasks_fast.rs` module with `run_bulletin_router` — scans new bulletin entries for @mentions and routes them to the appropriate agent (Ollama inline or mailbox for external CLIs) every minute. - **`run_expire_approvals`**, **`run_plan_sync`**, **`run_embedding_on_change`**: Additional fast-cycle daemon tasks extracted into `tasks_fast.rs`. - **Memory consolidation insights feed self-agency** (`hq-daemon`): `gather_insights` now reads `Notebooks/Memories/` consolidation-insight notes as a third insight source. Promoted insights are marked `promoted: true` to prevent duplicate proposals. - **`relay_status_handler`** (`hq-web`): New `GET /api/relay/status` endpoint returns connection status for Telegram and Discord relays (connected/disconnected/not_configured). - **`relay_config_get/post_handler`** (`hq-web`): New `GET/POST /api/relay/config` endpoints for reading (masked) and updating relay bot tokens from the settings UI. - **`note_delete_handler`** (`hq-web`): New `DELETE /api/note?path=...` endpoint for deleting vault notes from the web UI, with path-traversal protection. - **`getBulletinFeed`** server function (`hq-web`, `apps/hq-web`): Reads `_bulletin/board.jsonl` and returns the last 60 entries for the bulletin UI. - **Chrome extension bridge** (`hq-web`, `hq-tools`): `WsState` gains an optional `ext_bridge` field (local-feature-gated) and a `/ws/extension` WebSocket endpoint for the HQ Chrome extension. - **`VaultGuardConfig`** and **`SocialConfig`** added to `HqConfig` default (see 0.8.8). - **Ollama model list endpoint** (`hq-web`): `GET /api/ollama` returns available local models from `http://localhost:11434/api/tags`. - **Harness GET endpoint** (`hq-web`): `GET /api/harness` returns the current harness name and discovered harness list. - **Desktop vault directory browsing** (`hq-desktop`): `getNoteOrDir` now returns directory entries when the path resolves to a folder, enabling folder navigation in the vault viewer. - **Tauri capabilities** (`hq-desktop`): `notification:default`, `global-shortcut:allow-*`, and `autostart:allow-*` capabilities added for quick-note overlay and login-item support. - **Web app graph error handling** (`hq-web`): `GraphViewer` now handles fetch errors gracefully instead of leaving the canvas stuck in a permanent loading state. #### Changed - **`generate_natural_message` prompt** (`hq-daemon`): Refined to produce exactly 2 sentences (not 2-3), enforces no filler phrases, rejects LLM output that echoes the task description verbatim, and hides the scope line when `affected_files_count` is 0. - **Web router pruned** (`hq-web`): `create_router` now exposes only vault-focused endpoints. Novel reader, WhatsApp, model-card, and agent-chat endpoints removed from the default router to reduce attack surface. - API path `/api/daemon-status` → `/api/daemon`, `/api/ollama/models` → `/api/ollama`. - `.obsidian` no longer blanket-excluded from sync (see 0.8.8; included here for the changelog completeness of this release). #### Fixed - **pi can reach Google's Gemini API under the agent sandbox**, and `docs/AGENT_HOST.md` now lists what each agent needs to start there. - **Cursor and pi can reach the network under the agent sandbox.** Node's fetch ignored the egress proxy, so they went direct, were denied and asked to sign in again; the host now tells Node to use the proxy. - **HQ now states the model and provider it is running on** in every chat surface (web, MCP, Discord, Telegram), taken from the backend chain, including fallbacks. The web chat and `hq_ask` gave it no identity, so it quoted a stale config value such as `deepseek-flash` or said it could not tell. - **PDF print popup null-window crash** (`hq-web`): Added guard against `window.open` returning `null` (browser popup blocker) plus `try/catch` around `marked.parse`. - **GraphViewer stuck loading** (`hq-web`): `.catch()` handler added so a failed `getVaultGraph` call still calls `setLoading(false)`. - **Proposal message with no pending list** (`hq-relay`): "No proposal found" reply now lists up to 5 pending proposals to help the user identify the correct ID. - **User-model trait capture from reply** (`hq-relay`): Telegram replies to user-model questions are now routed to `apply_user_reply` before falling through to the regular message handler. --- ## [0.8.8] - 2026-05-12 ### Tailscale Sync, Obsidian Bridge, VaultGuard & Document Conversion #### Added - **`hq-convert` crate** — new bidirectional document conversion library: - **Inbound** (any → Markdown): pure-Rust `transmutation` crate (PDF, DOCX, XLSX, PPTX, HTML, CSV, RTF, ODT, images, audio/video). Zero Python dependency. - **Outbound** (Markdown → any): shells to `pandoc` with clear install instructions if pandoc is missing. Supports PDF, DOCX, PPTX, HTML, EPUB, RTF. - `InboundConverter`, `OutboundConverter`, `DetectedFormat`, `ExportFormat`, `ConvertError` types with full format detection and safe path validation. - **`VaultGuard`** (`hq-sync`): enforces the markdown-first vault invariant. Watches the vault for non-`.md` files, auto-converts them to Markdown via `hq-convert`, then moves the originals to configured export destinations. Non-blocking — spawns Tokio tasks; never stalls the watcher loop. - **`VaultGuardConfig`** (`hq-core`): new config section `[vault_guard]` with: - `enabled` (default: true) - `export_destinations` (per-extension paths with `~` expansion) - `obsidian_api_port` (default: 27125) - `obsidian_api_key` (config override; auto-generated and persisted if absent) - `obsidian_live_api_key` (for bridging to real Obsidian Local REST API) - **HQ Obsidian-compatible REST API** (`hq-web`): full implementation of the [Obsidian Local REST API](https://coddingtonbear.github.io/obsidian-local-rest-api/) spec so `mcp-obsidian` and other Obsidian automation clients work when Obsidian is not running. Endpoints: `GET/PUT/POST/DELETE /vault/{path}`, `POST /search/simple/`, `GET /tags/`. Path-traversal validation (`..`, absolute paths, null bytes rejected). - **Obsidian bridge MCP tools** (`hq-tools`): 6 new MCP tools under category `"obsidian"` that auto-detect whether Obsidian is running and proxy accordingly: `obsidian_search`, `obsidian_read`, `obsidian_write`, `obsidian_patch`, `obsidian_tags`, `obsidian_open`. - **Conversion MCP tools** (`hq-tools`): 2 new tools under category `"convert"`: `convert_to_markdown` and `convert_from_markdown`. - **`hq sync serve`** (`hq-cli`): new subcommand starts the WebSocket sync server so Obsidian mobile can connect over Tailscale. Accepts `--port N` (default 18800). - **Obsidian plugin — Tailscale real-time sync** (`plugins/obsidian-vault-sync`): - Primary transport upgraded to WebSocket over Tailscale (`SyncEngine`). - Google Drive demoted to offline fallback transport. - Settings tab redesigned with Tailscale section first, Drive as fallback. - New commands: `force-full-restore`, `show-mobile-setup`. - `isConnecting` guard on `SyncTransport` prevents duplicate connect races. - `workspace.json` debounce extended to 5 s to reduce noise from active Obsidian. - Mtime-unstable files are now re-queued instead of silently dropped. - `base64ToUtf8` helper added to `protocol.ts` for correct non-ASCII decoding. - **Selective `.obsidian/` sync** (`hq-sync`): scanner and watcher now allow syncing `app.json`, `workspace.json`, `community-plugins.json`, `core-plugins.json`, `hotkeys.json` and theme/snippet CSS from `.obsidian/` instead of blanket-ignoring the directory. Plugin binaries are still excluded. - **VaultClient write guard** (`hq-vault`): `write_note()` now rejects non-`.md` paths with a clear error, enforcing the markdown-first invariant at the API level. - **Protocol `camelCase` serialization** (`hq-sync`): `#[serde(rename_all = "camelCase")]` added to all protocol structs so Rust ↔ TypeScript wire format is consistent. - **Self-contained plugin protocol** (`plugins/obsidian-vault-sync`): all types, crypto, and constants inlined into `protocol.ts` — the `@repo/vault-sync-protocol` monorepo package is no longer required. - **Obsidian API server** (`hq-daemon`): daemon now starts the HQ Obsidian REST API on port 27125 when `vault_guard.enabled = true`. API key is auto-generated with `uuid::Uuid::new_v4()` and persisted to `_data/obsidian-api-key`. #### Changed - `.obsidian` is no longer blanket-excluded from sync; essential config files are selectively included via `OBSIDIAN_ALLOWED` and `OBSIDIAN_ALLOWED_DIRS`. - Default sync excludes list updated: `.obsidian` removed, comment added. - Obsidian plugin transport architecture: `SyncTransport` no longer mutates `settings.deviceToken` on `hello-ack`; that responsibility belongs to `SyncEngine`. - OAuth credentials for the Google Drive transport removed from source code; credentials are now supplied via plugin settings (`oauthClientId`, `oauthClientSecret`), with auto-population from the gws CLI on desktop. #### Security - **Hardcoded OAuth client secret removed** from `driveAuth.ts` and the compiled bundle. The secret was previously embedded in the open-source repository. The prior commit (`eba73f95`) that introduced it is in git history — the secret should be considered public and rotated if sensitive. The new design loads credentials from plugin settings or the gws CLI at runtime, with no defaults in source. - **Cryptographically random API key generation**: the Obsidian API key is now generated with `uuid::Uuid::new_v4()` (128 bits of entropy) instead of the previous `subsec_nanos + pid` approach (predictable, ~32 bits effective entropy). - **Path-traversal protection** in `obsidian_api.rs`: vault path segments are validated for `..`, leading `/`, and null bytes before any filesystem access. - **`.gitignore` additions**: `*.secret`, `config.local.yaml`, `config.local.yml`, `plugins/*/data.json` (plugin runtime state) added to prevent accidental commits of per-instance secrets or generated data. #### Fixed - `sync.rs`: missing newline at end of file. - `SyncTransport.connect()`: race condition — concurrent calls during reconnect could open two WebSockets. Fixed with `isConnecting` guard. ## [0.8.7] - 2026-05-12 ### Pi Harness, Deep Sleep Memory, Live Harness Switching & Code Cleanup #### Added - **Pi coding agent harness** (`hq-core`): New `PiConfig` struct and `PiHarnessMode` enum (`Print`, `Json`, `Rpc`) for headless pi.dev integration. Fields: `cwd`, `binary`, `default_model`, `session_dir`, `timeout_secs`, `min_version`. - **`HqConfig::resolve_pi_model()`**: Precedence chain for Pi model selection — per-turn user override → `PiConfig::default_model` → `RelayConfig::model` → `HqConfig::default_model`. Returns `None` when all candidates are empty so Pi uses its own built-in default. - **Pi and DeepSeek-TUI in harness discovery**: `discover_harnesses()` now probes for `pi`, `deepseek-tui` (`deepseek` binary), and `kimi-cli` (`kimi` binary) in addition to existing harnesses. - **`TaskContext::active_harness()`** (`hq-daemon`): Re-reads `active_harness` from the config file at call time, enabling live harness switches without restarting the daemon. - **T3 deep sleep cycle** (`hq-daemon`): `run_deep_sleep_cycle()` runs a full vault analysis using a dual-LLM approach — a dream model (T1) and a dedicated deep-sleep model (T3), scheduled at 2am when CPU < 15% and RAM > 8GB. - **T1 nap engine** (`hq-daemon`): `start_nap_engine()` starts a filesystem watcher that returns a `NapEngine` + event receiver for caller-driven polling. Exports `DreamEngine`, `NapEngine`, `NapEvent` from `hq-memory`. #### Changed - **Default harness flipped to `"pi"`**: `active_harness` and `coding_default_agent` now default to `"pi"` instead of `"claude-code"`. Existing configs with an explicit `active_harness` value are unaffected. If `pi` is not installed, HQ falls back gracefully via the discovery check. - **Removed Ollama warm-up keepalive loop** (`hq-daemon`): The 20-minute `qwen3.5:9b` keepalive ping was removed. Ollama now uses adaptive eviction natively — continuous pinging added overhead without measurable benefit. - **Dream cycle model binding** (`hq-daemon`): `run_dream_cycle()` now calls `hq_memory::dream_model()` instead of hardcoding `"ollama/qwen3.5:4b"`, so the tier model registry is the single source of truth. #### Fixed - **Stale hardware test assertions** (`hq-core`): `test_recommend_24gb` and `test_recommend_32gb` were asserting `gemma4:e4b`/`gemma4:26b` after the recommend function was updated to use `qwen3:8b`/`qwen3:14b`. Tests updated to match current implementation. #### Security & Repository - **`.gitignore` additions**: Added `*.rdb` / `dump.rdb` (Redis snapshots) and `terraces-full.png` / `turboquant_arxiv.png` (stray root-level images) to prevent accidental commits of non-source artifacts. #### Code Quality - **Workspace-wide `rustfmt` pass** (~85 files): Import reordering, long-line wrapping, trailing whitespace removal across `hq-context`, `hq-core`, `hq-crypto`, `hq-daemon`, and `hq-db`. Zero functional changes. - **`sysinfo` dependency** added to `hq-daemon` for system health and load-gating in the deep sleep scheduler. ## [0.8.6] - 2026-05-09 ### Unified Multi-Harness Persona & System-Wide Harness Switching All harnesses (Claude Code, Cursor, HQ/Ollama, Gemini CLI, Codex) now present as the same HQ persona regardless of the underlying engine. Switching harness is a single command (`hq harness switch claude-code`) that propagates everywhere. #### Added - **`active_harness` config field**: Single source of truth in `~/.hq/config.yaml`. All entry points (Telegram, Discord, Web API, CLI, relay commands) read and write this field. Default: `"claude-code"`. - **`discover_harnesses()`** (`hq-core`): Probes PATH for known CLIs (`claude`, `cursor-agent`, `gemini`, `codex`). Returns `Vec<HarnessInfo>` with availability flags. Used everywhere harness validation occurs. - **`HqConfig::set_key()`**: Line-based YAML patcher so any crate can write a top-level config field without a full parse-serialize round-trip. - **`hq harness` CLI command** (alias `h`): `status`, `list`, `switch <name>`. Validates against discovered harnesses before writing. - **`!harness` command in Telegram and Discord**: Shows available harnesses with current marker; switches per-chat and system-wide simultaneously. - **`GET /api/harness`**: Returns `{ active, available[] }`. Replaces the former 410 Gone response. Mobile app and web dashboard can now read and switch harnesses. - **`POST /api/harness`**: Validates, writes config, broadcasts `harness_changed` WebSocket event. Handles 400 (unknown), 422 (not installed), 500 (config write). - **Full multi-harness dispatch in Discord**: `dispatch_hq` now routes to `claude-code`, `cursor`, `gemini-cli`, `codex`, or any external CLI by harness name — Discord was previously hardcoded to `"hq"`. - **`cc_initialized` session tracking** (`ChannelState`): Tracks whether the claude-code harness has HQ persona established for a channel. Resets on harness switch so the next call triggers a fresh `--system-prompt` injection. #### Fixed - **HQ persona injection order** (critical): Claude Code relay was using `--append-system-prompt` which places HQ identity _after_ CC's built-in "I am Claude Code, a coding assistant" instructions. CC's own identity was winning. Fix: fresh sessions now use `--system-prompt` (replaces CC default, HQ persona at top); subsequent `--continue` sessions carry the persona from session state with no re-injection. - **Discord `--print` sessions**: Switched from `--append-system-prompt` to `--system-prompt` in `run_claude_code_headless_with_context`. Every Discord message is a stateless `--print` call, so HQ context must be injected fresh each time — at the top, not appended. - **Relay model switched to `granite4.1:8b`**: `relay`, `plan`, `premium`, `mid` aliases all point to Granite 4.1 8B. Qwen 3.5 9B was generating text-format "would-do" tool results (fake checkboxes, empty bash blocks) instead of JSON function calls. Granite has stronger native tool-calling and uses 1.3GB less RAM. - **`(no result captured)` from ClaudeCodeChatTool**: When CC ends a session on a tool call (no final text block), the `result` field in the NDJSON stream-json output is empty. `cli_runner.rs` now tracks `last_assistant_text` across all assistant events and uses it as fallback. The three-layer chain: `result field → last_assistant_text → "(no result captured)"`. - **`validate_path` blocked extensionless paths**: The old `!path.contains('.')` condition rejected valid paths like `_moc/Dashboard`. Removed; only trailing slashes are now rejected (pointing at a directory). - **`read_note` auto-.md extension**: `vault_read` with `_moc/Dashboard` failed because the file is `Dashboard.md`. Notes now try `{path}.md` automatically when the exact path doesn't exist and has no extension (Obsidian wikilink style). - **Memory consolidator compile error**: `consolidate_cluster` was called with 2 args in the dream cycle path but takes 3. Fixed with empty project-context string. - **Memory model**: Switched from `gemma4:e2b` to `qwen3.5:4b` for background memory operations (smaller, faster, leaves more VRAM headroom). - **Dream cycle model**: Switched from `qwen/qwen3.6-plus-preview:free` (cloud) to `ollama/qwen3.5:4b` (local). Dream synthesis runs in background — no cloud dependency needed. #### Improved - **Memory consolidation grounding**: Consolidator now loads up to 8 project READMEs from `Notebooks/Projects/` and injects them into the LLM prompt so insights are grounded in actual project state rather than abstract patterns. - **`build_hq_context` used consistently**: Canonical HQ identity block function shared by Telegram and Discord; fresh sessions pass the full enriched system prompt (not the previous 1800-char truncated excerpt). - **Session runner refactored**: `run_claude_code_headless` is now a thin wrapper around `run_claude_code_headless_with_context`; `run_external_cli_harness` added as a generic fallback for unknown CLI harnesses. ## [0.8.5] - 2026-04-09 ### Ironclad Context Engine - **Elastic Knapsack Allocation**: Transitioned from dropping over-budget items to elastic truncation (semantic reduction) for high-priority content (System Soul, User Query). - **Zero-Copy Memory Architecture**: Internalized `Arc<str>` across the context pipeline to prevent OOM and minimize allocation overhead. - **BPE Drift Protection**: Implemented a 1.10 `DRIFT_SAFETY_FACTOR` and `RwLock`-guaranteed LRU token caching for robust budget estimation. - **Iterative Semantic Truncation**: Added safety loops to the `SemanticReducer` to guarantee budget compliance even with extreme token density and BPE variance. - **JSON Structural Integrity**: Depth-aware truncation prevents JSON fragmentation and semantic hallucinations during budget emergency cuts. ## [0.8.4] - 2026-04-09 ### Memory Consolidation Bridge - **Stalled Plan Detection**: Integrated into the memory consolidation cycle, allowing LLM-generated insights to surface project bottlenecks and pending approval states. - **Context Injection**: Consolidation prompts now include a dedicated section for stalled plans found in the database. - **Centralized Schema**: Moved `StalledPlan` and retrieval logic to `hq-db` for shared access across workspace crates. ### Code Quality & Compliance - **Full Clippy Compliance**: Resolved all existing warnings (collapsible if, needless clones, etc.) across 26 crates, achieving zero-warning build state. - **Modernized Idiomatic Rust**: Refactored legacy code patterns to use modern Rust features like `is_some_and` and `let` chains. ## [0.8.3] - 2026-04-07 ### Job Queue Retirement & Dead Code Cleanup Full code review of 69 unpushed commits (97 files, +1405/-4991 lines). Identified and resolved 17 issues across Rust and TypeScript. ### Breaking Changes - **Job queue fully retired**: Removed `_jobs/` filesystem queue, `worker.rs`, `jobs.rs`, `tasks.rs`, `atomic_queue.rs`, `cleanup.rs`. All work dispatches through sub-agents or relay notifications. - **Web API**: `vault_status` endpoint no longer returns `jobs_pending/running/done/failed` fields (directories don't exist). ### Added - **Model Card Collectibles**: Game-stat cards for 351 LLM models with AIDC benchmark integration and mobile UI - **HQ Mobile App**: Expo Router app with vault browser, chat, and WebSocket sync - **AIDC modules**: `harness.rs`, `pareto.rs`, `trace.rs` for harness specs, Pareto frontier, session traces - **`hq review` command**: Daily review with vault activity gathering and LLM synthesis - **Session trace tracking**: `hq-daemon/session_trace.rs` for daemon-level lifecycle logging - **Bidirectional vault sync**: Peer-to-peer sync over Tailscale - **Multi-provider LLM chat**: Centralized `/api/chat` with tool-aware routing - **PWA control center**: 25 iterative improvements (offline, search, chat panel, keyboard shortcuts) ### Fixed - **Stale closure bug** (mobile): Vault note viewer no longer overwrites cached content on network fetch errors - **Timeout message** (control center): WS timeout error now correctly says "10 minutes" (was "5 minutes") - **Stale benchmark reference**: Removed deleted `worker.rs` from codegraph file ratio test - **Dead code removal**: Unused MCP tool-discovery scaffolding, `PENDING_OPT_SUBDIR`, 5 dead chat styles, unused `isThinking`/`Dimensions` - **`gather_daily_activity`**: No longer scans retired `_jobs/` directories - **`hq review`**: Removed model resolution ceremony that was silently ignored - **Compiler warnings**: Resolved all warnings across 8 crates (unused imports, variables, suspicious clones) - **Doc comments**: Updated `hq-agent` lib.rs and builder.rs to reflect sub-agent dispatch replacing workers ## [0.8.2] - 2026-04-05 ### Code Review: Full 21-Crate Audit Comprehensive code review across all 546 source files (8,900 AST nodes). 57 issues identified, all 57 fixed. ### Critical Bug Fixes - **Streaming session divergence** (hq-agent): `prompt_stream` and `prompt_inner` converged via 4 shared helpers (`build_turn_request`, `check_limits`, `check_compaction`, `process_tool_results`). Streaming sessions were missing deferred tool catalog, plan-mode suffix, and post-turn callbacks. - **Atomic job moves** (hq-vault): `move_job` now writes to temp file + `fs::rename` instead of write-then-delete, preventing job duplication on crash - **UTF-8 truncation panic** (hq-tools): `truncate_output` in `coding.rs` now uses `floor_char_boundary` instead of raw byte slicing, preventing panics on non-ASCII shell output - **FTS5 tag search false positives** (hq-db): `get_tagged_note_paths` now uses FTS5 column filter syntax (`tags:<term>`) instead of unscoped MATCH that searched all columns - **Semantic search OOM prevention** (hq-db): Added `LIMIT 10000` to both `semantic_search` and `find_similar_notes` queries that previously loaded all embeddings into RAM - **`!reset` command was a no-op** (hq-relay): Added `ThreadStore::reset_thread()` that actually deletes the thread file and clears the chat_map entry - **Discord bridge blocked forever** (hq-relay-discord): Wrapped `serenity::Client::start()` in `tokio::spawn` (matching Telegram bridge pattern), stored shard_manager and JoinHandle for graceful shutdown - **Novel pipeline stubs silent success** (hq-novel): All placeholder functions now emit `tracing::warn!`; `export_pdf` returns an error; `StateMachine::advance` now validates chapter output before advancing phases - **Ingestion lock race condition** (hq-memory): Lock acquisition moved before contradiction detection loop so all `store_fact` calls happen inside the lock scope - **Token estimation wrong slice** (hq-context): `estimate_tokens_mixed` now iterates actual code/prose segments instead of slicing a prefix of the full text - **EditFileTool skipped staleness check** (hq-tools): Replaced inline validation with call to canonical `validate_file_edit()` + `apply_edit()` from `file_edit.rs` - **Wildcard route specificity** (hq-llm): Added `is_wildcard` tiebreaker to `ScoredCandidate` so explicit routes always beat wildcard matches (e.g., `cerebras/llama-8b` beats `cerebras/*`) ### Bug Fixes - **Title filter used filename** (hq-vault): `title_contains` in `NoteQuery` now checks frontmatter `title` field first, falling back to file stem only when no frontmatter title exists - **Bare `.unwrap()` on user JSON** (hq-tools): Replaced 7 panic-prone `.unwrap()` calls in `antigravity.rs` with `.unwrap_or("unknown")` or `.context()?` - **`UnifiedBot::new` required config** (hq-relay): Changed signature to accept `Arc<HqConfig>` parameter instead of silently using `HqConfig::default()` with no API keys - **`md5_hash` was actually FNV-1a** (hq-memory): Renamed to `content_fingerprint` to match actual hashing algorithm - **`unwrap()` after `is_some()` guard** (hq-memory): Replaced with proper pattern matching in `chain_insights` - **Hard-coded GWS_BIN path** (hq-sync): Replaced `/opt/homebrew/bin/gws` constant with `gws_bin()` function that checks Homebrew ARM, Intel, and bare PATH fallback - **Calendar agenda bare `gws`** (hq-daemon): `get_calendar_agenda` now uses same `gws_bin()` lazy lookup pattern - **Legacy `.vault` relative path** (hq-daemon): `consolidate_memories` now warns about relative path; callers directed to `run_memory_cycle` - **Web auth inconsistency** (hq-web): `wa_message_handler` now checks both `x-api-key` and `Authorization: Bearer` headers, matching all other endpoints - **WhatsApp harness timeout** (hq-web): `spawn_harness_for_wa` now wraps child process in `tokio::time::timeout(300s)`, killing on timeout - **Python method separator** (hq-codegraph): Changed `extract_python_class_body` from `"::"` to `"."` separator, fixing summarizer method detection - **Go import qname collision** (hq-codegraph): Import nodes now include line number (`::import::L{line}`) instead of a single `::import` that clobbered all but the last import - **`#[allow(dead_code)]` on used fields** (hq-agent, hq-llm): Removed incorrect suppressions on `AgentWorker.db` and `ScoredCandidate.cost_tier` - **`unsafe set_var` in async context** (hq-cli): Moved env file loading to synchronous `fn main()` before tokio runtime starts, eliminating data race with worker threads - **`unsafe impl Send` undocumented** (hq-audio): Added SAFETY comment explaining three invariants for `RecordingSession` - **Novel chapter parsing** (hq-novel): Replaced `unwrap_or(0)` with proper error handling using `.context()` - **`reqwest::Client` TLS panic** (hq-tools): `YahooClient::new()` now returns `Result<Self>` instead of panicking on TLS init failure - **AIDC unsupported targets** (hq-tools): `AgentDef`/`CliBench` now rejected at creation time with clear error, not at runtime via `bail!` ### Structural Refactors - **`config.rs` split** (hq-core): 1,051-line monolith decomposed into `config/mod.rs`, `config/crypto.rs`, `config/llm.rs`. All public types re-exported. - **`types.rs` split** (hq-core): 1,123-line catch-all decomposed into `types/mod.rs`, `types/job.rs`, `types/relay.rs`, `types/session.rs`. All public types re-exported. - **`lib.rs` split** (hq-web): 1,429-line monolith decomposed into `lib.rs` (router), `ws.rs`, `api.rs`, `mcp_http.rs`, `proxy.rs`, `whatsapp.rs`. All public types re-exported. - **`parser.rs` split** (hq-codegraph): 1,734-line file decomposed into `parser/mod.rs`, `parser/helpers.rs`, and 7 language modules (`rust.rs`, `typescript.rs`, `python.rs`, `go.rs`, `java.rs`, `c_family.rs`, `ruby.rs`). - **`querier.rs` split** (hq-memory): 966-line file decomposed into `querier/mod.rs`, `querier/temporal.rs`, `querier/ranking.rs`, `querier/delta.rs`. - **`drive.rs` split** (hq-sync): 861-line file decomposed into `drive/mod.rs`, `drive/gws.rs`, `drive/scan.rs`. - **Frontmatter dedup** (hq-core + hq-db): Extracted shared `frontmatter_utils.rs` into `hq-core`, replaced 60-line duplicated parsers in `hq-db/search.rs` with thin wrappers. - **Daemon utils extraction** (hq-daemon): Duplicated `find_recently_modified`/`visit_md_files` extracted into shared `vault_utils.rs` - **Tool utility dedup** (hq-tools): `now_iso()`/`generate_id()` extracted into shared `util.rs` - **Dead code removal** (hq-core): Removed `detect_apple_chip` function duplicating `detect_gpu_type` - **GovernedRegistry Deref** (hq-agent): Replaced 7 manual delegation methods with `impl Deref<Target = ToolRegistry>` ### Performance - **Shared HTTP client** (hq-tools): `web_search` and `web_fetch` now use a `LazyLock<Client>` instead of constructing a new `reqwest::Client` per call, enabling TLS session and connection pool reuse - **Lazy GWS binary lookup** (hq-sync, hq-daemon): `gws_bin()` uses `LazyLock` so the filesystem path check happens only once per process ### Improvements - **Microcompact dedup** (hq-agent): `AgentSession::microcompact_result` now delegates to canonical `hq_context::microcompact::microcompact` instead of reimplementing with different thresholds - **Worker clarity** (hq-agent): `unblock_dependents` renamed to `log_completed_dependents` with doc comment explaining the lazy unblocking design - **Discarded mailbox visibility** (hq-agent): `process_mailbox` now logs at `warn!` level instead of `debug!`, making silently dropped messages visible - **CLI stubs hidden** (hq-cli): 8 non-functional commands now `#[command(hide = true)]` and print "not yet implemented" instead of faking success - **Usage subsystem documented** (hq-vault): `get_recent_activity` and `record_usage` annotated as intentionally separate subsystems (`_logs/` vs `_usage/daily/`) - **Regex `.expect()` clarity** (hq-memory): Dynamic regex in `consolidator.rs` uses `.expect()` instead of bare `.unwrap()` - **Thread map intent documented** (hq-relay): `ThreadStore::load_index` annotated explaining `chat_id == thread.id` by design ### Stats - 57 files changed (44 modified, 13 new) - Net: -7,118 lines (683 insertions, 7,801 deletions) - Zero new compiler warnings - All 57 code review issues resolved ## [0.8.1] - 2026-04-03 ### New Crates - **hq-tui**: Full TUI interface built on ratatui/crossterm with markdown rendering, ASCII welcome screen, session browser, cost tracker, task list, progress bars, and themed output ### New Features #### Native Multi-Model Coding Pipeline (`hq code`) - `CodingPipeline` in hq-agent: four-phase pipeline (context gather, plan, implement, verify) with per-phase model selection - `ModelSelector` enum: `FreeFirst`, `BudgetAware`, `LocalFirst`, `Fixed` strategies for routing across free cloud and local models - Phase 0 (context): file discovery, dependency scanning, codebase structure - Phase 1 (plan): multi-model planning with adversarial critique (Phase 1.5) - Phase 2 (implement): code generation with adversarial review (Phase 2.5) - Phase 3 (verify): mechanical checks (compile, lint, test) with retry loop - Free-first pipeline routing: common path costs $0 using Cerebras, Groq, and Ollama - `hq plan` CLI command: standalone adversarial multi-model planning with wall-clock timing, effort estimation (LOC + complexity heuristic), and CC comparison table - Prior plan learning: loads vault plan snippets as few-shot examples - Task-type-aware adversarial critique with focused reviews per domain - Mechanical plan validation: checks paths exist, edits are plausible, test commands are runnable #### Adversarial Critic - `adversarial_critic` module in hq-agent: devil's advocate reviews for plans and code - Wired into pipeline as Phase 1.5 (plan critique) and Phase 2.5 (implementation critique) #### MCP Coding Tools (21 new tools) - File I/O: `file_read`, `file_write`, `file_edit`, `file_find`, `file_grep`, `list_dir` - `file_edit_batch`: atomic multi-file edits in a single tool call - Git: `git_commit_flow` (composite status+diff+stage+commit), `git_diff`, `git_status`, `git_log`, `git_pr`, `git_issue` - Session: `session_export`, `session_save`, `session_resume`, `session_list` - Notebook: `notebook_read`, `notebook_edit` - Utilities: `clipboard_copy`, `repl_exec`, `native_code` - 8 existing tools marked `read_only` for parallel execution #### TUI Chat Interface - Fullscreen `ChatApp` with ratatui: markdown rendering, ANSI helper, mouse scroll, tab completion - Slash command registry with 13 built-in commands (`/code`, `/save`, `/resume`, etc.) - Notification system with message timestamps - Welcome screen with ASCII logo and keyboard shortcuts - Session save/resume persistence to vault - Agent session event renderer, cost tracker, progress bar widgets - 14+ unit tests covering comprehensive TUI behavior ### Improvements - **Gemma 4 model migration**: Replaced all local Ollama models from Qwen 3 to Gemma 4 (gemma4:e2b, gemma4:e4b, gemma4:26b) with updated VRAM estimates and 128K context windows - SBLU trainer pivot models updated to Gemma 4 family - Planning verification expanded to 23 features (11.5x CC coverage) ### Bug Fixes - **`hq-context` test failures**: Repaired 2 pre-existing test failures - **TUI chat loop**: Handle `AppAction::RunPipeline` in CLI event loop ### Infrastructure - **cargo-gc script**: `scripts/cargo-gc.sh` + weekly launchd job (`com.agent-hq.cargo-gc`) to prevent 100GB+ `target/` bloat from 26-crate debug builds ## [0.8.0] - 2026-04-02 ### Breaking Changes - **Single harness consolidation**: Removed all 7 external CLI harnesses (Claude Code, Gemini, Codex, Opencode, Qwen, Kilo, Mistral Vibe). The internal `AgentSession` is now the only execution path for all agent work. - **Removed `hq-harness` crate** from workspace. External CLI subprocess spawning is no longer supported. The research loop and sub-agent system use in-process execution. - **Relay bots simplified**: Discord and Telegram bots no longer offer `!harness`/`!switch` commands. All messages route through the HQ agent. ### New Features #### Single Harness Architecture - `SessionBuilder` in hq-agent: centralizes session construction from `HqConfig` with LLM provider, tool registry, governance, and context assembly. Used by CLI, relay bots, and web API. - `AgentBackend` in hq-relay: replaces `LocalHarness`/`RemoteHarness`/`CloudFallback` with a single implementation backed by `AgentSession`. - Read-before-write governance: tracks files read during a session and warns when writing to unread files (inspired by Claude Code's staleness detection). - Result disk-spill: tool outputs exceeding 64KB are written to `/tmp/hq-tool-output-{id}.txt` with a preview sent to the model. - `SessionEvent::CostUpdate`: emitted after each LLM call with cumulative cost, token counts, and model name. #### Instance Configuration (Local vs Cloud) - `InstanceConfig` with `InstanceType` (Local/Cloud) and `InstanceFeatures` (local_ollama, browser_automation, audio_recording). - Feature-gated Cargo dependencies: `hq-audio` and `hq-browser` are optional via `--features local`. Cloud builds are pure Rust with no C dependencies. - Conditional tool registration: browser, audio, and meeting tools excluded on cloud instances. - Instance-aware daemon: meeting watcher, audio tasks, and browser health skipped on cloud. - Build modes: `cargo build --release` (local, all features) vs `--no-default-features` (cloud VPS). #### Bidirectional Vault Sync - `VaultSyncEngine` in hq-sync: detects local changes via vault scanning, applies remote changes with three-way conflict detection, manages persistent sync state. - `SyncConfig` in hq-core: configurable sync directories, exclusion patterns, and scan intervals. - Enhanced `BridgeEvent` with `SyncDelta`, `SyncFileRequest`, `SyncFileResponse`, `SyncAck` variants for real-time change propagation over WebSocket. - Bidirectional bridge: both Mac (LocalBridge) and VPS (GatewayBridge) can send and receive sync events. - Conflict resolution: last-write-wins with `.conflict-{device_id}.md` backup files. ### Improvements - `target_harness` field on `Job` deprecated (all jobs use internal agent). - `DelegateHarness` removed from gateway routing decisions. - Gateway routing simplified to `SelfHandle`, `DelegateLocal`, `Queue`. - Discord/Telegram relay bots: removed harness selection UI, always route through HQ. - CLI harness module: removed streaming NDJSON parser, external CLI builder. ### Bug Fixes - **UTF-8 panic prevention**: `microcompact_result` (session.rs) and `web_fetch`/`web_search` (web.rs) now use `floor_char_boundary`/`ceil_char_boundary` for safe string slicing, preventing panics on multi-byte characters. - **Budget session cap enforcement**: `BudgetGuard.can_spend()` now checks the per-session spending cap in addition to the monthly cap. Previously `session_cap` was stored but never enforced. - **PostToolUse hook feedback delivery**: Block messages from PostToolUse hooks are now appended to the tool result so the model sees them. Previously the feedback was matched but silently discarded. - **OpenAI o3 pricing**: Corrected from $2/$8 to $10/$40 per million tokens, preventing budget cap miscalculation. - **Bridge broadcast lag handling**: `connect_and_stream` now logs `RecvError::Lagged` instead of silently dropping events, improving sync reliability diagnostics. - **Bridge reconnect backoff**: Fixed counter reset ordering so graceful close uses base delay instead of 2x base on the first reconnect. - **Conflict path generation**: Sync engine now uses `Path::file_stem()` instead of `trim_end_matches(".md")`, correctly handling files with repeated extensions or non-.md files. - **Telegram presence directory**: Added `create_dir_all` before writing `CHANNEL-PRESENCE.md`, preventing silent write failures when `_system/` does not exist. - **Relay dead code cleanup**: Removed unused `messages_for_llm` bindings and prefixed unused parameters in Discord/Telegram dispatch functions. ### Code Quality - Removed ~2000 lines of external harness spawning code. - Inlined minimal CLI runner for research loop backward compatibility. - 6 new sync engine tests (create, modify, delete, stable, conflict, directory filtering). - Suppressed warnings for gateway streaming functions (planned for future use) with `#[allow(dead_code)]`. ## [0.7.3] - 2026-04-02 ### New Crates - **gateway**: Cloud-resident thin orchestrator with `RoutingAgent` (LLM-powered routing), `HealthPoller`, `RequestQueue`, and `VaultCache` - **hq-audio**: Audio recording pipeline with silence detection, chunked transcription (Whisper via Ollama), and automatic vault ingestion - **hq-novel**: AutoNovel pipeline for long-form fiction generation with foundation, drafting, revision, and export phases ### New Features #### Gateway & Streaming - SSE transport for MCP Streamable HTTP in hq-web - Harness RPC handler with NDJSON streaming (`/api/harness` route) - Streaming runner in hq-harness with NDJSON event protocol - `GatewayConfig` in hq-core for gateway mode configuration #### Agent System Uplift - **Coding agent uplift**: Claude Code pattern extraction for tool descriptions and system prompts - **Typed sub-agents**: `SubagentType` enum (General, Explorer, Planner, Verifier, Coder, Custom) with role-specific prompts, permission modes, and tool allow/deny lists - **Permission mode system**: DontAsk, Plan, AcceptEdits, BypassPermissions with `DenialTracker` for session-scoped monitoring - **`GovernedTool` wrapper**: Enforces call limits, path restrictions, and permission modes around every tool execution - **Session checkpointing**: Append-only NDJSON format with truncation-safe recovery - **Inter-agent messaging**: `send_message` tool with broadcast support and path-traversal-safe mailbox routing - **Graceful shutdown pipeline**: Failsafe timers, cross-platform signal handling, orphan detection - **Git worktree isolation**: Agent sessions can run in isolated worktrees - **Task graph executor**: Topological sort with cycle detection for multi-step task execution - Per-message token caching for O(1) estimation - Feature-gated exact BPE token counting via `tiktoken-rs` - 10 advanced bash security checks (stacked brace expansion DoS detection, etc.) #### LLM Providers - `TurboQuant` provider for local quantized model serving - `LlmError` structured error enum with `is_transient()` and `is_context_overflow()` helpers - `LlmRouter` Default impl and improved route resolution #### Memory - Transcript extractor for durable memory extraction from agent sessions - HRR (Holographic Reduced Representations) module improvements #### Tools - `PlanDecomposeTool` for decomposing plans into TaskRecord entries with dependency wiring - `file_edit` utilities: `find_actual_string` (curly-quote normalization), `strip_trailing_whitespace`, `FileStateCache` - `CliBench` AIDC target kind for CLI benchmark optimization loops - Expanded planning, skills, browser, financial, and research tool implementations #### CLI & Infrastructure - **`hq meeting`**: Meeting intelligence CLI (record, list, transcribe, summary) - **`hq novel`**: AutoNovel pipeline CLI (init, run, status, export) - **`hq profile`**: LLM-powered professional profile generation - **`hq memory entities`**: Entity relationship graph queries - Dockerfile and fly.toml for containerized deployment - Meeting watcher, idle alignment, inbox triage, entity graph, presence tools, audio tools, novel tools, diagram expansion, skill hints enrichment ### Improvements - Codebase-wide `rustfmt` pass for `let-chain` syntax alignment - `SubagentType::default()` now uses `#[derive(Default)]` with `#[default]` attribute - Heartbeat system expanded with idle detection and alignment triggers - Memory ingester/querier/consolidator with entity graph integration - DrawIt tools refactored with shared rendering logic - Search: improved FTS5 query parsing and snippet extraction ### Code Quality (2026-04-02 review pass) - **Microcompact deduplication**: extracted `microcompact_result()` helper in session.rs, replacing 40 lines of copy-paste between `prompt_inner` and `prompt_stream` - **Daemon scheduler cleanup**: stripped `scheduler.rs` to trait definitions only; removed dead `DaemonScheduler` struct and re-export - **Deduplicated `is_process_alive`**: removed copy from `memory.rs`, now imports `pub(crate)` version from `instance_lock.rs` with proper `#[cfg(unix)]` guard - **Eliminated double sysctl subprocess**: `detect_gpu_type()` reuses the brand string instead of calling `detect_apple_chip()` a second time - **Unified `TURBOQUANT_BASE_URL`**: both `router.rs` and `turboquant.rs` now use `http://localhost:14747/v1` as the canonical default - **Shared `fnv1a_hash()`**: added to `hq-memory/lib.rs`, replacing identical copies in `querier.rs` (misnamed `md5_hash`) and `transcript_extractor.rs` - **Removed redundant ALTER TABLE**: `access_count` column was declared in both CREATE TABLE and ALTER TABLE in `db.rs` - **Removed dead `PendingDelta.candidate_id`**: field was set but never read, had `#[allow(dead_code)]` - **Removed dead `next_provider()`**: unused round-robin method in `router.rs` diverged from the inline implementation - **Cloud fallback system prompt rewritten**: VPS agent now correctly describes full CLI/shell access, web search, internet access, and vault cache capabilities; extracted into shared `cloud_system_prompt()` to prevent drift between streaming and non-streaming paths ### Bug Fixes - **`BypassPermissions` governance**: Now enforces call limits and path restrictions (previously skipped all governance checks) - **`classify_openai_error` string matching**: Rewrote to use pattern matching on `OpenAIError` enum variants and `ApiError.code` field instead of fragile string-contains on full error messages - **`find_actual_string` byte corruption**: Fixed byte-index mapping when curly quotes (3-byte UTF-8) are normalized to ASCII (1-byte) - **Path traversal in `send_message`**: Recipient directory sanitized against `/`, `\`, `..` - **O(n^2) checkpoint loading**: Eliminated re-counting lines on every corrupt entry - **Worktree directory conflict**: Creates parent dir only, letting `git worktree add` create the target - **Transcript extractor budget**: Uses char count instead of byte length for Unicode correctness - **Task graph panicked tasks**: Panicked tasks now trigger the halt logic instead of being silently dropped - **`PlanDecomposeTool` persistence**: Decomposed tasks now written to `Plans/{plan_id}/tasks.jsonl` for `TaskGraphExecutor` consumption - **Training pipeline panics**: Replaced `.parent().unwrap()` with `.context()` error handling on path operations - **AIDC e2e test**: Fixed directory mismatch (used project ID instead of target ID) - **Missing `CliBench` match arm**: Added to daemon AIDC periodic task handler - Fixed unused imports and dead code warnings across multiple crates - Clippy warnings: derivable Default for SubagentType, collapsible if statements in LlmRouter ### Security - **Caddyfile untracked**: Removed from git tracking (contained personal Tailscale hostname) - **Download files gitignored**: Changed `download.txt` to `download.*` pattern --- ## [0.7.2] - 2026-03-23 ### New Features - **`hq mcp-serve`**: Extracted MCP stdio server into dedicated CLI command with proper stderr tracing, replacing inline match arm. - **`hq mcp doctor`**: New diagnostic subcommand to verify MCP connection health, binary path, and config validity. - **Dynamic MCP instructions**: Server initialization now sends a full tool catalog (categories + tool descriptions) so agents know available tools without calling `hq_discover` first. - **Skill-enriched system prompts**: `enrich_system_prompt` now accepts an optional `ToolRegistry` to inject a compact tool catalog alongside skill hints. - **Registry catalog block**: `ToolRegistry::catalog_block()` generates a compact, category-grouped tool listing for system prompt injection (~50 bytes per tool). ### Security Hardening - **Pre-commit hook**: Added `scripts/pre-commit` hook that blocks commits containing personal hostnames, hardcoded home paths, API key patterns (AWS, GitHub, Slack), and machine-specific identifiers. Install with `cp scripts/pre-commit .git/hooks/`. - **Personal data removal**: Removed hardcoded hostname (a personal tailnet hostname) from `vite.config.ts`, replaced with `TLS_HOST` env var. Removed personal paths from `Caddyfile` (now gitignored, template at `Caddyfile.example`). Removed personal vault path from `.gemini/settings.json`. - **Gitignore hardening**: Added `.claude/`, `.gemini/`, `download.txt`, and `Caddyfile` to `.gitignore` to prevent accidental commit of local settings, confidential documents, and machine-specific configs. ### Improvements - **Stable MCP binary path**: `hq mcp install` now writes `/usr/local/bin/hq` to MCP configs instead of the current exe path, preventing sandbox SIGKILL issues on macOS. - **Dynamic gateway schema**: `create_gateway_tools()` now accepts the registry to populate the `hq_discover` category enum from actual registered categories. - **CLAUDE.md updates**: Updated binary size (20MB), install path (`/usr/local/bin/hq`), crate count (17), added `hq mcp doctor` and post-build install command. --- ## [0.7.1] - 2026-03-22 ### New Features - **`hq install` overhaul**: One-command zero-to-working setup. 7-step automated flow: platform detection, vault scaffolding (39 dirs), rich soul content injection, 6 embedded guide files, config generation with env var auto-detection, tool detection, CAPABILITIES.md generation. Idempotent, `--upgrade` refreshes system files while preserving user edits, `--minimal` for CI. - **`hq onboard`**: Interactive 6-step walkthrough for progressive feature activation (API keys, agent harnesses, gws CLI with OAuth, MCP server, relay setup, personalization). Resumable via `_system/ONBOARD.md` progress tracker. `--step N` to jump, `--reset` to restart. - **`hq service`**: New subcommand for service daemon management (launchd/systemd). Replaces the old `hq install` which only did service daemons. - **Embedded vault content**: SOUL.md, MEMORY.md, PREFERENCES.md, HEARTBEAT.md, CONFIG.md, CAPABILITIES.md, ONBOARD.md, and 6 guide files (getting-started, vault-structure, agent-principles, tool-setup, workflows, memory-system) compiled into the binary via `include_str!()`. - **Docker e2e test suite**: 108-test Dockerfile.test validates the full install lifecycle (fresh install, idempotency, upgrade, minimal, env var detection, service commands, onboard reset, health, aliases, custom vault paths, content integrity, multiple vaults). ### Security Hardening - Secret prompting: `hq onboard` now uses `rpassword` to mask API keys and tokens during input (no terminal echo). - YAML injection: All user-supplied strings (API keys, bot tokens, model names) are escaped before interpolation into config YAML, preventing config corruption via special characters. - Test fixture privacy: Removed personal name from HRR memory test fixtures. ### Command Changes - `hq setup` is now an alias for `hq install` - `hq init` (hidden) delegates to `hq install` for backwards compatibility - Old `hq install` (service daemons) moved to `hq service install/uninstall/status` --- ## [0.7.0] - 2026-03-22 ### New Crates - **hq-browser**: CDP-based browser automation (navigate, screenshot, evaluate, extract) - **hq-codegraph**: Tree-sitter code graph with structural summaries and blast radius analysis (6-49x token reduction) - **hq-harness**: Extracted CLI harness builder/runner from hq-cli ### New Features - **Multi-agent collaboration**: Bulletin board, curiosity engine, mailbox (point-to-point messaging), heartbeat-based liveness tracking - **Soul evolution**: Weekly daemon task that learns user behavioral patterns from consolidation insights - **SBLU trainer**: Dual-gate quality scoring for local model fine-tuning iterations - **Lesson extractor**: Post-mortem analysis of job exchanges with severity-weighted decay - **Session summaries**: Automatic session summarization for memory consolidation - **HRR cache**: Holographic Reduced Representation for fast in-memory fact retrieval - **Bash policy**: Security denylist for agent bash commands with sanitized environment - **Subagent support**: Agents can spawn sub-agents for parallel task decomposition - **Context engine upgrades**: Cascade budget allocation, scoring weights, progressive budget distribution, section-boundary truncation - **Financial tools**: Market data (Yahoo Finance), Black-Scholes options pricing, correlation matrix - **Stitch tools**: Google Stitch project/screen management integration - **CLI adapter tools**: Wrap external CLI tools as HQ tools via YAML specs - **Checkpoint tools**: Content-addressed vault snapshots with dedup - **Codegraph tools**: Build, query, impact analysis, and review via MCP - **Control Center PWA**: Service worker for offline support, push notifications, room and terminal views - **PTY agent**: WebSocket-based terminal server with tmux session persistence - **Inbox watcher**: Drop files into `.vault/_inbox/` to create jobs automatically - **Briefing generator**: Morning briefing from daemon observations ### Security Hardening - XSS: MarkdownViewer sanitizes HTML via DOMPurify before rendering - Path traversal: Heartbeat and mailbox modules validate harness IDs - Shell injection: PTY tmux-control uses `spawnSync` argument arrays instead of `execSync` string interpolation - Timing-safe auth: PTY API key comparison uses `crypto.timingSafeEqual` - CORS: hq-web restricts origins to localhost instead of wildcard - Adapter name validation: CLI adapter save/load rejects path traversal - Stitch injection: Strict alphanumeric validation on all stitch arguments - Regex safety: Soul evolution uses `regex::NoExpand` to prevent `$` backreference injection - LLM fact labeling: `query_with_fallback` prefixes LLM-inferred facts with `[llm-inferred]` - Personal hostnames removed: Caddyfile and vite.config.ts use env vars - UTF-8 safety: Fixed 3 byte-indexed truncation panics on multi-byte characters ### Bug Fixes - SQL alias in WHERE: `query_facts_by_tags` repeated match expression in WHERE (SQLite rejects aliases there) - Double compilation: `format_compiled_context` called `compile_temporal_context` twice per cache miss - Fabricated API removed: `finance_hormuz_monitor` returns unavailable status instead of calling non-existent endpoint - Hash misnames: Renamed `md5_hash` to `prompt_fingerprint`/`content_hash`, switched to stable FNV-1a ### Refactors - Harness module decomposed into `hq-harness` crate - Chat panel, stream buffers, thread hooks removed from control center (replaced by room/terminal) - Budget profiles expanded with cascade weights and scoring parameters - Memory DB schema extended with lessons, session summaries, HRR tables --- ## [0.6.0] — 2026-03-21 > **Note**: Continues from v0.5.0 (Bun/TS monorepo). This release marks the full Rust rewrite. > The legacy npm package is deprecated — the canonical distribution is now > the `hq` binary from [GitHub Releases](https://github.com/CalvinMagezi/hq/releases). ### Major: Modular Architecture Refactor The monolithic `start.rs` (3,084 lines) has been decomposed into a clean 24-file module hierarchy under `crates/hq-cli/src/commands/start/`. - **`start/mod.rs`** — Component orchestrator - **`start/common.rs`** — Shared types (ChannelState, model aliases) - **`start/agent.rs`** — Job polling worker - **`start/harness/`** — CLI subprocess runner with 30-minute timeout + NDJSON parsing - **`start/daemon/`** — Scheduler + tasks organized by cycle speed (fast/periodic/scheduled/slow) - **`start/relay/`** — Discord + Telegram bot implementations - **`start/touchpoints/`** — Reactive file-change engine with 6 handlers + synaptic chains ### Major: Touch Points Engine (Restored) Reactive vault-change handlers wired to `hq-sync::FileWatcher`, restoring the old Bun/TS behavior: - **frontmatter-fixer** — Adds missing YAML frontmatter on note create/modify, chains to tag-suggester - **size-watchdog** — Warns at 10KB, alerts at 25KB, writes alert notes at 50KB - **tag-suggester** — Keyword-based tag suggestion (projects + topics) - **folder-organizer** — Suggests moves based on frontmatter `project:` field (path-sanitized) - **conversation-learner** — Extracts decisions/learnings from completed threads - **stale-thread-detector** — Urgency-aware staleness, auto-archives 3x stale threads - Config read from `.vault/_system/TOUCHPOINT-CONFIG.md`, logs to `TOUCHPOINT-LOG.md` - Synaptic chain propagation with depth limit of 3 ### Major: Memory System Wired All `hq-memory` crate subsystems connected to the daemon and agent worker: - **Consolidation**: `memory-consolidation` daemon task now calls `hq_daemon::run_memory_cycle()` (was a TODO stub) - **Forgetting**: `memory-forgetting` calls `MemoryForgetter::run_cycle()` — 3-tier synaptic homeostasis decay - **Ingestion**: Agent worker ingests job results as memories via `MemoryIngester::ingest()` (best-effort, Ollama-dependent) - **Awake Replay**: Forward replay surfaces precedent memories on job start; reverse replay does credit assignment on job completion - **Context Engine**: Agent worker now uses the 5-layer `ContextEngine::build_frame()` with SOUL, memory, pinned notes, and budget-aware token allocation ### Major: Morning Brief Pipeline (Restored) Replaced all three stub tasks with real implementations: - **6:00 AM EAT** — LLM-generated [S1]/[S2] conversational script + Kokoro TTS audio - **6:30 AM EAT** — NotebookLM notebook creation with curated sources - **7:00 AM EAT** — Rich markdown brief with calendar agenda (via `gws`), pending jobs, news highlights ### Added - **Evening reflection** — New daemon task at 8:45 PM EAT generates introspective self-analysis, ingested as long-term memory - **Daily synthesis** — LLM-powered reflection on the day's activity (was a static stub) - **Proactive bot notifications** — 5-minute check for stuck/unclaimed jobs, sends alerts to last-active Telegram channel - **Channel presence tracking** — Telegram relay writes `CHANNEL-PRESENCE.md` on every message - **Vault cleanup task** — Daily: reconciles stale jobs (3-day threshold), prunes old touchpoint backups, detects empty stubs - **Frontmatter audit task** — Daily: backfills tags on 20 untagged notes/cycle using keyword matching - **FTS5 indexing** — `embeddings` task now indexes 50 notes/cycle into SQLite FTS5 (was a TODO) - **Graph link building** — `vault-health` task scans wikilinks and populates `graph_links` table - **Vault health metrics** — Reports wikilink count, dead links, link health percentage - **5-minute harness heartbeat** — Discord/Telegram show "Still working… (Xm elapsed)" during long harness runs - **30-minute harness timeout** — Kills runaway CLI harness subprocesses - **Rust CI workflow** — `cargo check` + `cargo test` + `cargo clippy` + release builds for macOS ARM + Linux x64 - **Regional news feeds** — Added Al Jazeera and TechCabal to news-pulse ### Fixed - **RSS parsing** — Fixed Atom format support (HN, Guardian now parse correctly) - **Port binding panic** — Graceful error instead of `unwrap()` on WS port conflict - **`hq restart`** — Now robustly kills processes by name matching (not just PID files), launches background process - **`hq stop`** — Three strategies: PID files, `pgrep` name matching, port freeing via `lsof` - **`hq` command** — Unified binary name (`hq` primary, `hq-rs` backward-compat symlink) - **`.gitkeep` false positive** — Proactive check now filters non-`.md` files - **Stale job threshold** — Reduced from 7 days to 3 days ### Security - Removed hardcoded personal identity from LLM prompts (now reads from gitignored SOUL.md) - Added path traversal validation in `parse_skill()` and `folder_organizer` - Bot token no longer leaked in download error messages - Hardcoded `localhost:5678` replaced with `config.ws_port` ### Removed - Placeholder daemon tasks that did nothing: `sblu-retraining`, `team-optimizer`, `plan-extraction` - Ghost touchpoint configs: `news-clusterer`, `news-linker`, `news-digest` chain (not implemented) - `MORNING_BRIEF_ENABLED` env var gate (morning brief is now a core feature) ## [0.1.0] — 2026-03-20 Initial Rust rewrite. Single binary replacing the Bun/TypeScript monorepo.