A provider-agnostic autonomous coding agent supervisor with failover, persistent task state, and multi-provider orchestration.
The Universal Coding Agent (UCA) is a supervisor/orchestrator that manages coding tasks across multiple AI providers. It does not replace coding agents like OpenCode—it wraps them, providing:
- Persistent task state that survives crashes, restarts, and provider switches
- Automatic failover between providers when one fails or exhausts quota
- Provider abstraction so you can use Nemotron, Codex, Claude, Gemini, OpenRouter, Ollama, or any compatible provider
- Git safety with checkpoints and repository state tracking
- Verification via tests, build, lint, and typecheck
- Routing strategies for quality, speed, cost, or availability
┌─────────────────────────────────────────────────────────────┐
│ UCA Supervisor │
├─────────────────────────────────────────────────────────────┤
│ Task Lifecycle Manager │ Provider Router │ State Store │
├─────────────────────────────────────────────────────────────┤
│ Provider Adapters │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌───────┐ │
│ │Nemotron │ │ Codex │ │ Claude │ │ Gemini │ │Ollama │ │
│ └─────────┘ └─────────┘ └─────────┘ └─────────┘ └───────┘ │
└─────────────────────────────────────────────────────────────┘
│
▼
┌───────────────────────┐
│ OpenCode / CLI │
│ (Execution Layer) │
└───────────────────────┘
| Component | Responsibility |
|---|---|
| Task Manager | Creates, tracks, and manages task lifecycle |
| State Store | Persists task state, checkpoints, history to .agent/ |
| Provider Registry | Manages provider adapters and their lifecycle |
| Provider Router | Selects optimal provider based on strategy |
| Error Classifier | Categorizes errors for retry/failover decisions |
| Git Inspector | Tracks repository state, diffs, checkpoints |
| Verification Engine | Runs tests, build, lint, typecheck |
- NVIDIA Nemotron 3 Ultra ✅ Implemented - Primary cloud provider via NVIDIA API
- OpenCode - Local coding agent execution layer
- OpenAI Codex (planned)
- Anthropic Claude (planned)
- Google Gemini (planned, via Antigravity if available)
- OpenRouter (planned)
- OmniRoute (planned)
- Groq (planned)
- Ollama (planned) (Qwen, Ministral, Granite, etc.)
# From source
git clone https://github.com/Fafda-Jalebi/Universal-Coding-Agent
cd Universal-Coding-Agent
npm install
npm run build
# Run CLI
npx uca --help# Create a task
uca task create "Build a REST API with authentication" --description "JWT-based auth with refresh tokens"
# Start the task (auto-selects best provider)
uca task start <task-id>
# Check status
uca task show <task-id>
# Run verification
uca verify <task-id> -t tests,build,lintCreate uca.config.yaml in your project root or ~/.uca/config.yaml:
version: 1
providers:
- id: nemotron
name: NVIDIA Nemotron 3 Ultra
type: nemotron
priority: 100
enabled: true
apiKeyEnv: NEMOTRON_API_KEY
capabilities: [coding, reasoning, large-context]
- id: codex
name: OpenAI Codex
type: codex
priority: 95
enabled: true
apiKeyEnv: OPENAI_API_KEY
capabilities: [coding, repository-operations]
- id: ollama
name: Ollama Local
type: ollama
priority: 20
enabled: true
endpoint: http://localhost:11434
capabilities: [coding, local, privacy]
routing:
strategy: quality-first # quality-first | speed-first | cost-first | availability-first | capability-based
fallbackEnabled: true
maxFailovers: 3
escalationEnabled: false
task:
stateDir: .agent
defaultVerification: [tests, build, lint]
checkpointInterval: 5
logging:
level: info
fileEnabled: true
consoleEnabled: true
logDir: .agent/logs
git:
autoCheckpoint: false
checkpointMessagePrefix: "[UCA]"
trackModifiedFiles: true
recordDiffs: true# Provider API keys (never commit these!)
export NEMOTRON_API_KEY=your-nvidia-api-key # Required for Nemotron 3 Ultra
export OPENAI_API_KEY=your-key # For OpenAI Codex (planned)
export ANTHROPIC_API_KEY=your-key # For Anthropic Claude (planned)
export GEMINI_API_KEY=your-key # For Google Gemini (planned)
export OPENROUTER_API_KEY=your-key # For OpenRouter (planned)
export OMNIROUTE_API_KEY=your-key # For OmniRoute (planned)uca task create <objective> [-d description] [-p priority] [--provider id]
uca task list [-s status]
uca task show <task-id>
uca task start <task-id> [--provider id]
uca task pause <task-id>
uca task resume <task-id>
uca task cancel <task-id>
uca task plan <task-id> <steps...>uca provider list
uca provider health [provider-id]
uca provider test-failover <task-id> <provider-id>uca state checkpoints <task-id>
uca state history <task-id> [-n limit]
uca state export <task-id> [-o file]uca verify <task-id> [-t tests,build,lint,typecheck]uca demo# Requires NEMOTRON_API_KEY environment variable
export NEMOTRON_API_KEY=your-key
uca smoke-testTask state is stored in .agent/:
.agent/
├── <task-id>.json # Main task state
├── checkpoints/
│ └── <task-id>-<cp-id>.json # Checkpoint snapshots
└── logs/
├── uca-combined.log # All logs
└── uca-error.log # Errors only
Each task state contains:
- Task: Objective, status, priority, provider history
- Plan: Steps with status, assignments, results
- Checkpoints: Git commit, diff, modified files, provider context
- History: Timestamped events for debugging
- Verification Results: Test/build/lint outcomes
- Repository State: Branch, commit, dirty files
When a provider fails, UCA:
- Classifies the error (rate limit, quota, auth, timeout, etc.)
- Determines if failover is appropriate
- Selects next provider via routing strategy
- Restores task state for new provider
- Continues from last checkpoint
State is never lost—the new provider receives:
- Original objective
- Current plan with completed steps
- Modified files and git diff
- Previous provider's conclusions
- Failed tests/errors
| Strategy | Behavior |
|---|---|
quality-first |
Highest priority, success rate, capabilities |
speed-first |
Lowest latency, streaming support |
cost-first |
Lowest cost per token, prefers local |
availability-first |
Healthiest, lowest error rate |
capability-based |
Best capability match for task |
| Code | Severity | Retryable | Failover |
|---|---|---|---|
RATE_LIMIT |
TRANSIENT | Yes | After retries |
QUOTA_EXHAUSTED |
QUOTA_RELATED | No | Immediate |
AUTHENTICATION_FAILURE |
PERMANENT | No | Immediate |
TIMEOUT |
TRANSIENT | Yes | After retries |
CONNECTION_FAILURE |
TRANSIENT | Yes | After retries |
PROVIDER_UNAVAILABLE |
TRANSIENT | Yes | After retries |
SERVER_ERROR |
TRANSIENT | Yes | After retries |
INVALID_RESPONSE |
PERMANENT | No | Immediate |
TOOL_FAILURE |
PERMANENT | No | Immediate |
- No destructive operations in Phase 1
- Checkpoints record: commit hash, diff, modified files
- Manual rollback:
git reset --hard <checkpoint-commit> - Auto-checkpoint optional (disabled by default)
Verification runs after task completion or on demand:
# Default: tests + build
uca verify <task-id>
# Custom types
uca verify <task-id> -t tests,build,lint,typecheckSupported verification types:
tests- npm test, vitest, jest, pytest, go test, cargo testbuild- npm run build, tsc, cargo build, go buildlint- npm run lint, eslint, prettier, ruff, go vet, cargo clippytypecheck- npx tsc --noEmit, mypy, cargo check
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Type check
npm run typecheck
# Lint
npm run lint
# Run CLI in development
npm run dev -- task create "Test task"src/
├── cli/ # CLI commands
├── config/ # Configuration loading/validation
├── errors/ # Error classification & retry logic
├── git/ # Git repository inspection
├── logging/ # Structured logging (Winston)
├── provider/ # Provider abstraction & adapters
│ ├── base.ts # BaseProviderAdapter, MockProviderAdapter
│ ├── registry.ts # ProviderRegistry, factories
│ ├── types.ts # Provider interfaces
│ └── nemotron.ts # Nemotron 3 Ultra provider adapter
├── routing/ # Provider routing strategies
├── state/ # Persistent task state storage
├── task/ # Task models & lifecycle
│ ├── lifecycle.ts # TaskLifecycleManager
│ ├── models.ts # Task, Plan, Checkpoint types
│ └── storage.ts # StateStorage
├── verification/ # Verification engine
└── index.ts # Public exports
✅ Completed
- Project initialization with TypeScript
- Configuration system (YAML + env vars)
- Provider abstraction with interfaces
- Mock provider for testing
- Task models (Task, Plan, Checkpoint, History)
- Persistent state storage (JSON files)
- Task lifecycle management
- Structured logging
- Git repository inspection
- Verification abstraction
- Error classification & retry logic
- Provider routing (5 strategies)
- CLI with full command set
- Unit tests for core logic
🚧 Phase 2.1: Nemotron 3 Ultra (Complete)
- ✅ Real Nemotron 3 Ultra provider adapter via NVIDIA API
- ✅ Authentication via NEMOTRON_API_KEY environment variable
- ✅ Error classification (rate limit, quota, auth, timeout, connection, server errors)
- ✅ Health checks with latency reporting
- ✅ Streaming and tool use support
- ✅ Routing integration (priority 100)
- ✅ Mock HTTP tests (no API key required)
- ✅ Optional smoke test (
uca smoke-test) with NEMOTRON_API_KEY - ✅ CLI integration (provider list, health, smoke-test)
🟡 Phase 2.2A: Execution Boundary (In Progress)
- ✅ Execution abstraction (
src/execution/engine.ts) defining request, output, status, and engine interface - ✅ OpenCode adapter (
src/execution/opencode-adapter.ts) conforming to execution abstraction with working-directory safety, timeout, and cancellation support - ✅ CLI task execution command (
uca task execute <task-id>) using the execution engine - ✅ Unit tests for execution abstraction, adapter configuration, working-directory safety, success/failure handling, timeout/cancellation, and secret redaction
- ✅ Exports from
src/index.ts ⚠️ Mock/demo mode only - real OpenCode CLI not available in this environment; integration requires environment-specific configuration⚠️ No real OpenCode execution performed; adapter demonstrates the integration boundary pattern
🟢 Phase 2.2B Plans (dependent on 2.2A verification)
- Real OpenCode CLI integration with working-directory validation
- Timeout and cancellation handling via OpenCode CLI
- Verification integration after OpenCode execution
- Checkpoint creation before/after execution
- Failover between Nemotron and OpenCode providers
- OpenCode as primary execution layer alongside Nemotron
- Escalation logic (weak → strong provider)
- Cost tracking & budgets for execution
- Web UI for execution monitoring
- Plugin system for custom verifications
- No hardcoded secrets - all credentials via environment variables
.gitignoreexcludes.agent/,*.log, config with secrets- API keys never logged (redacted in logs)
- State files contain no credentials
MIT