ViteHub is still experimental. Expect bugs and breaking changes.

Instructions

Write durable model-facing behavior and policy for an Agent.

Instructions tell a model or coding provider how to behave. Keep tool schemas with Capabilities; use instructions for durable behavior, source policy, trust boundaries, escalation, and uncertainty handling.

Start with a colocated document

Put longer guidance beside the Agent as instructions.md.

server/agents/support/instructions.md
# Support

Answer from inspected Workspace evidence before using outside knowledge.

When the docs do not answer the question, say that directly.
server/agents/support/agent.ts
import { defineAgent } from 'vite-hub/agent'

export default defineAgent({
  driver: {
    model: 'openai/gpt-5.1-mini',
  },
  workspace: {
    sources: {},
  },
})

ViteHub parses instruction Markdown through Comark. A colocated document becomes the default when driver.instructions is absent. Provider Drivers receive the rendered document as AGENTS.md for Codex or CLAUDE.md for Claude Code.

Use driver.instructions for short or invocation-specific text:

server/agents/support.ts
import { defineAgent } from 'vite-hub/agent'

export default defineAgent({
  driver: {
    model: 'openai/gpt-5.1-mini',
    instructions: [
      'You are a support engineer.',
      'Answer from inspected evidence. State when evidence is missing.',
    ],
  },
})

Split reusable guidance

Use static @./path.md imports when one document becomes difficult to scan.

server/agents/support/instructions.md
# Support

@./shared-style.md

@./escalation-policy.md

Imports are relative, recursive up to four levels, and processed like the parent document. Remote URLs, absolute paths, and globs fail instead of widening instruction reachability.

Insert trusted invocation values

Read explicit context.* values with double braces for scalars and triple braces for trusted Markdown.

server/agents/support/instructions.md
Answer for {{ context.customerName }}.

{{{ context.supportPolicy }}}

The caller or a Capability must set these values before composition. Missing bindings fail instead of rendering empty text; templates cannot read arbitrary request fields, environment variables, or JavaScript expressions.

Use conditions for small policy branches:

server/agents/support/instructions.md
::if{condition="context.audience === 'technical'"}
Include implementation details and cite file paths.
::else
Prefer customer-facing language and next actions.
::

Conditions support context.* paths, scalar literals, equality, &&, ||, !, and parentheses.

Insert Workspace bindings

Declare values or Markdown files under workspace.bindings, then reference only those named bindings.

server/agents/support/agent.ts
import { defineAgent } from 'vite-hub/agent'

export default defineAgent({
  driver: {
    model: 'openai/gpt-5.1-mini',
    instructions: [
      'Use {{ workspace.tone }} tone.',
      '@workspace.policy',
    ],
  },
  workspace: {
    bindings: {
      tone: 'short',
      policy: { path: 'policies/support.md' },
    },
  },
})

@workspace.policy inserts the declared Markdown and composes it again. ViteHub does not scan or auto-load every Markdown file in the Workspace.

Cover configured primitives

Name how to use each configured Source, Capability, or Skill. ViteHub records this coverage for inspection and warns when a configured primitive has no explicit policy.

server/agents/support/instructions.md
::source{key="docs"}
Use the docs Source for published product behavior. Say when it does not answer.
::

::capability{key="workspaceShell"}
Inspect the Workspace before answering implementation questions.
::

::skill{path="skills/review-browser-evidence"}
Use this Skill only when the task needs browser evidence.
::

ViteHub strips the wrapper directives before model execution and keeps their prose. A file that merely exists in the Workspace does not count as instruction coverage.

Use the right instruction lifetime

Instruction sourceUse it for
Colocated instructions.mdDurable guidance shared by model and provider-backed execution.
Model driver.instructionsModel-facing behavior, including invocation-time callbacks and bindings.
Provider driver.instructionsInvocation-scoped policy written into the provider working directory.
Custom driver.runApplication code reads prepared context directly; ViteHub does not build a model prompt for it.

Read Agent Drivers for execution-specific behavior and Workspace context for file visibility.