NOTE: This file contains shared instructions for all AI agents working on Auto-Terminal.
Agent-Specific Instructions:
- Claude agents: Read
CLAUDE.mdafter this file- Gemini agents: Read
GEMINI.mdafter this file
- Code Exploring: Use Glob/Grep for targeted searches. Read
PROJECT_STRUCTURE.mdfirst for high-level overview. - Process Management: NEVER kill processes directly. Use
npx kill-port {ports} - Task Completion: Always ensure successful build after changes
- Commits: Commit on task completion. Follow project commit message style.
- Testing: 80%+ coverage for new code. Run tests before committing.
Load detailed docs from docs/agentic/ based on task:
| Phase | File | When to Load |
|---|---|---|
| Setup | 01-setup.md |
Environment setup, installation issues, first-time setup |
| Architecture | 02-architecture.md |
Understanding codebase, design patterns, component relationships |
| Coding | 03-coding.md |
Writing code, Rust/TypeScript standards, design principles |
| Testing | 04-testing.md |
Creating tests, coverage requirements, test strategies |
| Debugging | 05-debugging.md |
Troubleshooting, performance issues, bug investigation |
| Operations | 06-operations.md |
Building, deployment, CI/CD, production concerns |
- Read relevant phase documentation (see table above)
- Consider edge cases and failure modes
- Ensure test coverage for new functionality
- SOLID, DRY, KISS, YAGNI - Details in
docs/agentic/03-coding.md - File size limit: ~1,200 lines per file
- Test coverage: 80%+ for new code
- Follow conventional commit format when possible
- Include issue/ticket numbers if applicable
- NO "Generated with Claude Code" or "Generated by AI" signatures
This section helps differentiate Master Agent from regular development.
You are the Master Agent if ANY of these are true:
- User explicitly invoked
/t-as-master(Claude) or equivalent orchestration command - User said "act as master agent" or similar
- Your task/todo list contains "MASTER AGENT MODE ACTIVE"
Master Agent Rules:
- READ
docs/agentic/master-agent.mdimmediately for full protocol - NEVER write code directly — delegate to Implementer Agent
- NEVER create tests directly — delegate to Test Analyst Agent
- ALWAYS maintain orchestration state in TodoWrite/task tracking
- After context limit/compaction: Check task state, re-read
master-agent.mdif needed
You are in direct implementation mode if:
- User asked you to implement a feature without orchestration
- No master agent context in conversation
- User wants quick, focused implementation
Direct Implementation Rules:
- READ relevant phase docs before starting
- WRITE code following standards in
docs/agentic/03-coding.md - CREATE tests as specified in
docs/agentic/04-testing.md - RUN tests and ensure they pass
- UPDATE documentation if needed
- Always refer to
/docs/auto-terminal/implementation.mdand/docs/auto-terminal/changelogs.mdfor progress tracking - When completing tasks, update the relevant documentation files in
/docsfolder - Use "npx kill-port [port]" to kill a running process when troubleshooting
- Always check eslint accordingly
- Organize documents in the structure
/docs/[project]/[phase]
Auto-Terminal Orchestration Platform is a comprehensive AI agent development ecosystem consisting of three integrated projects:
A cross-platform terminal emulator built with Tauri (Rust backend) and React/TypeScript frontend. Provides advanced tabbed and split-view UI with rich developer APIs for automation and integration. Embeds multiple shells (cmd, PowerShell, Git Bash) with real-time event hooks and programmatic control.
Status: Migrated from Electron to Tauri. The Electron implementation is now obsolete.
A React-based web application (/terminal-monitor/) for monitoring and controlling headless Auto-Terminal instances. Features JWT authentication, real-time WebSocket monitoring, and multi-terminal management capabilities.
A server-based application (/agent-monitor/) for provisioning and monitoring AI agents (Claude Code, Gemini, etc.) running in terminals. Enables intelligent team coordination, task distribution, and session persistence for collaborative development workflows.
Terminal Rendering: Uses modern @xterm/* packages (v5.5.0) for optimal performance, including WebGL rendering support for enhanced display and reduced CPU usage.
# Development Setup
npm install # Install dependencies
npm run dev # Start development (Tauri + renderer)
npm run dev:renderer # Start renderer dev server only
# Building
npm run build # Build all components
npm run build:tauri # Build Tauri application
npm start # Start built application
# Testing
npm test # Run Jest unit tests
npm run test:e2e # Run Playwright E2E tests
npm run test:e2e:headed # Run E2E tests with browser UI
npm run test:e2e:debug # Debug E2E tests
npm run test:all # Run all tests (unit + E2E)
# Rust Backend
cd src-tauri
cargo build # Build Rust backend
cargo test # Run Rust tests
cargo clippy # Lint Rust codecd terminal-monitor
# Development
npm install # Install dependencies
npm start # Start React development server
npm run build # Build production bundle
npm test # Run testscd agent-monitor
# Setup
npm install # Install dependencies
npm run build # Build TypeScript
cp env.example .env # Configure environment
# Operation
npm start # Start monitoring
npm run team:start <config> # Start team orchestration
npm run team:session <config> # Check team status
npm run team:start <config> --resume # Resume session# 1. Start core platform with API
npm run dev
# 2. Launch web monitoring (separate terminal)
cd terminal-monitor && npm start
# 3. Start AI agent team (separate terminal)
cd agent-monitor && npm run team:start team-config.json
# Access web interface at http://localhost:3000
# API endpoints available at http://localhost:3001
# WebSocket events on ws://localhost:9876The three projects form a comprehensive orchestration ecosystem:
- Auto-Terminal - Core platform providing terminal infrastructure and APIs
- Terminal-Monitor - Web client for monitoring and controlling terminals
- Agent-Monitor - AI orchestration server for team coordination
- ACTIVE:
src-tauri/(Rust backend using Tauri framework) - OBSOLETE:
src/main/(Electron main process),src/api/(Node.js API server) - SHARED:
src/renderer/(React frontend, works with Tauri)
Core Components:
- lib.rs: Main entry point, command registration
- state.rs: Application state (thread-safe)
- pty_manager.rs: Terminal process management using portable-pty
- api_server.rs: Embedded Axum API server for external integration
- commands.rs: Tauri command handlers (IPC layer)
- components/Terminal/: xterm.js integration, terminal display
- components/Tabs/: Tab management UI
- components/Panes/: Split pane layout
- store/: Redux state management (tabs, panes, settings)
- services/: Business logic (TerminalService, etc.)
- React Frontend: Web-based monitoring interface
- Redux Store: State management for terminals and authentication
- WebSocket Client: Real-time communication with Auto-Terminal
- JWT Authentication: Secure API access with automatic token refresh
- Team Orchestrator: Core coordination logic
- Agent Detection: AI agent identification and monitoring
- Session Persistence: Save/restore team state
- ChatHub Integration: Communication layer for agent coordination
Current Implementation (Tauri/Rust):
- portable-pty: Cross-platform PTY abstraction
- Process spawning: Rust-based process management
- I/O handling: Async reads/writes using Tokio
- Platform support: Windows (ConPTY), macOS/Linux (native PTY)
Legacy (Obsolete):
src/shell/PTYManager.ts: Old Node.js implementationsrc/shell/pty-wrapper.ts: Electron-based PTY wrapper
Frontend (Redux Toolkit):
tabsSlice: Tab creation, selection, and managementpanesSlice: Split pane layout and terminal assignmentssettingsSlice: Shell profiles, themes, and user preferences
Backend (Rust):
AppState: Shared application state usingArc<Mutex<>>- Thread-safe access to PTY manager and API server state
- xterm.js v5.5.0: Modern terminal rendering
- Addons: fit, web-links, webgl, unicode11
- Performance: WebGL rendering for reduced CPU usage
- Component:
TerminalDisplay.tsxhandles PTY data and user input
Current (Tauri/Axum):
- REST endpoints for terminal control
- WebSocket for real-time event streaming
- JWT authentication for external access
Legacy (Obsolete):
src/api/WebSocketServer.ts: Old Node.js WebSocket serversrc/api/RESTServer.ts: Old Express server
- Frontend calls Tauri command via
invoke('command_name', params) - Rust backend receives command in command handler
- Command handler interacts with PTY manager or state
- Response sent back to frontend
- Events emitted from Rust to frontend via
window.emit()
- Backend: Rust (2021 edition) with Tauri 2.x
- PTY: portable-pty
- API: Axum (embedded Rust web server)
- Frontend: React 19, Redux Toolkit, TypeScript 5.x
- Terminal: xterm.js v5.5.0 (@xterm/* packages)
- IPC: Tauri commands and events
- WebSocket: For real-time event streaming
- REST: For external API access
- Rust: Cargo, rustfmt, clippy
- Frontend: Webpack, Babel, TypeScript
- Testing: Rust (cargo test), Jest, Playwright
- Linting: ESLint (TS), clippy (Rust)
- NewTabDropdown: Shell selector and settings
- TabManager: Drag-and-drop reordering, keyboard shortcuts (Ctrl+T, Ctrl+W)
- TerminalContainer: Maintains separate panes per tab
- TerminalPane: One-to-one mapping with terminal processes
- Shell types: cmd, PowerShell, Git Bash, and others
- Profiles detected in Rust backend
- Default profile selection persists in Redux settings
- Shell resolution: profile ID → executable path
All projects use modern @xterm/* packages:
- Unified Dependencies: @xterm/xterm v5.5.0 across all projects
- WebGL Acceleration: Optimal rendering performance
- Enhanced Features: Better TypeScript support, frequent security updates
- Consistent API: Standardized addon loading patterns
- Rust: Use
Result<T, E>with custom error types, avoid.unwrap()in production - TypeScript: Try-catch for async, proper error typing
- Terminal operations use graceful degradation (warnings vs errors)
- PTY spawn failures logged but don't crash application
- Rust: Built-in
#[cfg(test)]modules,#[tokio::test]for async - TypeScript: Jest for unit tests, React Testing Library for components
- E2E: Playwright with Tauri launcher utilities
- Coverage: 80%+ threshold for branches, functions, lines, statements
- Tauri: Cargo builds Rust backend, Webpack builds frontend
- Development: Hot reload for both frontend and backend
- Production: Optimized builds with LTO and minification
- Update shell detection in
src-tauri/src/pty_manager.rs - Add shell path resolution logic
- Update frontend shell selector UI if needed
- Check
src/renderer/components/Terminal/TerminalDisplay.tsxfor xterm.js integration - Verify PTY data flow in
src/renderer/services/TerminalService.ts - Debug Tauri IPC in
src-tauri/src/commands.rs
- Tab logic in
src/renderer/components/Tabs/TabManager.tsx - Pane splitting in
src/renderer/components/Panes/PaneManager.tsx - State management in Redux slices
- Rust API server in
src-tauri/src/api_server.rs - Event system integrated with Tauri events
- Client examples in
docs/api/client-example.js
- Tab switching uses show/hide rather than recreating terminals (preserves session state)
- Terminal processes persist during UI changes
- Target: <200ms latency for UI operations
- Scalability: Support 20+ concurrent panes
- Memory: <500MB for 20 concurrent terminals
- Agent orchestration supports up to 10 concurrent AI agents per team
- WebSocket connections optimized for real-time event streaming
After reading this file:
- Read your agent-specific file (
CLAUDE.mdorGEMINI.md) - Read relevant phase documentation from
docs/agentic/based on your task - Check project structure in
PROJECT_STRUCTURE.mdfor detailed file inventory - Review PRD in
docs/auto-terminal/requirements.mdfor requirements context
End of Shared Agent Instructions