> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gleap.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Your own coding agent

> Fix and answer Gleap tickets in Claude Code, Codex or any MCP client, with the plan, screenshots, pages and a next-step card visible in Gleap.

**Open in Claude Code**, **Open in Codex** and **Open in Cursor** on a ticket hand the task to the coding app on your machine (see [Tickets and pull requests](/documentation/kai-code/tickets-and-pull-requests#hand-over-to-your-coding-app)). The app works through the Gleap MCP server and reports back to a **coding session** on the ticket, the same session view Kai Code's own runs use: the live plan, screenshots and pages the agent shares, the pull request, and a next-step card at the end of each turn.

## Set up

<Tabs>
  <Tab title="Claude Code">
    The Gleap plugin is the recommended setup. It adds the Gleap MCP server, the `fix-ticket` and `answer-ticket` skills, and hooks that keep the session's plan and recap in sync:

    ```bash theme={null}
    claude plugin marketplace add GleapSDK/gleap-claude-plugin
    claude plugin install gleap@gleap
    ```

    Workspaces hosted in the US install `gleap-us@gleap` instead. Install one of the two, not both. On Claude Code 2.1.275 or later, `/plugin install gleap --marketplace GleapSDK/gleap-claude-plugin` inside a session does both steps.

    Start a new session, open `/mcp`, select the `gleap` server and choose **Authenticate** to sign in with Gleap and pick the project.
  </Tab>

  <Tab title="Codex">
    The same plugin works in Codex:

    ```bash theme={null}
    codex plugin marketplace add GleapSDK/gleap-claude-plugin
    codex plugin add gleap@gleap
    ```

    US workspaces add `gleap-us@gleap`. In the ChatGPT desktop app, the link `codex://plugins/install/gleap?marketplace=gleap` opens the install once the marketplace is added. Start a new session, then run `/hooks` and trust the three Gleap hooks: Codex runs plugin hooks only after you trust them. Run `codex mcp login gleap` if Codex doesn't ask you to sign in.
  </Tab>

  <Tab title="MCP only">
    Without the plugin, add the Gleap MCP server for your region and sign in with Gleap (OAuth):

    | Data region | MCP server URL |
    | - | - |
    | EU (default) | `https://mcp.gleap.io/mcp` |
    | US | `https://mcp.us.gleap.ai/mcp` |

    ```bash theme={null}
    claude mcp add --scope user --transport http gleap https://mcp.gleap.io/mcp
    codex mcp add gleap --url https://mcp.gleap.io/mcp
    ```

    Everything below works the same; only the plan mirroring and the automatic recap need the plugin's hooks.
  </Tab>
</Tabs>

The workflow the agent follows also covers setup: when the Gleap tools are missing, the agent installs the plugin (or adds the MCP server) itself and tells you which command restarts the session.

## Start a ticket

* **From Gleap**: **Open in …** on the ticket. The kickoff names the ticket, the repository and the session ("tracked as Gleap coding session …").
* **From the agent**: ask for it ("fix Gleap ticket #1234"), run the plugin skill (`/gleap:fix-ticket 1234`, `/gleap:answer-ticket 1234`; with the US plugin `/gleap-us:fix-ticket 1234`, `/gleap-us:answer-ticket 1234`), or use the MCP prompts below. Without a session id the agent passes `ticketId` and Gleap continues the ticket's open session or starts one for you.

Either way, the first call is `report_progress` with phase `investigating`, then `get_agent_workflow` for the instructions: how to investigate, branch, open the pull request and write the customer messages under this project's rules.

### MCP prompts

| Prompt | Argument | What it does |
| - | - | - |
| `fix_ticket` | `ticket`: `#number` or 24-char id | Starts the fix workflow (the feature workflow for a feature request) with a summary of the ticket. |
| `answer_ticket` | `ticket` | Starts the investigate-and-answer workflow: no code changes, the reply is drafted in the ticket composer. |

Most MCP clients list prompts as slash commands; type `/` and search for `fix_ticket`.

## Session tools

These Gleap MCP tools address the session the same way as `report_progress`: `sessionId` from the kickoff or a previous result, or `ticketId` when there is none. Each result names the session id to use next.

| Tool | What it does |
| - | - |
| `report_progress` | Phase changes: `investigating`, `reproduced`, `fixing`, `blocked`, `pr_opened` (with `prUrl` and the customer messages), `done`. See [Reporting from your own tools](/documentation/kai-code/tickets-and-pull-requests#reporting-from-your-own-tools). |
| `get_agent_workflow` | The workflow as Markdown for `kind` `fix`, `answer` or `feature`. The same text is published at `https://gleap.io/agent-setup/`. |
| `update_plan` | The whole plan in order, `items: [{ content, status }]` with status `pending`, `in_progress`, `completed` or `cancelled`, plus an optional one-line `explanation`. Each call replaces the list shown on the session. |
| `share_screenshot` | Posts a screenshot into the session with a one-line `caption` and an optional `label`. Pass `path` (and `compare_with` for a before shot, shown as before/after); the result returns one `curl` upload command per file, valid for 15 minutes, which the agent runs. Agents without a shell pass `imageBase64` instead. PNG, JPEG, WebP or GIF. |
| `publish_artifact` | Publishes one self-contained HTML page (at most 1 MB) into the session: reports, root-cause write-ups, mockups. Returns the dashboard link; pass the `artifactId` to publish a new version. |
| `wrap_up` | The next-step card at the end of a turn: a `recap` (what is now true, what is not done or not verified), at most one `ask`, and up to two `actions`, the recommended one first. |
| `get_ticket_screenshot` | The screenshot the Gleap SDK captured with the ticket, as an image (up to 2 MB). |

### Wrap-up actions

Each action has a `label` (1 to 3 words) and an `action`:

| `action` | Available when | In Gleap |
| - | - | - |
| `open_pr` | the session has an open pull request | Opens it. |
| `review_changes` | the session has an open pull request | Opens the changes. |
| `merge_pr` | a GitHub pull request, the project's **Merge from Gleap** switch is on, and the pull request is mergeable with no failing checks | Merges it; only the session owner or a project admin. Pull requests on other providers are merged there. |
| `open_preview` | a preview is running | Opens the preview. |
| `send_customer_update` | the session is linked to a ticket; pass the draft as `message` | Puts the draft in the ticket composer. Gleap never sends it on its own. |

A local agent can't receive a button click as a message, so its actions always name an `action`. Anything else you answer in the agent's chat.

### What `report_progress` returns

Besides the confirmation, the project's customer-message rules and the session id, every result carries two fields for the agent:

| Field | Meaning |
| - | - |
| `stop` | `true` when someone stopped the session in Gleap. The agent stops working, wraps up and tells you. |
| `hook` | `{ sessionId, token, apiBase, expiresAt }`: the session file for the plugin's hooks. The agent writes it to `.gleap/session.json` at the repository root and adds `.gleap/` to `.git/info/exclude`. The token is valid for 48 hours and only for this session's plan and wrap-up. |

`get_agent_workflow` returns the same `hook` block, and the other session tools return `stop` and `hook` when they apply.

## Blocked means waiting on you

When the agent reports `blocked`, it needs something from you: a decision, an account detail, an access it lacks. The session shows as **Waiting on you in Claude Code** (or the app's name) with the agent's question. It stays that way and does not expire like a session that went silent; answer in the agent's chat, and its next report (`investigating`, `fixing` and so on) picks the session back up.

## What the plugin's hooks send

The hooks run only in a folder that has a `.gleap/session.json`, which the agent writes for sessions started from or reported to Gleap. Then:

| When | Sent to Gleap |
| - | - |
| The agent updates its own plan (Claude Code's task or todo tool, Codex's plan tool) | The plan items: text and status. |
| A turn ends | The agent's last message, at most 4,000 characters. Gleap uses it as the turn's recap when the agent didn't call `wrap_up`; the agent's own wrap-up always wins. |
| A session starts or resumes | Only that the agent is still there. |

Nothing else leaves your machine through the hooks: no code, files, tool output or transcript. The hook script sends only to Gleap hosts, gives up after 2 seconds, and never blocks or fails the agent. Delete `.gleap/` in a repository to stop the hooks there; uninstall the plugin (`claude plugin uninstall gleap@gleap`, `codex plugin remove gleap@gleap`) to stop them everywhere.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.