Skip to main content

Commands

Global commands available in OpenCode after installing the harness. Each command runs a global skill or diagnostic script. This reference separates the shared contract from commands specific to the OpenCode adapter.

Names start with / when invoked in the OpenCode chat (for example, /prevc).

Commands shared by the PREVC contract​

Session​

CommandWhen to useWhat it does
/harness-session-startAt the start of every sessionDiscovers root instructions, progress state, feature state, and startup path; runs the baseline if safe; declares the active task
/harness-clean-handoffAt the end of every sessionCollects evidence, blockers, progress notes, handoff, and git status; returns a handoff report

Project​

CommandWhen to useWhat it does
/harness-initFirst time in a projectAudits the harness layers without writing anything; produces a gap report with recommended fixes
/harness-bootstrapInstall the full harness packageProposes the full package (AGENTS.md, feature_list.json, docs/harness, agent-os) and writes only after confirmation
/harness-standardsBefore planning or implementingDetects the stack and loads project and global standards; returns applicable risk, validation, permission, and skill profiles
/harness-specMedium or large featureCreates or proposes an Agent OS spec in agent-os/specs/YYYY-MM-DD-HHMM-slug/

Work​

CommandWhen to useWhat it does
/prevcAny significant workControls the lifecycle grouped into Prepare, Execute, Validate, and Confirm

Commands specific to OpenCode​

CommandWhen to useWhat it does
/planPlan significant work in this distributionOpenCode's size-gated pipeline; ends at awaiting_plan_approval
/goalTrack a long-term objectiveOptional OpenCode plugin; keeps objective memory separate from PREVC

Agent OS​

CommandWhen to useWhat it does
/plan-productStart product documentationCreates the base product documentation in agent-os/product/
/shape-specManual escape hatch for heavy specs (the default pipeline is /plan)Models a lean spec in planning mode; does not implement until approved
/discover-standardsDocument code patternsDiscovers existing patterns and creates standards in agent-os/standards/
/index-standardsRebuild the standards indexScans agent-os/standards/ and regenerates the alphabetized index.yml
/inject-standardsBring standards into contextReads index.yml, suggests relevant standards, and injects content into the conversation, skill, or plan

Security and diagnostics​

CommandWhen to useWhat it does
/harness-security-scanAudit the security surfaceScans OpenCode, Cursor, the repo harness, MCPs, and memory for supply-chain risks and secrets; summarizes PASS/WARN/FAIL without printing values
/harness-mcp-inventoryInventory MCPsLists OpenCode/Cursor MCP servers, detects drift, and flags keys holding secrets without exposing values
/harness-context-budgetAudit context loadReports the context budget of skills, plugins, commands, and MCPs; recommends lazy-loading
/harness-statusCheck readinessPrints git, PREVC, goal, handoff, context, and security status; points to the next best action
/harness-worktree-lifecycleParallel agents with worktreesReports worktree lifecycle safety (dirty, clean, stale) without deleting files

Quality and Refine​

CommandWhen to useWhat it does
/qualityBefore a commit (or any time)Runs the measured quality gate and risk router; unavailable metrics or missing/stale reports are named gaps, never passes
/refineAfter Judge, or to record an operator noteRuns the read-only refiner and routes proposals by blast radius; it writes nothing

Interface and investigation commands​

Local commands in command/, focused on interface design, investigation, and PRs in the OpenCode adapter.

CommandWhen to useWhat it does
/initBuild UI with craftBuilds an interface following the interface-design skill
/auditCheck code against the design systemChecks design-system violations
/critiqueReview build craftReviews the build as a design lead
/extractCreate system.md from codeExtracts design patterns into system.md
/statusView design system stateShows direction, tokens, and patterns
/investigateDiscovery before planningAsks focused questions and analyzes the code
/investigate-batchBatch discoveryAsks up to five questions, then analyzes the code
/trimShrink a PR descriptionReduces the current PR description while preserving essentials

Step-by-step for the main commands​

1. Work on something significant — /prevc​

/prevc prepare <objective>
  • Runs the global prevc-workflow skill, the single lifecycle controller for significant work.
  • prepare <objective> performs discovery, classifies risk, and creates a plan, stopping at awaiting_plan_approval in the conversation.
  • Never invokes /goal or the goal tools; lifecycle labels stay in the conversation and in the existing harness files.
  • Routes low-risk routine operations (session-start, status checks, explicit dependency installation, formatting, narrow test repairs) through a fast path with objective verification, without the PREVC ceremony.
