AI Agent Templates

AI Agent Templates

Conduct v0.1 provides 9 structured agent templates that guide AI agents through spec-run-check workflows with persistent memory integration.

Agent Template Overview

Conduct deploys 9 templates to _conduct/templates/ and copies them to agent-specific directories:

1. conduct-spec - Create Specification

Transform user intent into structured specification.

Features:

  • Fetch remote context (GitHub issues, Linear tickets)
  • Consult memory (past specs, discovered features)
  • Multi-file spec support for complex projects
  • Level of effort estimation (simple|medium|complex|epic)
  • Generate SQL for memory registration

Output: _conduct/specs/X.vY.spec.md or _conduct/specs/X/

Workflow:

User Intent → conduct-spec
  ↓
1. Fetch remote sources (GitHub, Linear)
2. Consult memory (conduct list --specs, --features)
3. Create spec file with structured content
4. Generate SQL: _conduct/operations/create-spec-X.sql
  ↓
Human executes: conduct save operations/create-spec-X.sql

2. conduct-design - Create UI Design

Create UI mockups before implementation.

Features:

  • Extract project styles automatically
  • Generate interactive HTML previews
  • Isolated from src/ (no pollution)
  • Integration with conduct-run workflow

Output: _conduct/designs/X/mockup.html

Workflow:

User Request → conduct-design
  ↓
1. Extract styles from existing codebase
2. Generate HTML/CSS mockup
3. Save to _conduct/designs/X/
4. Create preview: conduct-design preview (optional)

3. conduct-run - Execute Specification

Implement specification end-to-end.

Features:

  • Design-first workflow (checks for designs)
  • Memory integration (feature linking)
  • Multi-phase execution support
  • SQL generation for memory updates

Output: _conduct/runs/X.vY.run.md or _conduct/runs/X/

Workflow:

Spec → conduct-run
  ↓
1. Check for UI designs (_conduct/designs/X/)
2. Consult memory (conduct list --features)
3. Implement specification
4. Create run file with execution log
5. Generate SQL: _conduct/operations/update-run-X.sql
  ↓
Human executes: conduct save operations/update-run-X.sql

4. conduct-check - Verify Implementation

Verify implementation against specification.

Features:

  • Spec vs. run comparison
  • Code vs. spec verification
  • Gap detection
  • Pass/fail/partial reporting

Output: _conduct/checks/X.vY.check.md

Workflow:

Run → conduct-check
  ↓
1. Load spec from memory
2. Load run from memory
3. Compare spec vs. run (did we do what we said?)
4. Verify code vs. spec (does code match spec?)
5. Detect gaps
6. Generate check file with results
7. Generate SQL: _conduct/operations/create-check-X.sql
  ↓
Human executes: conduct save operations/create-check-X.sql

5. conduct - Lightweight Mode

Quick changes without full ceremony.

Features:

  • No spec/run files created
  • Still logs to memory database
  • Good for bug fixes, small changes
  • Faster workflow

Output: Memory updates only

When to Use:

  • Bug fixes
  • Small refactors
  • Quick improvements
  • No ceremony needed

6. conduct-index - Discover Features

Scan codebase and discover features.

Features:

  • Multi-strategy discovery (directory, exports, package.json)
  • Interactive confirmation
  • Batch SQL generation
  • Package assignment

Output: _conduct/operations/discovered-features.sql

Workflow:

conduct-index
  ↓
1. Scan codebase for features
2. Use 3 strategies:
   - Directory structure analysis
   - Export analysis (TypeScript/JavaScript)
   - package.json hints
3. Present discovered features
4. Interactive confirmation
5. Generate SQL
  ↓
Human executes: conduct save operations/discovered-features.sql

7. conduct-reconcile - Sync Memory

Keep memory synchronized with codebase reality.

Features:

  • Git diff analysis
  • Status suggestions (deprecated, removed, moved)
  • Interactive confirmation
  • Drift detection

Output: _conduct/operations/reconciled-updates.sql

Workflow:

conduct-reconcile
  ↓
1. Load features from memory
2. Analyze git log (last 7 days by default)
3. Detect changes:
   - Deleted files → suggest "removed"
   - Renamed files → suggest "renamed"
   - Moved files → suggest "moved"
   - Large deletions → suggest "deprecated"
4. Calculate confidence scores
5. Interactive confirmation
6. Generate SQL
  ↓
Human executes: conduct save operations/reconciled-updates.sql

8. conduct-dry-run - Plan Only

Generate execution plan without implementing.

Features:

  • Review plan before execution
  • Estimate time and impact
  • Identify risks early
  • No code changes

Output: _conduct/runs/X.vY.run.md (plan only)

