.do
Patterns

CLI Patterns

Complete guide to CLI patterns for all .do primitives

CLI Patterns Guide

The .do CLI follows semantic triple patterns ($.Subject.predicate.Object) across all 925+ domains. This guide helps you choose the right pattern for your use case.

The Four Core Patterns

graph TB Root[CLI Patterns] Root --> Noun[Noun-Based<br/>Persistent State] Root --> Verb[Verb-Based<br/>Immediate Actions] Root --> View[View-Based<br/>Transformations] Root --> Agent[Agent-Based<br/>Autonomous Workers] Noun --> NounEx[CRM, ERP, CMS<br/>Database, Inventory] Verb --> VerbEx[Sell, Launch, Analyze<br/>Process, Send] View --> ViewEx[JSON, GraphQL, CSV<br/>REST, Schema] Agent --> AgentEx[SDR, CFO, Engineer<br/>Support, Writer]

1. Noun-Based Patterns

Build systems with persistent state (CRM, ERP, CMS, databases)

Read the full guide →

do service create CRM --mode headless
do crm.entity create Contact '{"name": "John Doe", "email": "[email protected]"}'

Use when: Building systems, managing entities, CRUD operations

Pattern: {service}.{mode}.{tld}$.{Service}Service.provides.{Capability}

2. Verb-Based Patterns

Execute actions on objects (selling, managing, analyzing, launching)

Read the full guide →

do commerce.sell Car '{"vin": "123", "price": 50000, "buyer": {...}}'
do intelligence.analyze Data '{"dataset": "sales-2025"}'

Use when: Executing immediate actions, transactions, workflows

Pattern: {subject}.{verb}.{mode}.{tld}/{object}$.{Subject}.{verb}.{Object}

3. View-Based Patterns

Transform data into different representations (JSON, GraphQL, CSV)

Read the full guide →

do database.view create JSON --collections users,orders
do api.view create GraphQL --schema schema.graphql

Use when: Format conversion, read-only transformation, projections

Pattern: {subject}.as/{view}$.{Subject}.viewAs.{View}

4. Agent-Based Patterns

Deploy autonomous workers (SDR, CFO, engineers, support)

Read the full guide →

do agent deploy amy --role sdr
do agent assign amy qualify-lead '{"lead": {...}}'

Use when: Autonomous operation, role-based work, learning systems

Pattern: {name}.do[/{occupation}] or {occupation}.do$.{Agent}.performs.{Role}

Pattern Selection Decision Tree

flowchart TD Start[What are you trying to do?] Start --> Q1{Need persistent state?} Q1 -->|Yes| Noun[Noun-Based Pattern] Q1 -->|No| Q2{One-time action?} Q2 -->|Yes| Q3{Modifies data?} Q2 -->|No| Q4{Autonomous operation?} Q3 -->|Yes| Verb[Verb-Based Pattern] Q3 -->|No| View[View-Based Pattern] Q4 -->|Yes| Agent[Agent-Based Pattern] Q4 -->|No| View Noun --> NounEx[Example: CRM system<br/>do service create CRM] Verb --> VerbEx[Example: Sell product<br/>do commerce.sell Car] View --> ViewEx[Example: Export JSON<br/>do database.view create JSON] Agent --> AgentEx[Example: Deploy SDR<br/>do agent deploy amy --role sdr]

Quick Reference

GoalPatternExample Command
Build CRM systemNoundo service create CRM --mode headless
Sell a productVerbdo commerce.sell Car '{"vin": "123", ...}'
Export to JSONViewdo database.view create JSON --collections users
Deploy sales agentAgentdo agent deploy amy --role sdr
Manage inventoryNoundo inventory.entity create Product '{...}'
Process paymentVerbdo finance.process Payment '{...}'
Generate GraphQLViewdo api.view create GraphQL --schema schema.graphql
Automate supportAgentdo agent deploy --role customer-support --count 3

Pattern Characteristics

Noun-Based

Characteristics:

  • ✅ Persistent state
  • ✅ Multiple entity types
  • ✅ CRUD operations
  • ✅ Relationships
  • ✅ Configuration
  • ❌ Not for one-off actions

Examples: CRM, ERP, CMS, Database, Inventory

CLI Structure:

do service create {Type} [options]
do {service}.entity {action} {EntityType} [data]

Verb-Based

Characteristics:

  • ✅ Immediate execution
  • ✅ Transaction-based
  • ✅ Stateless
  • ✅ Chainable
  • ❌ Not for persistent systems

Examples: Sell, Launch, Analyze, Process, Send

CLI Structure:

