herdr-cam
CLAUDE.md2 starsChanged 52 days agoMITView on GitHub
A herdr plugin for macOS: prefix+i opens a native camera window, Space adds photos to a tray, Enter pastes their paths into the focused herdr pane as one bracketed paste, where Claude Code turns them into [Image #N] attachments. Read README.md for the product and docs/DEVELOPMENT.md for the full design; this file is the short version for agents. - bin/herdr-cam: POSIX sh launcher. Plugin action entry (capture), detached worker (__run), paste, prune, doctor. - app/Core.swift: pure logic (options, key map,…
- Reads credentials
In this repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
The file
We split this CLAUDE.md into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
No AppKit, so tests/core/main.swift compiles it with plain swiftc.
- Very specific: line 77
Write the test first for any behaviour change.
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
herdr-cam
A herdr plugin for macOS: prefix+i opens a native camera window, Space adds photos to a
tray, Enter pastes their paths into the focused herdr pane as one bracketed paste, where
Claude Code turns them into [Image #N] attachments. Read README.md for the product and
docs/DEVELOPMENT.md for the full design; this file is the short version for agents.
Commands
sh scripts/test.sh # all offline tests (~90s): core x2, launcher, app smoke
sh scripts/build.sh # build/HerdrCam.app (what the plugin runs)
sh scripts/build.sh build/test --testing # test build with the automation hooks
sh tests/e2e_live.sh # live: needs a running herdr and the claude CLI
sh tests/e2e_live.sh camera # live with the real webcam; ask the user first
sh scripts/render-media.sh # re-render banner, social preview, demo GIF
shellcheck -s sh bin/herdr-cam scripts/*.sh tests/*.sh tests/support/fake-open tests/support/fake-herdrLayout
bin/herdr-cam: POSIX sh launcher. Plugin action entry (capture), detached worker (__run),paste,prune,doctor.app/Core.swift: pure logic (options, key map,Tray,RunResult,processImage). No AppKit, sotests/core/main.swiftcompiles it with plainswiftc.app/CamApp.swift: the AppKit/AVFoundation window.Cameraowns the session on a serial queue; everything else is main-thread.assets/src/: HTML/JS sources for the README media;assets/render.mjsrenders them with Playwright driving the installed Chrome.
How the pieces talk
- Launcher runs
open -W HerdrCam.app --args --out <base> ….opendrops the app's stderr and exit code, so the app always ends by writing<base>.result(ok+ paths,cancel, orerror+ message). No result file means a crash; the launcher reports it. Keep this contract when changing either side. - Paste goes over the herdr socket as
pane.send_input(raw JSON throughnc -U), which herdr wraps in bracketed-paste markers. Multiple paths go in one paste, space separated. - The pane id comes from
HERDR_PANE_ID, elseherdr pane currentparsed withplutil.
Rules that are easy to break
- Camera permission and rebuilds. The app is ad-hoc signed; macOS ties the camera grant
to the exact signature. Every rebuild of
build/HerdrCam.appmakes the user click Allow again. Do not rebuild it casually; tests build intobuild/test/andbuild/test-release/. Batch app changes and rebuild the release app once at the end. - Test hooks are test-build only.
--fake-image,--auto-capture,--auto-shotsare behind#if HERDR_CAM_TESTING. The launcher forwards them only from environment variables (HERDR_CAM_*), never fromconfig.env. Do not move them into release builds or config; a release build must never take a photo without a key press. config.envis data. It is parsed key by key and validated; neversourceit.- Privacy.
umask 077in the launcher, 0700/0600 from Swift. Metadata stripping is tested; keepprocessImagere-encoding from pixels, not copying properties. - Keyboard focus. The window is a non-activating
NSPanel. Do not switch back to anNSWindowwithNSApp.activate(): on macOS 14+ an app launched from herdr's background process cannot activate itself that way, the window opens without focus, and Space goes to the terminal (the v0.1.0 bug).e2e_live.shchecks this with--focus-check. - Hardened runtime needs
app/HerdrCam.entitlements(camera). Keep both inbuild.sh. - Never point the live e2e at the user's own pane or config. It uses a scratch pane, pastes by pane id, and keeps state in a temp dir.
- Ask before anything that opens the real camera (
e2e_live.sh camera, launching the app without--fake-image): it lights the camera and may show a permission prompt.
Shell gotchas we have hit
- In POSIX sh,
VAR=x some_functionleaksVARinto the rest of the script. The launcher tests call captures throughenvfor this reason. plutil -extract … rawprints its errors on stdout; check its exit status.- A paste into a Claude Code session that started seconds ago can stay plain text; the e2e waits for herdr to report the agent idle first.
- A same-page
#hashnavigation does not re-run a page's script;render.mjsgoes viaabout:blank.
Testing expectations
Write the test first for any behaviour change. Swift logic goes in Core.swift with a
check in tests/core/main.swift; launcher behaviour gets a case in tests/cli_test.sh
(assert the exit code too). UI changes in CamApp.swift need a live run: fixture mode at
least, camera mode with the user's go-ahead. Keep README.md, SECURITY.md,
docs/DEVELOPMENT.md, and CHANGELOG.md in step with behaviour; the README's claims are
checked by reviewers against the code.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

