Fragments in Claude Code and Codex
Check your agent’s UI edits against your design system, draw frames on your own components, and update rules locally with no login.
Install the plugin
Pick your coding agent and run two commands in your terminal. No Fragments account or API key is required.
claude plugin marketplace add fragments-sdk/agent-plugin
claude plugin install fragments@fragmentsRestart any Claude Code session that's already open.
Claude Code
Restart any open Claude Code session after running the commands above so hooks load.
Codex
Choose Trust all and continue when Codex asks to review hooks, or type /hooks and press t.
Verify it’s active
Run claude plugin list or open /plugins in Codex. You should see fragments.
Check it’s working
Ask your agent for a small UI change with a hand-written value, such as “add a footer with padding: 20px”. The agent should name the Fragments finding and either swap in your token or explain why it kept the value.
Before you start
- Node 22.9 or newer. Run
node --version. On macOS, install it from nodejs.org or withbrew install node. - Claude Code or Codex, installed and signed in.
- For Frames: Chrome, Edge, Brave or Chromium.
What it does
The plugin, the Fragments desktop app, and your CI all run the exact same check engine and give the same answer.
| Stage | Agent plugin (no app needed) | With desktop app open |
|---|---|---|
| Before writing UI | Reads your project’s tokens, CSS/SCSS Modules, and components. | Adds live page pictures via see and element-to-source links. |
| After each edit | Flags hand-written colours, sizes, and radii in the same turn. | Same findings, plus visual before-and-after comparison in Changes. |
| Mocking screens | Draws Frames on your real components outside git. | Builds a picked frame via frame_use as one change with Undo. |
| Review & rules | Updates fragments.config.json only after you confirm. | Publishes hosted review links on app.usefragments.com and records turns. |
- It reads CSS, SCSS (including Modules) and class names in React projects. Tested on macOS.
- It does not set up a design system or choose a UI library. A rules file is optional, and the agent starts one only when you ask. See Checks and rules.
What needs the desktop app
Checks, the rules file, and Frames work with the plugin alone. These tools need the Fragments app open on your project:
Show all desktop-connected tools
- Pictures of your pages
seepictures your running pages at the widths and states you name.judgepictures them again after the edit and holds the change to your ask, the drift it added, and a detail audit.- Directions as real code
takebuilds two or three directions, each in its own copy of your app.useapplies the one you pick as one change with Undo.- A picked frame, in one step
frame_usebuilds the frame you picked.- Hosted review links
- Share a frame or page to
app.usefragments.comso teammates pin feedback without installing the app, then pull those notes back into your agent. - Record a turn
- Capture the app window while a turn runs and keep the take locally under
~/.fragments/recordings/.
What it reads and writes
- It reads your project’s source, on your machine.
- It sends nothing off your machine and fetches nothing. What it tells your agent joins the agent’s conversation, like any tool result.
- It writes to your project only after you confirm, and only the files a rules change lists.
Working files live in ~/.claude/plugins/data/fragments-fragments (Claude Code) or ~/.fragments/agent-state (Codex). Remove that folder to delete them. The README lists its contents.
Troubleshooting
“Fragments is off: it needs Node 22.9 or later”
Upgrade node, then restart the session.
Codex says nothing about drift
Trust the hooks: type /hooks and press t. Until then, ask the agent to run check on its edits.
Claude Code shows hook errors
Run node --version in the terminal you start Claude Code from to make sure Node 22.9+ is on PATH.
Started from the Dock
The Claude and Codex apps take PATH from your login shell. Check that node --version works in a new terminal window.
Update
claude plugin marketplace update fragments
claude plugin update fragments@fragmentsOn 0.9.0 or the old CLI? Remove @usefragments/cli and its hooks, so two engines don’t answer. The README lists which old files to review.
Uninstall
claude plugin uninstall fragments@fragments
claude plugin marketplace remove fragments- Claude Code deletes Fragments’ data on uninstall. Add
--keep-datato keep it. - Codex does not. Delete
~/.fragments/agent-stateyourself. - Pictures and frames stay in
~/.fragments/runsand~/.fragments/framesuntil you delete them. - For
fragments@synced, turn it off in Claude’s plugin directory.
Limits
- Shell writes
- A file written with a shell command, such as
cat > file, gets no note after the edit. Only edit tools say which files they changed. - Values the agent names
- If the agent’s closing reply names a drifted value, Fragments treats it as explained and lets the agent finish.
- Very large files
- Files over 1 MB are not checked. Fragments says so once a session, with the reason.
Licence
Free for your own projects, including commercial ones, under the Fragments Local Use License.
Next steps
- Read the full READMEEvery command, file and limit.
- Report an issueOn GitHub.
- Checks and rulesWhat a finding means and how your project treats it.
- FramesMock a screen on your own components before writing code.