needs-you

Guides

Add a sender (a machine, a project, a CI repo)

A sender is anything that posts items: an agent, an Orca automation, a VM's cron jobs, a CI workflow. Each one gets its own token so you can revoke it alone.

  1. Make a link. In the Mac app: right-click the pill → Settings… → Connect a machine (or Connect a Machine… in the menu bar menu), keep A server or agent that sends alerts, set Uses to the number of machines, Create invite. On a server hub: needs-you-admin invite create my-server --role sender --uses 3 --ttl 72. You get:
    • a join URL, e.g. http://my-mac.example.ts.net:8765/join/nyi_...,

    • a one-liner: curl -fsSL <join_url>/install.sh | bash -s -- --yes --claude-hooks user --skill --alerts. The last three options set up Claude Code alerts; on a machine without Claude Code, drop them (Options),

    • the same install as plain lines (Plain lines in the app), for a browser console that types a paste key by key and can drop a |:

      cd
      umask 077
      curl -fsSLo needs-you-install.sh <join_url>/install.sh
      bash needs-you-install.sh --yes --claude-hooks user --skill --alerts

      The saved installer holds the invite code, so umask 077 keeps it private and it deletes itself as soon as it starts. Options go on the last line,

    • an agent prompt: "Set up needs-you alerts on this machine: read <join_url> and follow it. If this machine runs Claude Code, use --claude-hooks user --skill --alerts. If it runs OpenAI Codex CLI, add --codex-hooks user; Gemini CLI, add --gemini-hooks user; opencode, add --opencode-plugin; GitHub Copilot CLI, add --copilot-hooks user; Kimi Code, add --kimi-hooks user; Grok Build, add --grok-hooks user; Cursor, add --cursor-hooks user; Cline, add --cline-hooks user; Aider, add --aider. Only if I ask for them: --mcp <agents> registers the needs-you MCP server (claude, codex, gemini, opencode, copilot, cursor) and --agent-instructions <agents> adds the posting rules to their instruction files (codex, gemini, opencode). Daily updates are on by default (the 5-minute flush runs needs-you update); add --no-auto-update only if I ask. Then run ~/.local/bin/needs-you doctor and, for each WARN or FAIL line, run the next step printed under it, or tell me if it needs me. If the installer says the link is unknown, expired or used up, ask me for a new one." (Codex)

  2. Use it on the machine. Paste the prompt into the machine's agent (Claude Code, Orca), or run the one-liner yourself (the plain lines in a browser console). The machine must reach the hub: on the Mac itself 127.0.0.1 always works (pass --hub http://127.0.0.1:8765 if the link's MagicDNS name doesn't resolve) and the installer puts it first; elsewhere it must be on the tailnet.
  3. Check the card that the installer posts, "needs-you is set up on <host>" (setup:<host>:test), under Recent in the panel; the installer's last lines say so. On the machine, open a new terminal and run needs-you doctor: every line should be OK or INFO, and each WARN or FAIL line has the command that fixes it under it.

If curl prints Failed to connect or Could not resolve host, or the installer stops with can't reach the hub, nothing was installed and no use was spent: the machine can't reach the Mac (asleep, Tailscale off on one side, or macOS blocked python3). Tailscale → Check reachability has the checks; then run the same line again.

The join URL is safe to open in a browser first: it's Markdown that explains what will happen. Opening it doesn't spend a use.

What the installer does #

StepDetail
Installs the CLIDownloads needs-you from the hub (/dl/needs-you), checks it compiles, puts it in ~/.local/bin, and adds ~/.local/bin to PATH with one line tagged # added by needs-you in your shell profile (~/.zshrc, ~/.bash_profile on macOS bash, ~/.bashrc on Linux bash, else ~/.profile). --no-path prints the line instead.
Redeems the inviteMints a token for this machine, named <invite name>-<host> (just the invite name if that already is the host). One link with uses: 5 sets up five machines, each with its own token.
Writes the config~/.config/needs-you/env, mode 600: NEEDS_YOU_URLS (the hub plus its peers, in failover order), NEEDS_YOU_URL, NEEDS_YOU_TOKEN, and NEEDS_YOU_DEFAULT_CONTEXT with --context. Other lines in the file are kept.
Schedules a flushEvery 5 minutes, needs-you flush sends anything queued while no hub answered (e.g. the Mac was asleep): a crontab line on Linux, the LaunchAgent io.needs-you.flush on macOS. Re-running adds it again if it's missing.
Turns on daily updatesNEEDS_YOU_AUTO_UPDATE=1: once a day the flush runs needs-you update from this hub, checked against the GitHub release (Keeping up to date). --no-auto-update leaves it off; a value already in the env file is kept.
Checks and testsneeds-you health, then a test info item. An unreachable hub is only a warning: the item queues.