When to Use:

  • Review plan before starting work
  • Estimate effort and time
  • Identify potential issues
  • Get approval before implementation

9. conduct-dry-check - Verify Plan

Verify plan against spec without code check.

Features:

  • Plan coverage analysis
  • Gap identification
  • Pre-execution validation
  • No code verification

Output: _conduct/checks/X.vY.check.md (plan verification)

When to Use:

  • Verify plan completeness
  • Check if plan covers all requirements
  • Validate approach before coding

Supported AI Agents

Cursor

Command Location: .cursor/commands/

Cursor commands are available via slash commands (or by referencing the files):

  • /conduct-spec - Create specification
  • /conduct-design - Create UI design
  • /conduct-run - Execute specification
  • /conduct-check - Verify implementation
  • /conduct - Lightweight mode
  • /conduct-index - Discover features
  • /conduct-reconcile - Sync memory
  • /conduct-dry-run - Plan only
  • /conduct-dry-check - Verify plan

Files Created: .cursor/commands/conduct-*.md (9 files)

Claude

Command Location: .claude/commands/

Claude can reference command files for workflow management:

  • conduct-spec, conduct-design, conduct-run, conduct-check
  • conduct, conduct-index, conduct-reconcile
  • conduct-dry-run, conduct-dry-check

Files Created:

  • .claude/commands/conduct-*.md (9 files)
  • CLAUDE.md - Root-level instructions with managed block

Special Features:

  • Claude reads CLAUDE.md automatically on project load
  • Managed block directs Claude to templates
  • Instructions available without manual intervention

Warp

Command Location: .warp/commands/

Warp commands are available in Agent Mode:

  • All 9 Conduct templates
  • Optimized for terminal-based workflow

Files Created:

  • .warp/commands/conduct-*.md (9 files)
  • WARP.md - Root-level instructions for Warp Agent Mode

Special Features:

  • Warp reads WARP.md automatically in Agent Mode
  • Commands optimized for terminal workflow

Factory

Command Location: .factory/commands/

Factory commands integrate directly with Factory’s command system:

  • All 9 Conduct templates
  • Supports Factory’s multi-step command execution

Files Created: .factory/commands/conduct-*.md (9 files)


Template Structure

All agent templates follow a consistent structure:

Header Section

# conduct-TEMPLATE

**Purpose:** Brief description

**When to use:** Scenarios where this template applies

**Prerequisites:** Requirements before using

Workflow Section

## Workflow

Step-by-step instructions:

1. Memory Consultation
2. Context Gathering
3. Work Execution
4. File Creation
5. SQL Generation

Memory Integration

## Memory Integration

Commands to query memory:
- conduct list --specs
- conduct list --features
- conduct list --runs

SQL generation guidelines

Output Format

## Output Format

### File Structure
Location and naming conventions

### Content Structure
Required sections and format

### SQL File
Template for SQL generation

Complete Workflow Example

Scenario: Build Authentication System

Step 1: Create Specification

# User invokes conduct-spec
Agent: (reads conduct-spec.md template)
  1. Consult memory: conduct list --features
  2. Check for similar past specs
  3. Create _conduct/specs/1.v0.spec.md
  4. Generate _conduct/operations/create-spec-1.sql

# Human reviews and executes
cat _conduct/operations/create-spec-1.sql
conduct save _conduct/operations/create-spec-1.sql

Step 2: Create UI Design (Optional)

# User invokes conduct-design
Agent: (reads conduct-design.md template)
  1. Extract styles from project
  2. Create _conduct/designs/1/mockup.html
  3. Generate interactive preview

Step 3: Execute Specification

# User invokes conduct-run
Agent: (reads conduct-run.md template)
  1. Check for designs: _conduct/designs/1/
  2. Consult memory: conduct list --features
  3. Link to features (e.g., feature_id: 5, 8)
  4. Implement authentication system
  5. Create _conduct/runs/1.v0.run.md
  6. Generate _conduct/operations/update-run-1.sql

# Human reviews and executes
cat _conduct/operations/update-run-1.sql
conduct save _conduct/operations/update-run-1.sql

Step 4: Verify Implementation

# User invokes conduct-check
Agent: (reads conduct-check.md template)
  1. Load spec from memory
  2. Load run from memory
  3. Compare spec vs. run
  4. Verify code vs. spec
  5. Create _conduct/checks/1.v0.check.md
  6. Generate _conduct/operations/create-check-1.sql

# Human reviews and executes
cat _conduct/operations/create-check-1.sql
conduct save _conduct/operations/create-check-1.sql

Step 5: Query Memory

# See everything in memory
conduct list

# Output:
📋 Specs (1):
  spec-1 [completed] Authentication System (simple)

