# Agent sessions

On the desktop app, Hatch reads the sessions that coding agents on this computer left behind: Claude Code, Codex, Grok and OpenCode. It shows the ones running now on a board, lets you search all of them, shows one session's whole story, and turns the corrections you keep repeating into rules for every agent. It adds to the agents. It doesn't replace their own terminals or apps.

Open it from "Agent sessions" in the sidebar, under Search, or from the commands "Open agent sessions board", "Search agent sessions" and "Review agent corrections". The web and phone apps don't have it.

## Using it

- **Board.** Four columns: Needs you, Working, Ready to review and Done. A session waiting on you says why and for how long ("Waiting on a permission for 4m"). The sidebar counts how many are waiting. Sessions quiet for a day leave the board. J and K move between cards, Enter opens one.
- **Collisions.** Two sessions working in the same folder, or changing the same files in one repo (worktrees count as one repo), are flagged on both cards.
- **All sessions.** Search what was asked, said and run. Filter by tool.
- **One session.** What was asked, what the agent said, and its steps folded into one line ("Ran 3 commands, edited 2 files"). Files changed with lines added and removed, and the helper agents it started. "Copy resume command" copies the command that opens it again in its tool. "Copy hand-off" copies a resume note for the next agent, built from the transcript: the goal, what was done with the command that showed it (tests, builds, commits that passed), what changed after the last passing check, where it ended, the next three steps when the agent listed them, what it waits on, and the traps: what you had to correct and commands that failed. On a session that ran on a branch, "Copy review notes" copies notes for whoever reviews it, from every session on that branch in that worktree: what each was asked, what you decided and corrected, each check's last result, the commits, pull requests, how it ended and the files changed. Paste them into the pull request so the reviewer sees why the diff looks the way it does.
- **Corrections.** When you tell agents the same thing three times in at least two sessions in the last 30 days ("no, use pnpm"), it shows up worded as a rule. Once is enough when you word it as a standing rule ("never force-push to a shared branch", "from now on…", "every time…"): it says "Said once, as a standing rule". "Never mind" doesn't count, and neither does anything in a session's first prompt. Hatch looks daily, weekly (the default) or every two weeks, and keeps what it found until the next look, so the list doesn't change under you. "Look now" looks at once. When your personal CLAUDE.md or AGENTS.md, or the CLAUDE.md or AGENTS.md at the top of the repo, already has a line that says much the same, the suggestion quotes it: agents had the rule and still needed telling, so it needs to be stronger or clearer, not repeated. Each suggestion names the strongest fix that fits, from its words: block it (it bans a command, so a hook can stop the command before it runs), make it a check (it's about tests, lint, types or format, so a failing check stops it for every agent), or a rule line when nothing stronger fits. Edit a rule, choose whether it applies in that repo or everywhere, and add it to the note "Agent rules". "Update agents" shows how each agent's personal instructions file would change, then copies the rules in.
- **Blocked commands.** When a suggestion bans a command ("use pnpm, not npm"), "Block npm" stops Claude Code and Codex from running it, in that repo or everywhere. The system asks first. Hatch keeps the guards in `guards.json` in its data folder and writes them into `hatch-guard.js`, run by Hatch's own Node through a small `hatch-guard.sh` (which lets everything through if Hatch was moved or removed), with one PreToolUse hook for shell commands in each Claude Code account's `settings.json`. Before a command runs, the script reads it the way a shell would (quotes, escapes, `;`, `&&`, pipes, new lines, subshells, `$(…)`, `sh -c "…"`, and `sudo`, `env`, `time` or `FOO=1` in front), so `cd "my app" && npm i` is stopped and `git commit -m "use npm"` isn't. For a match it exits with 2 and tells the agent why, so it tries another way. It guards against habits, not a determined agent: a command written to a file and run from there gets through. Each stop is noted in `guards.jsonl`, so the list shows how often each guard fired this week. Hatch then reads the session: when your next prompt after a stop waves the agent past it ("go ahead", "that's fine, just run it"), the stop counts as one you overrode, and the list says so, since a guard you keep overriding is blocking more than you meant. Only your words count, never the agent's. The read guard and the outbound check get the same count. An account added later is named until it gets the hook. Taking a guard out needs no dialog, and with the last one gone the hook comes out too. Codex gets the same hook in its `hooks.json` (in `$CODEX_HOME` when set, else `~/.codex`; Codex asks you to trust it in `/hooks`, and a Codex hooks file that isn't valid JSON is left alone), and a command Codex sends as its words (`["bash", "-lc", "npm i"]`) is read as one line. The read guard is Claude Code's only, since Codex reads files with shell commands. Grok isn't guarded yet.
- **Replay tests.** A suggestion that bans a command has "Replay real prompts". Hatch finds the prompts you gave right before each time you said it, keeps the ones that stand on their own (short, no pasted code, no `@file` mention) and where the agent ran the command within its first 3 steps (at most 4), and looks up the commit each repo was at then. It asks in a system dialog, with the rule as worded on the card, the number of runs, about what it can cost and whether it bills an API key or your sign-in. Then it runs your own Claude Code on each prompt twice without the rule, and twice with the rule added to the copy's CLAUDE.md, and shows the counts ("without the rule, 3 of 4 runs tried npm. With it, 0 of 4") with what it cost. A run that hits its cap, errors or takes too long is counted as not finished, and the rest go on. If no finished run without the rule tries the command, it stops there and says the mistake didn't happen again, so there was nothing to test. One replay runs at a time, quitting Hatch stops it, results are kept in `replays.json` in Hatch's data folder, and replays aren't offered on Windows yet.
  - Nothing the replayed agent does runs on your computer. Each case gets a plain copy of the repo at the last commit before that prompt (`git archive`, so no checkout and no git hooks, at most 300 MB, and both git and tar must finish cleanly), in a private `replay-work` folder in Hatch's data folder that is emptied before and after. Claude Code's settings files, `.mcp.json`, other agents' settings and every symlink are taken out of the copy. Claude Code gets only `--tools Read,Glob,Grep,Bash`, `--strict-mcp-config` (no MCP servers), `--setting-sources project` (none of your settings, hooks or personal CLAUDE.md), and settings that stop every Bash command with a PreToolUse hook (exit 2, noted) and also set Bash to ask, with `--permission-prompts none` so nobody answers. A run whose start message shows other tools, or where any Bash result lacks the hook's note, stops the whole replay. Each run is capped with `--max-budget-usd 0.50` (checked between turns, so a run can go a little over) and 3 minutes, and the prompt goes in on stdin, never as an argument.
  - What it can't promise: the copy is the repo's committed state near that time, not your working tree then, and your personal CLAUDE.md isn't there, so runs can differ from the real sessions. Two runs per arm is a small sample, so the raw counts are shown rather than a score. Only commands the agent tried count, not ones it describes. Claude Code signs in as usual, but an `apiKeyHelper` or API key set in your Claude Code settings isn't used, since replays skip those settings. Whether `--setting-sources project` still loads the copy's CLAUDE.md should be checked on each new Claude Code version: if it stops, "with the rule" runs look like "without" ones.