Options #

Add them after --yes: curl -fsSL <join_url>/install.sh | bash -s -- --yes --skill --context personal.

OptionMeaning
--yesDon't ask. Needed when piped (there's no terminal to confirm on).
--claude-hooks user|project|noneInstall the Claude Code hooks for every repo (user), or the current directory's repo (project). Default none. See Claude Code.
--codex-hooks user|noneInstall the OpenAI Codex CLI hooks in ~/.codex/hooks.json (trust them once with /hooks in Codex). Default none. See Codex CLI.
--gemini-hooks user|noneInstall the Gemini CLI hooks in ~/.gemini/settings.json. Default none. See Gemini CLI.
--opencode-pluginInstall the opencode plugin in ~/.config/opencode/plugins/. See opencode.
--copilot-hooks user|noneInstall the GitHub Copilot CLI hooks in ~/.copilot/hooks/. Default none. See Copilot CLI.
--kimi-hooks user|noneAdd the Kimi Code CLI hooks to ~/.kimi-code/config.toml (one marked block). Default none. See Kimi Code.
--grok-hooks user|noneInstall the Grok Build hooks in ~/.grok/hooks/. Default none. See Grok Build.
--cursor-hooks user|noneInstall the Cursor hooks in ~/.cursor/hooks.json (a card when a turn finishes; no approval hook). Default none. See Cursor.
--cline-hooks user|noneInstall the Cline hooks in ~/Documents/Cline/Hooks/ (a card when a task finishes; no approval hook). Default none. See Cline.
--aiderSet Aider's notifications command in ~/.aider.conf.yml (printed instead when that file can't safely be changed). See Aider.
--alertsTurn the Claude Code, Codex, Gemini CLI, opencode, Copilot CLI, Kimi Code, Grok, Cursor, Cline and Aider hooks on for every session here (NEEDS_YOU_AGENT_ALERTS=1 in the env file).
--skillInstall the needs-you skill to ~/.claude/skills/needs-you/.
--no-auto-updateDon't let the 5-minute flush run needs-you update once a day. It's on by default (NEEDS_YOU_AUTO_UPDATE=1); updates come only from this hub, checked against the GitHub release. A value already in the env file is kept unless you pass this or --auto-update (which turns it back on). See Keeping up to date.
--context-alert PCTCard suggesting /compact or /clear once a Claude session's context is PCT% full. Default 80; 0 off.
--ssh-alias NAMEThis machine's name in the Mac's ~/.ssh/config: agent cards get a VS Code Remote-SSH button.
--agent-link 'LABEL=URL'One link template for agent cards instead of the automatic editor links; none turns them off. See Claude Code everywhere.
--orca-environment NAMEOn a paired Orca server: its name in the Mac's Orca.
--orcaWrite the Orca automation snippet to ~/.config/needs-you/orca-snippet.md and print it. See Orca.
--orca-usageUsage meters for every Claude and Codex account Orca manages here, sent by the flush (NEEDS_YOU_ORCA_USAGE=1). See Orca.
--context work|personalDefault context for this machine's items.
--host NAMEThis machine's name (default: short hostname).
--hub URLUse a different URL for the same hub (e.g. its IP while DNS is broken). It is used for the install and saved first in NEEDS_YOU_URLS, ahead of the hub's advertised URLs.
--no-scheduleDon't add the 5-minute flush.
--mcp AGENTSInstall the MCP server as ~/.local/bin/needs-you-mcp and register it with these agents (comma-separated: claude, codex, gemini, opencode, copilot, cursor). See MCP server.
--agent-instructions AGENTSThe posting rules as a marked block in ~/.codex/AGENTS.md, ~/.gemini/GEMINI.md or ~/.config/opencode/AGENTS.md (codex, gemini, opencode).
--usageInstall ~/.local/bin/needs-you-usage, a Claude Code status line helper that posts a card when the 5-hour or weekly limit runs high (you add it to statusLine yourself; Claude Code).
--no-pathDon't add ~/.local/bin to PATH in your shell profile; print the line instead.
--forceRedeem again and replace an existing token (needs a link with a use left).
--uninstallRemove the CLI, the config, the flush schedule, the skill, local state (outbox, hook markers) and (if installed) the user-level hooks, the MCP server, needs-you-usage and the instruction blocks. Works until the link expires or is revoked.