/prevc run
  • Accepts explicit operator approval in plain language or /prevc run; requires no goal ID or /goal confirm.
  • An operator instruction to execute a named plan or spec end to end is itself the authorization for an autonomous run: no separate /prevc run, no per-task approval; the run stops once at awaiting_confirmation for the whole spec.
  • Automates Review → Execute → Validate → Judge within the approved scope and the declared budgets (files, permissions, verification, retry, tools, duration).
  • On low-risk work, allows a limited repair pass for a newly exposed verification prerequisite (a missing test, lint, typecheck, or dev-dependency build) and then runs full validation again.
  • Preserves the low, medium, high, and untrusted risk paths: medium+ requires context/security evidence or a documented skip; high/untrusted requires explicit risk acknowledgment before executing.
  • Never commits, pushes, deploys, switches branches, or runs remote Git operations automatically.

2. Audit a project — /harness-init​

/harness-init
  • Runs the global harness-initializer skill.
  • Detects the repo root, root instructions, progress state, feature state, startup path, Judge/evaluation layer, harness skills, security posture, hook/plugin posture, MCP/plugin hygiene, context budget, goal memory hygiene, worktrees, agent permissions, and parity with Cursor.
  • Produces a non-mutating gap report with recommended fixes.
  • Does not create or edit files unless the user approves a specific fix.
  • Does not assume that init.ps1, feature_list.json, or .specs/project/STATE.md exist.

3. Install the full harness — /harness-bootstrap​

/harness-bootstrap
  • Runs the global harness-bootstrap skill.
  • Always proposes the full package: AGENTS.md, feature_list.json, docs/harness (progress, handoff, sprint-contract, security-policy, hook-policy, context-budget, eval-contract, agent-permission-matrix, status), docs/ARCHITECTURE.md, docs/PRODUCT.md, docs/RELIABILITY.md, agent-os/judges/project-judge.md, agent-os/standards, and spec templates including evals.md.
  • First audits the current repo, detects the stack with harness-stack-router, and discovers the startup path.
  • Shows the exact files to create, merge, or skip and asks for explicit confirmation before writing anything.
  • Never assumes init.ps1, feature_list.json, .specs/project/STATE.md, or repo paths.

4. Start the session — /harness-session-start​

/harness-session-start
  • Runs the global harness-session-start skill as a direct routine operation, not as PREVC work.
  • Never invokes /goal or the goal tools.
  • Reads root instructions, if they exist.
  • Locates the progress state in .specs/project/STATE.md, docs/harness/progress.md, or agent-progress.md.
  • Locates the feature state in feature_list.json or .specs/features/*/tasks.md.
  • Reads docs/harness/session-handoff.md, if present.
  • Discovers the startup command with harness-startup-path and runs it if safe.
  • Runs git log --oneline -3 in git repos.
  • Applies WIP=1 when there is durable state.
  • Ends by declaring: Active task, AC (observable criteria). If startup fails, it records the exact error in the progress file and stops.

5. Close the session — /harness-clean-handoff​

/harness-clean-handoff
  • Runs the global harness-clean-handoff skill as a PREVC handoff subroutine.
  • Collects evidence, blockers, progress notes, a session handoff, passing verification results, and git status.
  • Only PREVC writes lifecycle transitions after the operator's decision.
  • When invoked directly, it returns only a handoff report: it does not mark feature state, infer confirmation, or assert completion.

6. Load standards and skills — /harness-standards​

/harness-standards
  • Runs harness-stack-router and then harness-standards-router.
  • Detects the stack from the files before guessing.
  • Loads project standards in agent-os/standards first, then the global standards templates.
  • Returns a risk profile, validation profile, agent permission profile, security standards, minimum checks, and skills applicable to the current task.
  • Does not implement code: it produces only the standards and skills routing report.

7. Create a spec — /harness-spec​

/harness-spec <objective>
  • Runs harness-agent-os-specs for the requested objective.
  • Creates or proposes agent-os/specs/YYYY-MM-DD-HHMM-slug/ with spec.md, plan.md, tasks.md, verification.md, and decisions.md from the global templates.
  • Replaces placeholders with concrete requirements, acceptance criteria, verification commands, and decisions.
  • Asks before writing if the target repo does not yet have a harness.

Quick commands (cheat sheet)​

# Unknown project: audit without writing
/harness-init

# Project without harness: propose full install
/harness-bootstrap

# Start of a normal session
/harness-session-start

# Prepare significant work
/prevc prepare <objective>

# Approve the prepared plan (approved ad-hoc plan): explicit approval in plain
# language; to run the approved plan, use
/prevc run

# Autonomous run: an instruction to execute a named plan/spec end to end is
# itself the authorization — no separate /prevc run, no per-task approval

# Pause or close with durable context
/harness-clean-handoff

# Quality and refine
/quality # measured quality gate + risk router (--mode full before a commit)
/refine # Refine phase after Judge (or --note "<what I fixed by hand>")

# Global diagnostics
/harness-status
/harness-security-scan
/harness-context-budget
/harness-mcp-inventory
/harness-worktree-lifecycle