clui-cc
AGENTS.md1.2k starsChanged 9 months agoMITView on GitHub
This file is optimized for AI coding agents (Claude Code, Cursor, Copilot, etc.). For human-readable docs see ARCHITECTURE.md and CONTRIBUTING.md. Clui CC is a macOS-only Electron overlay that wraps the Claude Code CLI (claude -p --output-format stream-json) in a floating pill UI. It is NOT a web app, NOT a VS Code extension, and does NOT call the Anthropic API directly — it spawns CLI subprocesses. Main process changes require full restart. Renderer changes hot-reload. All IPC and event types…
Trending
Quiet since March.thin dataabout the whole repository
Who's talking about lcoutodemos/clui-cc
The biggest 1 of 1 mention linking to the repository that our crawl found. Each line is their own headline.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
20 rules. About 0 are common, 5 are distinctive, and 15 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 71
All IPC and event types live in src/shared/types.ts.
- Very specific: line 88
All new IPC channels: must be added to src/shared/types.ts AND wired in both src/preload/index.ts and src/main/index.ts
- Distinctive: line 102
Don't import main-process modules from renderer (or vice versa) — the preload bridge is the only crossing point
- Distinctive: line 103
Don't add network calls — the app is designed to be nearly offline (only marketplace fetches from GitHub)
- Very specific: line 104
Don't use node-pty for new features — it's legacy, prefer RunManager (stdio-based)
- Very specific: line 105
Don't add Electron remote module usage — it's disabled for security
- Very specific: line 110
Add channel name to IPC const in src/shared/types.ts
- Very specific: line 111
Add handler in src/main/index.ts (ipcMain.handle or ipcMain.on)
- Very specific: line 113
Call from renderer via window.clui.*
- Very specific: line 117
Use useColors() for all colors
- Very specific: line 118
Use Phosphor icons (@phosphor-icons/react) — not other icon libraries
- Very specific: line 122
Add raw type to ClaudeEvent union in src/shared/types.ts
- Very specific: line 123
Add normalized form to NormalizedEvent union
- Very specific: line 128
Add to TabState interface in src/shared/types.ts
- Very specific: line 130
Update via ControlPlane events — never directly from renderer
- Distinctive: line 154
No telemetry. No analytics.
- Distinctive: line 158
Forgetting to restart dev server: after main-process changes — renderer hot-reloads but main does not
- Very specific: line 159
Adding raw color values: instead of using useColors() — breaks theming
- Distinctive: line 160
Mutating tab state from renderer: instead of going through ControlPlane events
- Very specific: line 161
Hardcoding IPC strings: instead of using IPC.* constants
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Guide — Clui CC
This file is optimized for AI coding agents (Claude Code, Cursor, Copilot, etc.). For human-readable docs see ARCHITECTURE.md and CONTRIBUTING.md.
What This Project Is
Clui CC is a macOS-only Electron overlay that wraps the Claude Code CLI (claude -p --output-format stream-json) in a floating pill UI. It is NOT a web app, NOT a VS Code extension, and does NOT call the Anthropic API directly — it spawns CLI subprocesses.
Quick Reference
| Action | Command |
| Install deps | npm install |
| Dev mode (hot-reload) | npm run dev |
| Type-check / build | npm run build |
| Toggle overlay | ⌥ + Space (fallback: Cmd+Shift+K) |
| Debug logging | CLUI_DEBUG=1 npm run dev (writes to ~/.clui-debug.log) |
Main process changes require full restart. Renderer changes hot-reload.
Architecture (3-Layer)
Renderer (React 19 + Zustand 5 + Tailwind CSS 4)
↕ contextBridge IPC (src/preload/index.ts)
Main Process (Node.js / Electron 33)
↕ spawns subprocess
Claude Code CLI (claude -p --output-format stream-json)Layer Responsibilities
| Layer | Directory | Manages |
| Renderer | src/renderer/ | UI state, theming, user input, message display |
| Preload | src/preload/ | Typed IPC bridge (window.clui API). Security boundary. |
| Main | src/main/ | Process lifecycle, tab state machine, permission server, marketplace |
Key Files by Concern
| Concern | File(s) |
| Tab lifecycle & state machine | src/main/claude/control-plane.ts |
| Spawning Claude CLI processes | src/main/claude/run-manager.ts |
| Raw NDJSON → canonical events | src/main/claude/event-normalizer.ts |
| Permission hook server | src/main/hooks/permission-server.ts |
| All TypeScript types & IPC channels | src/shared/types.ts |
| Zustand state store | src/renderer/stores/sessionStore.ts |
| Theme / color system | src/renderer/theme.ts |
| Main window & IPC handler setup | src/main/index.ts |
| Marketplace catalog | src/main/marketplace/catalog.ts |
| Skill installer | src/main/skills/installer.ts |
Data Flow: Prompt → Response
InputBar.tsx → window.clui.prompt(tabId, requestId, opts)
→ ipcRenderer.invoke('clui:prompt')
→ ControlPlane.prompt()
→ RunManager spawns: claude -p --output-format stream-json --resume <sid>
→ stdout emits NDJSON lines
→ EventNormalizer → NormalizedEvent
→ ControlPlane broadcasts via IPC
→ useClaudeEvents hook → sessionStore.handleNormalizedEvent()
→ React re-rendersCanonical Types
All IPC and event types live in src/shared/types.ts. Key types:
NormalizedEvent— union of all events the main process emits to the rendererTabState— full state of a single tab (status, messages, permissions, session metadata)TabStatus— state machine:connecting → idle → running → completed/failed/deadIPC— const object with all IPC channel names (use these, never raw strings)RunOptions— options passed when spawning a Claude CLI runCatalogPlugin— marketplace plugin metadata
Conventions & Rules
Must Follow
- TypeScript strict mode — zero errors required (
npm run buildmust pass) - Use
IPC.*constants for all IPC channel names — never hardcode strings - Use
useColors()hook for all color references in renderer — never hardcode colors - Narrow Zustand selectors with custom equality functions for performance
- All new IPC channels must be added to
src/shared/types.tsAND wired in bothsrc/preload/index.tsandsrc/main/index.ts - Tab state transitions go through
ControlPlaneonly — never mutate tab state directly
Security — Do Not Break
- Permission server binds to
127.0.0.1only (never0.0.0.0) - Per-launch app secret (random UUID) validates hook requests — do not weaken
- Per-run tokens route permission responses to correct tab — do not bypass
CLAUDECODEenv var is explicitly removed from spawned processes- Sensitive fields (tokens, passwords, secrets, keys, auth, credentials) are masked via
maskSensitiveFields()before display - 5-minute auto-deny timeout on unanswered permissions — do not remove
Don't
- Don't import main-process modules from renderer (or vice versa) — the preload bridge is the only crossing point
- Don't add network calls — the app is designed to be nearly offline (only marketplace fetches from GitHub)
- Don't use
node-ptyfor new features — it's legacy, preferRunManager(stdio-based) - Don't add Electron
remotemodule usage — it's disabled for security
Adding a New Feature — Checklist
New IPC channel
- Add channel name to
IPCconst insrc/shared/types.ts - Add handler in
src/main/index.ts(ipcMain.handleoripcMain.on) - Expose via
contextBridgeinsrc/preload/index.ts - Call from renderer via
window.clui.*
New UI component
- Create in
src/renderer/components/ - Use
useColors()for all colors - Use Phosphor icons (
@phosphor-icons/react) — not other icon libraries - Animations via Framer Motion
New event type from Claude CLI
- Add raw type to
ClaudeEventunion insrc/shared/types.ts - Add normalized form to
NormalizedEventunion - Handle in
EventNormalizer.normalize()(src/main/claude/event-normalizer.ts) - Handle in
sessionStore.handleNormalizedEvent()(src/renderer/stores/sessionStore.ts)
New tab state field
- Add to
TabStateinterface insrc/shared/types.ts - Initialize in
createTab()in bothControlPlaneandsessionStore - Update via
ControlPlaneevents — never directly from renderer
Stack
| Layer | Tech | Version |
| Desktop | Electron | 33 |
| Build | electron-vite | 3 |
| UI | React | 19 |
| State | Zustand | 5 |
| Styling | Tailwind CSS | 4 |
| Animation | Framer Motion | 12 |
| Icons | Phosphor Icons | 2 |
| Markdown | react-markdown + remark-gfm | 9 / 4 |
| PTY (legacy) | node-pty | 1.1 |
Network Surface
| Endpoint | Purpose | Required |
raw.githubusercontent.com/anthropics/* | Marketplace catalog (cached 5 min) | No |
api.github.com/repos/anthropics/*/tarball/* | Skill auto-install | No |
127.0.0.1:19836 | Permission hook server (local only) | Yes |
No telemetry. No analytics. No auto-update.
Common Pitfalls
- Forgetting to restart dev server after main-process changes — renderer hot-reloads but main does not
- Adding raw color values instead of using
useColors()— breaks theming - Mutating tab state from renderer instead of going through ControlPlane events
- Hardcoding IPC strings instead of using
IPC.*constants - Testing on non-macOS — this is macOS-only (transparent windows, node-pty bindings)
- Not handling the
session_deadevent — if a Claude process crashes, the tab must transition todeadstatus
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