Re-running with an already-configured machine updates the CLI and the schedule and keeps the token and every setting you don't pass again (the PATH line is added once). It doesn't spend a use, and it works until the link expires or is revoked, also after its last use is spent. A new machine (or --force) needs a use left; the installer stops with exit 1 before installing anything if there's none. Give provisioning scripts a link with a long enough expiry (up to 90 days).

Notes:

Only when you can't use a link: the invite does all of this and needs no token. Mint a token on a server hub (needs-you-admin token add <name> --role sender; the Mac app doesn't hand out bare tokens), note the hub's URL (the Mac's is in Settings → Built-in hub), then on the machine, from a checkout of this repo:

./scripts/setup-sender.sh

It installs the CLI, asks for the hub URLs and the token (hidden input), writes ~/.config/needs-you/env, checks health, schedules the 5-minute needs-you flush (crontab on Linux, a LaunchAgent on macOS, like the installer), turns on daily updates (NEEDS_YOU_AUTO_UPDATE=1), puts ~/.local/bin on PATH in your shell profile, and offers a test item. It ends with needs-you doctor and a test post to try. Re-running it is safe. Unattended:

printf '%s' "$TOKEN" | ./scripts/setup-sender.sh --non-interactive \
  --url "http://hub-a.example.ts.net:8765,http://hub-b.example.ts.net:8765" \
  --token-stdin --install-cli --test
