Canvas

From Xiangyu-CAS/codex-canvas · View interactive version

Canvas is an AI agent skill from the GitHub repository Xiangyu-CAS/codex-canvas. Open and use Codex-Canvas, a project-local infinite canvas for Codex image generation. Use when the user says /canvas, asks to open the canvas, or wants generated images collected on a visual board.

How to use this skill

Skill file

Codex-Canvas

Use this skill to open the local Codex-Canvas board and keep generated images collected in the active project.

Workflow

  1. Open the native plugin sidebar with the codex-canvas.open_canvas MCP tool. Discover the installed tool if it is deferred, then pass the active workspace's absolute projectDir and the current Codex threadId whenever available.
  1. Keep the workspace and thread explicit for subsequent imports and operations. Without a thread binding, use the shared project default; never guess another chat's binding.
  2. Browser compatibility fallback: only when the host lacks MCP App support, the plugin MCP tool is unavailable, or the user explicitly asks for a browser, run node <plugin-root>/bin/codex-canvas.mjs open --project <workspace> --thread-id <thread-id> (omit thread when unavailable), or call open_canvas with presentation: "browser".
  1. When the user asks for image generation or image editing while this skill is active:

node <plugin-root>/bin/codex-canvas.mjs import <image-path> --project <workspace> --thread-id <thread-id>.

node <plugin-root>/bin/codex-canvas.mjs collect --project <workspace> --thread-id <thread-id> --since-minutes 30 --limit 5.

  1. Quick Edit, Remove BG, Expand, Edit Text, and Edit Elements are implemented as background Codex-Canvas jobs. They create a canvas placeholder immediately, run Codex/ImageGen through the matching Codex-Canvas operation skill and bundled Codex App CLI, then replace the placeholder with the collected output.
  2. Edit Text is a two-step interaction: first run text recognition and show the formatted editable text list in the canvas UI; after the user changes one or more fields and clicks Run, call imagegen to produce the edited PNG.
  1. Edit Elements asks ImageGen for a low-detail instance segmentation map, then Codex-Canvas locally splits the source image into four-channel transparent PNG object/text layers plus a residual background. Codex-Canvas immediately imports the residual background and transparent object/text layers, stacks them to the right of the source image so they reconstruct the original composition, and continues a background-completion pass from the original image plus residual background in the background. When completion finishes, Codex-Canvas replaces the existing background layer asset in place and refreshes that layer. Intermediate segmentation and raw completion images stay internal to the job and are not added to the canvas.
  2. Canvas-to-chat requires a bound Codex thread. Each bound thread uses a separate canvas scope under canvas/threads/<canvasId>/. The frontend send-to-chat action sends a localImage turn through Codex app-server thread/resume + turn/start; MCP/HTTP callers may explicitly use mention-file for a Codex @file-style mention turn. The frontend @file toolbar button must not directly send a turn; it prepares/copies an @<absolute-path> reference for the user to paste into the Codex chat box. Do not use desktop UI automation or clipboard paste as a fallback.

Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.