do {subject}.{verb} {Object} [data] [options]

Key Rule: MUST have explicit subject

  • sell cars (WHO sells?)
  • commerce sell cars (Commerce sells)

View-Based

Characteristics:

  • ✅ Read-only
  • ✅ Format conversion
  • ✅ Projection
  • ✅ Composable
  • ❌ Not for modification

Examples: JSON, GraphQL, CSV, REST, Schema

CLI Structure:

do {subject}.view {action} {View} [options]

Key Rule: View/format MUST be explicit

  • functions.as (as WHAT?)
  • functions.as/api (as API)

Agent-Based

Characteristics:

  • ✅ Autonomous
  • ✅ 24/7 operation
  • ✅ Learning
  • ✅ Role-based
  • ❌ Not for simple tasks

Examples: SDR, CFO, Engineer, Support, Writer

CLI Structure:

do agent deploy {name} --role {occupation}
do agent assign {agent} {task} [data]

Key Distinction:

  • Named: Persistent identity (amy.do, tom.do)
  • Role: Generic workers (sdr.do, cfo.do)

Common Scenarios

Scenario: E-commerce Platform

# 1. Build inventory system (Noun-Based)
do service create Inventory --mode headless
do inventory.entity create Product '{...}'

# 2. Sell products (Verb-Based)
do commerce.sell Product '{...}'

# 3. Export orders (View-Based)
do database.view create JSON --collections orders
do database.view export JSON orders --output orders.json

# 4. Deploy support agents (Agent-Based)
do agent deploy --role customer-support --count 5

Scenario: SaaS Business

# 1. Build CRM (Noun-Based)
do service create CRM --mode headless
do crm.entity create Contact '{...}'

# 2. Automate sales (Agent-Based)
do agent deploy amy --role sdr
do agent assign amy qualify-lead '{...}'

# 3. Process payments (Verb-Based)
do finance.process Payment '{...}'

# 4. Generate analytics (View-Based)
do analytics.view create Dashboard --queries queries.json

Scenario: Content Platform

# 1. Build CMS (Noun-Based)
do service create CMS --backend payload
do cms.entity create BlogPost '{...}'

# 2. Generate content (Agent-Based)
do agent deploy --role content-writer
do agent assign --role content-writer write-article '{...}'

# 3. Publish content (Verb-Based)
do content.publish Article '{...}'

# 4. Export to formats (View-Based)
do cms.view create REST --collections posts
do cms.view export JSON posts --output posts.json

Pattern Comparison

AspectNounVerbViewAgent
StatePersistentTransientNonePersistent
ExecutionContinuousOne-timeOn-demandAutonomous
Data FlowBidirectionalInput→OutputInput→OutputBidirectional
ScalabilityVerticalHorizontalHorizontalBoth
LearningNoNoNoYes
Cost ModelPer instancePer executionPer queryPer agent-hour

Best Practices

1. Start with the Right Pattern

Don't force a pattern:

  • ❌ Using verb-based for persistent systems
  • ❌ Using noun-based for one-off actions
  • ❌ Using agents for simple tasks

2. Combine Patterns

Patterns work together:

# Noun + Verb
do service create CRM --mode headless
do crm.entity create Contact '{...}'      # Noun
do marketing.send Campaign '{...}'        # Verb

# View + Agent
do agent deploy analyst --role data-analyst
do agent assign analyst create-view '{...}'
do analytics.view query Dashboard

3. Use Semantic Triple

Always complete the triple:

  • ✅ Subject: WHO does it
  • ✅ Predicate: WHAT action
  • ✅ Object: ON WHAT

4. Choose Named vs Role Agents

Named agents:

  • Persistent identity
  • Build relationship
  • Learn over time
  • Higher cost

Role agents:

  • Scalable pool
  • Disposable
  • Consistent behavior
  • Lower cost

5. Optimize Costs

# Efficient: One persistent service
do service create CRM --mode headless
do crm.entity create Contact '{...}'  # Many times

# Inefficient: Multiple one-off services
do commerce.sell Product '{...}'       # Creates/destroys each time

Pattern Multiplication

Each pattern multiplies across domains:

PatternBaseMultiplierTotal
NounServices817 Schema.org types817x
VerbActions817 × ~50 verbs~40,000x
ViewFormats817 × ~20 views~16,000x
AgentRoles923 O*NET occupations923x+

Next Steps

  1. Learn each pattern: Read the detailed guides
  2. Try examples: Start with common use cases
  3. Combine patterns: Build complete solutions
  4. Optimize: Choose the right pattern for each task

Pattern Examples Library

Browse 100+ real-world examples: