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
1. Noun-Based Patterns
Build systems with persistent state (CRM, ERP, CMS, databases)
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)
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)
do database.view create JSON --collections users,orders
do api.view create GraphQL --schema schema.graphqlUse 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)
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
Quick Reference
| Goal | Pattern | Example Command |
|---|---|---|
| Build CRM system | Noun | do service create CRM --mode headless |
| Sell a product | Verb | do commerce.sell Car '{"vin": "123", ...}' |
| Export to JSON | View | do database.view create JSON --collections users |
| Deploy sales agent | Agent | do agent deploy amy --role sdr |
| Manage inventory | Noun | do inventory.entity create Product '{...}' |
| Process payment | Verb | do finance.process Payment '{...}' |
| Generate GraphQL | View | do api.view create GraphQL --schema schema.graphql |
| Automate support | Agent | do 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 5Scenario: 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.jsonScenario: 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.jsonPattern Comparison
| Aspect | Noun | Verb | View | Agent |
|---|---|---|---|---|
| State | Persistent | Transient | None | Persistent |
| Execution | Continuous | One-time | On-demand | Autonomous |
| Data Flow | Bidirectional | Input→Output | Input→Output | Bidirectional |
| Scalability | Vertical | Horizontal | Horizontal | Both |
| Learning | No | No | No | Yes |
| Cost Model | Per instance | Per execution | Per query | Per 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 Dashboard3. 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 timePattern Multiplication
Each pattern multiplies across domains:
| Pattern | Base | Multiplier | Total |
|---|---|---|---|
| Noun | Services | 817 Schema.org types | 817x |
| Verb | Actions | 817 × ~50 verbs | ~40,000x |
| View | Formats | 817 × ~20 views | ~16,000x |
| Agent | Roles | 923 O*NET occupations | 923x+ |
Next Steps
- Learn each pattern: Read the detailed guides
- Try examples: Start with common use cases
- Combine patterns: Build complete solutions
- Optimize: Choose the right pattern for each task
Related Documentation
- Noun-Based Patterns - Detailed guide
- Verb-Based Patterns - Detailed guide
- View-Based Patterns - Detailed guide
- Agent-Based Patterns - Detailed guide
- Semantic Patterns - Architecture
- SDK Documentation - TypeScript SDK
- CLI Reference - CLI overview
Pattern Examples Library
Browse 100+ real-world examples: