# Check the MassifyAI connection, then continue the original task

This check is for the coding agent receiving a tutorial prompt. Keep that original prompt as the pending task. Reading this file is guidance, not proof of a connection or permission to change accounts, install software, read private history, or modify shared resources.

## 1. Reuse a verified connection from this chat when possible

Before calling whoami, inspect the active chat's recent tool evidence. Reuse a successful MassifyAI whoami result already verified in this uninterrupted chat when its account, organization, project and environment match the pending task and the connection has not changed. Continue the tutorial without another whoami call or setup narration.

Routine wording in a copied tutorial such as “confirm the project” or “call whoami” can use that existing verified result. It does not demand a fresh call at every step. A user's explicit request to recheck the connection still takes precedence.

Report the verified account, organization and project at most once during the current conversation while that scope stays unchanged. Check whether that confirmation has already been shown before writing a connection-status message. If it has, continue directly with the tutorial's useful work; do not repeat “The connection is confirmed as …” or replace it with “still connected”, “already verified” or another routine acknowledgment. This applies to every later prompt template and ready-to-use example, even when its wording asks to confirm the workspace. A necessary fresh whoami call does not itself require another announcement if the returned scope is unchanged. Report a changed scope or an actual connection problem when relevant, and answer an explicit user request for connection details.

This is a chat-context check, not a website cookie or a browser sign-in check. An unsupported statement such as “we connected earlier”, a pasted example response, or merely seeing tool names is not verified tool evidence. If the result has been lost or its age/scope is uncertain after a long gap or context reset, verify once. Do not run a timer or poll whoami between tutorial steps.

Invalidate the remembered check after an account/project/server/environment change, reconnect, sign-out, client restart, missing tools, or an authentication/access error. Also verify again when the user explicitly asks. A new chat needs its own successful check. Before a consequential write, verify the resource's current destination, owner and version; this does not require repeating whoami when the session scope is already established and unchanged.

## 2. Check the actual tools and workspace only when verification is needed

- Look for MassifyAI's MCP whoami tool; the server prefix can vary. If available, call it. Do not substitute a guessed shell command, a screenshot, or an invented response.
- A ready connection requires a successful response identifying the account, organization and active project. Compare actual IDs/names with any workspace explicitly requested in the current chat, and the environment of these instructions (https://www.massifyai.com). Use returned endpoint information where supplied; a display name alone does not establish an environment.
- If the user has already confirmed that workspace during the active conversation, reuse the confirmation. Report the returned scope briefly only if it has not already been shown during the current conversation or has changed. For a read-only practice task with no named destination, the current project can be used after that first report. Before writing, establish the intended destination from the original request and existing approvals; ask only if it remains ambiguous.
- If the account, environment or project differs from the requested one, explain the mismatch. Use supported project selection only for the explicitly chosen destination and within existing authorization. Preserve other routes and shared defaults. Do not run installation or fresh authentication merely because the current project differs.
- If the response has no active project, guide selection of a permitted project and repeat whoami before continuing. Do not guess a project ID.

## 3. Recover only when needed

- If whoami succeeds in the intended workspace, skip setup and continue the original prompt immediately. Do not reinstall, reconnect, launch history mining or create an onboarding task.
- Missing tools or a failed call do not establish that the plugin is absent. First distinguish installation state using the client's supported plugin/CLI status or configured MCP-server listing, or clear installation evidence already available in the active conversation. Inspect status only; do not read credential/configuration secrets. If that evidence is unavailable, ask the user whether MassifyAI is installed or shown in their MCP controls instead of guessing.

| Situation | Next action |
| --- | --- |
| Plugin/CLI is confirmed not installed | Fetch and read [the canonical one-prompt setup](https://www.massifyai.com/docs-assets/setup/one-prompt-setup.md) now: it holds the install commands and sign-in steps for each client. Use only the actual client's section in tutorial-recovery mode. Do not stop here or send the user to the docs site instead; this page gives no commands on purpose, that page does. Explain installation and browser authorization, obtain any needed permission, skip optional first-win/history steps, then return to the original task. |
| Plugin/CLI or configured MassifyAI server already exists, but MCP tools disappeared or an established connection became stale | Ask the user to reconnect the existing MassifyAI MCP connection using their client's supported controls, then reply “go”. Do not run the one-prompt installation flow, add a duplicate server, or reinstall the plugin. |
| Existing connection requires authentication again | Guide Authenticate/sign-in for that existing server through the supported client controls. This is reauthentication, not a new installation. |
| Installation state is unknown | Inspect the supported listing or ask for that one missing fact. Do not assume either “not installed” or “stale” from a failed whoami alone. |

For Claude Code, ask the user to open `/mcp`, select MassifyAI and choose Reconnect (or Authenticate when required), then reply “go”. For Codex, use the available client MCP reconnect/authentication controls. If that client cannot refresh tools in the active chat, guide the supported restart/reload; for CLI use, resume the same conversation with `codex resume --last`. Never invent a reconnect command or treat a client restart as permission to install anything.

- If whoami fails because of a network error, timeout, service outage, policy restriction, or missing permission, report that actual failure. A failed request does not prove the plugin is absent. Retry at most once when appropriate; otherwise use [Troubleshooting](https://www.massifyai.com/docs/reference/troubleshooting). Do not repeatedly reinstall or switch accounts.
- After a reload or sign-in, call whoami again. A browser authorization or CLI success alone is not a passing connection check. If the agent must restart, keep a concise continuation note with the original prompt and required next check, without credentials.

## 4. Resume without changing the task

Once verified, return to the original tutorial prompt using its specified skills, example inputs and limits. Do not declare a skill loaded or a resource saved without the actual result. Retain any approval boundary in that prompt. For later prompts in the same verified chat, avoid repeated setup narration; recheck when scope changes, the connection fails, or a consequential write needs fresh destination verification.

Only if this page or the one-prompt setup page cannot be retrieved, give the user [Connect with one prompt](https://www.massifyai.com/docs/getting-started/connect-with-one-prompt) as the next action. When they can be retrieved, the recovery table above is the next action, not that guide. Keep the MassifyAI-dependent step pending; do not pretend it ran. Unrelated local work may continue if authorized.
