Skip to content

See how your app actually fits together. An interactive, plain-English map of your codebase, drawn by Claude or Codex.

Codex support: install Floorplan as a Codex plugin, ask on the map through Codex

Hayden Smithed1a530eb956
diff --git a/.agents/plugins/marketplace.json b/.agents/plugins/marketplace.json
new file mode 100644
index 0000000..f232b4d
--- /dev/null
+++ b/.agents/plugins/marketplace.json
@@ -0,0 +1,20 @@
+{
+ "name": "floorplan",
+ "interface": {
+ "displayName": "Floorplan"
+ },
+ "plugins": [
+ {
+ "name": "floorplan",
+ "source": {
+ "source": "local",
+ "path": "./"
+ },
+ "policy": {
+ "installation": "AVAILABLE",
+ "authentication": "ON_INSTALL"
+ },
+ "category": "Developer Tools"
+ }
+ ]
+}
diff --git a/.codex-plugin/icon.png b/.codex-plugin/icon.png
new file mode 100644
index 0000000..85f9c6a
Binary files /dev/null and b/.codex-plugin/icon.png differ
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
new file mode 100644
index 0000000..2fa9662
--- /dev/null
+++ b/.codex-plugin/plugin.json
@@ -0,0 +1,46 @@
+{
+ "name": "floorplan",
+ "version": "0.1.5",
+ "description": "See how your app actually fits together: an interactive map of your codebase where every part, file and web request has a plain-English name and description, with a health check, screens, guided flows, questions answered on the map, and highlights of what was just worked on.",
+ "author": {
+ "name": "Hayden Smith",
+ "url": "https://github.com/haydenschmitty"
+ },
+ "homepage": "https://github.com/haydenschmitty/floorplan",
+ "repository": "https://github.com/haydenschmitty/floorplan",
+ "license": "MIT",
+ "keywords": [
+ "codebase",
+ "architecture",
+ "map",
+ "visualization",
+ "onboarding",
+ "diagram",
+ "documentation"
+ ],
+ "skills": "./skills/",
+ "requires_local_executor": true,
+ "interface": {
+ "displayName": "Floorplan",
+ "shortDescription": "See how your app fits together",
+ "longDescription": "Codex reads your codebase and draws an interactive map of it. Every part, file and web request gets a plain-English name and description, and every connection between them is shown. It adds a health check for exposed keys and endpoints anyone can change, your app's screens, guided flows, highlights of what was just worked on, and an Ask bar that answers questions on the map using your own Codex sign-in.",
+ "developerName": "Hayden Smith",
+ "category": "Developer Tools",
+ "capabilities": [
+ "Interactive",
+ "Read",
+ "Write"
+ ],
+ "websiteURL": "https://github.com/haydenschmitty/floorplan",
+ "privacyPolicyURL": "https://github.com/haydenschmitty/floorplan/blob/main/docs/privacy-and-security.md",
+ "defaultPrompt": [
+ "Draw a floorplan of this codebase",
+ "Update the floorplan with what we just changed",
+ "Show me how the frontend talks to the backend"
+ ],
+ "composerIcon": "./.codex-plugin/icon.png",
+ "logo": "./.codex-plugin/icon.png",
+ "brandColor": "#111111",
+ "screenshots": []
+ }
+}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5b64645..c3a62d7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## Unreleased
+
+- **Codex support:** Floorplan now installs as a Codex plugin too (`codex plugin marketplace add haydenschmitty/floorplan`), with the same skill, map and Health check. In Codex, the map's Ask bar runs your own Codex on your ChatGPT sign-in, read-only and kept out of your Codex history, and "Fix with Codex" prompts are ready to paste. The map server uses whichever agent built the map, and falls back to the other one. See [Floorplan in Codex](docs/codex.md).
+
## 0.1.5 (2026-10-28)
- **Fewer false Health alarms on FastAPI:** a dependency shortcut whose own name says it checks the caller, like `AdminAccess = Annotated[dict, Depends(check)]`, now counts as a login check even when its function has a plain name.
diff --git a/README.md b/README.md
index b549d6d..36faffa 100644
--- a/README.md
+++ b/README.md
@@ -9,9 +9,10 @@
**See how your app actually fits together.**
-Claude reads your codebase and draws an interactive map of it. Every part, file and web request gets a plain-English name, and every connection between them is shown.
+Claude or Codex reads your codebase and draws an interactive map of it. Every part, file and web request gets a plain-English name, and every connection between them is shown.
[![Claude Code plugin](https://img.shields.io/badge/Claude%20Code-plugin-D97757?style=flat-square)](https://code.claude.com/docs/en/overview)
+[![Codex plugin](https://img.shields.io/badge/Codex-plugin-111?style=flat-square)](docs/codex.md)
[![Tests](https://img.shields.io/github/actions/workflow/status/haydenschmitty/floorplan/test.yml?branch=main&style=flat-square&label=tests)](https://github.com/haydenschmitty/floorplan/actions/workflows/test.yml)
[![Version](https://img.shields.io/badge/version-0.1.5-111?style=flat-square)](CHANGELOG.md)
[![License: MIT](https://img.shields.io/badge/license-MIT-111?style=flat-square)](LICENSE)
@@ -140,7 +141,9 @@ Want to click around yourself? Open the [live demo](https://haydenschmitty.githu
## Install
-You need [Claude Code](https://code.claude.com/docs/en/overview) (the desktop app's Code tab or the CLI) and [Node.js 18+](https://nodejs.org).
+You need [Node.js 18+](https://nodejs.org) and either Claude Code or Codex.
+
+**Claude Code** (the desktop app's Code tab or the CLI):
```bash
claude plugin marketplace add haydenschmitty/floorplan
@@ -149,6 +152,21 @@ claude plugin install floorplan@floorplan
Start a new session and it's ready. Installing the Claude Code CLI is recommended even if you use the desktop app, because it lets the map's Ask bar read your real code. More in [Getting started](docs/getting-started.md).
+**Codex** (signed in with ChatGPT). No terminal needed:
+
+1. In the Codex app, open **Plugins** and choose **Add a marketplace**.
+2. For **Source**, enter `haydenschmitty/floorplan` and click **Add marketplace**.
+3. Find **Floorplan** and click **+** to install it.
+
+Or, from a terminal:
+
+```bash
+codex plugin marketplace add haydenschmitty/floorplan
+codex plugin add floorplan@floorplan
+```
+
+Start a new chat and ask for a floorplan, or type `$floorplan`. The map's Ask bar runs on your own Codex sign-in, with no API key. More in [Floorplan in Codex](docs/codex.md).
+
## Quick start
1. Open your project in Claude Code. For a frontend and backend in separate repos, open the folder that holds both.
@@ -197,7 +215,7 @@ A `floorplan/` folder holding the map, plus a short section in `CLAUDE.local.md`
- The scan, the map and its small local server all run on your computer. The server only accepts connections from your own machine.
- No dependencies or install scripts, and the map works offline: its layout engine and fonts are built in.
-- Questions on the map go to your own Claude account, through the Claude Code CLI.
+- Questions on the map go to your own account, through the Claude Code CLI or Codex, which can read your code but not change it.
- The Health check never stores or shows secret values, only where they are.
- No analytics or tracking. The map may ask once whether you'd like an email when Floorplan Cloud launches. Nothing is sent unless you sign up, and then only your email and "just me" or "with my team".
diff --git a/docs/README.md b/docs/README.md
index 32929cd..255fd87 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -3,6 +3,7 @@
| Guide | What's in it |
|---|---|
| [Getting started](getting-started.md) | Installing, making your first map, keeping it updated, updating and removing the plugin |
+| [Floorplan in Codex](codex.md) | Installing and using Floorplan in Codex, and what's different from Claude Code |
| [Using the map](using-the-map.md) | Every button, view, panel, shortcut and right-click menu |
| [How it works](how-it-works.md) | The pipeline from scan to map, how connections are found, how updates stay cheap |
| [What's in your project](project-files.md) | Every file Floorplan creates, which ones you can edit, and how it stays out of git |
diff --git a/docs/codex.md b/docs/codex.md
new file mode 100644
index 0000000..b8ff162
--- /dev/null
+++ b/docs/codex.md
@@ -0,0 +1,85 @@
+# Floorplan in Codex
+
+Floorplan works in [Codex](https://developers.openai.com/codex) the same way it works in Claude Code: the same skill, scripts and map, on your own ChatGPT sign-in. There are no API keys to set up.
+
+## What you need
+
+- Codex: the desktop app or the CLI, signed in with your ChatGPT account.
+- [Node.js](https://nodejs.org) 18 or newer.
+
+## Install
+
+**In the Codex app** (no terminal needed):
+
+1. Open **Plugins** and choose **Add a marketplace**.
+2. For **Source**, enter `haydenschmitty/floorplan`. Leave **Git ref** empty, and click **Add marketplace**.
+3. Find **Floorplan** in the list and click **+** to install it.
+4. Start a new chat.
+
+**From a terminal**, with the [Codex CLI](https://developers.openai.com/codex/cli):
+
+```bash
+codex plugin marketplace add haydenschmitty/floorplan
+codex plugin add floorplan@floorplan
+```
+
+The app and the CLI share their plugins, so installing in one makes Floorplan available in both.
+
+## Make your first map
+
+Open your project in Codex and ask in plain words:
+
+> Draw a floorplan of this codebase
+
+To call the skill by name, type `$floorplan`. Everything after that is the same as in Claude Code ([Getting started](getting-started.md#make-your-first-map)): Codex scans the code, describes every part, file and web request, builds the map and opens it. Later, "update the floorplan" re-reads only what changed.
+
+When Codex opens the map, it asks to run the map's server outside its sandbox. The server has to keep running after the command ends, and the Ask bar needs to reach Codex. If you'd rather not allow it, run the server yourself from the project folder:
+
+```bash
+node floorplan/serve.mjs
+```
+
+## Asking questions on the map
+
+The map's Ask bar runs your own Codex on your computer: `codex exec` in Codex's **read-only** sandbox, in your project folder, with your ChatGPT sign-in. It reads the map and your source to answer, and can't change any files. These runs aren't saved to your Codex history; a follow-up question brings the last few questions and answers along instead.
+
+The server uses whichever agent built the map, and falls back to the other one if that one isn't installed. To choose:
+
+```bash
+node floorplan/serve.mjs --engine codex
+```
+
+It finds `codex` on your PATH, and on Windows the CLI that comes with the Codex desktop app. If yours is somewhere else, pass `--codex /path/to/codex`. `--model <name>` picks the model; otherwise your Codex settings decide.
+
+## What's different from Claude Code
+
+- **No notes file.** In Claude Code, Floorplan keeps a short note in `CLAUDE.local.md` (personal and never committed) that points future sessions at the map. Codex has no personal, uncommitted equivalent (`AGENTS.md` is shared with your team), so in Codex Floorplan leaves your project's notes alone.
+- **No Claude app.** Publishing the map to the Claude app is a Claude feature. In Codex the map opens in your browser, served from your computer.
+- **"Fix with Codex".** The Health panel's ready-made fix prompts are for pasting into Codex.
+
+## Update or remove it
+
+In the app, open **Plugins**, find the Floorplan marketplace and choose **Upgrade** to get the latest version, or **Remove marketplace** to take it out. From a terminal:
+
+```bash
+codex plugin marketplace upgrade floorplan
+codex plugin add floorplan@floorplan
+```
+
+```bash
+codex plugin remove floorplan@floorplan
+codex plugin marketplace remove floorplan
+```
+
+Your maps stay in each project's `floorplan/` folder until you delete them.
+
+## Trying a working copy
+
+Point Codex at your local clone instead of GitHub:
+
+```bash
+codex plugin marketplace add /path/to/floorplan
+codex plugin add floorplan@floorplan
+```
+
+Codex copies a local plugin into its cache when you add it (unlike Claude Code, which runs a local plugin straight from the folder). After you change the plugin, run `codex plugin add floorplan@floorplan` again and start a new session.
diff --git a/docs/development.md b/docs/development.md
index 2e7779a..ffea50a 100644
--- a/docs/development.md
+++ b/docs/development.md
@@ -7,8 +7,14 @@
plugin.json the plugin: name, version, author
marketplace.json this repo as its own one-plugin marketplace
icon.png
+.codex-plugin/
+ plugin.json the same plugin for Codex (same skill, same version)
+ icon.png
+.agents/plugins/
+ marketplace.json this repo as a Codex marketplace
skills/floorplan/
- SKILL.md the workflow Claude follows
+ SKILL.md the workflow Claude and Codex follow
+ agents/openai.yaml how Codex lists the skill
references/ formats and style guides Claude reads while working
schema.md architecture.json and recent-work.json
choosing-boundaries.md how to carve a codebase into a good map
@@ -21,12 +27,12 @@ skills/floorplan/
refresh.mjs incremental update: re-scan, carry over, flag changes, rebuild
recent.mjs facts for marking recent work
open.mjs start or reuse the map's server, and open the browser
- lib/ extraction, import resolution, route matching, Health, screens, helpers
+ lib/ extraction, import resolution, route matching, Health, screens, which agent is running, helpers
assets/
viewer.html the map (template the build fills in)
ui/ viewer extensions: glossary, Health, recent work, screens, tour, waitlist card
graph-query.js shared map lookups (viewer, query.mjs, Ask instructions)
- serve.mjs copied into each project's floorplan/ folder
+ serve.mjs copied into each project's floorplan/ folder; answers through Claude Code or Codex
query-cli.mjs becomes floorplan/query.mjs
logo.png, favicon.png
vendor/ bundled layout engine (elkjs) and fonts, with their licenses
@@ -45,6 +51,8 @@ claude plugin install floorplan@floorplan
A plugin installed from a local folder runs straight from it, so edits apply in the next session with no update step.
+To try it in Codex, see [Trying a working copy](codex.md#trying-a-working-copy). Codex copies a local plugin when you add it, so run `codex plugin add floorplan@floorplan` again after each change. `--agent claude|codex` on build.mjs (or `FLOORPLAN_AGENT`) and `--engine claude|codex` on serve.mjs let you try either agent's map from anywhere.
+
The scripts also run on their own, which is the fastest way to work on them:
```bash
@@ -71,7 +79,9 @@ The tests use Node's built-in test runner, so there's nothing to install (`npm t
| `health.test.mjs` | which endpoints Health calls open to anyone (FastAPI sample in `fixtures/`) |
| `sample-app.test.mjs` | a whole map of a two-repo shop: endpoints, cross-repo requests, Health, offline map, no secret values written, updates |
| `serve.test.mjs` | the map's server: 127.0.0.1 only, token and same-origin checks, nothing served from outside its folder |
-| `release.test.mjs` | the version agrees across `plugin.json`, the README badge and the changelog |
+| `ask.test.mjs` | asking through Claude Code or Codex: which one is used, read-only, follow-ups, sign-in errors (stand-in CLIs in `fixtures/fake-cli/`) |
+| `agents.test.mjs` | telling Claude Code from Codex, and what a map built by each records and writes |
+| `release.test.mjs` | the version agrees across both plugins' `plugin.json`, the README badge and the changelog |
Sample projects are written to a temp folder by `helpers.mjs` (`shopApp()`) or copied from `tests/fixtures/`. Anything secret-looking is assembled at runtime, so no real-looking key is ever committed.
@@ -129,7 +139,7 @@ Files in `skills/floorplan/assets/ui/` are inlined into every map, in name order
npm test
claude plugin validate . --profile directory
```
-2. Bump `version` in `.claude-plugin/plugin.json` and the version badge in `README.md`.
+2. Bump `version` in `.claude-plugin/plugin.json` and `.codex-plugin/plugin.json`, and the version badge in `README.md`.
3. Rename `## Unreleased` in `CHANGELOG.md` to `## X.Y.Z (YYYY-MM-DD)`.
4. Commit as `Floorplan X.Y.Z: <one-line headline>` and push `main`.
5. Tag and push the tag. This also checks that `plugin.json` and the marketplace entry agree:
diff --git a/docs/getting-started.md b/docs/getting-started.md
index 445b61f..73bc0e2 100644
--- a/docs/getting-started.md
+++ b/docs/getting-started.md
@@ -2,6 +2,8 @@
Prefer to watch? The [walkthrough video](https://youtu.be/NTUUzC7L_NQ) covers installing Floorplan and touring a finished map.
+Using Codex? See [Floorplan in Codex](codex.md) for installing; the rest of this guide applies too.
+
## What you need
- **Claude Code**: the Code tab in the Claude desktop app, or the Claude Code CLI in a terminal.
diff --git a/docs/privacy-and-security.md b/docs/privacy-and-security.md
index 336d2d8..a2f7d6b 100644
--- a/docs/privacy-and-security.md
+++ b/docs/privacy-and-security.md
@@ -5,10 +5,11 @@
| Part | Where it runs | What it sends |
|---|---|---|
| Scan, build, updates | your computer (Node.js) | nothing |
-| Writing names and descriptions | Claude, through your Claude Code session | the files Claude reads, the same as any Claude Code task |
+| Writing names and descriptions | Claude or Codex, through your session | the files it reads, the same as any other task you give it |
| The map | your browser | nothing. Its layout engine and fonts are bundled into the file, so it works offline |
| The map's server (`serve.mjs`) | your computer, listening on `127.0.0.1` only | nothing on its own |
| Asking questions (Claude Code CLI) | a `claude -p` session on your computer, with your account | your question, and the files Claude chooses to read |
+| Asking questions (Codex) | a `codex exec` run on your computer, with your ChatGPT sign-in, not saved to your Codex history | your question, and the files Codex chooses to read |
| Asking questions (Claude app) | your claude.ai account | the map (names, descriptions, structure), never your source code. Claude asks before publishing it there |
| Floorplan Cloud waitlist (only if you sign up) | the map's server, to Floorplan's waitlist service | the email you typed or chose, and "just me" or "with my team". See [below](#floorplan-cloud-waitlist) |
@@ -21,6 +22,7 @@ The layout engine ([elkjs](https://github.com/kieler/elkjs) 0.9.3, EPL-2.0) and
- It listens on `127.0.0.1` only, so other machines on your network can't reach it.
- Every start creates a random token, which only the map page it serves receives. Asking questions and saving flows require that token, and those requests are refused when they come from another website.
- Questions run Claude with **read-only** tools: reading files, searching, and the map's own lookup script. It can't edit files or run other commands.
+- With Codex, questions run in Codex's **read-only** sandbox: it can read and search, but not write files.
- It stops by itself two hours after the last tab closes, and `node floorplan/serve.mjs --stop` stops it immediately.
## Floorplan Cloud waitlist
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md
index 238b94e..9ae5876 100644
--- a/docs/troubleshooting.md
+++ b/docs/troubleshooting.md
@@ -12,6 +12,18 @@ The map is open without a way to ask questions. Either:
node floorplan/serve.mjs --claude /path/to/claude
```
+### Codex: the Ask bar says it needs Codex
+The map's server looks for `codex` on your PATH and, on Windows, for the CLI that comes with the Codex desktop app. Install the [Codex CLI](https://developers.openai.com/codex/cli), or point the server at yours:
+
+```bash
+node floorplan/serve.mjs --codex /path/to/codex
+```
+
+If it says Codex isn't signed in, open the Codex app (or run `codex login`) and sign in with ChatGPT. More in [Floorplan in Codex](codex.md).
+
+### Codex: the map didn't open, or Ask stopped working after Codex opened it
+Codex runs commands in a sandbox, and the map's server needs to keep running and reach the network. Allow the server to run outside the sandbox when Codex asks, or run `node floorplan/serve.mjs` yourself from the project folder.
+
### `node` isn't recognized
Install [Node.js](https://nodejs.org) 18 or newer, then start a new session so Claude Code picks it up.
diff --git a/skills/floorplan/SKILL.md b/skills/floorplan/SKILL.md
index 331b7cb..77ea2d6 100644
--- a/skills/floorplan/SKILL.md
+++ b/skills/floorplan/SKILL.md
@@ -17,6 +17,8 @@ The scripts do the mechanical work: finding repos, parsing imports and routes, m
Existing map: !`node ${CLAUDE_SKILL_DIR}/scripts/status.mjs || true`
Arguments: $ARGUMENTS
+**In Codex** (or any agent that left the two lines above unfilled): `${CLAUDE_SKILL_DIR}` in every command here means this skill's folder, the one holding this SKILL.md, so use its path. Run `node <that folder>/scripts/status.mjs` from the codebase root yourself to see whether a map exists, and take the path and `--refresh` from the user's request. The scripts notice they're running under Codex, so the map's Ask bar and "Fix with" prompts use Codex.
+
## A map already exists? Refresh it instead
If the status above shows an existing map, don't start over. Run:
@@ -70,7 +72,7 @@ The codebase root is the argument if one was given, otherwise the current direct
**Nothing Floorplan makes is committed.** `floorplan/` holds its own `.gitignore` that ignores the whole folder, so the project's tracked files aren't touched. If git already tracks files there, the build prints the `git rm -r --cached` command to untrack them; pass it on to the user rather than running it.
- Each build also keeps a short marked block in the project's `CLAUDE.local.md`, Claude Code's personal, uncommitted project notes, which load at session start like CLAUDE.md. The block tells future Claude Code sessions here that the map exists and how to look things up in it with `floorplan/query.mjs`, so they start from the map instead of searching the code from scratch. The build adds `CLAUDE.local.md` to the repo's local ignore list (`.git/info/exclude`, not `.gitignore`). It rewrites only its own block, and moves the block out of `CLAUDE.md` if an older version put it there. To opt out, pass `--no-claude-md`, or put `<!-- floorplan:off -->` in CLAUDE.local.md.
+ Each build also keeps a short marked block in the project's `CLAUDE.local.md`, Claude Code's personal, uncommitted project notes, which load at session start like CLAUDE.md. The block tells future Claude Code sessions here that the map exists and how to look things up in it with `floorplan/query.mjs`, so they start from the map instead of searching the code from scratch. The build adds `CLAUDE.local.md` to the repo's local ignore list (`.git/info/exclude`, not `.gitignore`). It rewrites only its own block, and moves the block out of `CLAUDE.md` if an older version put it there. To opt out, pass `--no-claude-md`, or put `<!-- floorplan:off -->` in CLAUDE.local.md. Under Codex the build skips this: Codex has no personal, uncommitted notes file (AGENTS.md is shared with the team), so don't add one there either.
6. **Describe every file and route.**
`node ${CLAUDE_SKILL_DIR}/scripts/describe.mjs <root>`
@@ -95,17 +97,22 @@ The codebase root is the argument if one was given, otherwise the current direct
8. **Show it, then report.** Whenever you make or update a floorplan, finish by putting it in front of the user:
`node ${CLAUDE_SKILL_DIR}/scripts/open.mjs <root>`
- It starts the map's server in the background (or reuses the one already running for this map) and opens it in their browser. Tabs that are already open reload in place instead of a new one opening.
- - It prints the URL, whether Ask works (the Claude Code CLI was found), and how to stop the server. The server also stops on its own a couple of hours after the last tab closes.
+ - It prints the URL, whether Ask works (the Claude Code CLI or Codex was found), and how to stop the server. The server also stops on its own a couple of hours after the last tab closes.
+ - **In Codex**, run open.mjs outside the sandbox (ask for escalated permissions): the server has to keep running after the command ends, and Ask needs the network to reach Codex. If that isn't allowed, give the user `node floorplan/serve.mjs` to run in their own terminal from the codebase root.
- If you have an in-app browser or preview tool, pass `--no-open` and open the printed URL there instead, so the map appears right beside the conversation.
- If this is a remote or headless machine where the user can't reach 127.0.0.1, skip open.mjs and tell them to run `node floorplan/serve.mjs` on their own machine, or offer the Claude app route (step 9).
- Then **report.** Give the URL, then describe the architecture you mapped in 3–5 lines, in the user's language, including anything surprising: cycles, god-files, dead areas, coupled subsystems. Always mention the **high-severity Health items** (`graph.health`; the build output and graph.json list them). Hard-coded passwords/keys and endpoints anyone can change data through are things the owner needs to hear about. Never repeat a secret's value. Say that `architecture.json` and `descriptions/` are theirs to edit, and that after more work they can just ask to "update the floorplan", which re-reads only what changed. Give them those plain words rather than a slash command: installed as a plugin, the command is `/floorplan:floorplan`, and as a personal skill it's `/floorplan`. On a first run, mention in one line that the map and its notes for future sessions (in CLAUDE.local.md) stay out of git.md so future sessions use the map. On an update, start with what changed for what they asked (it's highlighted under **Recent work**).
+ Then **report.** Give the URL, then describe the architecture you mapped in 3–5 lines, in the user's language, including anything surprising: cycles, god-files, dead areas, coupled subsystems. Always mention the **high-severity Health items** (`graph.health`; the build output and graph.json list them). Hard-coded passwords/keys and endpoints anyone can change data through are things the owner needs to hear about. Never repeat a secret's value. Say that `architecture.json` and `descriptions/` are theirs to edit, and that after more work they can just ask to "update the floorplan", which re-reads only what changed. Give them those plain words rather than a command: in Claude Code the plugin's command is `/floorplan:floorplan` (`/floorplan` as a personal skill), and in Codex it's `$floorplan`. On a first run, mention in one line that the map stays out of git, and in Claude Code that its notes for future sessions (in CLAUDE.local.md) do too. On an update, start with what changed for what they asked (it's highlighted under **Recent work**).
## 9. Opening the map and asking questions
-The map has a floating Ask bar. The user types a question, and Claude answers with text plus an answer board: the relevant cards, the connections among them, a note on each card, and an optional step-by-step walkthrough. There are two ways to power it. The UI is the same either way.
+The map has a floating Ask bar. The user types a question, and the agent answers with text plus an answer board: the relevant cards, the connections among them, a note on each card, and an optional step-by-step walkthrough. There are two ways to power it. The UI is the same either way.
+
+- **Claude Code CLI or Codex (best).** The map's server (`floorplan/serve.mjs`, started by open.mjs in step 8) serves it at http://127.0.0.1:4378, or the next free port. Each question runs on the user's own sign-in, in the codebase, read-only, so answers can cite real code:
+ - **Claude Code:** `claude -p` with the map (via `floorplan/query.mjs`) plus Read/Grep/Glob on the source. The server finds `claude` on PATH or in `~/.local/bin`.
+ - **Codex:** `codex exec` in Codex's read-only sandbox, with nothing saved to their Codex history. The server finds `codex` on PATH, or the CLI that comes with the Codex app.
-- **Claude Code CLI (best).** The map's server (`floorplan/serve.mjs`, started by open.mjs in step 8) serves it at http://127.0.0.1:4378, or the next free port. Each question runs the user's `claude` CLI in the codebase with read-only tools (the map via `floorplan/query.mjs`, plus Read/Grep/Glob on the source), so answers can cite real code. The script finds `claude` on PATH or in `~/.local/bin`; `--claude <path>` overrides that and `--model <name>` picks the model (open.mjs passes both through). Users can also run `node floorplan/serve.mjs` themselves at any time, and stop a background one with `node floorplan/serve.mjs --stop`.
+ It uses the agent that built the map, and falls back to the other if that one isn't installed. `--engine claude|codex` forces one, `--claude <path>` or `--codex <path>` points at an unusual install, and `--model <name>` picks the model (open.mjs passes all of these through). Users can also run `node floorplan/serve.mjs` themselves at any time, and stop a background one with `node floorplan/serve.mjs --stop`.
- **Claude app.** If you're running in the Claude app (the Artifact tool is available), offer to publish the map so they can open it there and ask questions on their own Claude account. Answers then come from the map only (names, descriptions, connections, endpoints), not the source, and the Ask bar shows a hint to install the CLI for a better experience. To publish:
1. `node ${CLAUDE_SKILL_DIR}/scripts/build.mjs <root> --artifact`. This writes `floorplan/artifact.html` without the machine's absolute path.
2. Publish that file with the Artifact tool, `capabilities: {"sample": {}}`, and keep the same file path for later publishes so the URL stays stable.
@@ -122,12 +129,12 @@ The map has a floating Ask bar. The user types a question, and Claude answers wi
- files nothing uses;
- files over ~1,000 lines, which AI struggles to edit safely.
- Each issue has **Show on map** (highlights the affected files and endpoints with notes) and **Fix with Claude** (a ready-to-paste prompt naming the exact files and lines and the safe fix). It's computed by `scripts/lib/health.mjs` during scan and build, and it never stores secret values, only the file, line and a masked hint. Treat it as a quick automatic check, not a security audit.
+ Each issue has **Show on map** (highlights the affected files and endpoints with notes) and **Fix with Claude** or **Fix with Codex** (a ready-to-paste prompt naming the exact files and lines and the safe fix). It's computed by `scripts/lib/health.mjs` during scan and build, and it never stores secret values, only the file, line and a masked hint. Treat it as a quick automatic check, not a security audit.
- **Screens.** The build detects the app's screens (Next.js, React Router, Vue, SvelteKit, Remix, Nuxt, Astro, Expo, Angular, TanStack) with `scripts/lib/screens.mjs`. It also works out what sits behind each one: its components, the requests it makes, the server code and data that answer them, and outside services. A **Screens** button lets people start from the page they know.
- **Start here.** A one-minute tour runs on first open and can be replayed from the header. It uses your `tour`, or builds one automatically.
- **Plain words by default.** Connection types read "Uses", "Web requests", "Background jobs". Common technical terms are underlined and explained on hover. **Filters → Show technical detail** switches to developer terms and shows exports.
-People can also use **Flows → Request a new flow** to have Claude trace something ("how does a refund get back to the customer's card?") into a step-by-step flow. With serve.mjs these are saved to `floorplan/custom-flows.json`, and every build folds them into the map (steps pointing at deleted code are dropped with a warning). Treat that file as user content: keep it on refresh, and don't edit it unless asked.
+People can also use **Flows → Request a new flow** to have the agent trace something ("how does a refund get back to the customer's card?") into a step-by-step flow. With serve.mjs these are saved to `floorplan/custom-flows.json`, and every build folds them into the map (steps pointing at deleted code are dropped with a warning). Treat that file as user content: keep it on refresh, and don't edit it unless asked.
## Notes
diff --git a/skills/floorplan/agents/openai.yaml b/skills/floorplan/agents/openai.yaml
new file mode 100644
index 0000000..5db352f
--- /dev/null
+++ b/skills/floorplan/agents/openai.yaml
@@ -0,0 +1,4 @@
+interface:
+ display_name: "Floorplan"
+ short_description: "Draw an interactive, plain-English map of this codebase"
+ default_prompt: "Use $floorplan to draw a floorplan of this codebase, or update the existing one, and open it."
diff --git a/skills/floorplan/assets/graph-query.js b/skills/floorplan/assets/graph-query.js
index 3319e71..7b160fe 100644
--- a/skills/floorplan/assets/graph-query.js
+++ b/skills/floorplan/assets/graph-query.js
@@ -1,5 +1,5 @@
// floorplan graph queries, shared by the viewer (as page tools for the Claude app) and by
-// floorplan/query.mjs (as a CLI the Claude Code CLI calls). Plain script: no imports, no exports.
+// floorplan/query.mjs (as a CLI that the Claude Code CLI or Codex calls). Plain script: no imports, no exports.
// Item ids: n:<node id> f:<file path> r:<route index> s:<file path>#<export index>
function createGraphQuery(G) {
@@ -214,7 +214,7 @@ function floorplanFlowInstructions(G, engine) {
function floorplanAskInstructions(G, engine) {
const tools = engine === 'cli'
- ? `Query the map with Bash: \`node floorplan/query.mjs overview\`, \`node floorplan/query.mjs find "<words>" [--kind module|file|endpoint|symbol]\`, \`node floorplan/query.mjs show <id>\`, \`node floorplan/query.mjs path <fromId> <toId>\`. Every result is JSON with ids. Start with the map; read or grep source files when you need specifics the map does not have.`
+ ? `Query the map from the shell: \`node floorplan/query.mjs overview\`, \`node floorplan/query.mjs find "<words>" [--kind module|file|endpoint|symbol]\`, \`node floorplan/query.mjs show <id>\`, \`node floorplan/query.mjs path <fromId> <toId>\`. Every result is JSON with ids. Start with the map; read or grep source files when you need specifics the map does not have.`
: `Use the tools find_items, get_item and dependency_path to explore the map. You cannot read source files, so answer from the map's names, descriptions, endpoints and connections, and say so when a question needs the code itself.`;
return [
`You answer questions about the codebase "${G.project.name}" for someone exploring an interactive architecture map of it.`,
diff --git a/skills/floorplan/assets/serve.mjs b/skills/floorplan/assets/serve.mjs
index c7418b1..43837cf 100644
--- a/skills/floorplan/assets/serve.mjs
+++ b/skills/floorplan/assets/serve.mjs
@@ -1,12 +1,14 @@
#!/usr/bin/env node
// floorplan/serve.mjs: serve this map locally and answer questions about the codebase through the
-// Claude Code CLI. Generated by build.mjs; needs only Node 18+ and a logged-in `claude` CLI.
+// Claude Code CLI or Codex. Generated by build.mjs; needs only Node 18+ and a signed-in `claude` or `codex`.
//
-// usage: node floorplan/serve.mjs [--port 4378] [--model <model>] [--claude <path to claude>] [--no-open] [--idle-exit <minutes>]
+// usage: node floorplan/serve.mjs [--port 4378] [--engine claude|codex] [--model <model>] [--claude <path>] [--codex <path>]
+// [--no-open] [--idle-exit <minutes>]
// node floorplan/serve.mjs --stop
//
-// The server listens on 127.0.0.1 only. Each question runs `claude -p` in the codebase root with
-// read-only tools (Read, Grep, Glob, and Bash limited to floorplan/query.mjs), on your own Claude account.
+// The server listens on 127.0.0.1 only. Each question runs in the codebase root, on your own account:
+// `claude -p` with read-only tools (Read, Grep, Glob, and Bash limited to floorplan/query.mjs), or
+// `codex exec` in its read-only sandbox. It uses the one that built the map, else whichever is installed.
// When the map is rebuilt, open tabs reload in place. The running server is recorded in .cache/server.json.
import http from 'node:http';
import fs from 'node:fs';
@@ -37,27 +39,21 @@ const model = opt('model', process.env.FLOORPLAN_MODEL || '');
const token = crypto.randomBytes(16).toString('hex');
const TYPES = { '.html': 'text/html; charset=utf-8', '.json': 'application/json', '.js': 'text/javascript', '.mjs': 'text/javascript', '.css': 'text/css', '.svg': 'image/svg+xml' };
-// ---------- find the Claude Code CLI ----------
+// ---------- find the CLI that answers: Claude Code or Codex ----------
function which(cmd) {
try {
const out = execFileSync(process.platform === 'win32' ? 'where' : 'which', [cmd], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
return out.split(/\r?\n/).map((s) => s.trim()).filter(Boolean);
} catch { return []; }
}
-/** Returns { cmd, args } to spawn, or null. Handles native installs, npm shims on Windows, and .js entry points. */
-function resolveClaude() {
- const explicit = opt('claude', process.env.FLOORPLAN_CLAUDE);
- const candidates = explicit ? [explicit] : [
- ...which('claude'),
- path.join(process.env.HOME || process.env.USERPROFILE || '', '.local', 'bin', process.platform === 'win32' ? 'claude.exe' : 'claude'),
- ...(process.platform === 'win32' ? [path.join(process.env.APPDATA || '', 'npm', 'claude.cmd')] : []),
- ];
+/** Returns { cmd, args, path } to spawn, or null. Handles native installs, npm shims on Windows, and .js entry points. */
+function resolveCli(candidates, npmEntry) {
for (const c of candidates) {
if (!c || !fs.existsSync(c)) continue;
if (/\.(m?js)$/i.test(c)) return { cmd: process.execPath, args: [c], path: c };
if (/\.(cmd|bat|ps1)$/i.test(c) || (process.platform === 'win32' && !path.extname(c))) {
// npm shim: run its JS entry point with node directly (spawning .cmd files needs a shell)
- const cli = path.join(path.dirname(c), 'node_modules', '@anthropic-ai', 'claude-code', 'cli.js');
+ const cli = path.join(path.dirname(c), 'node_modules', ...npmEntry);
if (fs.existsSync(cli)) return { cmd: process.execPath, args: [cli], path: c };
const exe = c.replace(/\.(cmd|bat|ps1)$/i, '.exe');
if (fs.existsSync(exe)) return { cmd: exe, args: [], path: exe };
@@ -67,19 +63,46 @@ function resolveClaude() {
}
return null;
}
-const claude = resolveClaude();
-// Started from inside a Claude Code session? Don't let the CLI think it's nested in it.
-function claudeEnv() {
+const HOME = process.env.HOME || process.env.USERPROFILE || '';
+const given = (name) => { const p = opt(name, process.env['FLOORPLAN_' + name.toUpperCase()]); return p ? [p] : null; };
+/** The Codex desktop app keeps its CLI in a versioned folder; newest first. */
+function codexApp() {
+ if (process.platform === 'darwin') return ['/Applications/Codex.app/Contents/Resources/codex'];
+ if (process.platform !== 'win32') return [];
+ const base = path.join(process.env.LOCALAPPDATA || '', 'OpenAI', 'Codex', 'bin');
+ try {
+ return fs.readdirSync(base).map((d) => path.join(base, d, 'codex.exe')).filter((f) => fs.existsSync(f))
+ .sort((a, b) => fs.statSync(b).mtimeMs - fs.statSync(a).mtimeMs);
+ } catch { return []; }
+}
+const ENGINES = {
+ claude: () => resolveCli(given('claude') || [
+ ...which('claude'),
+ path.join(HOME, '.local', 'bin', process.platform === 'win32' ? 'claude.exe' : 'claude'),
+ ...(process.platform === 'win32' ? [path.join(process.env.APPDATA || '', 'npm', 'claude.cmd')] : []),
+ ], ['@anthropic-ai', 'claude-code', 'cli.js']),
+ codex: () => resolveCli(given('codex') || [...which('codex'), ...codexApp()], ['@openai', 'codex', 'bin', 'codex.js']),
+};
+// --engine (or FLOORPLAN_ENGINE) decides; otherwise the agent that built the map, then the other one
+const builtBy = (() => { try { return JSON.parse(fs.readFileSync(path.join(here, 'graph.json'), 'utf8')).meta?.agent; } catch { return null; } })();
+const asked = opt('engine', process.env.FLOORPLAN_ENGINE);
+const isEngine = (k) => typeof k === 'string' && Object.hasOwn(ENGINES, k);
+const want = isEngine(asked) ? asked : isEngine(builtBy) ? builtBy : 'claude';
+let engine = null, cli = null;
+for (const k of isEngine(asked) ? [asked] : [want, ...Object.keys(ENGINES).filter((k) => k !== want)]) { cli = ENGINES[k](); if (cli) { engine = k; break; } }
+const NAME = { claude: 'Claude Code CLI', codex: 'Codex' };
+// Started from inside a Claude Code or Codex session? Don't let the CLI think it's nested in it.
+function cliEnv() {
const env = { ...process.env };
- for (const k of Object.keys(env)) if (/^CLAUDE_?CODE_(SESSION|ENTRYPOINT|CHILD|MESSAGING|HOST|SDK)|^CLAUDECODE$/.test(k)) delete env[k];
+ for (const k of Object.keys(env)) if (/^CLAUDE_?CODE_(SESSION|ENTRYPOINT|CHILD|MESSAGING|HOST|SDK)|^CLAUDECODE$|^CODEX_(THREAD_ID|SESSION_ID|TOOL_CALL_ID|CI$|SANDBOX)/.test(k)) delete env[k];
return env;
}
let version = null;
-if (claude) { try { version = execFileSync(claude.cmd, [...claude.args, '--version'], { encoding: 'utf8', timeout: 15000, stdio: ['ignore', 'pipe', 'ignore'] }).trim(); } catch {} }
+if (cli) { try { version = execFileSync(cli.cmd, [...cli.args, '--version'], { encoding: 'utf8', timeout: 15000, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true }).trim(); } catch {} }
// The page, the graph, and the instructions and answer schema (from query.mjs's inlined graph-query
// code). Loaded at start and again whenever the map is rebuilt.
-const inject = `<script>window.FLOORPLAN_SERVER=${JSON.stringify({ token, cli: !!claude, version, model: model || null })};</script>`;
+const inject = `<script>window.FLOORPLAN_SERVER=${JSON.stringify({ token, cli: !!cli, engine, want, version, model: model || null })};</script>`;
let page, G, core, MODES;
function load() {
const html = fs.readFileSync(path.join(here, 'index.html'), 'utf8');
@@ -89,11 +112,21 @@ function load() {
c.q = c.createGraphQuery(g);
page = html.replace('</head>', inject + '</head>');
G = g; core = c;
- // two kinds of request: a question (answer + board) or a new guided flow
+ // two kinds of request: a question (answer + board) or a new guided flow. Codex reads its schema from a file.
MODES = {
- ask: { instructions: core.floorplanAskInstructions(G, 'cli'), schema: JSON.stringify(core.FLOORPLAN_ANSWER_SCHEMA) },
- flow: { instructions: core.floorplanFlowInstructions(G, 'cli'), schema: JSON.stringify(core.FLOORPLAN_FLOW_SCHEMA) },
+ ask: { instructions: core.floorplanAskInstructions(G, 'cli'), schema: core.FLOORPLAN_ANSWER_SCHEMA, file: path.join(here, '.cache', 'answer-schema.json') },
+ flow: { instructions: core.floorplanFlowInstructions(G, 'cli'), schema: core.FLOORPLAN_FLOW_SCHEMA, file: path.join(here, '.cache', 'flow-schema.json') },
};
+ if (engine === 'codex') {
+ fs.mkdirSync(path.join(here, '.cache'), { recursive: true });
+ for (const m of Object.values(MODES)) fs.writeFileSync(m.file, JSON.stringify(strict(m.schema)));
+ }
+}
+/** OpenAI structured outputs want every property required and nothing extra; optional lists just come back empty. */
+function strict(s) {
+ if (s?.type === 'object' && s.properties) return { ...s, properties: Object.fromEntries(Object.entries(s.properties).map(([k, v]) => [k, strict(v)])), required: Object.keys(s.properties), additionalProperties: false };
+ if (s?.type === 'array') return { ...s, items: strict(s.items) };
+ return s;
}
load();
@@ -132,9 +165,9 @@ function cloudPrompt() {
}
/** The email of the claude.ai account Claude Code is signed in with, or null (API key, Bedrock, not signed in). */
function claudeEmail() {
- if (!claude) return null;
+ if (engine !== 'claude') return null;
try {
- const out = execFileSync(claude.cmd, [...claude.args, 'auth', 'status', '--json'], { encoding: 'utf8', timeout: 15000, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true, env: claudeEnv() });
+ const out = execFileSync(cli.cmd, [...cli.args, 'auth', 'status', '--json'], { encoding: 'utf8', timeout: 15000, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true, env: cliEnv() });
const email = JSON.parse(out).email;
return typeof email === 'string' && EMAIL.test(email) ? email : null;
} catch { return null; }
@@ -158,18 +191,37 @@ async function joinWaitlist(body) {
// ---------- asking ----------
const nameFor = (id) => { try { return core.q.brief(id)?.name || id; } catch { return id; } };
const running = new Map();
-function describeTool(name, input = {}) {
- const rel = (p) => String(p || '').replace(/\\/g, '/').replace(root.replace(/\\/g, '/') + '/', '');
- if (name === 'Bash') {
- // Claude often chains several lookups in one command; describe each one, by name
- const parts = String(input.command || '').split(/\s*(?:&&|;|\|\|)\s*/).map((c) => /query\.mjs\s+(\w+)\s*(.*)$/.exec(c)).filter(Boolean);
- if (!parts.length) return 'Running a command';
+const rel = (p) => String(p || '').replace(/\\/g, '/').replace(root.replace(/\\/g, '/') + '/', '');
+/** A shell command, in words: map lookups by name, then searches, file reads and listings. */
+function describeCommand(command) {
+ let c = String(command || '');
+ // Codex wraps each command in a shell: bash -lc '…' or powershell.exe -Command "…"
+ const wrapped = /\s-(?:l?c|Command)\s+(["'])([\s\S]*)\1\s*$/i.exec(c);
+ if (wrapped) c = wrapped[2].replace(/\\(["'])/g, '$1');
+ const cmds = c.split(/\s*(?:&&|;|\|\|?)\s*/).filter(Boolean);
+ // agents often chain several lookups in one command; describe each one, by name
+ const parts = cmds.map((x) => /query\.mjs\s+(\w+)\s*(.*)$/.exec(x)).filter(Boolean);
+ if (parts.length) {
const one = ([, cmd, rest]) => {
const a = rest.replace(/--\w+\s+\S+/g, '').replace(/["']/g, '').trim();
- return { overview: 'Reading the map overview', find: `Searching the map for "${a}"`, show: `Looking at ${a.split(/\s+/).map(nameFor).join(', ')}`, path: `Tracing a path ${a.split(/\s+/).map(nameFor).join(' → ')}` }[cmd] || 'Querying the map';
+ return { overview: 'Reading the map overview', find: a ? `Searching the map for "${a}"` : 'Searching the map', show: `Looking at ${a.split(/\s+/).map(nameFor).join(', ')}`, path: `Tracing a path ${a.split(/\s+/).map(nameFor).join(' → ')}` }[cmd] || 'Querying the map';
};
return parts.slice(0, 2).map(one).join(' · ') + (parts.length > 2 ? ` (+${parts.length - 2} more)` : '');
}
+ const first = cmds[0] || '';
+ if (/^(rg|grep|git grep|Select-String|findstr)\b/i.test(first) && !/\s--files\b/.test(first)) {
+ const pat = /\s(["'])(.+?)\1/.exec(first)?.[2] || /\s(?:-Pattern\s+)?([^\s-][^\s]*)/i.exec(first.replace(/^\S+(\s+-\S+)*/, ''))?.[1];
+ return pat ? `Searching code for "${pat}"` : 'Searching code';
+ }
+ if (/^(rg\s.*--files|ls|dir|Get-ChildItem|gci|find|tree)\b/i.test(first)) return 'Listing files';
+ if (/^(cat|type|Get-Content|gc|sed|head|tail|nl|more|less)\b/i.test(first)) {
+ const file = [...first.matchAll(/[\w@.\\/-]+\.\w{1,6}\b/g)].map((m) => m[0]).pop();
+ return file ? `Reading ${rel(file)}` : 'Reading a file';
+ }
+ return 'Running a command';
+}
+function describeTool(name, input = {}) {
+ if (name === 'Bash') return describeCommand(input.command);
if (name === 'Read') return `Reading ${rel(input.file_path)}`;
if (name === 'Grep') return `Searching code for "${input.pattern}"`;
if (name === 'Glob') return `Listing ${input.pattern}`;
@@ -182,22 +234,70 @@ function parseAnswer(ev) {
for (const cand of [t, fence?.[1], t.slice(t.indexOf('{'), t.lastIndexOf('}') + 1)]) { try { const v = JSON.parse(cand); if (v && typeof v === 'object') return v; } catch {} }
return { title: 'Answer', answer: t, items: [] };
}
-function ask(req, res, body) {
- res.writeHead(200, { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-store', Connection: 'keep-alive' });
- const send = (event, data) => res.write(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
- if (!claude) { send('failure', { code: 'cli_missing', message: 'Claude Code CLI not found.' }); return res.end(); }
- const mode = MODES[body.mode] || MODES.ask;
- const args = [...claude.args, '-p', '--output-format', 'stream-json', '--verbose',
- '--json-schema', mode.schema, '--append-system-prompt', mode.instructions,
+const failCode = (msg) => /not logged in|logged out|\/login|log ?in again|sign in|authenticat|unauthori[sz]ed|\b401\b/i.test(msg) ? 'not_logged_in'
+ : /usage limit|rate limit|too many requests|\b429\b/i.test(msg) ? 'rate_limited' : 'cli_error';
+// Claude Code: `claude -p` with read-only tools, answering in the schema; follow-ups resume its session
+function claudeRun(body, mode) {
+ const args = [...cli.args, '-p', '--output-format', 'stream-json', '--verbose',
+ '--json-schema', JSON.stringify(mode.schema), '--append-system-prompt', mode.instructions,
'--tools', 'Read,Grep,Glob,Bash', '--allowedTools', 'Bash(node floorplan/query.mjs:*)', 'Read', 'Grep', 'Glob'];
if (body.session) args.push('--resume', String(body.session));
if (model) args.push('--model', model);
- const child = spawn(claude.cmd, args, { cwd: root, env: claudeEnv(), stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
+ return {
+ args, input: String(body.question || '').slice(0, 4000),
+ onEvent(ev, out) {
+ if (ev.type === 'assistant') for (const c of ev.message?.content || []) if (c.type === 'tool_use') out.progress(describeTool(c.name, c.input));
+ if (ev.type !== 'result') return;
+ if (ev.is_error) out.fail(String(ev.result || ev.subtype || 'Claude Code reported an error'));
+ else out.answer({ ...parseAnswer(ev), session: ev.session_id });
+ },
+ };
+}
+// Codex: `codex exec` in its read-only sandbox, answering in the schema. Runs are ephemeral (nothing lands
+// in the person's Codex history), so a follow-up carries the last few questions and answers with it.
+const convos = new Map();
+function codexRun(body, mode) {
+ const session = convos.has(body.session) ? body.session : crypto.randomBytes(8).toString('hex');
+ const turns = convos.get(session) || [];
+ const question = String(body.question || '').slice(0, 4000);
+ const earlier = turns.length ? `\n\nEarlier in this conversation:\n${turns.map((t) => `Q: ${t.q}\nA: ${t.a}`).join('\n\n')}` : '';
+ const args = [...cli.args, 'exec', '--json', '--sandbox', 'read-only', '--skip-git-repo-check', '--ephemeral',
+ '--output-schema', mode.file, '-C', root];
+ if (model) args.push('--model', model);
+ args.push('-');
+ let last = '', error = '';
+ return {
+ args, input: `${mode.instructions}${earlier}\n\nThe question:\n${question}`,
+ onEvent(ev, out) {
+ if (ev.type === 'item.started' && ev.item?.type === 'command_execution') out.progress(describeCommand(ev.item.command));
+ if (ev.type === 'item.completed' && ev.item?.type === 'agent_message') last = String(ev.item.text || '');
+ if (ev.type === 'error') error = String(ev.message || error);
+ if (ev.type === 'turn.failed') out.fail(String(ev.error?.message || error || 'Codex reported an error'));
+ if (ev.type === 'turn.completed') {
+ const a = parseAnswer({ result: last });
+ convos.set(session, [...turns, { q: question.slice(0, 500), a: String(a.answer || '').slice(0, 1500) }].slice(-4));
+ out.answer({ ...a, session });
+ }
+ },
+ lastError: () => error,
+ };
+}
+function ask(req, res, body) {
+ res.writeHead(200, { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-store', Connection: 'keep-alive' });
+ const send = (event, data) => res.write(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
+ if (!cli) { send('failure', { code: 'cli_missing', message: `${NAME[want]} not found.` }); return res.end(); }
+ const run = (engine === 'codex' ? codexRun : claudeRun)(body, MODES[body.mode] || MODES.ask);
+ const child = spawn(cli.cmd, run.args, { cwd: root, env: cliEnv(), stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
const id = crypto.randomBytes(6).toString('hex');
running.set(id, child);
send('start', { id });
- child.stdin.end(String(body.question || '').slice(0, 4000));
+ child.stdin.end(run.input);
let buf = '', stderr = '', done = false;
+ const out = {
+ progress: (text) => { if (!done) send('progress', { text }); },
+ answer: (data) => { if (!done) { done = true; send('answer', data); } },
+ fail: (message) => { if (!done) { done = true; send('failure', { code: failCode(message), message }); } },
+ };
child.stdout.on('data', (d) => {
buf += d;
let nl;
@@ -205,24 +305,17 @@ function ask(req, res, body) {
const line = buf.slice(0, nl).trim(); buf = buf.slice(nl + 1);
if (!line) continue;
let ev; try { ev = JSON.parse(line); } catch { continue; }
- if (ev.type === 'assistant') for (const c of ev.message?.content || []) if (c.type === 'tool_use') send('progress', { text: describeTool(c.name, c.input) });
- if (ev.type === 'result') {
- done = true;
- if (ev.is_error) {
- const msg = String(ev.result || ev.subtype || 'Claude Code reported an error');
- send('failure', { code: /not logged in|\/login|authenticat/i.test(msg) ? 'not_logged_in' : 'cli_error', message: msg });
- } else send('answer', { ...parseAnswer(ev), session: ev.session_id });
- }
+ run.onEvent(ev, out);
}
});
child.stderr.on('data', (d) => { stderr = (stderr + d).slice(-2000); });
- child.on('error', (e) => { if (!done) { done = true; send('failure', { code: 'cli_error', message: e.message }); } res.end(); });
+ child.on('error', (e) => { out.fail(e.message); res.end(); });
child.on('close', (code) => {
running.delete(id);
- if (!done) send('failure', { code: /not logged in|\/login/i.test(stderr) ? 'not_logged_in' : 'cli_error', message: stderr.trim() || `claude exited with code ${code}` });
+ out.fail(run.lastError?.() || stderr.trim() || `${engine} exited with code ${code}`);
res.end();
});
- // the browser went away (closed tab, Stop): don't leave Claude working. Note req 'close' fires as soon as
+ // the browser went away (closed tab, Stop): don't leave the CLI working. Note req 'close' fires as soon as
// the body is read, so watch the response instead.
res.on('close', () => { if (!done) child.kill(); });
}
@@ -243,7 +336,7 @@ const server = http.createServer((req, res) => {
return;
}
if (req.method === 'GET' && url.pathname === '/api/status') { res.writeHead(200, { 'Content-Type': 'application/json' }); return res.end(JSON.stringify({ tabs: tabs.size, pid: process.pid, hash: selfHash, root })); }
- if (req.method === 'GET' && url.pathname === '/api/health') { res.writeHead(200, { 'Content-Type': 'application/json' }); return res.end(JSON.stringify({ cli: !!claude, version, path: claude?.path || null })); }
+ if (req.method === 'GET' && url.pathname === '/api/health') { res.writeHead(200, { 'Content-Type': 'application/json' }); return res.end(JSON.stringify({ cli: !!cli, engine, want, version, path: cli?.path || null })); }
// requested flows are saved next to the map; build.mjs folds them into graph.json
if (url.pathname === '/api/flows') {
if (req.method === 'GET') { res.writeHead(200, { 'Content-Type': 'application/json' }); return res.end(JSON.stringify({ flows: readFlows() })); }
@@ -315,7 +408,9 @@ server.on('listening', () => {
process.on('exit', forget);
for (const sig of ['SIGINT', 'SIGTERM', 'SIGHUP']) process.on(sig, () => process.exit(0));
console.log(`Floorplan: ${u}`);
- console.log(claude ? `asking via Claude Code CLI ${version || ''} (${claude.path})${model ? `, model ${model}` : ''}` : 'Claude Code CLI not found: the map works, but asking questions needs it (https://docs.claude.com/en/docs/claude-code). Pass --claude <path> if it is installed somewhere unusual.');
+ console.log(cli
+ ? `asking via ${NAME[engine]} ${version || ''} (${cli.path})${model ? `, model ${model}` : ''}`
+ : `${NAME[want]} not found: the map works, but asking questions needs it (${want === 'codex' ? 'https://developers.openai.com/codex' : 'https://docs.claude.com/en/docs/claude-code'}). Pass --${want} <path> if it is installed somewhere unusual.`);
if (!has('no-open')) {
const opener = process.platform === 'win32' ? ['cmd', ['/c', 'start', '', u]] : process.platform === 'darwin' ? ['open', [u]] : ['xdg-open', [u]];
try { spawn(opener[0], opener[1], { stdio: 'ignore', detached: true }).unref(); } catch {}
diff --git a/skills/floorplan/assets/ui/20-health.js b/skills/floorplan/assets/ui/20-health.js
index 609c96a..3663032 100644
--- a/skills/floorplan/assets/ui/20-health.js
+++ b/skills/floorplan/assets/ui/20-health.js
@@ -1,10 +1,11 @@
// Health check panel: plain-language warnings from graph.health (lib/health.mjs) — leaked keys,
// endpoints anyone can call, unused and oversized files — each with "Show on map" and a ready
-// prompt to paste into Claude Code. Talks to the viewer only through window.Floorplan.
+// prompt to paste into Claude Code or Codex. Talks to the viewer only through window.Floorplan.
(() => {
const SC = window.Floorplan;
if (!SC) return;
const { h } = SC;
+ const A = SC.agent || { name: 'Claude', app: 'Claude Code' };
const issues = (SC.graph.health && SC.graph.health.issues) || [];
const SEV = {
@@ -47,15 +48,15 @@
function closeList() { isOpen = false; SC.closePanel(); }
function showOnMap(issue) {
const items = (issue.items || []).filter((id) => SC.exists(id)).map((id) => ({ id, note: (issue.notes && issue.notes[id]) || '' }));
- if (!items.length) { SC.toast('This one isn’t on the map. Use “Fix with Claude” instead.'); return; }
+ if (!items.length) { SC.toast(`This one isn’t on the map. Use “Fix with ${A.name}” instead.`); return; }
if (isOpen) closeList();
SC.showBoard({ title: issue.title, question: issue.detail, items });
}
- function fixWithClaude(issue) {
+ function fixWith(issue) {
SC.modal({
- title: 'Fix with Claude',
- html: `<p class="hc-hint">Copy this request and paste it into <b>Claude Code</b>, opened in your project folder. It explains what to change and asks before anything risky.</p><pre>${h(issue.fix)}</pre>`,
- actions: [{ label: 'Copy prompt', primary: true, icon: 'copy', onClick: () => { SC.copy(issue.fix); SC.toast('Copied. Paste it into Claude Code.'); } }],
+ title: `Fix with ${A.name}`,
+ html: `<p class="hc-hint">Copy this request and paste it into <b>${A.app}</b>, opened in your project folder. It explains what to change and asks before anything risky.</p><pre>${h(issue.fix)}</pre>`,
+ actions: [{ label: 'Copy prompt', primary: true, icon: 'copy', onClick: () => { SC.copy(issue.fix); SC.toast(`Copied. Paste it into ${A.app}.`); } }],
});
}
const onMap = (issue) => (issue.items || []).some((id) => SC.exists(id));
@@ -73,12 +74,12 @@
${locText(issue)}
<div class="hc-a">
${onMap(issue) ? `<button class="btn soft" data-hc-show="${idx}">${SC.iconI('search')}Show on map</button>` : ''}
- <button class="btn soft" data-hc-fix="${idx}">${SC.iconI('spark')}Fix with Claude</button>
+ <button class="btn soft" data-hc-fix="${idx}">${SC.iconI('spark')}Fix with ${A.name}</button>
</div>
</div>`;
const bindIssues = (el) => {
el.querySelectorAll('[data-hc-show]').forEach((b) => b.addEventListener('click', (ev) => { ev.stopPropagation(); showOnMap(issues[+b.dataset.hcShow]); }));
- el.querySelectorAll('[data-hc-fix]').forEach((b) => b.addEventListener('click', (ev) => { ev.stopPropagation(); fixWithClaude(issues[+b.dataset.hcFix]); }));
+ el.querySelectorAll('[data-hc-fix]').forEach((b) => b.addEventListener('click', (ev) => { ev.stopPropagation(); fixWith(issues[+b.dataset.hcFix]); }));
};
const headline = () => urgent ? `${SC.plural(urgent, 'thing')} need${urgent === 1 ? 's' : ''} attention` : issues.length ? 'Nothing urgent' : 'No problems found';
const breakdown = () => `<div class="hc-sub">${ORDER.filter(count).map((s) => `<span><i class="dot" style="background:${SEV[s].color}"></i>${count(s)} ${SEV[s].word}</span>`).join('')}</div>`;
@@ -95,7 +96,7 @@
const list = issues.map((i, idx) => [i, idx]).filter(([i]) => i.severity === sev);
return list.length ? `<div class="sec"><h3>${h(SEV[sev].group)} <span class="c">${list.length}</span></h3>${list.map(([i, idx]) => issueHtml(i, idx)).join('')}</div>` : '';
}).join('');
- const foot = issues.length ? `<div class="sec" style="color:var(--text-3);font-size:12px;line-height:1.6">These are automatic hints. “Fix with Claude” gives you a request to paste into Claude Code; it checks the code before changing anything.</div>` : '';
+ const foot = issues.length ? `<div class="sec" style="color:var(--text-3);font-size:12px;line-height:1.6">These are automatic hints. “Fix with ${A.name}” gives you a request to paste into ${A.app}; it checks the code before changing anything.</div>` : '';
return top + groups + foot;
}
function openList() {
diff --git a/skills/floorplan/assets/ui/50-cloud.js b/skills/floorplan/assets/ui/50-cloud.js
index c2db8a5..83ecc90 100644
--- a/skills/floorplan/assets/ui/50-cloud.js
+++ b/skills/floorplan/assets/ui/50-cloud.js
@@ -69,7 +69,7 @@
view(`<div class="ce">Floorplan Cloud</div><h3>Where should we email you?</h3>
<input type="email" placeholder="[email protected]" autocomplete="email" spellcheck="false" maxlength="254">
<div class="cm"></div>
- <div class="ca"><button class="btn primary" data-send>Notify me</button>${S.cli ? '<button class="btn soft" data-claude>Use my Claude email</button>' : ''}</div>
+ <div class="ca"><button class="btn primary" data-send>Notify me</button>${S.cli && S.engine !== 'codex' ? '<button class="btn soft" data-claude>Use my Claude email</button>' : ''}</div>
<div class="cf">Only this email and your answer (${answer.use === 'team' ? 'with my team' : 'just me'}) are sent, to a private Google Sheet kept by Floorplan's maker. It's used only to tell you when Floorplan Cloud launches. <a href="${PRIVACY}" target="_blank" rel="noopener">Details</a></div>`,
(el) => {
const input = el.querySelector('input'), msg = el.querySelector('.cm'), send = el.querySelector('[data-send]');
diff --git a/skills/floorplan/assets/viewer.html b/skills/floorplan/assets/viewer.html
index e4d8c00..18105e0 100644
--- a/skills/floorplan/assets/viewer.html
+++ b/skills/floorplan/assets/viewer.html
@@ -455,6 +455,13 @@ html.wk svg.dim .node:not(.hl) foreignObject { opacity: .28; }
(() => {
'use strict';
const G = window.FLOORPLAN;
+// who answers questions and takes "Fix with …" prompts: the CLI the map server runs, else the agent that built the map
+const AGENT = (window.FLOORPLAN_SERVER?.engine || window.FLOORPLAN_SERVER?.want || G.meta.agent) === 'codex'
+ ? { id: 'codex', name: 'Codex', app: 'Codex', cli: 'Codex', docs: 'https://developers.openai.com/codex',
+ signIn: 'Open the Codex app (or run <code>codex login</code> in a terminal) to sign in, then ask again.' }
+ : { id: 'claude', name: 'Claude', app: 'Claude Code', cli: 'the Claude Code CLI', docs: 'https://docs.claude.com/en/docs/claude-code/overview',
+ signIn: 'Run <code>claude</code> in a terminal once to sign in, then ask again.' };
+const Cap = (t) => t[0].toUpperCase() + t.slice(1);
if (!G) { document.body.innerHTML = '<p style="padding:2rem">No data. Run build.mjs.</p>'; return; }
if (typeof ELK === 'undefined') { document.body.innerHTML = '<p style="padding:2rem">Could not load the ELK layout engine. Rebuild the map with build.mjs.</p>'; return; }
@@ -1504,9 +1511,9 @@ function renderFlowMenu() {
fm.querySelector('[data-new]').onclick = showFlowForm;
}
function showFlowForm() {
- fm.innerHTML = `<form class="ff"><label>Describe what to trace, and Claude builds a step-by-step flow through the map.</label>
+ fm.innerHTML = `<form class="ff"><label>Describe what to trace, and ${AGENT.name} builds a step-by-step flow through the map.</label>
<textarea placeholder="e.g. How does an order end up charged through Stripe?" spellcheck="false"></textarea>
- ${askState.engine ? '' : '<div class="note">Needs the Claude Code CLI (run node floorplan/serve.mjs) or the Claude app.</div>'}
+ ${askState.engine ? '' : `<div class="note">Needs ${AGENT.cli} (run node floorplan/serve.mjs)${AGENT.id === 'claude' ? ' or the Claude app' : ''}.</div>`}
<div class="ffa"><button type="button" class="btn" data-cancel>Cancel</button><button type="submit" class="btn primary" ${askState.engine ? '' : 'disabled'}>Build flow</button></div></form>`;
const form = fm.querySelector('form'), ta = form.querySelector('textarea');
setTimeout(() => ta.focus(), 30);
@@ -1581,7 +1588,7 @@ async function requestFlow(prompt) {
try {
const raw = askState.engine === 'cli' ? await askViaCli(prompt, progress, 'flow') : await askViaApp(prompt, progress, 'flow');
const steps = (raw.steps || []).map((s) => ({ ref: String(s.id || ''), note: String(s.note || '') })).filter((s) => Q.exists(s.ref));
- if (steps.length < 2) throw { code: 'flow_empty', message: "Claude couldn't find enough connected steps for that. Try naming where it starts or ends." };
+ if (steps.length < 2) throw { code: 'flow_empty', message: `${AGENT.name} couldn't find enough connected steps for that. Try naming where it starts or ends.` };
const fl = { id: 'custom-' + Date.now().toString(36), title: String(raw.title || prompt).slice(0, 80), description: String(raw.description || ''), steps, custom: true };
G.flows.push(fl);
await saveCustomFlow(fl);
@@ -1645,15 +1652,15 @@ function highlightFlow(a, b) {
anim.beginElement?.();
}
-// ======================= ask (Claude Code CLI via serve.mjs, or the Claude app) =======================
+// ======================= ask (Claude Code CLI or Codex via serve.mjs, or the Claude app) =======================
const Q = createGraphQuery(G);
const askState = { engine: null, sample: null, busy: false, ctl: null, session: null, turns: [], last: null };
const askInput = $('#ask-input'), askSend = $('#ask-send'), sheet = $('#ask-sheet'), warn = $('#ask-warn');
-const DOCS = 'https://docs.claude.com/en/docs/claude-code/overview';
+const DOCS = 'https://docs.claude.com/en/docs/claude-code/overview'; // the Claude app's tip: install the CLI
const WARNINGS = {
- no_engine: `Asking needs the <b>Claude Code CLI</b>. From the codebase root run <code>node floorplan/serve.mjs</code>, or open this map in the Claude app.`,
- cli_missing: `Requires the <b>Claude Code CLI</b> installed to work. <a href="${DOCS}" target="_blank" rel="noopener">Install it</a>, then restart <code>serve.mjs</code>.`,
- not_logged_in: `The Claude Code CLI isn't signed in. Run <code>claude</code> in a terminal once to sign in, then ask again.`,
+ no_engine: `Asking needs <b>${AGENT.cli}</b>. From the codebase root run <code>node floorplan/serve.mjs</code>${AGENT.id === 'claude' ? ', or open this map in the Claude app' : ''}.`,
+ cli_missing: `Requires <b>${AGENT.cli}</b> installed to work. <a href="${AGENT.docs}" target="_blank" rel="noopener">Install it</a>, then restart <code>serve.mjs</code>.`,
+ not_logged_in: `${Cap(AGENT.cli)} isn't signed in. ${AGENT.signIn}`,
app_unavailable: `Claude isn't available for this map in this view.`,
not_granted: `Claude access was declined for this map. Reload the page to be asked again.`,
cli_tip: `Install the <b>Claude Code CLI</b> for a better experience: it can read your source code, not just this map. <a href="${DOCS}" target="_blank" rel="noopener">Install it</a>, then run <code>node floorplan/serve.mjs</code> in the codebase.`,
@@ -1672,7 +1679,7 @@ function setEngine(engine, label, warning) {
tag.className = 'engine ' + (engine ? 'ok' : 'warn');
tag.innerHTML = `<i></i>${h(engine ? label : 'Unavailable')}${engine === 'app' ? `<button type="button" class="einfo" title="Install the Claude Code CLI for a better experience" aria-label="About the Claude Code CLI"><svg class="i" viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 8h.01"/></svg></button>` : ''}`;
tag.querySelector('.einfo')?.addEventListener('click', () => setWarning(warn.hidden || !warn.classList.contains('info') ? 'cli_tip' : null));
- tag.title = engine === 'cli' ? 'Answers come from your local Claude Code CLI, which can read the source' : engine === 'app' ? 'Answers come from Claude in the Claude app, using the map (not the source files)' : '';
+ tag.title = engine === 'cli' ? `Answers come from ${AGENT.cli} on this computer, which can read the source` : engine === 'app' ? 'Answers come from Claude in the Claude app, using the map (not the source files)' : '';
askInput.disabled = !engine;
askSend.disabled = !engine;
askInput.placeholder = engine ? `Ask anything about ${G.project.name}…` : 'Asking is unavailable';
@@ -1681,7 +1688,7 @@ function setEngine(engine, label, warning) {
}
async function detectEngine() {
const S = window.FLOORPLAN_SERVER;
- if (S) { S.cli ? setEngine('cli', 'Claude Code' + (S.model ? ' · ' + S.model : '')) : setEngine(null, null, 'cli_missing'); return; }
+ if (S) { S.cli ? setEngine('cli', AGENT.app + (S.model ? ' · ' + S.model : '')) : setEngine(null, null, 'cli_missing'); return; }
if (window.claude?.use) {
setEngine(null, null); $('#ask-engine').innerHTML = '<i></i>connecting…';
let sample = null;
@@ -1759,7 +1766,7 @@ function showFailure(question, code, message, partial) {
if (code === 'not_logged_in' || code === 'not_granted') setWarning(code);
if (code === 'not_granted' || code === 'sampling_disabled') setEngine(null, null, code === 'not_granted' ? 'not_granted' : 'app_unavailable');
if (code === 'cancelled') { sheet.hidden = true; return; }
- const copy = { rate_limited: 'Claude is busy or you have hit a usage limit. Try again in a bit.', not_logged_in: 'The Claude Code CLI needs you to sign in first.', cli_missing: 'Claude Code CLI not found.', invalid_json: "Claude's answer couldn't be read as a map view. Try rephrasing.", session_expired: 'Your Claude session expired. Sign in again.' }[code];
+ const copy = { rate_limited: `${AGENT.name} is busy or you have hit a usage limit. Try again in a bit.`, not_logged_in: `${Cap(AGENT.cli)} needs you to sign in first.`, cli_missing: `${Cap(AGENT.cli)} not found.`, invalid_json: `${AGENT.name}'s answer couldn't be read as a map view. Try rephrasing.`, session_expired: `Your ${AGENT.name} session expired. Sign in again.` }[code];
sheetShell(question, `<p class="err">${h(copy || message || 'Something went wrong.')}</p>${partial ? md(partial) : ''}${code === 'cli_error' && message ? `<p style="font-family:var(--mono);font-size:11px;color:var(--text-3)">${h(message.slice(0, 400))}</p>` : ''}`);
}
function setBusy(b) {
@@ -1950,7 +1957,7 @@ const custom = { panel: null };
function emit(event, data) { for (const fn of ext.listeners[event] || []) { try { fn(data); } catch (e) { console.error('floorplan extension', e); } } }
window.Floorplan = Object.freeze({
version: 1,
- graph: G, query: Q, state,
+ graph: G, query: Q, state, agent: AGENT,
// model helpers
info, chain, children: (id) => visibleKids(id), parentOf: (id) => parentOf.get(id), exists: (id) => Q.exists(id),
files, nodes, routes, colorOf, iconKey,
diff --git a/skills/floorplan/scripts/build.mjs b/skills/floorplan/scripts/build.mjs
index 1b29a61..5e55408 100644
--- a/skills/floorplan/scripts/build.mjs
+++ b/skills/floorplan/scripts/build.mjs
@@ -12,10 +12,12 @@ import { fallbackFileName, fallbackRouteName, routeKey } from './lib/names.mjs';
import { buildHealth } from './lib/health.mjs';
import { buildScreens } from './lib/screens.mjs';
import { writeClaudeMd } from './lib/claudemd.mjs';
+import { detectAgent } from './lib/agent.mjs';
const HERE = path.dirname(fileURLToPath(import.meta.url));
const SKILL_DIR = path.resolve(HERE, '..');
const args = parseArgs(process.argv.slice(2));
+const agent = detectAgent(args);
const root = path.resolve(args._[0] || '.');
const outDir = path.resolve(args.out || mapDir(root));
const archFile = path.resolve(args.arch || path.join(outDir, 'architecture.json'));
@@ -367,7 +369,7 @@ const graph = {
schema: 'floorplan/graph@1',
meta: {
generatedAt: new Date().toISOString(), scanAt: scan.generatedAt, rootName: scan.rootName, root: scan.root,
- audience,
+ audience, agent,
repos: scan.repos.map(({ path: p, name, branch, head, remote }) => ({ path: p, name, branch, head, remote })),
counts: { files: included.length, loc: included.reduce((s, f) => s + f.loc, 0), unassigned: unassigned.length },
},
@@ -434,9 +436,9 @@ const uiScripts = fs.existsSync(uiDir) ? fs.readdirSync(uiDir).filter((n) => n.e
const html = page(graph);
fs.writeFileSync(path.join(outDir, 'index.html'), html);
// --artifact: a copy to publish to the Claude app, without this machine's absolute path (editor links)
-if (args.artifact) fs.writeFileSync(path.join(outDir, 'artifact.html'), page({ ...graph, meta: { ...graph.meta, root: null } }));
-// Self-contained helpers next to the map: ask questions through the Claude Code CLI (serve.mjs)
-// and the graph lookups it hands to Claude (query.mjs). They need only Node, not this skill.
+if (args.artifact) fs.writeFileSync(path.join(outDir, 'artifact.html'), page({ ...graph, meta: { ...graph.meta, root: null, agent: 'claude' } }));
+// Self-contained helpers next to the map: ask questions through the Claude Code CLI or Codex (serve.mjs)
+// and the graph lookups it hands to them (query.mjs). They need only Node, not this skill.
fs.writeFileSync(path.join(outDir, 'query.mjs'), `${graphQuery}
// ---- cli ----
${fs.readFileSync(path.join(SKILL_DIR, 'assets', 'query-cli.mjs'), 'utf8')}`);
@@ -454,8 +456,10 @@ if (graph.screens?.length) report.push(`SCREENS ${graph.screens.length} detecte
report.push(graph.recent
? `RECENT WORK ${graph.recent.items.length} card(s) highlighted across ${graph.recent.tasks.length} task(s)`
: `RECENT WORK none highlighted${fs.existsSync(recentFile) ? '' : ' (no recent-work.json)'}`);
-// point future Claude Code sessions in this project at the map
-if (!args['no-claude-md']) report.push(`CLAUDE.LOCAL.MD ${writeClaudeMd(root, outDir)}`);
+// point future Claude Code sessions in this project at the map. Codex has no personal, uncommitted
+// equivalent (AGENTS.md is shared with the team), so a map built by Codex leaves the project's notes alone.
+if (agent === 'codex') report.push('AGENT Codex: questions on the map run through Codex');
+else if (!args['no-claude-md']) report.push(`CLAUDE.LOCAL.MD ${writeClaudeMd(root, outDir)}`);
report.push(trackedWarning ? `GIT ! ${trackedWarning}` : 'GIT floorplan/ is kept out of git (it ignores itself)');
report.push('');
report.push(`✓ wrote ${path.relative(root, path.join(outDir, 'index.html'))} (${fmtNum(Math.round(html.length / 1024))} KB) and graph.json`);
diff --git a/skills/floorplan/scripts/lib/agent.mjs b/skills/floorplan/scripts/lib/agent.mjs
new file mode 100644
index 0000000..404f0dc
--- /dev/null
+++ b/skills/floorplan/scripts/lib/agent.mjs
@@ -0,0 +1,11 @@
+// Which coding agent is running the skill: Claude Code or Codex. The map records it, so its Ask bar and
+// "Fix with …" prompts name the right one, and serve.mjs answers through the same CLI.
+// --agent claude|codex (or FLOORPLAN_AGENT) decides; otherwise Codex is recognised by the variables it
+// sets for every command it runs, and anything else is taken to be Claude Code.
+export const AGENTS = ['claude', 'codex'];
+
+export function detectAgent(args = {}, env = process.env) {
+ const v = String(args.agent || env.FLOORPLAN_AGENT || '').toLowerCase();
+ if (AGENTS.includes(v)) return v;
+ return env.CODEX_THREAD_ID || env.CODEX_SESSION_ID ? 'codex' : 'claude';
+}
diff --git a/skills/floorplan/scripts/open.mjs b/skills/floorplan/scripts/open.mjs
index d1c2d13..cc7cea6 100644
--- a/skills/floorplan/scripts/open.mjs
+++ b/skills/floorplan/scripts/open.mjs
@@ -2,7 +2,7 @@
// Show the map to the user after a build or refresh. Reuses this map's server if it's running (open tabs
// have already reloaded themselves), restarts it if serve.mjs changed, otherwise starts it in the
// background and opens a browser tab. Prints the URL and how to stop it.
-// usage: node open.mjs [root] [--no-open] [--port N] [--model M] [--claude PATH]
+// usage: node open.mjs [root] [--no-open] [--port N] [--engine claude|codex] [--model M] [--claude PATH] [--codex PATH]
import fs from 'node:fs';
import path from 'node:path';
import crypto from 'node:crypto';
@@ -51,7 +51,7 @@ if (status && status.hash !== hash) {
}
if (!status) {
- const pass = ['port', 'model', 'claude'].flatMap((k) => (args[k] ? ['--' + k, String(args[k])] : []));
+ const pass = ['port', 'engine', 'model', 'claude', 'codex'].flatMap((k) => (args[k] ? ['--' + k, String(args[k])] : []));
if (!args.port && s?.port) pass.push('--port', String(s.port)); // keep the address people have open
fs.mkdirSync(path.dirname(stateFile), { recursive: true });
const log = fs.openSync(path.join(dir, '.cache', 'server.log'), 'w');
@@ -59,7 +59,7 @@ if (!status) {
spawn(process.execPath, [serveFile, '--no-open', '--idle-exit', String(IDLE_MINUTES), ...pass], {
cwd: root, detached: true, stdio: ['ignore', log, log], windowsHide: true,
}).unref();
- // finding the Claude CLI takes a few seconds before the server listens
+ // finding the Claude Code or Codex CLI takes a few seconds before the server listens
for (let i = 0; i < 100; i++) {
await sleep(200);
const n = readState();
@@ -80,7 +80,11 @@ else if (args['no-open']) shown = 'not opened in a browser (--no-open): open the
else shown = openBrowser(s.url) ? 'opened in the browser' : 'could not open a browser: open the URL yourself';
console.log(`FLOORPLAN ${s.url} (${shown})`);
+const CLI = {
+ claude: { name: 'the Claude Code CLI', docs: 'https://docs.claude.com/en/docs/claude-code' },
+ codex: { name: 'Codex', docs: 'https://developers.openai.com/codex' },
+};
console.log(health?.cli
- ? `ASK works: questions run through the Claude Code CLI${health.version ? ' ' + health.version : ''}`
- : 'ASK needs the Claude Code CLI, which was not found; the map itself works (https://docs.claude.com/en/docs/claude-code)');
+ ? `ASK works: questions run through ${CLI[health.engine]?.name || 'the Claude Code CLI'}${health.version ? ' (' + health.version + ')' : ''}`
+ : `ASK needs ${(CLI[health?.want] || CLI.claude).name}, which was not found; the map itself works (${(CLI[health?.want] || CLI.claude).docs})`);
console.log(`SERVER runs in the background, updates open tabs when the map is rebuilt, and stops ${IDLE_MINUTES / 60} hours after the last tab closes. Stop it now: node ${rel}/serve.mjs --stop`);
diff --git a/tests/agents.test.mjs b/tests/agents.test.mjs
new file mode 100644
index 0000000..a87e2bc
--- /dev/null
+++ b/tests/agents.test.mjs
@@ -0,0 +1,56 @@
+// Claude Code and Codex: the skill notices which one is running it, and the map remembers, so its
+// Ask bar and "Fix with …" prompts name the right one. Only Claude Code gets the CLAUDE.local.md note.
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import path from 'node:path';
+import { lib, shopApp, run, readGraph, readJson, cleanup } from './helpers.mjs';
+
+const { detectAgent } = await lib('agent.mjs');
+
+test('Codex is recognised by the variables it sets for every command', () => {
+ assert.equal(detectAgent({}, { CODEX_THREAD_ID: 'abc' }), 'codex');
+ assert.equal(detectAgent({}, { CODEX_SESSION_ID: 'abc' }), 'codex');
+ assert.equal(detectAgent({}, {}), 'claude');
+ assert.equal(detectAgent({}, { CLAUDECODE: '1' }), 'claude');
+});
+
+test('--agent and FLOORPLAN_AGENT override the guess, and nonsense is ignored', () => {
+ assert.equal(detectAgent({ agent: 'codex' }, {}), 'codex');
+ assert.equal(detectAgent({ agent: 'Claude' }, { CODEX_THREAD_ID: 'abc' }), 'claude');
+ assert.equal(detectAgent({}, { FLOORPLAN_AGENT: 'codex' }), 'codex');
+ assert.equal(detectAgent({ agent: 'gpt' }, { CODEX_THREAD_ID: 'abc' }), 'codex');
+});
+
+test('a map built under Codex records it, and leaves the project notes alone', () => {
+ const root = shopApp();
+ try {
+ run('scan.mjs', root);
+ const out = run('build.mjs', root, '--agent', 'codex');
+ assert.equal(readGraph(root).meta.agent, 'codex');
+ assert.match(out, /AGENT {2}Codex/);
+ assert.ok(!fs.existsSync(path.join(root, 'CLAUDE.local.md')), 'no CLAUDE.local.md');
+ assert.ok(!fs.existsSync(path.join(root, 'AGENTS.md')), 'no AGENTS.md');
+ } finally { cleanup(root); }
+});
+
+test('a map built under Claude Code records it, and keeps the CLAUDE.local.md note', () => {
+ const root = shopApp();
+ try {
+ run('scan.mjs', root);
+ run('build.mjs', root, '--agent', 'claude');
+ assert.equal(readGraph(root).meta.agent, 'claude');
+ assert.match(fs.readFileSync(path.join(root, 'CLAUDE.local.md'), 'utf8'), /floorplan\/query\.mjs/);
+ } finally { cleanup(root); }
+});
+
+test('the copy for the Claude app always says Claude, whoever built the map', () => {
+ const root = shopApp();
+ try {
+ run('scan.mjs', root);
+ run('build.mjs', root, '--agent', 'codex', '--artifact', '--no-claude-md');
+ const html = fs.readFileSync(path.join(root, 'floorplan', 'artifact.html'), 'utf8');
+ assert.match(html, /"agent":"claude"/);
+ assert.equal(readJson(path.join(root, 'floorplan', 'graph.json')).meta.agent, 'codex');
+ } finally { cleanup(root); }
+});
diff --git a/tests/ask.test.mjs b/tests/ask.test.mjs
new file mode 100644
index 0000000..86bf67b
--- /dev/null
+++ b/tests/ask.test.mjs
@@ -0,0 +1,130 @@
+// Asking questions on the map: serve.mjs runs the Claude Code CLI or Codex on the person's own sign-in,
+// read-only, and turns their event stream into progress lines and an answer board. Stand-in CLIs
+// (fixtures/fake-cli) record what they were given, so these run without either one installed.
+import { test, before, after } from 'node:test';
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import path from 'node:path';
+import { spawn } from 'node:child_process';
+import { REPO, shopApp, run, cleanup } from './helpers.mjs';
+
+const FAKE = path.join(REPO, 'tests', 'fixtures', 'fake-cli');
+let root;
+const servers = [];
+
+/** Starts the map's server with these environment overrides; returns { base, token, page, log }. */
+async function serve(env) {
+ const log = path.join(root, `fake-${servers.length}.log`);
+ const port = 20000 + Math.floor(Math.random() * 20000);
+ const server = spawn(process.execPath, [path.join(root, 'floorplan', 'serve.mjs'), '--port', String(port), '--no-open'], {
+ cwd: root, env: { ...process.env, FLOORPLAN_NO_PROMPTS: '1', FLOORPLAN_ENGINE: '', FAKE_LOG: log, ...env }, stdio: ['ignore', 'pipe', 'pipe'],
+ });
+ servers.push(server);
+ const base = await new Promise((resolve, reject) => {
+ let out = '';
+ const timer = setTimeout(() => reject(new Error(`server didn't start: ${out}`)), 20000);
+ server.stdout.on('data', (d) => { out += d; const m = /Floorplan: (http:\/\/\S+)/.exec(out); if (m) { clearTimeout(timer); resolve(m[1]); } });
+ server.on('exit', (code) => reject(new Error(`server exited (${code}): ${out}`)));
+ });
+ const html = await (await fetch(base + '/')).text();
+ const page = JSON.parse(/window\.FLOORPLAN_SERVER=(\{.*?\});/.exec(html)[1]);
+ return { base, token: page.token, page, calls: () => fs.readFileSync(log, 'utf8').trim().split('\n').map((l) => JSON.parse(l)) };
+}
+
+/** Asks one question and returns its server-sent events as [{ event, data }]. */
+async function ask(s, question, session) {
+ const r = await fetch(s.base + '/api/ask', { method: 'POST', headers: { 'content-type': 'application/json', 'x-floorplan-token': s.token }, body: JSON.stringify({ question, session }) });
+ return (await r.text()).split('\n\n').filter(Boolean).map((b) => ({ event: /^event: (\w+)/.exec(b)[1], data: JSON.parse(/^data: (.*)$/m.exec(b)[1]) }));
+}
+const pick = (events, name) => events.filter((e) => e.event === name).map((e) => e.data);
+
+// built "by Claude Code" whichever agent runs the tests, so the engine order below is predictable
+before(() => { root = shopApp(); run('scan.mjs', root); run('build.mjs', root, '--no-claude-md', '--agent', 'claude'); });
+after(async () => {
+ // wait for the servers to exit first: on Windows their working folder can't be removed while they run
+ await Promise.all(servers.filter((s) => s.exitCode === null).map((s) => new Promise((resolve) => { s.once('exit', resolve); s.kill(); })));
+ cleanup(root);
+});
+
+test('with only Codex installed, questions run through Codex, read-only and out of its history', async () => {
+ const s = await serve({ FLOORPLAN_CLAUDE: path.join(root, 'no-such-cli'), FLOORPLAN_CODEX: path.join(FAKE, 'fake-codex.mjs') });
+ assert.equal(s.page.engine, 'codex');
+ assert.equal(s.page.cli, true);
+
+ const events = await ask(s, 'How do refunds work?');
+ assert.deepEqual(pick(events, 'progress').map((p) => p.text), ['Searching the map for "refund"', 'Reading shop-api/routes/orders.js']);
+ const [answer] = pick(events, 'answer');
+ assert.equal(answer.title, 'Refunds');
+ assert.deepEqual(answer.items.map((i) => i.id), ['f:shop-api/routes/orders.js']);
+ assert.match(answer.session, /^[0-9a-f]{16}$/);
+
+ const [call] = s.calls();
+ const flag = (name) => call.args[call.args.indexOf(name) + 1];
+ assert.equal(call.args[0], 'exec');
+ assert.equal(flag('--sandbox'), 'read-only');
+ assert.ok(call.args.includes('--ephemeral'), 'nothing is saved to the Codex history');
+ assert.equal(path.resolve(flag('-C')), path.resolve(root));
+ assert.match(call.input, /How do refunds work\?/);
+ assert.match(call.input, /node floorplan\/query\.mjs/);
+});
+
+test('Codex gets an answer schema it accepts: every property required, nothing extra', async () => {
+ const s = await serve({ FLOORPLAN_CLAUDE: path.join(root, 'no-such-cli'), FLOORPLAN_CODEX: path.join(FAKE, 'fake-codex.mjs') });
+ await ask(s, 'What is this?');
+ const { schema } = s.calls()[0];
+ const check = (node, where) => {
+ if (node.type === 'object') {
+ assert.equal(node.additionalProperties, false, where);
+ assert.deepEqual([...node.required].sort(), Object.keys(node.properties).sort(), where);
+ for (const [k, v] of Object.entries(node.properties)) check(v, `${where}.${k}`);
+ }
+ if (node.type === 'array') check(node.items, `${where}[]`);
+ };
+ check(schema, 'answer');
+ assert.ok(schema.required.includes('steps') && schema.required.includes('followups'));
+});
+
+test('a Codex follow-up carries the conversation so far', async () => {
+ const s = await serve({ FLOORPLAN_CLAUDE: path.join(root, 'no-such-cli'), FLOORPLAN_CODEX: path.join(FAKE, 'fake-codex.mjs') });
+ const [first] = pick(await ask(s, 'How do refunds work?'), 'answer');
+ const [second] = pick(await ask(s, 'Who can ask for one?', first.session), 'answer');
+ assert.equal(second.session, first.session);
+ const calls = s.calls();
+ assert.doesNotMatch(calls[0].input, /Earlier in this conversation/);
+ assert.match(calls[1].input, /Earlier in this conversation:\nQ: How do refunds work\?\nA: Refunds go through/);
+ // an unknown session starts a fresh conversation
+ const [other] = pick(await ask(s, 'Start over', 'not-a-session'), 'answer');
+ assert.notEqual(other.session, first.session);
+ assert.doesNotMatch(s.calls()[2].input, /Earlier in this conversation/);
+});
+
+test('a signed-out Codex says so, so the map can tell the person to sign in', async () => {
+ const s = await serve({ FLOORPLAN_CLAUDE: path.join(root, 'no-such-cli'), FLOORPLAN_CODEX: path.join(FAKE, 'fake-codex.mjs') });
+ const [failure] = pick(await ask(s, 'SIGNED-OUT question'), 'failure');
+ assert.equal(failure.code, 'not_logged_in');
+ assert.equal(pick(await ask(s, 'SIGNED-OUT again'), 'answer').length, 0);
+});
+
+test('the Claude Code CLI comes first for a map Claude built, with read-only tools, and follow-ups resume', async () => {
+ const s = await serve({ FLOORPLAN_CLAUDE: path.join(FAKE, 'fake-claude.mjs'), FLOORPLAN_CODEX: path.join(FAKE, 'fake-codex.mjs') });
+ assert.equal(s.page.engine, 'claude');
+ const events = await ask(s, 'How do refunds work?');
+ assert.deepEqual(pick(events, 'progress').map((p) => p.text), ['Reading the map overview', 'Reading shop-api/routes/orders.js']);
+ const [answer] = pick(events, 'answer');
+ assert.equal(answer.session, 'test-session');
+ await ask(s, 'And then?', answer.session);
+ const [first, second] = s.calls();
+ assert.ok(first.args.includes('-p'));
+ assert.deepEqual(first.args.slice(first.args.indexOf('--allowedTools') + 1), ['Bash(node floorplan/query.mjs:*)', 'Read', 'Grep', 'Glob']);
+ assert.equal(first.input, 'How do refunds work?');
+ assert.equal(second.args[second.args.indexOf('--resume') + 1], 'test-session');
+});
+
+test('--engine picks one CLI and never falls back to the other', async () => {
+ const s = await serve({ FLOORPLAN_ENGINE: 'codex', FLOORPLAN_CLAUDE: path.join(FAKE, 'fake-claude.mjs'), FLOORPLAN_CODEX: path.join(root, 'no-such-cli') });
+ assert.equal(s.page.cli, false);
+ assert.equal(s.page.want, 'codex');
+ const [failure] = pick(await ask(s, 'Anything?'), 'failure');
+ assert.equal(failure.code, 'cli_missing');
+ assert.match(failure.message, /Codex not found/);
+});
diff --git a/tests/fixtures/fake-cli/fake-claude.mjs b/tests/fixtures/fake-cli/fake-claude.mjs
new file mode 100644
index 0000000..f5a81be
--- /dev/null
+++ b/tests/fixtures/fake-cli/fake-claude.mjs
@@ -0,0 +1,19 @@
+// Stands in for `claude` in tests: answers --version, and for `-p` logs its arguments and prompt to
+// $FAKE_LOG, then prints the stream-json events a real run would.
+import fs from 'node:fs';
+
+const args = process.argv.slice(2);
+if (args[0] === '--version') { console.log('2.0.0 (Claude Code, test)'); process.exit(0); }
+let input = '';
+process.stdin.on('data', (d) => { input += d; });
+process.stdin.on('end', () => {
+ fs.appendFileSync(process.env.FAKE_LOG, JSON.stringify({ args, input }) + '\n');
+ const out = (ev) => console.log(JSON.stringify(ev));
+ out({ type: 'system', subtype: 'init', session_id: 'test-session' });
+ out({ type: 'assistant', message: { content: [{ type: 'tool_use', name: 'Bash', input: { command: 'node floorplan/query.mjs overview' } }] } });
+ out({ type: 'assistant', message: { content: [{ type: 'tool_use', name: 'Read', input: { file_path: 'shop-api/routes/orders.js' } }] } });
+ out({ type: 'result', subtype: 'success', is_error: false, session_id: 'test-session', structured_output: {
+ title: 'Refunds', answer: 'Refunds go through [[f:shop-api/routes/orders.js]].',
+ items: [{ id: 'f:shop-api/routes/orders.js', note: 'Holds the refund endpoint.' }],
+ } });
+});
diff --git a/tests/fixtures/fake-cli/fake-codex.mjs b/tests/fixtures/fake-cli/fake-codex.mjs
new file mode 100644
index 0000000..1da9274
--- /dev/null
+++ b/tests/fixtures/fake-cli/fake-codex.mjs
@@ -0,0 +1,29 @@
+// Stands in for `codex` in tests: answers --version, and for `exec` logs what it was given (arguments,
+// prompt, output schema) to $FAKE_LOG, then prints the JSONL events a real run would. A prompt containing
+// "SIGNED-OUT" fails the way Codex does when nobody is signed in.
+import fs from 'node:fs';
+
+const args = process.argv.slice(2);
+if (args[0] === '--version') { console.log('codex-cli 0.0.0-test'); process.exit(0); }
+let input = '';
+process.stdin.on('data', (d) => { input += d; });
+process.stdin.on('end', () => {
+ const schemaFile = args[args.indexOf('--output-schema') + 1];
+ fs.appendFileSync(process.env.FAKE_LOG, JSON.stringify({ args, input, schema: JSON.parse(fs.readFileSync(schemaFile, 'utf8')) }) + '\n');
+ const out = (ev) => console.log(JSON.stringify(ev));
+ out({ type: 'thread.started', thread_id: 'test-thread' });
+ out({ type: 'turn.started' });
+ if (input.includes('SIGNED-OUT')) {
+ out({ type: 'error', message: 'You are not logged in. Run codex login.' });
+ out({ type: 'turn.failed', error: { message: 'You are not logged in. Run codex login.' } });
+ return;
+ }
+ out({ type: 'item.started', item: { id: 'item_0', type: 'command_execution', command: `/bin/bash -lc 'node floorplan/query.mjs find "refund"'`, status: 'in_progress' } });
+ out({ type: 'item.started', item: { id: 'item_1', type: 'command_execution', command: `"C:\\\\Windows\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe" -Command "Get-Content shop-api/routes/orders.js"`, status: 'in_progress' } });
+ out({ type: 'item.completed', item: { id: 'item_2', type: 'agent_message', text: 'Let me check the refund route.' } });
+ out({ type: 'item.completed', item: { id: 'item_3', type: 'agent_message', text: JSON.stringify({
+ title: 'Refunds', answer: 'Refunds go through [[f:shop-api/routes/orders.js]].',
+ items: [{ id: 'f:shop-api/routes/orders.js', note: 'Holds the refund endpoint.' }], steps: [], followups: ['Who can ask for one?'],
+ }) } });
+ out({ type: 'turn.completed', usage: { input_tokens: 1, output_tokens: 1 } });
+});
diff --git a/tests/release.test.mjs b/tests/release.test.mjs
index 7eebfc8..5ed5b09 100644
--- a/tests/release.test.mjs
+++ b/tests/release.test.mjs
@@ -20,6 +20,22 @@ test('the marketplace lists this plugin, from this repo', () => {
assert.equal(entry.source, './');
});
+test('the Codex plugin matches the Claude Code plugin and points at the same skill', () => {
+ const codex = readJson(path.join(REPO, '.codex-plugin', 'plugin.json'));
+ assert.equal(codex.name, plugin.name);
+ assert.equal(codex.version, plugin.version, '.codex-plugin/plugin.json version');
+ assert.equal(codex.skills, './skills/');
+ assert.ok(fs.existsSync(path.join(REPO, 'skills', plugin.name, 'SKILL.md')));
+ for (const k of ['composerIcon', 'logo']) assert.ok(fs.existsSync(path.join(REPO, codex.interface[k])), `${k}: ${codex.interface[k]}`);
+});
+
+test('the Codex marketplace lists this plugin, from this repo', () => {
+ const codexMarket = readJson(path.join(REPO, '.agents', 'plugins', 'marketplace.json'));
+ const entry = codexMarket.plugins.find((p) => p.name === plugin.name);
+ assert.ok(entry, `.agents/plugins/marketplace.json lists ${plugin.name}`);
+ assert.deepEqual(entry.source, { source: 'local', path: './' });
+});
+
test('the README version badge matches plugin.json', () => {
assert.match(read('README.md'), new RegExp(`badge/version-${plugin.version.replaceAll('.', '\\.')}-`));
});
diff --git a/tests/serve.test.mjs b/tests/serve.test.mjs
index 36302e6..b3748a5 100644
--- a/tests/serve.test.mjs
+++ b/tests/serve.test.mjs
@@ -12,9 +12,9 @@ before(async () => {
root = shopApp();
scanAndBuild(root);
const port = 20000 + Math.floor(Math.random() * 20000);
- // no Claude CLI and no waitlist card: this only exercises the server itself
+ // no Claude Code or Codex CLI and no waitlist card: this only exercises the server itself
server = spawn(process.execPath, [path.join(root, 'floorplan', 'serve.mjs'), '--port', String(port), '--no-open'], {
- cwd: root, env: { ...process.env, FLOORPLAN_CLAUDE: path.join(root, 'no-such-cli'), FLOORPLAN_NO_PROMPTS: '1' }, stdio: ['ignore', 'pipe', 'pipe'],
+ cwd: root, env: { ...process.env, FLOORPLAN_CLAUDE: path.join(root, 'no-such-cli'), FLOORPLAN_CODEX: path.join(root, 'no-such-cli'), FLOORPLAN_NO_PROMPTS: '1' }, stdio: ['ignore', 'pipe', 'pipe'],
});
base = await new Promise((resolve, reject) => {
let out = '';