Skip to main content

CLI Reference

The modal command-line tool is your interface to Modality.

Installation

# First-contract onboarding wrapper
cd rust
cargo build --release -p modal --no-default-features --features contract-onboarding

# Language/model CLI used by the first-contract guide
cargo build --release -p modality

The lean onboarding wrapper exposes the contract and identity surfaces needed by the first-contract guide: modal contract, modal c, modal id, modal passfile, modal ai, modal status, modal pull, modal commit, modal diff, modal set, modal repost, modal add-rule, and modal download. It omits the runtime-heavy hub, node, network, predicate, program, chain, local, run, killall, and upgrade surfaces.

Build the full wrapper with cargo build --release -p modal when you need those broader command groups. Use modality for model and rule authoring tasks such as modality model lint, modality model synthesize, modality model validate, modality model mermaid, and modality model view.

Command Groups

CommandAliasDescription
modal contractmodal cContract management (create, commit, push, pull)
modal aiAI provider configuration and modal ai suggest-rule
modal idmodal identityIdentity management (create, derive, get)
modal passfilePassfile encryption/decryption
modal hubContract hub server and collaboration; full wrapper only
modal predicatePredicate listing and testing; full wrapper only
modal programProgram management; full wrapper only
modal nodeNetwork node operations; full wrapper only. With no subcommand, opens an action-picker TUI. Public testnet: join-testnet.md
modal netmodal networkNetwork information; full wrapper only
modal localLocal development utilities; full wrapper only
modal runQuick node runners; full wrapper only
modal chainChain validation; full wrapper only

Global Commands

# Show version
modal --version
modal -v

# Show help
modal --help
modal <command> --help

# Show status (in contract directory)
modal status

# Pull commits (shortcut for modal contract pull)
modal pull http://hub.example.com/contracts/my-contract

# Show uncommitted changes (shortcut for modal contract diff)
modal diff

# Repost a snapshot from another contract (then modal commit --all)
modal repost source-contract-id /source/path
modal repost source-contract-id /source/path /local/path

# Add a rule to the current contract
modal add-rule --name authorized \
'[] always([-signed_by(/parties/alice.id) -signed_by(/parties/bob.id)] false)'

# Configure an AI provider, then suggest a rule formula
modal ai set --provider openai
modal ai suggest-rule "after this commit either alice or bob must sign"

# Download a packed contract file
modal download http://hub.example.com/contracts/my-contract.pack

# Kill all local nodes (full wrapper only)
modal killall

# Upgrade to latest version (full wrapper only)
modal upgrade

Quick Reference

# Identity
modal id create --name example/alice
modal id get --name example/alice

# Contract workflow
modal c create
modal c set-named-id /parties/alice.id example/alice
modal c commit --all --sign example/alice -m "Initial setup"
modal c status
modal c log

# Push/Pull
modal c push http://hub.example.com/contracts/my-contract
modal c pull http://hub.example.com/contracts/my-contract

# Predicates
modal predicate list
modal predicate info signed_by
modal predicate test signed_by --data '{"path":"/alice.id","signature":"..."}'

Shortcuts

Full CommandShortcut
modal contractmodal c
modal contract statusmodal status
modal contract pullmodal pull
modal contract commitmodal commit
modal contract diffmodal diff
modal contract setmodal set
modal contract repostmodal repost
modal contract add-rulemodal add-rule
modal contract downloadmodal download
modal identitymodal id
modal networkmodal net
modal local killall-nodesmodal killall

Environment Variables

VariableDescriptionDefault
MODAL_NODE_PATHDefault node directory./node
MODAL_NETWORKNetwork (mainnet/testnet)mainnet
MODAL_HUB_URLDefault hub URL
MODAL_PASSFILEDefault passfile path
MODAL_AI_API_KEYAPI key for modal ai suggest-rule
OPENAI_API_KEYOpenAI API key
ANTHROPIC_API_KEYAnthropic API key
XAI_API_KEYxAI / Grok API key
CURSOR_API_KEYCursor Agent API key
MODAL_AI_CURSOR_AGENTPath to the Cursor agent CLIagent or cursor-agent on PATH