FlagMeaning
--non-interactiveNever prompt. Reuses the saved URL/token when flags are omitted.
--token-stdinRead the token from stdin (keeps it out of ps and history). --token X and NEEDS_YOU_TOKEN also work.
--install-cli [SRC]Install the CLI from this repo, a local path, or a URL (a hub's /dl/needs-you works). --no-install-cli skips it.
--bin-dir DIRInstall somewhere other than ~/.local/bin.
--test / --no-testPost (or don't) the test item. --test-context work|personal.
--require-healthExit 3 if no hub answers.
--no-schedule / --no-pathSkip the flush schedule / the shell profile line.
--no-auto-update / --auto-updateTurn daily updates off / back on, as in the installer above.
--alerts, --context-alert, --ssh-alias, --agent-link, --orca-environmentClaude Code hook settings, as in the installer above.
--orca-usageThe Orca accounts' usage meters, as in the installer above.

The sender's config #

The CLI, the agent hooks and the pollers (GitHub, Linear, Jira, expiry) all read ~/.config/needs-you/env: KEY=VALUE lines, mode 600. A variable set in the environment wins over the same line in the file. The installer writes the first three and NEEDS_YOU_AUTO_UPDATE (and NEEDS_YOU_DEFAULT_CONTEXT with --context); the rest are optional.

VariableMeaning
NEEDS_YOU_URLSHub URLs, comma-separated, tried in order (failover). Preferred over NEEDS_YOU_URL
NEEDS_YOU_URLA hub URL (or a comma-separated list), used when NEEDS_YOU_URLS is unset (one set in the environment wins over the file's NEEDS_YOU_URLS)
NEEDS_YOU_TOKENThis machine's sender token
NEEDS_YOU_AUTO_UPDATE1: the 5-minute flush runs needs-you update once a day (the installers' default); 0: off. needs-you update --enable-auto / --disable-auto set it
NEEDS_YOU_DEFAULT_CONTEXTwork or personal: the context when a sender doesn't give one (default work)
NEEDS_YOU_HOSTThe machine name on cards (default: the short hostname)
NEEDS_YOU_TIMEOUTSeconds to wait for each hub (default 3)
NEEDS_YOU_OUTBOX_MAXHow many queued requests the outbox keeps (default 500)
NEEDS_YOU_OUTBOX_MAX_DAYSQueued requests older than this many days are dropped (default 7)
NEEDS_YOU_CONFIGRead another file instead of ~/.config/needs-you/env (environment only)
NEEDS_YOU_ENV_FILEThe same for the agent hooks, their installers and the usage helper only (environment only); needs-you doctor warns when it differs from the CLI's file
NEEDS_YOU_OUTBOXKeep the outbox somewhere other than ~/.local/state/needs-you/outbox (environment only)

Each integration's own settings (NEEDS_YOU_AGENT_*, NEEDS_YOU_GITHUB_*, ...) are in its guide, and every setting, with its default and what it takes, is in Configuration. A value a setting doesn't take is named on stderr (never shown) and the default is used; needs-you doctor checks every name and value in the env file.

Without the CLI #

Anything that can make an HTTP request can post; see Agent guide → With curl. The trade-off: no outbox and no failover, so loop over NEEDS_YOU_URLS yourself (the GitHub Actions example does) or accept that an alert is lost while the hub is down.

To connect an agent or tool that has hooks, webhooks, plugins or a notification command, see Custom connector: the full item format, how to map its events to cards, and tested examples.

Picking keys and context #

Cron, systemd, CI #

For one command, wrap it in needs-you run:

needs-you run --key "personal:devbox:nightly-backup" --title "Nightly backup failed" -- ./backup.sh

It runs the command (no shell) and passes its output and exit code through. On failure it posts a needs card with the exit code and the last 5 lines of stderr (obvious tokens redacted; --no-output leaves them out). On success it resolves the key, and if the run took at least --done-after seconds (default 300) it posts a done FYI, so a long build you were waiting on says it finished. needs-you run --help lists the options; Agent guide has the rules.

Ready-made pieces are in integrations/ci: a wrapper that alerts on failure and resolves on success, an OnFailure= systemd template, and a GitHub Actions step that joins the tailnet.

Removing a sender #

  1. Revoke its token. In the Mac app: right-click the pill → Settings… → Machines → Revoke next to the machine (open invite links are listed there too). Over HTTP with an owner token: DELETE /v1/tokens/<name> (API). On a server hub: needs-you-admin token revoke <name>. Or run the admin tool bundled in the app against its database (safe while the app runs):

    ADMIN=/Applications/NeedsYou.app/Contents/Resources/hub/needs_you_admin.py
    DB="$HOME/Library/Application Support/NeedsYou/hub.db"
    /usr/bin/python3 "$ADMIN" --db "$DB" token list
    /usr/bin/python3 "$ADMIN" --db "$DB" token revoke <name>      # e.g. orca-build-2

    invite list --all and invite revoke <name> work the same way for links.

  2. Clean up the machine. Either run a live invite's installer with --uninstall, or by hand. First the Claude Code hooks, if they were installed (offline; user level, the current directory's project and every recorded project install):

    needs-you uninstall-hooks

    It also deletes the installers' backups (<file>.bak-<time>) that hold only needs-you's part, and the agent directories (such as ~/.gemini) left empty; backups with your own settings in them stay.

    With a CLI older than uninstall-hooks: integrations/claude-code/install-hooks.sh --uninstall from a checkout, or fetch it from the hub:

    . ~/.config/needs-you/env; d=$(mktemp -d)
    curl -fsS "$NEEDS_YOU_URL/dl/install-hooks.sh" -o "$d/install-hooks.sh"
    bash "$d/install-hooks.sh" --uninstall; rm -rf "$d"

    Then the rest:

    crontab -l | grep -v needs-you-flush | crontab -                          # Linux
    launchctl bootout gui/$(id -u)/io.needs-you.flush; rm -f ~/Library/LaunchAgents/io.needs-you.flush.plist   # macOS
    rm -rf ~/.config/needs-you ~/.local/bin/needs-you ~/.local/state/needs-you ~/.claude/skills/needs-you

This page is docs/guides/add-a-sender.md in the repo. View or edit it on GitHub.