Port of the Mac's "Approve commands from the notch" (#934). Antigravity has
no permission request: it runs PreToolUse before its own permission check and
waits for the hook's decision. With Settings → Agents → Antigravity →
Approve commands from the notch (off by default, shown once the hooks are
installed), a run_command that none of Antigravity's command(...) rules
covers waits on the island's card: Allow prints {"decision":"allow"}, Deny
{"decision":"deny","reason":"Denied from Coucou"}, and Reply in terminal, no
click, a full card or Coucou closed print {"decision":"ask"}. Coucou never
allows a command without a click.
- agy_rules.rs: AgyPermissionRules.swift in Rust (CLI settings, global
grants, the session's project or "outside of project"), with the Swift
tests plus Windows folder URIs and paths.
- agy_approvals.rs: the gate (setting, run_command, hooks.json timeout >=
120 s, rules verdict unknown, wait min(timeout - 10, 110) s) and the
setting's commands, owned by Rust like the phone switches.
- Relay: Antigravity's PreToolUse is tagged coucou_kind agy_pre_tool and
reads one line: "ask" at once, or "pending" then allow / deny / ask. 3 s
for the first line, 115 s once pending. A command longer than what the
relay forwards is flagged and gets no card.
- App (pipe.rs): the event goes to the island as usual, then the card as a
PermissionRequest; "pending" once the island acks it.
- PreToolUse hook installed with a 120 s timeout; Settings shows the Mac's
"install again" hint for hooks written with 10 s.
- Card: Deny, Allow and Reply in terminal for Antigravity only. Mac strings
reused (all already in strings.json), no extra.json entries needed.
- CHANGELOG, windows/README.md, docs/AGENTS.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
- The app watches the relay's connection while a card is up: when Claude
Code ends the relay because the prompt was answered in the terminal or
the Claude app, the island gets hook-resolved and the card goes at once.
- The card also goes when the very tool call it asked about runs.
- coucou-hook notices when the shell that ran it (Git Bash, cmd) is gone
and exits, so an orphaned relay no longer keeps the card up.
OpenCode joins the agents whose permission requests the island can answer
(Codex, Copilot CLI, Muse Code). The generated OpenCode plugin gains a
blocking permission.ask hook that relays the request to coucou-hook and
maps the island decision to allow/deny; without a decision it falls back
to ask, so nothing is ever allowed without a human click.
- reply.rs: takes_decisions accepts opencode
- agents.rs: approvals() includes OpenCode + plugin round-trip
- agents.ts: OpenCode joins APPROVAL_AGENTS
- tests: reply shape, whitelist contract and island card flows updated
Refs #351
Allow Claude Desktop sessions on Windows to display permission approval
cards and interactive AskUserQuestion cards on the dynamic island instead
of immediately declining them.
- Add "claude-desktop" to APPROVAL_AGENTS in windows/src/island/agents.ts.
- Allow AskUserQuestion from claude-desktop to form question cards in hooks.ts.
- Add "claude-desktop" to takes_decisions and format decision JSON with
question answers in windows/hook/src/reply.rs.
- Add test coverage for Claude Desktop approval and question cards in both
Node.js and Rust test suites.
Fixes#328
#317 found the real bug: Antigravity reads "{}" on PreToolUse as a denial,
so the Coucou hook blocked every tool. Its fix answered {"decision":"allow"},
which would run every Antigravity tool without its permission prompt (Coucou
never approves anything without an explicit click). Antigravity's hooks also
take "ask": it shows its own prompt and respects the user's Always Allow.
Both relays (Mac and Windows/Linux) now answer that, and the Rust tests keep
checking that nothing is ever allowed with nobody clicking.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
- Chat: a file rides along with a question only if it is one of Coucou's own
copies in the inbox. The page names the path, so any readable file could
otherwise be sent to a chat provider.
- Custom OpenAI-compatible server: its key is stored with the address it was
entered for and only ever sent there, never over plain http to another
machine. The page can no longer point the key at another address through
the settings or Connect; the generic secret_set refuses it.
- Plan usage: a statusLine Coucou does not understand (not an object) is
refused instead of replaced.
- Relay: only agents whose decisions the island can give wait for one.
- Agent configs: a symlinked config is resolved on Windows too, and on removal.
- Codex plan check: on Windows, end the whole process tree (codex.cmd → node).
- DOM helper: drop the unused innerHTML path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts resolved with the relay rewrite (port/agents) and the plan card:
- The relay's truncate_payload runs at the end of prepare(), on the
normalised event name: only a finished (PostToolUse) Edit / MultiEdit /
Write keeps its text, up to 256 KB per string and 512 KB per event; every
other agent's events keep the ordinary 2 000-byte cap. Tested through
prepare().
- Stop's final line reads last_assistant_message for every agent (Claude Code,
Hermes, Codex), else message.
- The overview's left card: plan card first, then an open diff, then the
ticker. A kept pill reset at the end of its session also drops its diffs
and final line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts resolved with port/agents and port/pills-approvals:
- The status line install now goes through config_file.rs, the shared
hardened writer (strict read, fingerprint, dated backup, atomic write);
plan-usage's private write_with/preview_with copy is gone. The diff is the
whole-file diff with context, like every other install.
- Settings keeps plan-usage's generic reviewChange, with port/agents' wording
for a settings.json that does not exist yet (no backup to take).
- The relay checks --statusline first, then parses --agent as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts resolved with port/agents:
- One card for every agent's request (Claude Code, Codex, Copilot CLI, Muse
Code): it comes up, its pill comes to the front, the previous pill returns,
it can be folded, and it is dropped when the turn ends. The badge-only path
for a request behind another pill is gone; clicking a pill with a waiting
request still opens its card.
- agent_hooks.rs reads Claude Code's hooks itself and every other agent's
through agents.rs, so the pill and Settings → Agents share one detection.
- The relay tags Claude Desktop sessions and Cursor's terminal inside the new
prepare() structure.
- OpenCode, Amp and Hermes are offered in the catalog now that port/agents
installs their plugins.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Claude Code session started from the Claude desktop app carries
CLAUDE_CODE_ENTRYPOINT=claude-desktop: the relay tags it
coucou_agent: claude-desktop, as the Mac's does, so it lands on the
Claude Desktop pill (an explicit --agent still wins). Claude Code in
Cursor's terminal is told apart from VS Code by CURSOR_TRACE_ID, or by
Cursor's executable behind VS Code's git helper, and reported as
term_editor: cursor.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
normalize.rs ports the Mac relay's full table: Gemini CLI, Antigravity,
snake_case and Copilot's camelCase event names (preToolUse,
sessionStart, permissionRequest…), Cursor's (beforeSubmitPrompt, a stop
with status "error" becomes StopFailure), and the fields: toolName /
toolArgs (object or JSON text), toolCall.name / args with Antigravity's
key aliases, conversationId / sessionId / GEMINI_SESSION_ID, workdir,
workspacePaths / workspace_roots. A field already present is kept.
reply.rs is the only place that knows what each agent reads on stdout:
hookSpecificOutput for Claude Code and Codex, a bare permissionDecision
for Copilot CLI and Muse Code, "{}" for Gemini CLI, Antigravity, Copilot
and Muse, silence for the rest. A decision is only ever relayed for a
PermissionRequest from an agent the island can answer (Claude Code,
Codex, Copilot, Muse); with no click there is never an allow, and
Copilot (fail-closed) gets an explicit "ask". When stdin cannot be read
the agent still gets its "no opinion" reply.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude Code's status line hands its command the plan limits (rate_limits).
`coucou-hook --statusline` forwards only those and the session id to the
app (300 ms at most, in the background), then runs the status line the user
had before with the same input and prints its output untouched, so it keeps
working. That command is kept in statusline-previous.json beside the relay.
Running the previous status line the way Claude Code runs it: /bin/sh -c on
Linux, Git Bash's bash -c on Windows (CLAUDE_CODE_GIT_BASH_PATH, then the Git
for Windows that git.exe on PATH belongs to, the usual install folders, then
bash.exe on PATH except the WSL launcher), never cmd /C. It gets 10 s, 64 KB
of output are kept and the rest drained, and a background child holding the
pipe open cannot hold the relay.
hooks.rs gains the status line install/remove, apart from the hooks: diff of
the `statusLine` key only, dated backup, fingerprint check and a write after
a click through the same hardened writer. Only `command` is swapped; removing
puts the previous status line back, or drops the key, and leaves a status
line the user changed since alone.
Based on #171 by Justin Minkmar (273efa0), re-applied on this branch.
Co-authored-by: Justin Minkmar <justinminkmar@proton.me>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The relay only sends answers back when they answer exactly the questions
Claude Code asked, with one of each question's labels (same rule as the
Mac's QuestionPayload.accepts).
- Multi-select answers go back as a list of labels, as on the Mac (Claude
Code 2.1.136+), instead of one comma-joined string.
- A question answered in the terminal takes the card down (PostToolUse of
AskUserQuestion for the same session), as in #172.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PostToolUse of Edit / MultiEdit / Write keeps old_string / new_string /
content up to 256 KB each and 512 KB per event (other fields and events keep
the 2 000-byte cap). Anything cut sets coucou_diff_truncated so the island
shows no counts it cannot trust.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AskUserQuestion arrived as a permission request and got the Deny / Allow
card, which says nothing about what is being asked and cannot answer it.
The question view now shows the question and its options as buttons. Picking
one sends the answer back to the session; several questions are stepped
through in turn, pick-several questions get toggles and a Done button, and
"Answer in terminal" hands the request back as before.
The answer travels as {"answers":{...}} on the relay connection. coucou-hook
turns it into an allow whose updatedInput is the question's own input plus
that map, and refuses anything else: no other field and no other tool's
input can be changed from the island.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The relay socket only lives in a runtime directory that is ours, private
(no group/other bits) and not a symlink, checked on both ends; otherwise
hooks stay off. The hook also checks the size getsockopt returns.
- settings.json keeps its permissions (and a dotfiles symlink) when Coucou
rewrites it; the temp file is created 0600.
- The hook command is single-quoted on Unix, so sh reads the path literally.
- ~/.local/share/coucou and ~/.config/coucou are 0700, the log 0600.
- The relay is installed by copy-and-rename, compared by content.
- open_in_vscode only opens an existing absolute folder.
- linux.yml: read-only build job without persisted credentials, a separate
publish job with write access, PUBLISH off until a first build is checked,
artifacts only on manual runs or publishing (3 days), SHA256SUMS, and the
relay built before cargo test.
- deb depends on gtk-layer-shell >= 0.6, which the bindings need.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U6iHtaxRfhryJ62nLk7nDJ
coucou-hook and the app now talk over $XDG_RUNTIME_DIR/coucou.sock on
Linux (falling back to /run/user/<uid>), with the same guarantees as the
Windows named pipe:
- 300 ms to connect, retrying only while the backlog is full
- SO_PEERCRED on both ends: only our own user is served or trusted
- a stale socket answers nothing and is replaced on launch; a live one
means another Coucou is serving, and we refuse to serve on top of it
- socket file is 0600 inside the 0700 runtime directory
The Windows pipe code moves into hook/src/win.rs so main.rs has no
platform code, and pipe.rs handles both transports through a small
Relay trait (the named pipe still disconnects explicitly).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Any hook relay can tag its payload with coucou_agent (lowercase,
digits and hyphens, ≤ 24 chars) to get its own pill next to Claude
Code in the island. Invalid or absent names fall back to the Claude
Code pill unchanged.
Mac relay (both builds):
- Shell wrapper passes "$@" so --agent <name> reaches nb-hook.py.
- Python relay parses --agent <name> from sys.argv and injects
coucou_agent into the payload before forwarding.
Windows relay:
- coucou-hook.exe --agent <name> [<EventName>] parsed; coucou_agent
inserted in the JSON when a name is provided.
App (HookServer):
- validateAgent(_:) enforces the [a-z0-9-]{1,24} constraint.
- upsertExternalAgent(id:name:) creates a dynamic pill on first event.
- processEvent routes all events (SessionStart … SessionEnd) to the
right pill; external-agent pills bypass the VS Code terminal filter
and are removed from the task list on Stop/SessionEnd.
Co-authored-by: Tudor Lacatus <lacatu5@users.noreply.github.com>
An audit of windows/ found four blockers in what 0.1.0 shipped. Two of them meant
the Claude Code integration could not work at all on anyone else's machine.
B1 — Allow and Deny were sent in a shape Claude Code does not read. The
documented format for PermissionRequest is hookSpecificOutput.decision.behavior
(https://code.claude.com/docs/en/hooks); we sent {"permissionDecision":"allow"}
and the relay echoed it through. The app now answers a bare `allow` or `deny`
and coucou-hook builds the JSON, so the wire format Claude Code expects lives in
one place with tests around it. Anything unrecognised prints nothing at all
rather than guessing.
B2 — the relay was never installed. `resources` was a glob, so NSIS mirrored the
source path into _up_\target\release\ and none of the three paths
ensure_hook_exe() searched covered it. It only looked healthy here because a
leftover copy from `tauri dev` was sitting in bin/; deleting it and relaunching
the installed build left bin/ empty. Map form now, plus the old location as a
fallback candidate, the failure is logged instead of going to a stderr nobody
reads, and "Install hooks…" is disabled while the relay is missing rather than
writing hook commands that point at nothing.
B3 — read_settings() returned {} on every error, including a lock, a permission
problem or JSON it could not parse. Merging on top of that empty object and
writing produced a settings.json containing nothing but Coucou's hooks. Now only
a missing file starts from nothing; a UTF-8 BOM is stripped (PowerShell writes
one); everything else is reported and nothing is written. The write also refuses
if the file changed since the diff the user approved, goes through a temp file
and a rename, keeps key order, and stamps backups to the second.
B4 — a permission request could freeze Claude Code for nearly two minutes with
nobody able to see it. The relay now waits for the island to confirm the card is
on screen before it starts the long wait: paused, unresponsive, or already
holding another request, and Claude Code gets the question back at once.
Measured: app closed 14 ms, paused 19 ms, a second concurrent request 69 ms, and
the first request stays answerable throughout.
Also in this release:
- I1/I3 — the relay retries only on ERROR_PIPE_BUSY and exits immediately when
the pipe is absent; every blocking call runs under a deadline; tool_response
and transcript_path are dropped and long strings capped, so a single Write no
longer ships a whole file down the pipe.
- I4 — "Always" is gone. It answered a plain allow and remembered nothing, which
is not what the button says. It comes back in 0.1.2 with the rule list.
- I5 — the approval card shows what is being authorised: the command, the file
path, the URL. Approving "Write" told you nothing.
- I6 — the frame loop stops whenever the island is hidden. engine.busy is
permanently true for any looping animation (breathing, sleeping, ratelimit
sweat), so a hidden island burned frames in the states it spends most of its
life in. The AudioContext is suspended when nothing is playing. Measured 0.000 s
of CPU over 180 s hidden.
- I7 — a display being added, removed, rearranged or rescaled is noticed and the
island is placed again.
- I8 — open_in_vscode no longer goes through `cmd /C`, where `&`, `^` and `%` in
a project path are syntax. PATH is walked directly.
- I9 — the inbox ages from when a file was copied. CopyFileEx carries the
source's timestamps across, so anything last edited over a week ago was swept
the moment it landed.
- I10 — the pipe name carries the user's SID, and the relay checks the server
process really belongs to us before sending anything.
- I2 (partial) — uninstalling removes %LOCALAPPDATA%\Coucou\bin, inbox and log.
settings.json is deliberately left alone: it is the user's, it may hold other
tools' hooks, and rewriting it from an uninstaller with no diff and no consent
is what the rest of this app goes out of its way not to do.
- Pause now reaches Rust, so the pollers stop calling out instead of only the
island stopping showing things; a poller also skips an integration the user
switched off. UserPromptSubmit reads `prompt`, not `message`, so that step is
no longer always blank. The production CSP drops the dev server. Vite's
envPrefix is TAURI_ENV_. .env is ignored. The n8n URL never reaches the log —
a self-hosted base can carry credentials.
- The release workflow checks package.json and Cargo.toml against the tag too,
and moves the windows-latest tag to the commit it published.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- coucou-hook.exe (crate `windows/hook`) relays hook events over the named pipe
`\.\pipe\coucou-<user>`. 300 ms to connect, then it gives up silently: if
Coucou is closed, slow or crashed the session carries on untouched. Only
PermissionRequest waits for an answer, and when none comes it still writes
nothing, so Claude Code falls back to asking in the terminal rather than us
denying anything behind the user's back.
- The app copies the relay into %LOCALAPPDATA%\Coucou\bin at launch and answers
with the same decision JSON as HookServer.swift.
- Hook installation follows the CLAUDE.md rule exactly: read, dated backup,
merge without touching anyone else's hooks, show the diff, write only on an
explicit click. Uninstall removes Coucou's entries and nothing else. The hook
command is just the quoted exe path in forward slashes plus the event name,
because Claude Code runs hook commands through Git Bash on Windows.
- New settings window (second Tauri window) with the Claude Code section and the
general preferences; the tray "Settings…" opens it.
- Click-through moved into the Rust cursor poll: the island rect is pushed from
the front end and the flag flips in the same 16 ms tick as the cursor read. The
previous IPC round trip lost clicks on buttons the cursor reached quickly.
- Log at %LOCALAPPDATA%\Coucou\coucou.log (the nbLog equivalent), written by both
the Rust side and the island. Nothing leaves the machine.
Verified end to end with the real relay: Allow, Deny, Always, and app closed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
First stage of the Windows port. Lives entirely in `windows/`, shares only the
28 WAVs with the Mac app (single path constant in vite.config.ts) and touches
no macOS file.
Stack: Tauri 2 (Rust backend, TypeScript + Vite front, no framework), Mochi
drawn in Canvas 2D.
- Borderless transparent always-on-top window that never takes focus
(WS_EX_NOACTIVATE + WS_EX_TOOLWINDOW), absent from the taskbar, placed at the
top centre of the chosen display with per-monitor DPI handled in physical px.
- Click-through: the cursor poll toggles set_ignore_cursor_events on the island
shape. When hidden the window shrinks to an invisible 240x6 wake strip and the
poll thread parks on a condvar — measured 0% CPU, 31 MB RAM.
- BotEngine.swift ported to Canvas 2D: superellipse body, eye projection,
emotes, badges, particles, tweens, mailbox morph, slap/dizzy, hover love.
- GreetingCanvasView.swift ported: same timings, same seeded particles.
- Island FSM, view sizes, colours, texts and sounds taken from the Swift app.
- 28 WAVs preloaded in Web Audio at volume 0.12, mute button in the header.
- Tray icon (Mochi, drawn in code by scripts/gen-icons.mjs): Open, Settings,
Pause, Quit. Single instance, optional autostart.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>