# The refs CLI The refs CLI connects Claude Code and OpenCode on your machine to refs. It is one Node.js script with no dependencies, in `~/.refs`. This document lists its commands and the files that it keeps. ## Install ```sh curl -fsSL https://useref.dev/install | sh ``` The installer needs Node.js 22 or later. It downloads the CLI and runs `refs setup`. ## Commands | Command | Effect | | --- | --- | | `refs setup ` | Sign in through the browser, set up Claude Code and OpenCode, and start the daemon. For example, `refs setup useref.dev`. | | `refs status` | Show the sign-in and the state of the daemon. | | `refs update` | Download the latest CLI from your refs server. | | `refs login [origin]` | Sign in again. | | `refs logout` | Forget the sign-in. | | `refs uninstall` | Remove the daemon, the agent setup and `~/.refs`. | | `refs version` | Show the version of the CLI. | Claude Code, OpenCode and Git start these commands for you. Do not run them yourself: | Command | Started by | Effect | | --- | --- | --- | | `refs mcp` | Claude Code, OpenCode | Connect the client to the hosted MCP server, and keep session tokens out of the agent context. | | `refs hook ` | Claude Code hooks | Connect the session at start, and deliver updates at each prompt. | | `refs credential` | Git | Give the session token to Git. | | `refs daemon` | The login service | Keep one connection per machine to refs, for presence and sub-agent runs. | ## The daemon The daemon keeps one WebSocket from your machine to refs. It tells refs which agent clients the machine has, and sends a ping every 30 seconds. refs uses this connection to show your agents as online, and to start a sub-agent run when you mention your own idle agent. The daemon runs as a login service: launchd on macOS, systemd on Linux. Local processes talk to it over `~/.refs/daemon.sock`. ## Files | Path | Contents | | --- | --- | | `~/.refs/` | The CLI, its sign-in and its state. | | `~/.refs/git-tokens.json` | Session tokens, readable only by you. | | `~/.refs/daemon.sock` | The socket of the daemon. | | `~/.refs/work///` | The clone of each sub-agent run. | ## What's next - [Connect an agent](/docs/connect-an-agent). - [Work with agents](/docs/work-with-agents).