Repository navigation
Closed as not planned
Labels
complexity-mediumComplexity: medium (board points 5-8)enhancementNew feature or requestpriority-p1Critical paththeme-devexTheme: DevExtype-featureNew functionality
Description
Summary
Add direct operational commands to the Trinity CLI and backend API that interact with agent containers without invoking the target agent's LLM. Enables file inspection, command execution, process management, and log access at the container level.
Motivation
- Currently, any interaction with an agent container goes through the chat/execution queue, which invokes the agent's LLM — expensive and slow for operational tasks
- Common ops tasks (check files, read logs, inspect processes, sync git) don't need LLM reasoning
- Platform operators need direct container access without
docker execknowledge - Enables automated health checks, file syncs, and maintenance scripts
New Backend API Endpoints
POST /api/agents/{name}/exec # Execute command in container
GET /api/agents/{name}/files # List files in directory
GET /api/agents/{name}/files/{path} # Read file contents
PUT /api/agents/{name}/files/{path} # Write file contents
DELETE /api/agents/{name}/files/{path} # Delete file
GET /api/agents/{name}/processes # List running processes
POST /api/agents/{name}/git/pull # Git pull in workspace
GET /api/agents/{name}/git/status # Git status of workspace
CLI Commands
# Execute arbitrary command in agent container
trinity exec <agent> -- <command>
trinity exec oracle-1 -- cat /home/user/.env
trinity exec oracle-1 -- pip list
trinity exec oracle-1 -- git -C /home/user/agent status
# File operations
trinity files <agent> ls [path]
trinity files <agent> cat <path>
trinity files <agent> write <path> --content "..."
trinity files <agent> rm <path>
# Process inspection
trinity ps <agent>
# Git operations on agent workspace
trinity git <agent> status
trinity git <agent> pull
trinity git <agent> log --oneline -5
# Enhanced logs (direct container logs, not via Vector)
trinity logs <agent> --tail 100 --follow
trinity logs <agent> --since 1hSecurity Considerations
- All operations scoped to agent owner (validated via MCP API key / JWT)
- Audit logged (command, user, agent, timestamp) via structured logging
execcommands run as the agent's container user (not root)- File operations restricted to
/home/user/workspace by default - Optional allowlist/blocklist for exec commands (future)
- No credential values exposed in logs
Implementation
- Backend: New router
src/backend/routers/container_ops.py - Docker access: Uses existing read-only Docker socket +
docker execvia Docker SDK - CLI: Extends the
trinityCLI from Trinity CLI tool mirroring MCP server #231 - Timeout: All exec commands have configurable timeout (default 30s)
- Streaming:
trinity execandtrinity logs --followsupport streaming output
Acceptance Criteria
-
trinity execruns commands in agent containers and returns stdout/stderr -
trinity filesprovides read/write/list/delete for agent workspace files -
trinity pslists processes inside agent container -
trinity gitproxies git commands to agent workspace - All operations audit logged with user identity
- Operations scoped to agent owner (non-admin cannot exec into others' agents)
- 30s default timeout on exec, configurable via
--timeout - Works from CLI and directly via API
- No LLM invocation on the target agent
Depends On
- Trinity CLI tool mirroring MCP server #231 (Trinity CLI tool mirroring MCP server) — CLI framework and auth
Metadata
Metadata
Assignees
Labels
complexity-mediumComplexity: medium (board points 5-8)enhancementNew feature or requestpriority-p1Critical paththeme-devexTheme: DevExtype-featureNew functionality
Activity
vybe commentedon Jun 5, 2026
Closed during backlog prioritization (2026-06-05): aged P1 "Later"-horizon feature off the current Reliability/Security critical path. Not planned for now — reopen if it becomes relevant.