Skip to content

The app wires learner-server's hook into every Claude Code session on this Mac - #8

Merged
onthegonow merged 3 commits into
mainfrom
claude-hook
Nov 18, 2026
Merged

onthegonow merged 3 commits into
mainfrom
claude-hook

Conversation

@onthegonow

Copy link
Copy Markdown
Contributor

What this does

The app now wires learner-server's live hook into Claude Code on this Mac, so the hook runs in every Claude Code session in any folder: the terminal CLI and the Code tab of the Claude desktop app (it runs the same Claude Code and reads the same ~/.claude/settings.json).

A new job, ClaudeHook, runs at launch and every 6 hours. It runs learner-server's own installer (clients/hook/src/install.ts) from the uploader's checkout with:

  • --server-url set to the paired server,
  • --key-command-json set to the Keychain lookup the app already uses. The key itself is never passed, written or logged.

It then runs the installer's --check, which asks the server with that key, and reports the result like any other job. A refused or missing key is blocked; an unreachable server is retried.

Not covered, by design of the Claude apps: a chat in the Claude desktop app or on claude.ai runs no hooks. Those still reach the server afterwards through the chat archive.

Server side

config/learner-server.ref moves to the learner-server commit that lets a paired device key call the hook's seven RPCs (before, they needed an admin key, so a Mac could not use the hook at all).

Tests

  • Light: installer arguments, --check report parsing, report to job outcome.
  • Medium: the job against a stand-in bun (order of calls, no key in arguments or environment, blocked and retried cases, more catalog parts on demand).
  • Heavy, runner only: the real installer from the pinned server checkout, against the real server with a real device key, into a scratch ~/.claude; one prompt sent through the installed hook command must come back with the live-feedback instructions.

This branch was written on a Linux box with no Swift toolchain, so CI is its first compile.

Testing it on the owner's Mac (for the desktop agent)

  1. git -C ~/code/learner-server pull --ff-only && (cd ~/code/learner-server && ~/.bun/bin/bun install --frozen-lockfile)
  2. Check out this branch, scripts/test.sh light and scripts/test.sh medium.
  3. Build and run the app from this branch; in the app log look for the ClaudeHook job finishing ok: wired into Claude Code.
  4. ~/.bun/bin/bun ~/code/learner-server/clients/hook/src/install.ts --check must print "ok":true (it prints no key).
  5. Start a new Claude Code session in any folder other than the server checkout, in the terminal and again in the Claude desktop app's Code tab, and send one prompt. The session's context must contain LEARNING LIVE FEEDBACK. Report the session ids (not the prompt text) so the server side can confirm the turns were stored.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SPMjtan22onKA34S16vwNd

… this Mac

A new job, ClaudeHook (launch, then every 6 h), runs learner-server's own installer
from the uploader's checkout: user-level ~/.claude/settings.json, the paired server's
URL, and the Keychain lookup as the way to read the device key (never the key). It
then runs the installer's --check, which asks the server with that key, and reports
the result like any other job: refused or keyless is blocked, unreachable is retried.

That covers the terminal CLI and the Code tab of the Claude desktop app. Chats in the
desktop app and on claude.ai run no hooks and still arrive through the chat archive.

Tests: the arguments and report parsing (light), the job against a stand-in bun
(medium), and on the runner the real installer against the real server with a real
device key into a scratch ~/.claude, with one prompt sent through the installed hook
(heavy). config/learner-server.ref moves to the server commit that admits a device
key on the hook's calls.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SPMjtan22onKA34S16vwNd
@onthegonow
onthegonow enabled auto-merge (squash) November 17, 2026 21:30
onthegonow and others added 2 commits November 17, 2026 21:35
…ng else and fails open)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SPMjtan22onKA34S16vwNd
@onthegonow
onthegonow merged commit 798a383 into main Nov 18, 2026
1 of 2 checks passed
@onthegonow
onthegonow deleted the claude-hook branch November 18, 2026 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant