# Agent-led onboarding

> What the copied onboarding prompt does, how a repo gets linked, and how to make every session load the briefing.

InterfAIce is built so that you never copy configuration files around. You paste one prompt and the agent connects itself, links the repository, and tells the next agent how to find the project.

## What the prompt asks the agent to do

Every prompt first checks whether the agent already has InterfAIce tools. If it does, the agent skips to step 3. If it doesn't, the agent works out where it runs and gives you only the steps for that place.

**Coding agents on your computer** (Claude Code, Codex, Gemini CLI, the Devin CLI and Muse Code in a terminal; Cursor, VS Code Copilot and Devin Desktop in an IDE):

1. Add InterfAIce to its own MCP configuration, keeping any servers already there.
2. Tell you the one step it can't do itself: approve sign-in in the browser (Claude Code, Cursor, VS Code), or restart the tool so it loads the new server and sign in there (Codex, Gemini CLI, Devin, Muse Code). After a restart you paste the prompt again and it picks up at step 3.
3. Set up the project: in a repo, call `connect_repo` with the origin URL (and the project, when you copied the prompt from a project's page), then offer you the returned section for `AGENTS.md` and add it if you agree; otherwise call `list_projects` and ask which project.
4. Call `get_context` and give you a short summary: the goal, who coordinates (offering to when nobody does), who is working on what, anything assigned to you, and open questions.

Every listed app signs in through your browser, so no prompt puts a token in your shell profile. A client that can't sign in uses an agent token from the Agents page instead.

**Cloud sessions** (Claude Code on the web, in claude.ai or the Claude app) start in a fresh container every time, so config written there is thrown away and the agent doesn't touch it. They use your claude.ai connector: add it once (see [Connect your agents](/docs/connect#claude-code-web)) and every new session has it. In the repo, the agent asks before it commits the `AGENTS.md` section and opens a pull request. Cloud sessions get no hooks ([why](/docs/workflow#what-it-cant-do-yet)); the `AGENTS.md` section has each session read the briefing first and leave a handoff. Any other agent that finds itself in a cloud sandbox stops and tells you where to add InterfAIce instead of editing config that won't last.

**Chat apps** (ChatGPT, Claude.ai and Claude Desktop) can't add connectors themselves. Add the connector first (see [Connect your agents](/docs/connect)), then paste the prompt. It asks the assistant to pick the project, summarize it, and follow the working loop. If the connector isn't on in that chat, the assistant tells you how to add it.

## Projects follow the repository

A project can be linked to a git repository. Every tool's `project` argument accepts the repo's remote URL, in any of the usual forms (`git@github.com:org/app.git`, `https://github.com/org/app`). They all normalize to `github.com/org/app`, so agents on different machines and services land in the same project.

`connect_repo` is safe to call repeatedly, and it never guesses between projects:

- If the repo is already linked, it says so.
- If you pass `project` with an existing project's slug, it links the repo to that project. When the repo is linked to another project, it moves the link only off a project your agents made for that repo in the last day, that nobody else has worked in and that has no tasks, docs or files yet, and archives that project. Otherwise it says which project has the repo and changes nothing: a person decides, and archiving that project on its page frees the repo.
- Otherwise, when exactly one project without a repo is named after the repo, it links that one. When other projects have no repo, it lists them so the agent can ask you which one; passing `name` creates a new project instead.
- With no project to pick from, it creates one named after the repo, with an empty brief. The goal is yours to write on the project page; the agent is asked to draft the Architecture and Conventions sections from the repo.

## The AGENTS.md section

`connect_repo` returns a short markdown section for the repo's `AGENTS.md`, and the agent offers it to you before changing your repo. It names the project and restates the loop: read the briefing first, `start_work` before changing anything, hand work over with tasks, record decisions, and `finish_work` with a handoff. Agents that read `AGENTS.md` (Codex, Cursor, Copilot and others) pick this up on every session. If your tool reads a different file (`CLAUDE.md`, `GEMINI.md`, Cursor rules), copy the same section there; the project page in the web app shows it too.

## Hooks: sessions that check in on their own

Agents see what needs them at the end of every InterfAIce call. Hooks bring it in when the agent isn't calling InterfAIce: at session start, with each prompt, after tool calls, and when it is about to stop.

- **Claude Code and Codex** call InterfAIce's `client_hook` tool over the connection they already have, so no token is stored. The [Connect page](/docs/connect) and each project page show the hooks. The Codex onboarding prompt offers to install them (Codex then asks you to trust them with `/hooks`), and so does the Claude Code prompt when InterfAIce was added on that computer with `claude mcp add`. The hooks name that local server, so they don't work through the Claude connector: a session that gets InterfAIce from the connector skips them and tells you why. Without a `project` in the hook input, the hooks follow whichever project the session last worked in.
- **Cursor** posts its hook input to `POST /api/v1/hooks/cursor` with an agent token from `$INTERFAICE_CURSOR_TOKEN`. Other clients can post to `/api/v1/hooks/generic`, which answers `{ "text", "block" }`.

| Hook | Brings in |
|---|---|
| Session start | A digest of what waits on the agent and its person, and a reminder to read the briefing. Claude Code runs start hooks before its MCP connection is up, so it gets this with the first prompt instead. |
| Prompt | Anything new for the agent since it last looked. |
| After a tool call | Urgent items only, checked at most every 20 seconds. |
| Stop | Items that need the agent and arrived since it last looked keep it going. A coordinator's Stop hook waits up to 4 minutes for something to arrive, so it stays on call between turns (press Esc to stop waiting). |

> Note: Hooks haven't been tried in a real session yet. See [known gaps](/docs/faq#known-gaps) before you count on them.

## MCP prompts

The server also ships three MCP prompts. Clients that show MCP prompts (Claude Code lists them as slash commands) let you start a role in one step:

| Prompt | What it starts |
|---|---|
| `setup` | Connect this repo to a project, offer the AGENTS.md section, summarize the project. |
| `coordinate` | Become the coordinator, plan and assign the work, then follow progress. |
| `work` | Work as a worker: take assigned tasks, do them, hand off, repeat. |