- **Reading big files.** On Usage, "Stop Claude Code reading big files whole" (off until you turn it on, after a system dialog) uses the same guard hook for Read: a read of a whole file over 40 KB (about 10K tokens) is stopped with "Search it first, then Read the lines you need with offset and limit". A read with an offset or limit, pictures and PDFs go through. Each stop is counted on Usage, so you can see whether it fires on the wrong things. For screenshots, the context table's fix says it: smaller screenshots, or the page's text when that's enough.
- **How sessions ended.** On Usage, the Result lines agents wrote in the last 7 days: done, partly done or blocked, why, and what they left open, each with a link to the session. Agents write them when your rules ask, and "Ask agents for it" adds that rule to Agent rules ("When you finish a task, end your last reply with Result, Why and Left open"). Files and pull requests come from the transcript, so the agent writes only the three lines. It works the same for every tool, with no hook.
- **Past decisions.** On Usage, "Remind agents of what you decided" (off until you turn it on, after a system dialog) adds a UserPromptSubmit hook to each Claude Code account, and to Codex's `~/.codex/hooks.json` when Codex is on this computer (Codex takes the same hook format and asks you to trust new hooks in `/hooks`). Codex has one account, so it gets decisions from Codex, Grok and the default Claude Code account. When it was on before Codex got it, Usage offers "Add to every agent". Hatch keeps your decisions from the last 90 days in `recall.json` in its data folder, readable only by your user and not encrypted (the hook runs while Hatch is closed, and the dialog says so), rewritten every half hour and at once when you forget or delete sessions. A decision is a sentence you typed in a short prompt that decides something ("let's go with", "always", "never", "use", a correction). Pastes, code, editor selections and an agent's words never count. When a prompt matches up to three of them from the same repo (the nearest folder with `.git`, so a nested repo keeps its own) and the same Claude Code account, the hook adds them with the session and date they came from, marked as notes that the current prompt overrides, at most 900 characters. It ranks with BM25 and needs two shared words covering a third of the decision, so an unrelated prompt gets nothing. The hook ignores anything older than 90 days even if the file wasn't refreshed, and logs only a hash of each decision it added. Usage shows how often it added something, the tokens added, how often the replies before your next prompt used most of a decision's words, and how often you asked an agent to recall an earlier session this week against the week before. Turning it off empties the file and the log, then takes the hook out.
  - The same hook tells the agent about other sessions working in its repo now. While Hatch is open and the switch is on, it reads recent session files every 30 seconds and writes the sessions active in the last 30 minutes to `live.json` (readable only by your user): the tool, its repo (git's common directory, so every worktree of a repo counts), worktree, branch, title and up to 8 files it changed. On each prompt (not slash commands) the hook finds the repo of the folder it runs in the same way, leaves out its own session (by the `session_id` the tool passes), other Claude Code accounts' sessions, and anything that did nothing in the last 5 minutes, and adds up to three lines such as "Codex in another worktree `shop-fix`, branch `fix-login`, active 4m ago, changed `api/login.ts`", asking the agent to tell you before editing a file another session changed. No titles or other text from transcripts, and file and branch names keep only path characters, so none can read as Hatch's own words. The 30-second refresh starts only while the switch is on and Hatch has decisions or a brief to keep, and it runs in line with turning off. With Hatch closed the file ages out, so it says nothing rather than something stale. Turning the switch off empties it.
  - The same switch adds a SessionStart hook running the same script, for a short brief when a new session starts (not a resumed or compacted one): the commands blocked there, the corrections you keep making there, and the last three sessions in that repo and account from the last 14 days: the first line you typed and the status from its Result line, with how many things it left open. Never the agent's own words, since a reply can repeat text written to steer agents. Corrections come from Hatch's last look, so writing the brief never starts one. Hatch writes it to `brief.json` beside `recall.json`, readable only by your user, refreshed with it. It's marked as notes about past work that the current request overrides, at most 900 characters with sessions dropped first, ignored by the hook when over 14 days old, and `brief.jsonl` logs only the time, session and length. If you turned recall on before the brief existed, Usage offers to add it.
- **Notes your agents share.** On Corrections, "Notes to keep" lists what you decided in your prompts (the same sentences recall finds) and what agents learned, for the repos your included sessions worked in over the last 30 days. Agents write "Learned: …" lines when Agent rules ask them to ("Ask agents for them" adds the line), and only the reply that ended the work counts (the one with a Result block), at most two lines a session. Links, markup and anything shaped like a secret are taken out, and a line with a command, a link or words aimed at agents says to read it before keeping it. Keep adds the line to the repo's note in the vault folder "Agent notes" (`Agent notes/<repo>.md`, made when needed), plain Markdown with the repo in its front matter (`repo: github.com/acme/shop`, the origin remote, so every clone and worktree on any computer matches; a repo with no remote uses its folder) and a link back to the session it came from. Drop leaves it out for good. Edit or delete lines in the note as you like. Under the intro, one sentence says what kept notes did in the last 7 days: how many sessions they went to, how many of those agents used them in (most of a note's words in the replies that followed), how those sessions ended by their Result lines, and how often you still told an agent something a note kept for that repo already said. The hook logs only hashes of the notes it handed over, in `notes-used.log` (readable only by you).
  - Nothing reaches an agent until you keep it in Hatch. Hatch keeps each line you kept, by repo and in its exact words, in `notes-kept.json` (and dropped ones in `notes-dropped.json`), readable only by your user. A line added or changed in a note some other way, by hand, a teammate's copy or a merge, shows up as "Added or changed outside Hatch" until you keep it there too (Markdown escapes an editor adds don't count as a change). The kept lines go to `notes.json` beside `recall.json`, rewritten when Hatch opens and whenever a note in "Agent notes" changes, once you've opened Agent sessions. It holds the notes of the vault that's open.
  - A session started in a folder that holds repos (`~/dev`, not a repo itself) counts for the repo most of the files it changed are in, for the lines offered in Notes to keep, which you read before any is kept. Decisions, the start brief and session search never use it: what such a session read could come from a folder you excluded. It counts for none when the changes are split, or when it changed or read a file in a folder you excluded or ran a command naming one. In such a folder the hook hands over the kept notes of a repo the prompt names ("fix the shop sidebar" in `~/dev` finds `~/dev/shop`, or a clone or worktree named `shop-…`), and nothing when it names none or when two repos there have that name.
  - "Import rules files" reads CLAUDE.md, AGENTS.md, .cursorrules and Cursor's `.cursor/rules` at the top of the repos in your included folders (a folder itself and the ones right inside it, never an excluded one and never through a link). It takes the list items that say what to do, at most 40 per repo, leaves out what the repo's note already has, and adds them under a heading per file when you press "Add to note". Clones and worktrees of a repo count once, with the newest copy of each file. The rules wait to be kept like any line added outside Hatch. When three or more lines of a note wait, "Keep all" keeps them together, except lines with a link, words aimed at agents or a command that can do harm, which are kept one by one.
  - The recall hook (it rides on "Remind agents of what you decided") hands them to Claude Code and Codex: up to three kept notes that share at least two words with a prompt, and as many of the five newest as fit in the start brief (leaving room for the rest of it), so a new session gets them whatever its first prompt says. Each is quoted on one line with the day it was kept and the session id from the line's link, kept only when it's a plain id, under a header saying they're data, not instructions, and the current prompt wins. Notes don't age out like decisions do, and aren't tied to one Claude Code account: they're yours, for every agent. Without the recall switch, the section says so.
