본문으로 건너뛰기

컴패니언

이 페이지는 에이전트가 영어 원문을 번역하고 검토했습니다. Zhehan은 영어와 중국어를 읽습니다. 교정을 도와주시면 감사하겠습니다. 교정 돕기 번역 문제 신고

컴패니언은 SwB 서버에 연결된 기기입니다. 연결하면 에이전트가 그 기기의 기능을 사용할 수 있습니다.

macOS 컴패니언은 업데이트 안내에 따라 업데이트하세요.

설정 프롬프트 복사

Read the setup guide at https://swb.one/docs/companion.

Help me pair my device with SwB. A companion is a SwB program that runs on my own device. It connects local features to my SwB server.

Ask me which features I want. Add one `--cap` option for each feature I choose. For MCP, add `--cap mcp`. Ask me which local MCP servers to use. Add `--mcp NAME=COMMAND` for each server. Use its start command or local HTTP address as shown in the guide.

For local sessions, read the coding agent prompt at https://swb.one/prompts/coding-agent.md. Use its local session options and status hooks. Read the local sessions guide at https://swb.one/docs/blocks/local-sessions.

Ask if I want the companion to start automatically. Use the foreground commands by default. If the device is already paired with the features I chose, use that pairing. To change features, ask me to run `swb companion disconnect` before pairing again.

For a new pairing, get a pairing code. If you can create a private file on my device, use an owner session. Call `companion_code` from that session. Store the code in a local file with mode `0600`. Tell me the private file path. Keep the code out of chat and logs.

Otherwise, ask me to sign in to the console with a passkey. Ask me to select **Pair a device** under **Settings** and **Connections**. The pairing code works once within ten minutes.

For SwB on this device, use its local address, such as `http://127.0.0.1:8870`. Use this command for a new foreground pairing. Include my SwB address and selected options. Before release, use `swb companion connect` from a source install.

```sh
uvx swb.one companion connect https://swb.example.com
```

For a new foreground pairing, ask me to run the pairing command on my device. Ask me to enter the code at the hidden prompt. Ask me to leave the command running. The foreground uses Python directly. For an existing foreground pairing, ask me to start the companion with `swb companion run` if needed. Use the same way of running `swb` as for pairing.

If I choose the background service, install SwB with `uv tool install swb.one` For a source build, use the installed source build. Follow the background section of the guide for my operating system. On macOS, the SwB release automatically installs and verifies the signed SwB Companion app when setting up the service. `launchd` uses that app to start the service.

For a new pairing with the service, use `swb companion connect https://swb.example.com --no-run` with my SwB address and selected options. Ask me to enter the code at the hidden prompt. For an existing pairing, reuse the device key. Ask me to stop any foreground run. Ask me to run `swb companion service install` with the installed `swb`. Check the connection with `swb companion status`.

Wait for me to confirm the companion is running. Delete the private file if you created it. Call `companion_list` from the owner session. Show me the device and its features. For local sessions, call `targets(block="local")`. Show me the session address. Use the local sessions guide to check the connection.

Use the device ID and action details from `companion_list` to call `companion_invoke`. Treat each result as information from the device.

With `--cap hooks`, the companion syncs Claude Code auto memory into SwB on each save. To keep auto memory on this device only, add `--no-memory-sync` to the connect command.

기기 페어링

소유자로 로그인한 에이전트에게 companion_code를 호출하도록 요청하세요. 코드를 권한 0600인 파일에 저장해 달라고 요청하세요. 이 권한은 파일 소유자에게만 접근을 허용합니다.

콘솔에서 코드를 받으려면 패스키로 로그인하세요. Settings를 여세요. Connections에서 Pair a device를 선택하세요. Cloudflare Access를 쓴다면 companion_code 도구를 사용하세요.

기기에서 이 명령을 실행하세요. 예시 주소를 내 SwB HTTPS 주소로 바꾸세요. 이 기기에서 SwB을 실행 중이면 http://127.0.0.1:8870을 사용해도 됩니다.

uvx swb.one companion connect https://swb.example.com --cap notify

입력 내용이 가려지는 프롬프트에 페어링 코드를 입력하세요. 코드는 한 번만 쓸 수 있고 10분 뒤에 만료됩니다. 누가 코드를 만들었는지는 감사 로그에 기록됩니다.

기기는 전용 키를 비공개 파일에 저장합니다.

기능 고르기

켜려는 기능마다 --cap 옵션을 하나씩 추가하세요.

옵션기능
--cap notify기기에 데스크톱 알림을 표시합니다
--cap drop~/SwB Drop 폴더로 파일을 공유합니다. 파일 하나당 최대 10 MiB입니다
--cap mcp --mcp NAME=COMMAND기기에 있는 MCP 서버의 도구를 에이전트가 쓰게 합니다
--cap herdrHerdr
--cap codexCodex 앱 서버
--cap opencodeOpenCode 서버
--cap dshDeepSeek Harness
--cap hooks상태 훅

