# Cline Integration

Zonegaze Flow includes a native Cline integration, exposed in the UI as ZoneGaze Flow, and still documents relevant upstream Cline capabilities when they are surfaced through this product.

## Product Boundary

Zonegaze Flow owns board state, project state, worktrees, review flows, runtime summaries, git actions, and browser state streaming.

Cline SDK owns provider settings, OAuth, session hosting, model catalogs, tool execution policy, persisted session artifacts, and upstream agent behavior. The shared `@zonegaze/cline-sdk` package owns direct upstream SDK imports; Flow runtime modules adapt those concepts into Zonegaze Flow task sessions.

## User Features

- Provider setup with model picker, custom model ID, base URL, API key, OAuth, device auth, and reasoning effort.
- Custom OpenAI-compatible providers with headers, timeout, model list, default model, source URL, and capabilities.
- Account profile, organization switching, credit balance, and credit notifications when available.
- MCP server management for stdio, SSE, and streamable HTTP transports.
- MCP OAuth status and connect/reconnect actions.
- Plan/Act mode, slash commands, `/clear`, file mentions, prompt history, images, cancellation, reload, resume, queued messages, and persisted chat history.

Screenshots:

- [Open ZoneGaze Flow agent sidebar](../assets/screenshots/agent-sidebar.png)
- [Open settings dialog](../assets/screenshots/settings-dialog.png)

![ZoneGaze Flow agent sidebar with model loading state](../assets/screenshots/agent-sidebar.png)

![Settings dialog with ZoneGaze Flow and Cline-related agent setup](../assets/screenshots/settings-dialog.png)

## Upstream Cline Capabilities Referenced In Docs

Official Cline docs describe Plan/Act mode, built-in tools, MCP tools, custom tools, providers, rules, skills, checkpoints, and agent/team concepts. Zonegaze Flow docs should reference those capabilities only when the local UI or runtime exposes them.

Useful upstream references:

- [Cline GitHub README](https://github.com/Cline/Cline)
- [Cline tools reference](https://docs.cline.bot/tools-reference/all-cline-tools)
- [Cline MCP overview](https://docs.cline.bot/mcp/mcp-overview)
- [Cline Plan and Act](https://docs.cline.bot/core-workflows/plan-and-act)

## Runtime Path

1. Browser sends task chat or provider requests through TRPC.
2. `runtime-api.ts` delegates to provider, MCP, or task-session services.
3. `@zonegaze/cline-sdk` isolates direct `@cline/sdk` and `@clinebot/*` package calls.
4. Event adapters translate SDK events into Zonegaze Flow chat messages and summaries.
5. `runtime-state-hub.ts` streams summaries and messages to the browser.

## Guardrails

- Do not store Cline provider secrets in Zonegaze Flow runtime config.
- Do not treat Cline as a PTY-backed CLI agent.
- Do not create docs inside Cline upstream/fork areas.
- Keep direct SDK imports constrained to the shared `@zonegaze/cline-sdk` package.

## Related Docs

- [System design](../architecture/system-design.md)
- [Runtime API reference](../reference/runtime-api.md)
- [Generated source reference](../reference/generated/source/README.md)