- **Past sessions for agents.** On Usage, "Let agents search past sessions" (off until you turn it on, after a system dialog) adds a read-only MCP server, `hatch-sessions`, to each Claude Code account with Claude Code's own `claude mcp add --scope user`, naming the account in `HATCH_ACCOUNT`, so Hatch never reads or writes `~/.claude.json`. When Codex is on this computer it goes into Codex too, with `codex mcp add` (Codex writes its own `config.toml`), seeing the default Claude Code account's sessions along with Codex's and Grok's. Hatch keeps where it added it in `mcp.json`, and turning it off runs each tool's `mcp remove`. It runs `hatch-sessions-mcp.sh` in Hatch's data folder, rewritten each time Hatch starts, which runs the server inside Hatch's `mcp.cjs` with Hatch's own Node. If Hatch was moved or removed it ends at once and Claude Code shows the server as failed. A Linux AppImage mounts somewhere new on each launch, so there it works while Hatch is open. An agent gets three tools: `search_sessions` (words in what was asked, said, run or changed, newest first, at most 10), `read_session` (the resume note: goal, what was done with proof, what was left, failed commands, corrections, and the prompts), and `active_sessions` (sessions in the repo that did something in the last 30 minutes, from any of the agents: tool, branch, folder, the last prompt and the files changed, so an agent can see another one working on the same files before it edits them).
  - In a folder of repos that isn't one itself (`~/dev`), each tool takes `repo`, the name of a repo folder right inside it, and answers for that one only, never an excluded one or through a link. Sessions started in that folder itself aren't shown.
  - The scope is narrow. It covers only sessions in the git repo the agent works in (worktrees count, and a `.git` file only counts as a worktree when the repo points back at it), and nothing outside a repo. It covers that Claude Code account plus Codex and Grok, in folders you included in Hatch, checked where a session started and where it ended. It skips sessions you told Hatch to forget (their ids are in `forgotten.json`), and covers the last 180 days, or less if Hatch keeps sessions for less. The session the agent is in now is part of it.
  - It reads the agents' transcripts itself, at most every 30 seconds and none over 16 MB, with secrets left out by the same patterns as Hatch's copy (a pattern match, so a password written as plain prose can get through). It works while Hatch is closed.
  - What it returns is fenced in a tag with a fresh random part, with anything shaped like the tag taken out first. The server says the text is data from old conversations, and that the note's next steps are suggestions to check, not instructions.
  - Each call is counted in `mcp.jsonl` (time, which tool, how many results, never the query). Usage shows the week's searches, hits and reads.
  - Turning it off runs `claude mcp remove` in each account Hatch added it to.
