aTerm
CLAUDE.md19 starsChanged 10 months agoMITView on GitHub
Agent-focused terminal workspace built with Tauri (Rust) + React + xterm.js. VSCode terminal (~/dev/ascent/src/vs/workbench/contrib/terminal/) — gold standard for xterm.js usage: - browser/xterm/xtermTerminal.ts — xterm.js wrapper, renderer selection, addon management - browser/terminalInstance.ts — write path, data segmentation, flush handling - browser/terminalProcessManager.ts — flow control, ack batching, process lifecycle - common/terminalConfiguration.ts — all terminal config options codemirror-rich-markdoc (github.com/segphault/codemirror-rich-markdoc) — reference for CM6 rich markdown editing (Obsidian-style): - src/richEdit.ts — decoration plugin pattern: collect Range<Decoration>[], use Decoration.set(widgets) for auto-sorting - src/renderBlock.ts — block…
The file
We split this CLAUDE.md into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 85
Commit form: Write commit message, commit, or commit & push
- Very specific: line 167
Use cn() for conditional classes: cn("base", condition && "active")
- Distinctive: line 168
Prefer shadcn components over custom implementations
- Very specific: line 169
Use semantic color names (bg-primary not bg-purple-500)
- Very specific: line 170
Use semantic z-index names (z-modal not z-50)
- Distinctive: line 202
Keep tightly coupled logic in one file (e.g., a component + its small helpers)
- Distinctive: line 203
Don't split just to hit 300 lines if it hurts readability
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 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
aTerm
Agent-focused terminal workspace built with Tauri (Rust) + React + xterm.js.
Reference Implementations
VSCode terminal (~/dev/ascent/src/vs/workbench/contrib/terminal/) — gold standard for xterm.js usage:
browser/xterm/xtermTerminal.ts— xterm.js wrapper, renderer selection, addon managementbrowser/terminalInstance.ts— write path, data segmentation, flush handlingbrowser/terminalProcessManager.ts— flow control, ack batching, process lifecyclecommon/terminalConfiguration.ts— all terminal config options
codemirror-rich-markdoc (github.com/segphault/codemirror-rich-markdoc) — reference for CM6 rich markdown editing (Obsidian-style):
src/richEdit.ts— decoration plugin pattern: collectRange<Decoration>[], useDecoration.set(widgets)for auto-sortingsrc/renderBlock.ts— block widget replacements for complex elements- Uses
cm-markdoc-hiddenCSS class pattern for hiding syntax characters
Architecture
src/ # React frontend
├── components/
│ ├── git/ # Git panel components
│ │ ├── GitPane.tsx # Main git panel container
│ │ ├── GitPanelTabs.tsx # Changes/History tab switcher
│ │ ├── FileChanges.tsx # Staged/Unstaged/Untracked sections
│ │ ├── FileItem.tsx # File row with stage/unstage actions
│ │ ├── DiffViewer.tsx # Unified diff display
│ │ ├── CommitForm.tsx # Commit message + buttons
│ │ ├── CommitHistory.tsx # Scrollable commit list
│ │ └── CommitItem.tsx # Expandable commit with files
│ ├── agent-config/ # Agent config pane components
│ │ ├── AgentConfigPane.tsx # Main pane container with editor
│ │ └── AgentConfigSidebar.tsx # Sidebar listing config files by agent
│ ├── AddProjectModal.tsx # Project creation (browse/clone)
│ ├── ProjectSidebar.tsx # Left sidebar with project list
│ ├── SettingsModal.tsx # Settings with tabs (Appearance, Profiles, Layouts)
│ ├── TerminalLayout.tsx # Pane grid with resize, context menu, maximize
│ └── TerminalPane.tsx # Individual terminal (xterm.js wrapper)
├── context/
│ └── ThemeContext.tsx # Theme provider with localStorage persistence
├── lib/
│ ├── agent-config.ts # Agent config file definitions per tool
│ ├── config.ts # AppConfig, ProjectConfig types
│ ├── git.ts # Git types (GitStatus, GitFile, CommitSummary)
│ ├── layouts.ts # Layout, LayoutRow, LayoutPane types
│ ├── profiles.ts # TerminalProfile type, defaults
│ ├── providers.ts # AI provider registry
│ └── themes.ts # Theme definitions
├── App.tsx # Main app with project/terminal state
└── main.tsx # Entry point
src-tauri/src/
└── lib.rs # Rust backend (PTY, config, git, filesystem)Key Patterns
Terminal Persistence
Terminals stay alive when switching projects. App.tsx tracks openedProjects Set and renders all opened projects, hiding inactive ones with display: none.
Pane Maximize
Uses CSS positioning, not conditional rendering. Maximized pane gets position: absolute to cover container, others get visibility: hidden. No unmounting.
Keyboard Shortcuts in Terminal
xterm.js captures keyboard events. Use onKeyDownCapture on container div to intercept before xterm. Store callbacks in refs to avoid stale closures.
Event Handlers Across Projects
Global event handlers (Cmd+W via Tauri listen, Cmd+D via window.addEventListener) must use refs for isProjectActive, focusedPaneId, and layout — not closure values. Multiple TerminalLayout instances are mounted simultaneously (hidden via CSS), so stale closures can execute shortcuts in the wrong project. Pattern: register listener once ([] deps), read ref.current inside callback.
Smooth Output (PTY Write Batching)
PtyWriteBatcher in terminal-pane/pty-write-batcher.ts coalesces rapid PTY output into one terminal.write() per animation frame. Mitigates Claude Code's screen redraw flicker (anthropics/claude-code#367). Gated behind Settings > Appearance > Smooth Output. Uses a module-level smoothOutputEnabled flag (set by App.tsx, read by TerminalPane) to avoid prop drilling.
Profile/Layout System
- Profiles: Reusable terminal configs (id, name, command, color, type)
type: "terminal"(default) - xterm.js terminal panetype: "git"- Git panel with status, staging, commits
- Layouts: Pane arrangements with rows containing panes, each referencing a profile
- Projects: Reference a layout by ID
GitPane
Non-terminal pane type for git operations. Features:
- Changes tab: View staged/unstaged/untracked files, stage/unstage, view diffs
- History tab: Browse commit history, expand to see changed files, view diffs
- Commit form: Write commit message, commit, or commit & push
- Status auto-polls every 5 seconds
AgentConfigPane
Dedicated pane for viewing/editing AI agent config files (CLAUDE.md, AGENTS.md, .cursorrules, etc.). Toggle via Cmd+Shift+A or sidebar bot icon. Features:
- Sidebar: Config files grouped by agent (Claude, Codex, Cursor, Copilot, etc.) with existence indicators
- Create: One-click creation of missing config files with sensible defaults
- Editor: Reuses MarkdownEditor for .md files, CodeEditor for .json — same editors as EditorPane
- Config file definitions live in
src/lib/agent-config.ts(easy to extend with new agents/files)
Config
Stored in ~/.config/aterm/config.json as flexible JSON. Rust backend uses serde_json::Value, frontend defines schema.
interface AppConfig {
projects: ProjectConfig[];
profiles: TerminalProfile[];
layouts: Layout[];
defaultProvider: ProviderId;
defaultLayoutId: string;
}Commands
npm run tauri dev # Development
npm run tauri build # Production buildStandards
- Conventional commits (feat, fix, docs, etc.)
- TypeScript strict mode
- Tailwind CSS + shadcn/ui for styling (following LumifyHub conventions)
- Always run
npx tsc --noEmitafter finishing a feature to catch type errors before committing
Design System
Uses Tailwind CSS + shadcn/ui, following the same conventions as LumifyHub:
Structure
src/
├── components/ui/ # shadcn components (Button, Dialog, etc.)
├── lib/utils.ts # cn() utility for class merging
└── styles/globals.css # Tailwind + CSS variablesAdding shadcn components
npx shadcn@latest add button dialog dropdown-menuCSS Variables (HSL format)
Themes are defined in globals.css with CSS variables:
--background,--foreground- Base colors--primary,--secondary,--muted,--accent- UI colors--destructive- Danger/error states--border,--input,--ring- Form elements
Theme Switching
Set data-theme attribute on <html>:
midnight(default),dracula,nord,tokyoNight,gruvbox,oneDark,catppuccin,monokai,solarized,rosePine
Z-Index Scale
Semantic z-index layers defined in tailwind.config.ts. Never use raw z-index values (z-10, z-50, etc.) — always use semantic names.
| Class | Value | Usage |
z-sticky | 100 | Sticky headers, fixed sidebars |
z-dropdown | 200 | Dropdown menus, maximized panes |
z-popover | 300 | Popovers, context menus, floating panels |
z-popover-nested | 400 | Selects inside popovers |
z-modal | 500 | Modal dialogs, overlays |
z-modal-nested | 600 | Selects/dropdowns inside modals |
z-toast | 700 | Toast notifications |
z-tooltip | 800 | Tooltips (highest regular layer) |
z-max | 9999 | Escape hatch for edge cases |
Conventions (from LumifyHub)
- Use
cn()for conditional classes:cn("base", condition && "active") - Prefer shadcn components over custom implementations
- Use semantic color names (
bg-primarynotbg-purple-500) - Use semantic z-index names (
z-modalnotz-50)
File Size Rules
Target: Keep files under 300 lines. Large files are harder to understand, test, and maintain.
How to Split Components
- Extract sub-components into sibling files:
components/ ├── TerminalLayout.tsx # Main orchestrator (~200 lines) ├── terminal-layout/ # Sub-components │ ├── SortablePane.tsx │ ├── RowWithResizer.tsx │ └── DropZones.tsx - Extract hooks for complex state/effects:
hooks/ ├── useTerminalInstance.ts # xterm.js lifecycle ├── usePaneResize.ts # Drag resize logic - Extract types into separate files when shared:
lib/ ├── types/terminal.ts
What Stays Together
- Keep tightly coupled logic in one file (e.g., a component + its small helpers)
- Don't split just to hit 300 lines if it hurts readability
- Data files (themes.ts) can be longer - they're config, not logic
Current Violations (to fix)
TerminalLayout.tsx(1028 lines) → Split pane/row componentsSettingsModal.tsx(935 lines) → Split tab contentsTerminalPane.tsx(690 lines) → Extract hooksAddProjectModal.tsx(528 lines) → Split clone/browse sectionsApp.tsx(452 lines) → Extract handlers into hooks
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.