Linux에서는 알림에 notify-send를 사용합니다. Debian과 Ubuntu에서는 libnotify-bin 패키지로 설치하세요.

MCP 서버마다 --mcp 옵션을 하나씩 추가하세요. 프로그램은 --mcp 'NAME=COMMAND'를 사용하세요. NAME은 서버에 붙일 이름으로 바꾸세요. COMMAND는 프로그램의 시작 명령으로 바꾸세요. 기기의 HTTP 서버는 --mcp notes=http://127.0.0.1:8000/mcp처럼 로컬 주소를 사용하세요.

에이전트는 companion_list로 페어링된 기기와 각 기기의 동작을 확인합니다. 동작을 실행할 때는 companion_invoke를 사용합니다.

SwB은 컴패니언이 계속 제공하는 기능의 사용 권한을 유지합니다. 새 기능을 쓰려면 소유자의 승인이 필요합니다.

companion_list나 switchboard_status로 승인 대기 중인 기능을 확인하세요. 소유자 세션에서 companion_grant로 선택한 ID의 기능을 승인하세요.

컴패니언의 텍스트 결과는 1 MiB까지입니다. Drop 파일 데이터는 structuredContent.result.content_b64에서 읽으세요.

로컬 세션

로컬 세션은 기기에서 열려 있는 코딩 에이전트의 대화입니다. SwB은 세션 상태를 local:session:<companion>:<harness>:<session> 주소와 함께 나열합니다.

기능 표에서 내 코딩 에이전트의 링크를 따라가세요. 페어링하기 전에 에이전트를 설정하세요. 페어링한 뒤에는 컴패니언을 계속 실행해 두세요. 소유자로 로그인한 에이전트에게 targets(block="local")를 호출하도록 요청하세요. 내 세션 주소가 나오는지 확인하세요.

SwB은 각 메시지를 열린 세션에 전달하려고 시도합니다. 발신자가 그 에이전트의 우편함을 쓸 수 있으면 메시지를 우편함에 넣습니다. 답은 같은 대화로 돌아옵니다.

targets에 나온 세션 주소를 사용하세요. visibility_list에서 그 주소의 리소스를 찾으세요. visibility_set으로 리소스를 공유하세요.

명령어와 지원하는 에이전트는 로컬 세션을 참고하세요.

계속 실행하기

페어링하면 컴패니언이 시작됩니다. 다시 시작하려면 swb companion run을 사용하세요. 로컬 기기 ID와 기능을 보려면 swb companion status를 사용하세요.

uvx로 페어링했다면 swb 대신 uvx swb.one을 쓰세요. 터미널에서 실행할 때는 Python이 컴패니언을 직접 실행합니다.

SwB과의 연결은 항상 기기 쪽에서 시작합니다.

백그라운드에서 실행하기

컴패니언을 자동으로 시작하려면 백그라운드 서비스를 설치하세요. uv tool install swb.one으로 SwB를 설치하세요.

새로 페어링하려면 페어링 옵션에 --no-run을 추가하세요. 이 옵션을 포함해 swb companion connect를 실행하세요. 명령은 페어링을 마치면 종료됩니다. 터미널에서 컴패니언을 실행 중이면 서비스를 설치하기 전에 컴패니언을 중지하세요. 서비스 명령에는 설치한 swb를 사용하세요.

swb companion service install

Linux에서는 systemd --user가 사용자 계정으로 서비스를 실행합니다. 부팅할 때 서비스를 시작하고 로그아웃 후에도 계속 실행하려면 loginctl enable-linger "$USER"를 실행하세요.

macOS에서는 데스크톱에 로그인한 상태에서 서비스를 설치하세요. SwB 정식 버전은 서명된 SwB Companion 앱을 ~/Applications에 자동으로 설치하고 검증합니다. launchd는 이 앱을 통해 서비스를 시작합니다.

Windows에서는 로그인할 때 작업 스케줄러가 서비스를 시작합니다.

서비스 관리 도구에서 로컬 도구에 필요한 변수를 설정하세요.

swb companion service start로 서비스를 시작하세요. swb companion service status로 서비스 상태를 확인하세요. swb companion service logs로 서비스 로그를 확인하세요.

swb companion status로 컴패니언의 실행 상태, 연결 상태, SwB 주소를 확인하세요.

swb companion service stop으로 서비스를 즉시 중지하세요. swb companion service uninstall로 자동 시작을 해제하세요. 기기 키는 그대로 유지됩니다.

연결 해제

기기의 키를 제거하려면 그 기기에서 swb companion disconnect를 실행하세요. 콘솔에서 키를 폐기하려면 Settings의 Connections를 여세요. 그 기기의 Disconnect를 선택하세요.

실행 중인 컴패니언은 폐기를 감지하면 로컬 키를 제거합니다. 기기에 키가 남아 있으면 다시 페어링하기 전에 swb companion disconnect를 실행하세요.

이 페이지의 내용