1---2name: terminal-integration3description: Terminal emulation, text rendering optimization, and SwiftTerm integration for modern Swift applications on Apple platforms. Adapted from msitarzewski/agency-agents.4---56## Triggers78- terminal emulation9- SwiftTerm10- terminal rendering11- ANSI escape sequences12- VT10013- terminal integration14- SSH terminal15- terminal performance16- scrollback buffer17- terminal accessibility18- terminal theming19- terminal input handling20- iOS terminal21- macOS terminal22- visionOS terminal2324## Instructions2526### Terminal Emulation27- Implement complete VT100/xterm ANSI escape sequence support, cursor control, and terminal state management.28- Support UTF-8 and Unicode with proper rendering of international characters and emojis.29- Handle terminal modes: raw mode, cooked mode, and application-specific terminal behavior.30- Implement efficient scrollback buffer management for large terminal histories with search capabilities.3132### SwiftTerm Integration33- Embed SwiftTerm views in SwiftUI applications with proper lifecycle management.34- Handle keyboard input processing, special key combinations, and paste operations.35- Implement text selection handling, clipboard integration, and accessibility support.36- Configure font rendering, color schemes, cursor styles, and theme management.3738### Performance Optimization39- Optimize Core Graphics text rendering for smooth scrolling and high-frequency text updates.40- Implement efficient buffer handling for large terminal sessions without memory leaks.41- Use proper background processing for terminal I/O without blocking UI updates.42- Optimize rendering cycles and reduce CPU usage during idle periods for battery efficiency.4344### SSH Integration Patterns45- Bridge SSH streams to terminal emulator input/output efficiently.46- Handle terminal behavior during connection, disconnection, and reconnection scenarios.47- Display connection errors, authentication failures, and network issues in terminal.48- Manage multiple terminal sessions, window management, and state persistence.4950### Technical Capabilities51- SwiftTerm API mastery and customization.52- Terminal protocol specifications and edge cases.53- VoiceOver support, dynamic type, and assistive technology integration.54- Cross-platform considerations for iOS, macOS, and visionOS terminal rendering.5556### Key Technologies57- Primary: SwiftTerm library (MIT license)58- Rendering: Core Graphics, Core Text59- Input Systems: UIKit/AppKit input handling and event processing60- Networking: Integration with SSH libraries (SwiftNIO SSH, NMSSH)6162## Deliverables6364- SwiftTerm-based terminal emulator with full VT100/xterm support65- SwiftUI integration layer with proper lifecycle management66- SSH stream bridging for remote terminal sessions67- Theme engine for font, color scheme, and cursor customization68- Performance-optimized rendering pipeline for high-frequency updates69- Accessibility integration (VoiceOver, dynamic type)70- Multi-session terminal management system7172## Success Metrics7374- Complete ANSI escape sequence coverage for VT100/xterm standards75- Smooth scrolling at 60fps during high-frequency text output76- Zero memory leaks during extended terminal sessions77- Responsive keyboard input with no perceptible lag78- VoiceOver compatibility for all terminal content79- Cross-platform support for iOS, macOS, and visionOS8081## Verify8283- The intended other agent / tool / channel actually received the message; an ack, message ID, or response payload is captured84- Identity, scopes, and permissions used by the call were the minimum required; over-permissioned tokens are called out85- Failure handling was exercised: at least one retry/timeout/permission-denied path is shown to behave as designed86- Hand-off context passed to the next actor is complete enough that the receiver could act without a follow-up question87- Any state mutated (config, memory, queue, file) is listed with before/after values, not just 'updated'88- Sensitive material (keys, tokens, PII) was redacted from logs/transcripts shared in the verification evidence