Quickstart
Get OpsCode running in your terminal in under five minutes. This guide walks through installing the ops CLI, configuring an LLM provider, running your first infrastructure task in the interactive TUI, and executing non-interactive grading loops in CI/CD.
OpsCode runs natively on macOS and Linux. On Windows, run OpsCode inside WSL 2 (Windows Subsystem for Linux).
Prerequisites
- Operating system: macOS, Linux, or Windows WSL 2
- API key: At least one supported LLM provider key (Anthropic, OpenAI, Google Gemini, AWS Bedrock, OpenRouter, or local Ollama)
- Optional: A Tavily API key (
TAVILY_API_KEY) to enable liveweb_searchfor provider docs and CVEs
Install and run your first task
Run the official install script to download the ops runtime and add it to your PATH:
curl -LsSf https://raw.githubusercontent.com/talkops-ai/opscode/main/scripts/install.sh | bash
Navigate to any infrastructure repository and start the terminal interface:
ops
Inside the TUI, open the interactive credential manager:
/auth
Select your provider (such as Anthropic, OpenAI, or Google Gemini) and paste your API key. Keys are stored in your OS keychain (macOS Keychain / Linux Secret Service) or ~/.opscode/credentials.json with 0600 permissions. For environment variable setup, see Credentials.
Enter a prompt in the chat input:
Create a Terraform module for an AWS S3 bucket with KMS encryption, versioning, public access block, and lifecycle rules
OpsCode delegates the task to the aws-terraform-module-writer subagent, generates the module files (main.tf, variables.tf, outputs.tf, versions.tf), presents a syntax-highlighted diff for your approval, and runs terraform validate to verify syntax.
Run /auth and add your LangSmith API key (or set export LANGSMITH_API_KEY="lsv2_..."). Every agent turn, subagent handoff, and MCP tool call is traced automatically on the next session launch.
Interactive mode
In interactive mode (ops), you converse with the agent in a multi-turn Textual interface while retaining full visibility into tool calls, diffs, and token usage.
Keyboard shortcuts
| Shortcut | Action |
|---|---|
Shift+Tab | Cycle runtime approval mode (Manual → Auto → YOLO) |
Escape | Cancel the current streaming response |
Ctrl+C | Interrupt a running shell command or exit the TUI |
Essential slash commands
| Command | What it does |
|---|---|
/model | Switch LLM providers or models mid-session without losing context |
/effort | Adjust reasoning effort (low, medium, high) |
/agents | Inspect or switch the active domain subagent |
/auth | Configure LLM provider, Tavily, or LangSmith API keys |
/skills | Browse and invoke discovered SKILL.md playbooks |
/memory | View, update, or clear persistent AGENTS.md instructions |
/mcp | Inspect connected MCP servers and discovered tools |
/plugins | Install, update, or remove plugins from marketplaces |
/goal | Define a structured goal with tracked acceptance criteria |
/rubric | Attach or inspect a self-grading rubric |
/cost / /context | View session token cost (USD) and context window utilization |
/compact | Summarize older conversation history to free context capacity |
/resume | Browse and resume previous conversation threads |
/doctor | Run environment, credential, and MCP health diagnostics |
Resume past sessions or target a subagent
# Resume the most recent conversation thread
ops -r
# Resume a specific thread by ID
ops -r <thread-id>
# Start directly inside a specific domain subagent
ops -a aws-terraform-module-writer
Non-interactive (headless) mode
Pass -n (--non-interactive) to run single-shot tasks in scripts, git hooks, or CI/CD pipelines:
# Validate all Terraform modules in the current repository
ops -n "Run terraform validate across modules/ and summarize any errors"
# Pipe a manifest via stdin for security auditing
cat deployment.yaml | ops -n "Audit this Kubernetes manifest against Pod Security Standards" --quiet
Headless flags
| Flag | What it does |
|---|---|
-n, --non-interactive <PROMPT> | Execute a single task and exit with a deterministic status code |
-q, --quiet | Suppress TUI chrome and progress spinners; emit only the final output for piping |
--no-stream | Buffer the complete response before printing to stdout |
--max-turns <N> | Cap the maximum number of agentic reasoning turns |
--timeout <SECONDS> | Enforce a hard wall-clock timeout for the entire run |
--rubric <SPEC_OR_FILE> | Grade the agent's output against acceptance criteria (@path/to/rubric.md or inline string) |
-y, --yolo | Auto-approve tool execution in isolated CI containers |
Self-verification with --rubric
Combine -n with --rubric so OpsCode automatically checks its work before exiting:
ops -n "Create a Kubernetes NetworkPolicy for the payments-api service" \
--rubric "Denies all ingress by default and allows TCP port 8080 only from pods labeled app=api-gateway"
Trace with LangSmith
Configure LangSmith to inspect subagent delegation trees, prompt caching ratios, and latency waterfalls:
export LANGSMITH_API_KEY="lsv2_pt_..."
export LANGSMITH_PROJECT="opscode-infra-ci"
ops -n "Lint all Helm charts in charts/" --quiet
Use /trace inside an interactive session to verify tracing status at any time.
Next steps
Complete reference for all CLI flags, subcommands, and exit codes.
Configure Manual, Auto, and YOLO governance tiers and AST shell scanning.
Build self-grading infrastructure pipelines with independent evaluator loops.
Customize AGENTS.md instructions and author reusable SKILL.md playbooks.