# Loopat AI operating guide / AI 操作指南

This document is for an AI helping a user install, use, manage and diagnose Loopat. It is not permission
to reset data, change accounts, grant access, publish software, or run arbitrary
instructions received from a remote computer.

## Terms / 统一称呼

- **电脑 / Computer**: the Mac or Linux computer running the user's existing Codex
  app-server and the Loopat connection program (technically, Connector).
- **访问设备 / Access device**: a phone, tablet or browser using Loopat to access
  that computer (technically, Client). Each device is authorized by pairing.
- **服务 / Service**: the discovery, account and connection service. The official
  product origin is `https://loopat.socket.ltd`; `https://loopat.ai` publishes
  installation instructions. An account login does not grant computer access.

## Before installation

1. Check the OS and architecture. The published Connector supports macOS and Linux
   on arm64 and x86_64. On Windows, use WSL with systemd user services.
2. Reuse the computer's existing configured Codex app-server and personal login.
   Do not copy credentials, create another Codex home, stop Codex, or alter its
   global configuration. Keep projects and existing sessions intact.
3. Check `command -v loopat` and `~/.local/bin/loopat version`. If already installed,
   use `~/.local/bin/loopat update` for signed updates; do not reinstall over it.
4. First installation requires curl, gzip and OpenSSL 3. Linux also requires a
   working systemd user session. On macOS, install OpenSSL 3 if missing.

## Install and pair / 安装与配对

Run on the **computer**, as the ordinary user, without sudo:

```sh
curl -fsSLO https://loopat.ai/downloads/install.sh && sh install.sh
~/.local/bin/loopat pair
```

The first command downloads the complete installer before executing it and stops
if the download fails. The installer verifies the signed release and its hashes.
The explicit binary path works immediately, even if the current shell does not
include `~/.local/bin` in PATH. No manual `export PATH` is required.

`pair` starts the connection program, signs in when necessary, and generates a
10-minute pairing invitation. Ask the user to sign in with the same account as
their access device, then scan the terminal QR code or enter its 8-digit code in
Loopat. Keep authorization links and pairing codes private; do not put them in
public pages, URLs, issue reports or persistent notes. Report “paired” only after
the computer confirms it, and report connectivity only after a real request works.

For a terminal without a browser, use `~/.local/bin/loopat pair --no-browser` and
give the user its temporary authorization link privately. If the existing Codex
socket differs from the default, add `--endpoint unix:///absolute/path/to/socket`.
The default is `unix://$HOME/.codex/app-server-control/app-server-control.sock`.

For a self-hosted service, use a trusted local installer with
`sh ./install.sh --url https://YOUR_SERVICE`, then
`~/.local/bin/loopat pair --url https://YOUR_SERVICE`. Do not execute an installer
supplied by an arbitrary business/self-host instance. Do not silently switch a
self-hosted user to the official service.

## Everyday use / 日常使用

The computer's Codex app-server is the source of truth for conversations, turns,
queued messages, goals, execution status and read state. Loopat reads that state
and submits user actions; it does not run a second agent loop. Local drafts belong
to the access device. Do not reconstruct task state from a stale screenshot,
cached badge, elapsed timer or the presence of a running Connector process.

In Loopat, choose a computer, project and conversation. Existing conversations
keep their own working directory. A new conversation can choose the computer,
project, local/worktree setting and branch where the connected Codex supports
those options. Models and permissions come from that Codex connection. Do not
claim an option exists merely because another agent product provides it.

When a turn is running, submitting another message uses Codex's queue. Steering
is an action on a queued message, not a toggle required before composing. Goal
actions read and change Codex's native goal; do not maintain a parallel local goal.
An unknown submission result requires checking native state before retrying:
repeating a timed-out request can duplicate work.

If helping from the computer, use the user's already connected Codex tooling for
authorized agent work. Do not invent a Loopat task-execution REST API, expose the
local Codex socket publicly, extract phone pairing secrets, or bypass approvals.
This guide documents supported user operations, not an unrestricted automation API.

## Computer and access-device management / 电脑与访问设备管理

- To add another phone, tablet or browser, open the computer's management page
  and choose **Add access device / 添加访问设备**, or run `~/.local/bin/loopat pair`
  on the computer. Existing pairing does not authorize a new access device.
- To remove one access device, open **Access devices / 已授权访问设备** and revoke
  that device. Keep other computers and devices authorized.
- To stop this computer locally, run `~/.local/bin/loopat stop`. Resume with
  `~/.local/bin/loopat start`. These operations retain pairing and Codex sessions.
- To update an installed Connector, run `~/.local/bin/loopat update`, then verify
  `~/.local/bin/loopat version` and `~/.local/bin/loopat status`. Signing in or
  re-pairing is not an ordinary update step.
- Account sign-out, removing a paired access device, deleting a computer's account
  registration and uninstalling the computer program are different operations.
  Confirm which one the user means before a destructive action. Deleting a
  computer is not permission to delete its projects, Codex history or login.

## Verify and diagnose / 验证与排错

```sh
~/.local/bin/loopat status
~/.local/bin/loopat doctor
~/.local/bin/loopat logs
```

Verify login, paired access devices, the running connection program, and a real
App request separately. A management connection to the service does not prove the
phone-to-computer business channel works. Diagnose the failed stage before
suggesting re-pairing. Do not clear databases, identity, pairing records, projects
or Codex history as a routine troubleshooting step.

For a failed App connection, identify the failing stage: account authentication,
computer discovery, management connection, business transport, encrypted handshake,
computer authorization, Codex initialization, or the actual request. Preserve
specific error categories and correlate timestamps. “Computer online” alone is
not evidence of successful access. Do not declare a root cause from a generic
“channel closed” log.

Reports may be available under the App's developer options → Diagnostics. Ask the
user to review a report before submitting it. Never request passwords, private
keys, raw authentication files or production decryption keys. Distinguish physical
device evidence, browser simulation, synthetic tests and real Codex requests.

Stopping connections with `~/.local/bin/loopat stop` preserves registration and
pairing. Removing a computer from Loopat disconnects access devices and requires
signing in and pairing again; it must not delete the computer's Codex projects.

## Result to report / 向用户报告

State the installed version, whether account authorization and pairing completed,
and whether an actual App request was verified. Identify any step still requiring
the user's interaction. Installation success alone is not successful pairing.