🏃 Runs (1):
  1 [completed] spec-1.v0 - Implemented OAuth2 auth
  
✨ Features (2):
  #5 authentication - Authentication System [active]
  #8 user-profile - User Profile [active]

✅ Checks (1):
  1 [pass] run-1 verification

Memory Integration

Consulting Memory

All templates encourage agents to consult memory before work:

# Query specs
conduct list --specs

# Query features
conduct list --features

# Query runs
conduct list --runs

# Query checks
conduct list --checks

SQL Generation

All templates that modify memory generate SQL files:

Pattern:

_conduct/operations/<operation>-<entity>-<id>.sql

Examples:

  • create-spec-1.sql
  • update-run-1.sql
  • create-check-1.sql
  • discovered-features.sql
  • reconciled-updates.sql

Security Model

Two-step process:

  1. Agent generates SQL (untrusted)
  2. Human validates and executes (trusted)

SQL Validation:

  • ✅ INSERT, UPDATE allowed
  • ❌ DELETE, DROP, ALTER blocked
  • ✅ Specific tables only
  • ❌ Subqueries blocked
  • ❌ SQL injection patterns blocked

Best Practices

For Agents

  1. Always consult memory first

    conduct list --features
    conduct list --specs
  2. Link to discovered features

    • Use feature IDs from memory
    • Create meaningful run-feature links
  3. Generate clean SQL

    • Use proper formatting
    • Include comments
    • Follow naming conventions
  4. Create structured outputs

    • Follow template formats
    • Include all required sections
    • Use consistent naming

For Humans

  1. Always review SQL before executing

    cat _conduct/operations/update-run-1.sql
  2. Validate SQL with dry-run

    conduct save file.sql --dry-run
  3. Maintain memory health

    # Weekly maintenance
    conduct relevancy --recalculate-all
    conduct archive -y
    conduct reconcile
  4. Discover features regularly

    conduct discover -y

Template Customization

Upgrading Templates

Keep templates up to date:

conduct upgrade

This updates all 9 templates in _conduct/templates/ and agent-specific directories.

Manual Customization

You can customize templates in _conduct/templates/:

  1. Edit template files
  2. Add project-specific guidelines
  3. Modify SQL generation patterns
  4. Add custom validation steps

Note: Running conduct upgrade will overwrite customizations. Use version control to track changes.

Per-Agent Customization

Each agent can have different instructions:

  1. Edit agent-specific files in .cursor/commands/, etc.
  2. Add agent-specific requirements
  3. Maintain consistency for team collaboration

Multi-Agent Workflows

Same Project, Multiple Agents

You can use multiple AI agents in the same project:

  1. All agents use same templates from _conduct/templates/
  2. All agents read/write to same memory database
  3. Changes made by any agent are compatible
  4. Specifications remain consistent

Team Collaboration

Local Mode (Solo):

Profile: default
URL: file://_conduct/memory.db
✅ Fast, no network required

Remote Mode (Team):

Profile: production
URL: libsql://conduct.turso.io
Token: <turso-token>
✅ Shared memory across team

Switching Between Agents

Seamlessly switch between agents:

  1. All agents read same memory database
  2. Templates are equivalent across agents
  3. No migration needed

Troubleshooting

Templates Not Working

  1. Verify templates exist

    ls _conduct/templates/
  2. Check agent-specific files

    ls .cursor/commands/
    ls .claude/commands/
  3. Upgrade templates

    conduct upgrade

Memory Not Updating

  1. Check SQL file

    cat _conduct/operations/update-run-1.sql
  2. Validate SQL

    conduct save file.sql --dry-run
  3. Execute SQL

    conduct save file.sql
  4. Verify memory

    conduct list --runs

Agent Not Following Template

  1. Ensure agent can read template files
  2. Check template syntax
  3. Verify agent is referencing correct file
  4. Try different agent invocation method

Advanced Usage

Multi-Phase Runs

For complex implementations, use multi-phase runs:

_conduct/runs/X/
├── index.md           # Plan + progress tracker
├── 1-database.md      # Phase 1: Database schema
├── 2-api.md           # Phase 2: API endpoints
└── 3-frontend.md      # Phase 3: UI components

Multi-File Specs

For large features, use multi-file specs:

_conduct/specs/X/
├── spec.md            # Main overview
├── architecture.md    # Architecture details
├── database.md        # Database schema
└── api.md             # API specification

Issue Tracker Integration

Link specs to external issues:

## Links

Source: [GitHub Issue #123](https://github.com/org/repo/issues/123)
Source: [Linear PROJ-456](https://linear.app/company/issue/PROJ-456)

Use conduct sync to keep status in sync:

conduct sync --github-token <token>
conduct sync --linear-token <token>

Next Steps