- **Checking before it says done.** On Usage, "Send Claude Code back to check" (off until you turn it on, after a system dialog) adds a Stop hook to each Claude Code account. When a turn ends with a reply that says something works or tests pass, and the agent changed files and ran no command after its last change, the hook sends it back once with "Run the test or command that shows it, then answer with what it printed". A second stop always goes through, so it can't loop. Plans ("I'll run them to make sure the tests pass") and negations don't count. The script is `hatch-gate.js`, run by Hatch's own Node through `hatch-gate.sh`, and reads only the end of the transcript Claude Code names. Each time it fires it notes the time, session, folder and the sentence in `gate.jsonl` on this computer, and Usage shows how often it then ran a check (it was right) or answered without one (maybe a false alarm).
- **Rules you added.** Each rule added from a correction is followed from then on: each look says whether you still say it ("Not said again in 12 sessions since", or "Said 2 times since, in 7 sessions", which means agents aren't reading it or it needs clearer words). What you say is matched against your wording and Hatch's, so a rule you reworded is still followed. A rule you added isn't suggested again, in its repo or, when it applies everywhere, anywhere.
- **Check with Claude Code** (off until you turn it on, and the system asks first). After each look, Hatch runs your own Claude Code headless with the suggestions it hasn't checked and up to 5 quotes each. The page shows the look at once and says while the check runs. Claude Code answers which are lasting rules and how to word them: its wording fills the rule (Hatch's own is shown under it), and the ones it thinks were one-offs are folded away. Claude Code sends that to Anthropic with your Claude Code sign-in, like a prompt you typed. Hatch never reads Claude Code's sign-in files.
  - The quotes come from transcripts, so the run can do nothing but answer. Hatch turns everything on by allow-list, not by blocking tools one by one: `--tools ""` (no built-in tools), `--strict-mcp-config` (none of your MCP servers), `--setting-sources ""` (none of your settings, so no hooks), `--disable-slash-commands` (no skills), `--no-session-persistence` (the check isn't saved as a session), one turn, a short system prompt, in an empty temporary folder. Hatch reads Claude Code's start message and stops the run if any tool or MCP server is there anyway.
  - One check runs at a time. A suggestion already checked keeps its answer and isn't sent again.
- **From peer reviews.** Reviews saved by `scripts/peer-review.py` (or any tool writing the same JSON to `<git common dir>/peer-reviews/<reviewer>/*.json`, `meta.status` `done`, `findings: [{ severity, file, line, finding, why }]`) are read for the repos your included sessions worked in. A kind of finding made at least 3 times across 2 reviews of one repo in 60 days is offered as a check ("Check before finishing: …") for that repo's section of "Agent rules", with the findings under it. Checks already in the note aren't offered again. Usage also scores each reviewer over the last 30 days (the sessions Hatch reads to follow up): its reviews, findings, high findings, how long a review took, and how many of the findings Hatch could follow an agent acted on. A finding counts as acted on when a session on the reviewed branch, in that repo, edited the file it names within two days and the same finding didn't come back in a later review of the branch. It's a heuristic for comparing reviewers, not a grade for one finding.
- **Agent skills.** On Corrections, each note in the vault's "Agent skills" folder is a skill you write once. "Update skills" copies it into each Claude Code account's `skills` folder and Codex's (`$CODEX_HOME/skills`, else `~/.codex/skills`) as `<name>/SKILL.md`. The name comes from the note's title, the description from `description:` in its front matter or else its first plain line. A system dialog first shows each new or changed skill: its description and the start of its text, eight skills at a time so every one is shown (the rest go on the next update). Next to each Hatch writes `.hatch-skill` with a hash of what it wrote and which vault it came from. A skill folder without it is yours and is never touched, one whose SKILL.md was edited by hand since is left alone, and Hatch never writes through a link, into a skills folder that is a link, or into a folder whose name differs only in case. Each folder is read again after the dialog, and anything that changed meanwhile is left as it is. When a note is deleted, its copy is taken out on the next update, only from the same vault, only if it's still exactly what Hatch wrote and holds nothing else. A note that can't be read keeps its copy. "New skill" starts a note from a template.
- **What agents send out.** On Usage, "Check what Claude Code sends out" (off until you turn it on, after a system dialog) adds to the guard hook a check of the text Claude Code is about to send: `git commit` and `git tag` messages, `gh pr`, `gh issue`, `gh release` and `gh gist` titles and bodies (only the subcommands that send something), and `gh api` fields. It reads the whole command, so flags, a heredoc and `$(cat <<'EOF' …)` all count, plus a body file when it's a regular file up to 200 KB. Something shaped like a secret (the same known shapes Hatch takes out of transcripts) or a word you listed stops the command, and the agent is told what to take out. For a word, running the very same command again in the same session within 15 minutes lets it through, so a false alarm costs one retry, and Usage counts those as likely false alarms. A secret never goes through on a retry. Words are matched without case, and a word made of letters and numbers only matches as a whole word, so "ai" doesn't stop "main". The log keeps the time, session and a hash of the command, never the text. It reads the command the way the guards do, so it's a check on habits, not a barrier: an agent could send text another way.
- **Harness check.** On Usage, Hatch reads each Claude Code account's `settings.json` and `CLAUDE.md`, and the hooks files it writes for Codex and Grok (never `~/.claude.json`, which holds your sign-in), and lists what's quietly broken: a settings file that isn't valid JSON (the tool then ignores all of it, hooks and permissions included), a hook whose script isn't there (it fails on every event), a hook listed twice (it runs twice), and an `@file` import in `CLAUDE.md` that points nowhere (Claude Code skips it without saying so). Each finding says what to do; for Hatch's own hooks that's turning the switch off and on. It only reads, and "Check again" reads the files again.
- **Errors agents keep hitting.** Hatch keeps the telling line of a failed command's output (the first line that sounds like an error, else the last, redacted, at most 200 characters) for Claude Code and Codex. A command you turned down or a hook stopped doesn't count. When the same command (its first words, without `cd`, variables, flags, paths or pipes, or the script for `python3`, `node` and the like; chained commands are left out, since either could have failed) fails the same way in two or more sessions of one repo in 30 days, and in at least two of them the same other command got it working with no file edited in between (or the same command run another way, without a pipe), Corrections offers that as a rule for the repo's section of "Agent rules": "When `pnpm typecheck` fails, run `pnpm install` first, which fixed it before." The error line is command output and can say anything, so it's shown only as evidence under the card, never put in the rule, and you edit the rule before adding it.
- **Usage.** The 7 days before the last look: sessions, prompts, how long agents waited on you (from the agent's last reply to your next prompt, at most 30 minutes each time), how many sessions ended in a commit or pull request, and how many replies said something worked ("tests pass", "it's fixed") with no command run after the agent's last change to show it (plans like "I'll check the tests pass" and negations don't count) (and how many of those claims you answered with "still broken"), each compared with the week before. When more than one model made such claims, "Claims by model" shows each model's claims, how many had nothing run, and how many you said were still broken. Each reply counts for the model that wrote it, so a session that switched models splits fairly. Then each tool and Claude account with the tokens it wrote down, subagents included. Cost shows only when a tool reported one: Hatch doesn't guess a price, since most plans are a subscription. When a tool's last 3 or more sessions this week came with no token counts at all, Usage says so, with the tool's version: the tool most likely changed how it writes them, and the numbers for it are missing, not zero. Last, files that more than one session changed within 2 days of each other. Under it, "Rules that never came up" lists lines of a personal CLAUDE.md or AGENTS.md, or a repo's own, that no session in the 30 days before touched (most of the line's words never appeared in what you asked, what the agent said, the commands it ran or the files it changed), with what each adds to every call. A personal file is judged only by its own tool's sessions, a repo's file only by that repo's, and nothing is said with fewer than 10 such sessions. Lines too general to judge (under 3 meaningful words) are left out. "Make it a skill" starts a note in "Agent skills" with the rule in it, for you to give a one-line description and take the line out of its file. All of it is counted on this computer.

