claude-code-cli-ui
CLAUDE.md434 starsChanged 8 months agoMITView on GitHub
agents-ui is a Nuxt 3-based visual dashboard for managing Claude Code agents, commands, skills, workflows, and plugins. It provides a GUI layer on top of the ~/.claude directory, allowing users to create, edit, and organize their Claude Code configuration without touching markdown files directly. Pages (app/pages/): - /agents - List and manage agents - /agents/[slug] - Edit individual agent - /commands - List and manage commands - /skills - List and manage skills - /workflows - Visual workflow builder -…
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
16 rules. About 0 are common, 9 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 65
All CRUD routes follow REST conventions:
- Very specific: line 153
Import metadata stored in ~/.claude/.imports.json for update tracking
- Distinctive: line 219
No agent selection required
- Very specific: line 260
All SDK events are normalized to a unified message type with different kind values:
- Distinctive: line 309
No batching (immediate display)
- Distinctive: line 356
When adding new features:
- Very specific: line 357
Test file CRUD operations by checking files are created/updated/deleted in ~/.claude/
- Distinctive: line 358
Test relationship detection by creating agents/commands with cross-references
- Distinctive: line 359
Test Studio chat by verifying SSE events stream correctly
- Distinctive: line 360
Test GitHub imports with real repos (e.g., public skill repos)
- Distinctive: line 361
Test CLI terminal by verifying PTY spawning, WebSocket streaming, and context monitoring
- Very specific: line 362
Test session management by creating/terminating sessions and checking ~/.claude/cli-history/
- Very specific: line 380
All TypeScript types are centralized in app/types/index.ts.
- Distinctive: line 392
All model-related data is centralized in two canonical files.
- Very specific: line 436
Adding a new model: add one entry to MODEL, MODEL_IDS, and MODEL_META.
- Very specific: line 467
No inline model data: No hardcoded rgba() per model in templates.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.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
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
agents-ui is a Nuxt 3-based visual dashboard for managing Claude Code agents, commands, skills, workflows, and plugins. It provides a GUI layer on top of the ~/.claude directory, allowing users to create, edit, and organize their Claude Code configuration without touching markdown files directly.
Development Commands
# Development
bun run dev # Start dev server at http://localhost:3030
npm run dev # Alternative with npm
# Build & Production
bun run build # Build for production
bun run preview # Preview production build
# Type Checking
bun run typecheck # Run TypeScript type checkingArchitecture
Frontend (Nuxt 3 + Vue 3)
Pages (app/pages/):
/agents- List and manage agents/agents/[slug]- Edit individual agent/commands- List and manage commands/skills- List and manage skills/workflows- Visual workflow builder/graph- Relationship visualization/explore- Browse templates and marketplace/cli- Full terminal emulator with context monitoring/settings- Global settings
Composables (app/composables/):
The app uses a centralized CRUD pattern via useCrud.ts which provides standard fetchAll, fetchOne, create, update, remove operations. Domain-specific composables wrap this:
useAgents.ts- Agent CRUD operationsuseCommands.ts- Command CRUD operationsuseSkills.ts- Skill CRUD operationsuseWorkflows.ts- Workflow CRUD operationsuseStudioChat.ts- Agent Studio chat with SSE streaminguseGithubImports.ts- Import skills from GitHub reposuseMarketplace.ts- Browse and install plugins from marketplaceuseTerminal.ts- Terminal emulator with xterm.js integration and WebSocket streaminguseContextMonitor.ts- Real-time context metrics tracking (tokens, cost, files, tools)useCliExecution.ts- CLI session management with agent-aware and standalone modes
Chat/Studio System:
The Agent Studio (/agents/[slug] page with test panel) uses SSE (Server-Sent Events) for streaming responses. The backend (server/api/chat.post.ts) uses the @anthropic-ai/claude-agent-sdk to query agents and stream results back as text_delta, thinking_delta, tool_progress events.
Backend (Nuxt Server API)
File System Layer (server/utils/):
claudeDir.ts- Resolves~/.claudepath (respectsCLAUDE_DIRenv var)frontmatter.ts- Parse/serialize YAML frontmatter + markdown bodyrelationships.ts- Extract relationships between agents/commands/skills by scanning frontmatter (agent:field) and body text for referencesgithub.ts- Clone, scan, and import skills from GitHub reposmarketplace.ts- Fetch and install plugins from marketplace sources
API Routes (server/api/):
All CRUD routes follow REST conventions:
GET /api/agents- List allGET /api/agents/[slug]- Get onePOST /api/agents- CreatePUT /api/agents/[slug]- UpdateDELETE /api/agents/[slug]- Delete
Special endpoints:
POST /api/chat- SSE endpoint for Agent Studio, uses@anthropic-ai/claude-agent-sdkto execute agents with streamingGET /api/relationships- Build graph data by extracting relationshipsGET /api/agents/[slug]/skills- List skills assigned to an agentPOST /api/github/import- Import skills from GitHubPOST /api/marketplace/install- Install plugin from marketplace
Data Model
Agents (~/.claude/agents/*.md):
---
name: Agent Name
description: What the agent does
model: sonnet | opus | haiku
color: "#hex"
memory: user | project | none
---
Agent instructions go here...Commands (~/.claude/commands/**/*.md):
---
name: command-name
description: What the command does
argument-hint: "[optional args]"
allowed-tools: [Read, Write, Edit]
agent: agent-slug # optional, link to agent
---
Command prompt goes here...Skills (~/.claude/skills/[name]/SKILL.md):
---
name: skill-name
description: What the skill does
context: when | always
agent: agent-slug # optional, link to agent
---
Skill prompt goes here...Workflows (~/.claude/workflows/*.json):
{
"name": "Workflow Name",
"description": "Description",
"steps": [
{ "id": "step-1", "agentSlug": "agent-name", "label": "Step label" }
],
"createdAt": "ISO timestamp"
}Key Patterns
Relationship Detection: The system automatically detects relationships between agents/commands/skills by:
- Checking
agent:frontmatter field (links command/skill → agent) - Scanning body text for
subagent_type: "agent-name"patterns - Scanning for
/command-namereferences in agent bodies - Matching direct mentions of agent slugs in text
Studio Chat System:
- Frontend uses
useStudioChat()which streams SSE events - Backend uses
@anthropic-ai/claude-agent-sdk'squery()function - System prompt is either the default "Agent Manager" prompt or the selected agent's instructions
- Session IDs enable conversation continuation across multiple messages
- Tool progress and thinking blocks are streamed incrementally
GitHub Import Flow:
- User provides GitHub URL
- Backend clones repo to temp dir
- Scans for SKILL.md files (checks frontmatter for
type: skill) - User selects which skills to import
- Skills are copied to
~/.claude/skills/[name]/ - Import metadata stored in
~/.claude/.imports.jsonfor update tracking
CLI Terminal System (/cli page):
The CLI provides a full terminal emulator with real-time context monitoring for tracking token usage, costs, file changes, and tool executions.
Architecture
Frontend Components (app/components/cli/):
Terminal.vue- Xterm.js terminal with WebSocket streamingContextPanel.vue- Tabbed context monitoring panel (Metrics, Files, Tools, History)MetricsCard.vue- Token usage, context window, and cost tracking with progress barsFileTree.vue- Real-time file system changes with type indicatorsToolTimeline.vue- Tool execution timeline with status and durationSessionHistory.vue- Active and historical session list
Backend Infrastructure (server/):
server/utils/cliSession.ts- PTY session management with node-ptyserver/utils/contextMonitor.ts- Token parsing, cost calculation, file watching with chokidarserver/api/cli/ws.ts- WebSocket handler for bidirectional terminal I/Oserver/api/cli/sessions/- REST endpoints for session CRUD
WebSocket Protocol
Client → Server Messages:
{ type: 'execute', agentSlug?, workingDir?, cols?, rows? } // Start new session
{ type: 'input', sessionId, data } // Send terminal input
{ type: 'resize', sessionId, cols, rows } // Resize terminal
{ type: 'kill', sessionId } // Terminate sessionServer → Client Events:
{ type: 'session', sessionId } // Session created
{ type: 'output', data } // Terminal output
{ type: 'context_update', metrics } // Full context metrics
{ type: 'token_update', tokens } // Incremental token update
{ type: 'file_change', change } // File system change
{ type: 'tool_call', tool } // Tool execution event
{ type: 'error', error } // Error message
{ type: 'exit', exitCode } // Session terminatedSession Management
Session Storage:
- Active sessions: In-memory Map with PTY instances, metadata, file watchers
- Session history: Saved to
~/.claude/cli-history/{sessionId}.json - Auto-cleanup: Sessions terminate after 30 minutes of inactivity
- Output buffering: Last 10,000 lines stored per session
Context Monitoring:
- Token parsing: Extracts token counts from Claude CLI output patterns
- Cost calculation: Real-time pricing based on model (Sonnet/Opus/Haiku)
- File watching: Chokidar monitors working directory for creates/modifies/deletes
- Tool tracking: Parses tool calls from output with status and elapsed time
Dual Mode Operation
Agent-Aware Mode:
- User selects an agent from dropdown
- Agent's instructions used as system prompt
- Agent's model and settings applied
- Session linked to agent in history
Standalone Mode:
- No agent selection required
- Default shell environment
- Independent session tracking
- Quick terminal access
Key Features
- Full Terminal Emulation: Uses xterm.js + node-pty for complete shell experience
- Real-time Metrics: Live token counting, cost tracking, context window visualization
- File System Monitoring: Automatic detection of file changes during execution
- Tool Timeline: Visual timeline of all tool calls with status and duration
- Session Persistence: Sessions saved to disk with full output history
- Responsive UI: 60/40 split view (terminal/context) with collapsible panels
Claude Code Chat Mode (/cli page - Chat tab):
The Chat mode provides a web-based chat interface that directly integrates with the Claude Code SDK for conversational interactions.
Architecture
Frontend Components (app/components/cli/chat/):
ChatInterface.vue- Main chat container with message list and inputChatMessages.vue- Message list rendererMessageItem.vue- Individual message component with markdown, tool rendering, thinking blocksChatInput.vue- Textarea input with auto-resize and keyboard shortcuts
Backend Infrastructure:
server/api/chat/ws.ts- WebSocket handler for bidirectional chat communicationserver/utils/claudeSdk.ts- Direct integration with@anthropic-ai/claude-agent-sdkserver/utils/messageNormalizer.ts- Converts SDK events to unified NormalizedMessage formatserver/utils/chatSessionStorage.ts- JSONL-based session persistenceserver/api/chat/sessions/- REST endpoints for session CRUD
Frontend Composables:
useChatSessions.ts- Session state management with message storeuseWebSocketChat.ts- WebSocket client with auto-reconnect and streaming handling
Message System
NormalizedMessage Format:
All SDK events are normalized to a unified message type with different kind values:
text- User or assistant text messagesthinking- Extended thinking blocks (collapsible)tool_use- Tool being called with parameterstool_result- Tool execution resultstream_delta- Streaming text chunks (accumulated in real-time)stream_end- Stream complete signalcomplete- Query finishederror- Error occurred
Message Flow:
User types message
↓
WebSocket: { type: 'start', message, sessionId, agentSlug }
↓
Backend calls query() from SDK
↓
SDK events normalized to NormalizedMessage
↓
Sent via WebSocket to client
↓
Frontend accumulates streaming text
↓
Display in ChatMessages component
↓
Save to JSONL file (~/.claude/chat-sessions/{sessionId}.jsonl)Session Storage
Format: JSONL (JSON Lines)
- One message per line
- Append-only for performance
- Stored in
~/.claude/chat-sessions/{sessionId}.jsonl
Pagination:
- Initial load: Last 50 messages
- "Load more" button fetches older messages
- Pagination managed by backend
Streaming Implementation
Buffered Updates:
- Stream deltas accumulated in
streamingTextref - Real-time display with cursor animation
- Finalized to permanent message on
stream_end
Performance:
- No batching (immediate display)
- Single streaming message at a time
- Auto-scroll to bottom on new messages
UI Features
Message Display:
- User messages: Right-aligned, blue background
- Assistant messages: Left-aligned, markdown rendering
- Tool use: Collapsible sections with parameters/results
- Thinking blocks: Collapsed by default, expandable
- Errors: Red highlighted banners
Input Composer:
- Auto-resizing textarea (max 200px height)
- Enter to send, Shift+Enter for newline
- Character counter
- Disabled during streaming
Status Indicators:
- Connected/Disconnected badge
- "Generating..." indicator during streaming
- Animated thinking dots before text appears
Agent Integration
Agent-Aware Mode:
- Agent selector in top bar
- Agent instructions passed as
systemPromptto SDK - Agent slug saved with session
- Sessions linked to agents in history
Standalone Mode:
- No agent selection required
- Default SDK behavior
- Quicker access for ad-hoc queries
Mode Toggle
The /cli page has tabs to switch between:
- Terminal - Full PTY terminal emulator
- Chat - Conversational Claude Code interface
Both modes share the same agent selector and working directory settings.
Testing
When adding new features:
- Test file CRUD operations by checking files are created/updated/deleted in
~/.claude/ - Test relationship detection by creating agents/commands with cross-references
- Test Studio chat by verifying SSE events stream correctly
- Test GitHub imports with real repos (e.g., public skill repos)
- Test CLI terminal by verifying PTY spawning, WebSocket streaming, and context monitoring
- Test session management by creating/terminating sessions and checking
~/.claude/cli-history/
Environment Variables
CLAUDE_DIR="~/.claude" # Override default Claude config directoryComponent Organization
Components in app/components/ are auto-imported with special prefixing:
chat/*- Chat UI components (no prefix)studio/*- Agent Studio components (no prefix)cli/*- CLI terminal components (no prefix)- Everything else - Standard component naming
Type Definitions
All TypeScript types are centralized in app/types/index.ts. Key types:
Agent,Command,Skill,Workflow- Core entitiesRelationship- Links between entitiesChatMessage,StreamActivity- Studio chatGithubImport,Plugin- External integrationsCliSession,ContextMetrics,TokenUsage,FileChange,ToolCall- CLI terminal and monitoringCliWebSocketMessage,CliWebSocketEvent- Terminal WebSocket typesNormalizedMessage,ChatSession,ChatSessionSummary- Chat mode typesChatWebSocketMessage,ChatWebSocketEvent- Chat WebSocket types
Model Registry Design
All model-related data is centralized in two canonical files. Never inline model colors, labels, pricing, option lists, or model string comparisons elsewhere.
Frontend — app/utils/models.ts
Single source of truth for all UI-facing model metadata:
// ✅ Use these in all .vue files and app/utils/
import {
MODEL, // { OPUS, SONNET, HAIKU } — named constants for comparisons/defaults
MODEL_IDS, // ['opus', 'sonnet', 'haiku'] — canonical list for iteration
MODEL_META, // Full per-model metadata (label, description, colors, etc.)
MODEL_OPTIONS, // Options array for picker UIs (includes "Default" entry)
MODEL_OPTIONS_COMPACT, // Compact options for toggle-button pickers
MODEL_OPTIONS_CHAT, // Options with { value, label, description } for chat selectors
DEFAULT_MODEL, // 'sonnet' — default when no model is specified
getModelLabel, // Human-readable label
getModelTagline, // One-liner ("Balanced", "Most capable", ...)
getModelColor, // Hex color for charts/bars
getModelBadgeClasses, // Tailwind bg+text classes for badges
getModelBadgeStyle, // Inline style object (use in templates with dynamic binding)
} from '~/utils/models'Comparisons and defaults — always use constants, never raw strings:
// ✅ Correct
import { MODEL, DEFAULT_MODEL } from '~/utils/models'
const selectedModel = ref(DEFAULT_MODEL) // not ref('sonnet')
if (model === MODEL.SONNET) { ... } // not if (model === 'sonnet')
frontmatter.model = MODEL.OPUS // not frontmatter.model = 'opus'
// ✅ Iterating all models
import { MODEL_IDS } from '~/utils/models'
MODEL_IDS.map(id => ({ value: id, label: MODEL_META[id].label }))
// ❌ Never
const selectedModel = ref('sonnet')
if (model === 'opus') { ... }Each ModelMeta entry contains: label, tagline, description, badgeBg, badgeText, color, contextWindow.
Adding a new model: add one entry to MODEL, MODEL_IDS, and MODEL_META. All downstream UI automatically picks it up.
Server — server/utils/models.ts
Server-side mirror with pricing and API model IDs:
import {
MODEL_ALIAS_KEY, // { OPUS, SONNET, HAIKU } — named alias key constants
DEFAULT_MODEL_ALIAS, // 'sonnet' — server-side default
SERVER_MODEL_META, // Full pricing + context window per model id
MODEL_ALIAS, // 'sonnet' → 'claude-sonnet-4' mapping (full ids)
getModelPricing, // Pricing for cost calculation
getModelContextWindow, // Context window for utilization tracking
resolveModelMeta, // Resolve alias OR full id → ServerModelMeta
} from './models' // (relative import from server/utils/)// ✅ Correct (server-side)
import { MODEL_ALIAS_KEY } from '../models'
models: Object.values(MODEL_ALIAS_KEY) // not ['sonnet', 'opus', 'haiku']
if (model === MODEL_ALIAS_KEY.SONNET) // not if (model === 'sonnet')Updating pricing: edit SERVER_MODEL_META in server/utils/models.ts only.
Design Principles
- One edit = one place: Adding a model → edit
MODEL/MODEL_IDS/MODEL_META(frontend) andMODEL_ALIAS_KEY/MODEL_ALIAS/SERVER_MODEL_META(server). All consumers update automatically. - No raw string literals in logic: String literals (
'sonnet','opus') live only inmodels.tsdefinitions. Every comparison and default elsewhere is aMODEL.Xconstant. - No inline model data: No hardcoded
rgba()per model in templates. No{ opus: '...', sonnet: '...', haiku: '...' }spread across components. - Frontend/server split: App utils cannot be imported server-side (different module context). Each layer has its own registry file.
- Backwards compat: Legacy helpers (e.g.,
getFriendlyModelNameinterminology.ts) are kept with@deprecatedJSDoc and delegate to the new helpers.
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.

