---
title: "Your own coding agent"
description: "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."
url: https://docs.gleap.ai/en/articles/692-your-own-coding-agent
collection: "Kai Code"
updated: 2026-11-01
language: en
---

# 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](https://gleap-developer-docs.gleap.help/en/articles/691-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

**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
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 your projects (see [Choose your projects](https://gleap-developer-docs.gleap.help/en/articles/712-connect-the-gleap-mcp#choose-your-projects)).

**Codex**

The same plugin works in Codex:

```bash
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.

**MCP only**

Without the plugin, add the Gleap MCP server for your region and sign in with Gleap (OAuth):

<table style="min-width: 50px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p>Data region</p></th><th colspan="1" rowspan="1"><p>MCP server URL</p></th></tr><tr><td colspan="1" rowspan="1"><p>EU (default)</p></td><td colspan="1" rowspan="1"><p><code>https://mcp.gleap.ai/mcp</code></p></td></tr><tr><td colspan="1" rowspan="1"><p>US</p></td><td colspan="1" rowspan="1"><p><code>https://mcp.us.gleap.ai/mcp</code></p></td></tr></tbody></table>

```bash
claude mcp add --scope user --transport http gleap https://mcp.gleap.ai/mcp
codex mcp add gleap --url https://mcp.gleap.ai/mcp
```

Everything below works the same; only the plan mirroring and the automatic recap need the plugin's hooks.

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

<table style="min-width: 75px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p>Prompt</p></th><th colspan="1" rowspan="1"><p>Argument</p></th><th colspan="1" rowspan="1"><p>What it does</p></th></tr><tr><td colspan="1" rowspan="1"><p><code>fix_ticket</code></p></td><td colspan="1" rowspan="1"><p><code>ticket</code>: <code>#number</code> or 24-char id</p></td><td colspan="1" rowspan="1"><p>Starts the fix workflow (the feature workflow for a feature request) with a summary of the ticket.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>answer_ticket</code></p></td><td colspan="1" rowspan="1"><p><code>ticket</code></p></td><td colspan="1" rowspan="1"><p>Starts the investigate-and-answer workflow: no code changes, the reply is drafted in the ticket composer.</p></td></tr></tbody></table>

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.

<table style="min-width: 50px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p>Tool</p></th><th colspan="1" rowspan="1"><p>What it does</p></th></tr><tr><td colspan="1" rowspan="1"><p><code>report_progress</code></p></td><td colspan="1" rowspan="1"><p>Phase changes: <code>investigating</code>, <code>reproduced</code>, <code>fixing</code>, <code>blocked</code>, <code>pr_opened</code> (with <code>prUrl</code> and the customer messages), <code>done</code>. See <a target="_blank" rel="noopener noreferrer nofollow" class="linktype-link link" data-linktype="link" href="https://gleap-developer-docs.gleap.help/en/articles/691-tickets-and-pull-requests#reporting-from-your-own-tools">Reporting from your own tools</a>.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>get_agent_workflow</code></p></td><td colspan="1" rowspan="1"><p>The workflow as Markdown for <code>kind</code> <code>fix</code>, <code>answer</code> or <code>feature</code>. The same text is published at <code>https://gleap.io/agent-setup/</code>.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>update_plan</code></p></td><td colspan="1" rowspan="1"><p>The whole plan in order, <code>items: [{ content, status }]</code> with status <code>pending</code>, <code>in_progress</code>, <code>completed</code> or <code>cancelled</code>, plus an optional one-line <code>explanation</code>. Each call replaces the list shown on the session.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>share_screenshot</code></p></td><td colspan="1" rowspan="1"><p>Posts a screenshot into the session with a one-line <code>caption</code> and an optional <code>label</code>. Pass <code>path</code> (and <code>compare_with</code> for a before shot, shown as before/after); the result returns one <code>curl</code> upload command per file, valid for 15 minutes, which the agent runs. Agents without a shell pass <code>imageBase64</code> instead. PNG, JPEG, WebP or GIF.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>publish_artifact</code></p></td><td colspan="1" rowspan="1"><p>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 <code>artifactId</code> to publish a new version.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>wrap_up</code></p></td><td colspan="1" rowspan="1"><p>The next-step card at the end of a turn: a <code>recap</code> (what is now true, what is not done or not verified), at most one <code>ask</code>, and up to two <code>actions</code>, the recommended one first.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>get_ticket_screenshot</code></p></td><td colspan="1" rowspan="1"><p>The screenshot the Gleap SDK captured with the ticket, as an image (up to 2 MB).</p></td></tr></tbody></table>

### Wrap-up actions

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

<table style="min-width: 75px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p><code>action</code></p></th><th colspan="1" rowspan="1"><p>Available when</p></th><th colspan="1" rowspan="1"><p>In Gleap</p></th></tr><tr><td colspan="1" rowspan="1"><p><code>open_pr</code></p></td><td colspan="1" rowspan="1"><p>the session has an open pull request</p></td><td colspan="1" rowspan="1"><p>Opens it.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>review_changes</code></p></td><td colspan="1" rowspan="1"><p>the session has an open pull request</p></td><td colspan="1" rowspan="1"><p>Opens the changes.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>merge_pr</code></p></td><td colspan="1" rowspan="1"><p>a GitHub pull request, the project's <strong>Merge from Gleap</strong> switch is on, and the pull request is mergeable with no failing checks</p></td><td colspan="1" rowspan="1"><p>Merges it; only the session owner or a project admin. Pull requests on other providers are merged there.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>open_preview</code></p></td><td colspan="1" rowspan="1"><p>a preview is running</p></td><td colspan="1" rowspan="1"><p>Opens the preview.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>send_customer_update</code></p></td><td colspan="1" rowspan="1"><p>the session is linked to a ticket; pass the draft as <code>message</code></p></td><td colspan="1" rowspan="1"><p>Puts the draft in the ticket composer. Gleap never sends it on its own.</p></td></tr></tbody></table>

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:

<table style="min-width: 50px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p>Field</p></th><th colspan="1" rowspan="1"><p>Meaning</p></th></tr><tr><td colspan="1" rowspan="1"><p><code>stop</code></p></td><td colspan="1" rowspan="1"><p><code>true</code> when someone stopped the session in Gleap. The agent stops working, wraps up and tells you.</p></td></tr><tr><td colspan="1" rowspan="1"><p><code>hook</code></p></td><td colspan="1" rowspan="1"><p><code>{ sessionId, token, apiBase, expiresAt }</code>: the session file for the plugin's hooks. The agent writes it to <code>.gleap/session.json</code> at the repository root and adds <code>.gleap/</code> to <code>.git/info/exclude</code>. The token is valid for 48 hours and only for this session's plan and wrap-up.</p></td></tr></tbody></table>

`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:

<table style="min-width: 50px;"><colgroup><col style="min-width: 25px;"><col style="min-width: 25px;"></colgroup><tbody><tr><th colspan="1" rowspan="1"><p>When</p></th><th colspan="1" rowspan="1"><p>Sent to Gleap</p></th></tr><tr><td colspan="1" rowspan="1"><p>The agent updates its own plan (Claude Code's task or todo tool, Codex's plan tool)</p></td><td colspan="1" rowspan="1"><p>The plan items: text and status.</p></td></tr><tr><td colspan="1" rowspan="1"><p>A turn ends</p></td><td colspan="1" rowspan="1"><p>The agent's last message, at most 4,000 characters. Gleap uses it as the turn's recap when the agent didn't call <code>wrap_up</code>; the agent's own wrap-up always wins.</p></td></tr><tr><td colspan="1" rowspan="1"><p>A session starts or resumes</p></td><td colspan="1" rowspan="1"><p>Only that the agent is still there.</p></td></tr></tbody></table>

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.

## Related

- [Kai Code](https://docs.gleap.ai/en/articles/688-kai-code.md)
- [Getting started](https://docs.gleap.ai/en/articles/689-getting-started.md)
- [Sessions](https://docs.gleap.ai/en/articles/690-sessions.md)
- [Tickets and pull requests](https://docs.gleap.ai/en/articles/691-tickets-and-pull-requests.md)
- [Repositories](https://docs.gleap.ai/en/articles/693-repositories.md)