## Set up

"Set up" on the Agent sessions page:

- **Folders.** Hatch reads nothing until you include a folder. Each folder agents worked in is listed once, with how many sessions it has. A rule covers the folders inside it, and the longest matching rule wins. New folders are asked about, never read by default.
- **Claude Code accounts.** People with several subscriptions run each with its own `CLAUDE_CONFIG_DIR`. Hatch reads `~/.claude`, `$CLAUDE_CONFIG_DIR`, and folders next to `~/.claude` that hold sessions (`~/.claude-work`, `~/.claude-max2`). "Add a folder" adds any other. A session from another account shows as "Claude Code (work)", and its resume command sets `CLAUDE_CONFIG_DIR`. Hooks and rules go to every account.
- **Hooks.** One switch per tool. With hooks on, each agent runs a small script when a turn starts or ends, or when it waits on a permission, so a session lands in Needs you the moment it stops. Without them the board goes by the transcript, which can't tell a finished turn from a paused one, so quiet sessions show as "Idle" instead of Needs you. Hatch shows the change to the settings file first, and the system asks again before anything is written. Codex asks you to trust new hooks in `/hooks` before it runs them. Hooks need a Unix shell, so Windows has none yet.
- **Keep sessions for** 30 days, 90 days, a year (the default) or forever. Agents delete their own old sessions. Hatch's copy keeps them this long. Choosing a shorter time asks first, since it deletes the older sessions from Hatch's copy.
- **Delete Hatch's copy.** Each tool's own files stay as they are.

