Overview
Extend the Champ agent's tool system to support remote terminal execution and file I/O operations over SSH. This enables the agent to work with code and systems on remote hosts, expanding beyond local-only workspace support.
Acceptance Criteria
Tests Required
Unit tests (target: 95% coverage for remote tool files):
Integration tests (require live SSH host or mock SSH server):
E2E tests (optional, requires live remote host):
Implementation Notes
- SSH communication: Use Node.js
child_process.execFile('ssh') with command piping (not ssh2 module dependency — avoid native deps)
- Credential storage: Use VS Code's built-in
context.secrets.store()" and .get()` (SecretStorage)
- Path safety: Reuse existing
resolveInWorkspace pattern for remote paths (validate against allow-list)
- Tool ordering: Implement in order: remote_terminal → remote_read_file → remote_write_file → remote_list_directory → registry
- Approval flow: Extend existing approval mechanism (same
requiresApproval: true + preview)
Risks & Mitigations
| Risk |
Mitigation |
| SSH key injection attacks |
Validate host/username format, use -- to separate args, no shell interpolation |
| Credential leaks |
Use SecretStorage only, never log credentials, redact in observability |
| Network timeouts |
Implement connection timeout + command timeout separately |
| Large remote files |
Cap read output like local tool does (MAX_OUTPUT_BYTES) |
| Remote auth prompts |
Interactive password prompt in webview (future UI work) |
Related Issues
Phase Mapping
This feature spans Phase 2 (Tool System) and Phase 10 (Polish) but is independent of other phases except Phase 3 (UI for optional password prompts).
Overview
Extend the Champ agent's tool system to support remote terminal execution and file I/O operations over SSH. This enables the agent to work with code and systems on remote hosts, expanding beyond local-only workspace support.
Acceptance Criteria
New
remote_terminal_cmdtool executes shell commands on remote SSH hostshost,username,port,command, and optionaltimeoutparametersssh-agentor key file)timeoutcommand or OS-level killNew
remote_read_filetool reads file contents from remote hostshost,username,port,file_pathssh+catto retrieve file (no SFTP dependency)New
remote_write_filetool writes/creates files on remote hostshost,username,port,file_path,content, optionalmodessh+teeor heredoc to write file (no SFTP dependency)New
remote_list_directorytool lists files on remote hostshost,username,port,directoryssh ls -lato retrieve listingSSH host registry and credential management
champ.remoteHostsarray with host definitionsname,host,port(22 default),username,auth_method(password | key | agent)ssh-agentfor key-based auth (no password prompt)Tool registry updates
Error handling and safety
Tests Required
Unit tests (target: 95% coverage for remote tool files):
test/unit/tools/remote-terminal.test.tstest/unit/tools/remote-read-file.test.tstest/unit/tools/remote-write-file.test.tsmkdir -p)test/unit/tools/remote-list-directory.test.tsls -laoutput correctlytest/unit/tools/remote-host-registry.test.tsIntegration tests (require live SSH host or mock SSH server):
test/integration/tools/remote-operations.test.tsnode-ptyorssh2mock)E2E tests (optional, requires live remote host):
test/e2e/remote-terminal-workflow.test.tsremote_terminal_cmdto execute a build scriptremote_read_fileremote_write_fileImplementation Notes
child_process.execFile('ssh')with command piping (notssh2module dependency — avoid native deps)context.secrets.store()" and.get()` (SecretStorage)resolveInWorkspacepattern for remote paths (validate against allow-list)requiresApproval: true+ preview)Risks & Mitigations
--to separate args, no shell interpolationRelated Issues
Phase Mapping
This feature spans Phase 2 (Tool System) and Phase 10 (Polish) but is independent of other phases except Phase 3 (UI for optional password prompts).