Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/plawio/veto/llms.txt

Use this file to discover all available pages before exploring further.

The veto init command sets up Veto in your project by creating the configuration directory and default policy files.

Syntax

veto init [options]

Description

Initializes Veto by creating:
veto/
  veto.config.yaml    # Main configuration file
  rules/
    defaults.yaml     # Default rules template
  .env.example        # Example environment variables
Also updates .gitignore to exclude sensitive Veto files.

Options

Force Overwrite

--force, -f
Overwrite existing files if Veto is already initialized. Example:
veto init --force

Policy Pack

--pack <name>
Start with a built-in policy pack:
  • @veto/financial - Financial transaction policies
  • @veto/communication - Email/messaging policies
  • @veto/browser-automation - Browser automation policies
  • @veto/data-access - Database/API access policies
  • @veto/coding-agent - Filesystem/shell command policies
  • @veto/deployment - Deployment/release policies
Example:
veto init --pack @veto/financial

Quiet Mode

--quiet, -q
Suppress output messages. Example:
veto init --quiet

Skip Confirmation

--yes, -y
Skip confirmation prompts (useful for automation). Example:
veto init --yes

Examples

Basic Initialization

veto init
Output:
Initializing Veto...

  Created veto/
  Created veto/rules/
  Created veto/veto.config.yaml
  Created veto/rules/defaults.yaml
  Created veto/.env.example
  Updated .gitignore

Veto initialized successfully!

Next steps:
  1. Add your validation rules in veto/rules/
  2. Use Veto in your application (local mode is default):
  3. Optional: set VETO_API_KEY to switch to cloud mode

     import { Veto } from "veto-sdk";

     const veto = await Veto.init();
     const tools = veto.wrapTools(myTools);

Initialize with Policy Pack

veto init --pack @veto/financial
Creates veto/rules/defaults.yaml that extends the financial policy pack:
# Extends built-in financial policy pack
extends: '@veto/financial'

rules:
  # Customize inherited rules or add new ones
  - id: block-large-transfers
    name: Block Large Transfers
    description: Block transfers over $10,000
    enabled: true
    severity: critical
    action: block
    tools:
      - transfer_funds
    conditions:
      - field: arguments.amount
        operator: greater_than
        value: 10000

Force Reinitialize

veto init --force
Overwrites existing configuration files. Useful for resetting to defaults.

Automated Setup (CI)

veto init --yes --quiet
echo $?  # Check exit code: 0 = success, 1 = failure

Created Files

veto/veto.config.yaml

Main configuration file:
# Veto Configuration
version: 1

# Rules configuration
rules:
  directory: rules
  recursive: true

# Validation mode
mode: local  # local, cloud, kernel, or custom

veto/rules/defaults.yaml

Default rules template:
rules:
  # Example: Block dangerous shell commands
  - id: block-rm-rf
    name: Block rm -rf
    description: Prevent destructive filesystem operations
    enabled: true
    severity: critical
    action: block
    tools:
      - execute_shell_command
    conditions:
      - field: arguments.command
        operator: contains
        value: 'rm -rf'

veto/.env.example

Example environment variables:
# Veto Cloud (optional)
VETO_API_KEY=your-api-key-here
VETO_API_URL=https://api.veto.so

# Local mode (default)
# No environment variables needed for local mode

.gitignore Updates

Adds these entries to your .gitignore:
# Veto
veto/.env
veto/logs/

Validation

Check if Veto is initialized:
veto doctor
Output:
Veto Doctor
===========

✓ Runtime: Node.js v20.11.0
✓ Veto directory: /path/to/project/veto
✓ Config file: veto.config.yaml
✓ Rules loaded: 1 rule from 1 file

Common Issues

Already Initialized

If Veto is already initialized:
veto init
Output:
Veto is already initialized in this directory.
Use --force to overwrite existing files.
Solution:
veto init --force

Invalid Policy Pack

If you specify an invalid pack:
veto init --pack @veto/invalid
Output:
Invalid --pack value: Policy pack '@veto/invalid' not found.
Available packs:
  @veto/financial
  @veto/communication
  @veto/browser-automation
  @veto/data-access
  @veto/coding-agent
  @veto/deployment

Permission Errors

If you get permission errors:
Error: EACCES: permission denied, mkdir 'veto'
Solution:
# Check directory permissions
ls -la

# Run with appropriate permissions
sudo veto init  # (not recommended)

# Or fix directory ownership
sudo chown -R $USER:$USER .

Best Practices

1. Initialize Early

Run veto init when starting a new agent project:
mkdir my-agent-app
cd my-agent-app
npm init -y
npm install veto-sdk
veto init

2. Choose the Right Pack

Select a policy pack that matches your agent’s domain:
# Financial agent
veto init --pack @veto/financial

# Browser automation agent
veto init --pack @veto/browser-automation

# General-purpose agent
veto init  # No pack, start from scratch

3. Commit Configuration

Commit veto/ to version control:
git add veto/
git commit -m "Initialize Veto policies"

4. Keep Secrets Separate

Never commit .env files:
# Copy example to .env
cp veto/.env.example veto/.env

# Edit with your keys
vim veto/.env

# .env is already in .gitignore

Next Steps

Build docs developers (and LLMs) love