## Where things live

| What | Where |
| --- | --- |
| Claude Code sessions | `~/.claude/projects/<folder>/<id>.jsonl`, helpers in `<id>/subagents/`, and the same in each account's folder |
| Codex sessions | `~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl` (or `$CODEX_HOME`). Newer Codex runs commands and edits from inside its `exec` tool; those come as `item_completed` events (`CommandExecution`, `FileChange`) and are read as steps. Checked against 72 real sessions on 2026-12-02 |
| Grok sessions | `~/.grok/sessions/<folder>/<id>/` (or `$GROK_HOME`) |
| OpenCode sessions | `~/.local/share/opencode/opencode.db` (or `$XDG_DATA_HOME/opencode`), one SQLite file for all sessions, opened read-only with Node's own `node:sqlite`. Only the `session`, `message` and `part` tables are read, never its account, credential or share tables. Each session lists as `<db>#<id>` with its own update time, and the list is read again only when the file or its write-ahead log changed. OpenCode has no hooks (it takes JavaScript plugins), so its sessions show on the board from their files alone and it isn't guarded. Checked against a 1.0.220 database with 14 sessions on 2026-12-02 |
| Hooks | `settings.json` in each Claude Code account's folder, `~/.codex/hooks.json`, `~/.grok/hooks/hatch.json` |
| Agent rules | The vault note `Agent rules.md`, copied between Hatch's markers into `CLAUDE.md` in each Claude Code account's folder, `AGENTS.md` in Codex's folder (`$CODEX_HOME` when set), `~/.grok/AGENTS.md` and `~/.config/opencode/AGENTS.md`, for each tool that's on this computer |
| Hatch's copy | `sessions/` in the app's data folder: an encrypted index, one encrypted file per session, settings and the hook events (`events.jsonl`) |

The note "Agent rules" has a section per scope: `## Everywhere`, then `## In ~/dev/shop` for rules that only apply there. Each rule is a list item. Edit it like any note, then press "Update agents".

## Privacy and safety

- Nothing leaves the computer unless you turn on the Claude Code check, which sends only the suggestions and their quotes, or run a replay test, which sends the replayed prompts and the files the agent reads in the repo's copy to your own Claude Code. Hatch reads the agents' session logs and settings files, never their sign-in files (`~/.claude.json`, `~/.codex/auth.json`), and keeps its copy in its own data folder.
- Secrets are left out of Hatch's copy: API keys from known providers, bearer tokens, private keys, passwords in URLs, values of settings named like a secret, and long random strings. A session page says how many were left out. Sessions over 64 MB are skipped: a transcript that big is mostly tool output.
- The hook events file holds only the event's name, the session id, its folder and whether it waits on a permission. Never a prompt or a command.
- The copy is encrypted (AES-256-GCM) with a key the system keychain locks (Electron `safeStorage`). On a Linux computer with no keychain, Hatch keeps sessions in memory only and says so. If the keychain won't open the key (a new keychain, a denied prompt), Hatch never deletes the copy: it reads sessions into memory for that run and tries again next time.
- "Forget this session" deletes Hatch's copy and Hatch won't read that session again.
- Hatch never writes to a project's own files. The rules go only to each agent's personal instructions file, between Hatch's markers, and hooks only add Hatch's own entries. A settings file that isn't valid JSON is never written.
- Every write outside Hatch's data folder (hooks, rules) and deleting the copy go through a system dialog the window can't answer for itself, so a note or plugin can't put words into an agent's instructions. The rules dialog lists the rules it will write. A file that changed while the dialog was open isn't written, and links are followed so a symlinked file is updated in place.
