Prompts & Workflows

Chuchu uses carefully crafted system prompts for each agent and workflow. Understanding these helps you get better results.

Quick Navigation

Research Plan Agents Best Practices Patterns Customize Troubleshooting

Research Mode

Purpose: Document codebase as-is without suggesting improvements.

When to use

Workflow

chu research "how does authentication work"
  1. Context gathering: Reads mentioned files fully
  2. Parallel research: Spawns specialized sub-agents
    • codebase-locator: Finds relevant files
    • codebase-analyzer: Explains how code works
    • thoughts-locator: Searches historical context
  3. Synthesis: Combines findings with file:line references
  4. Documentation: Generates research artifact

Key principles

Example output

## Findings

Authentication is handled in internal/auth/:

1. internal/auth/middleware.go:45-67
   - ValidateToken() checks JWT signature
   - Extracts user_id from claims
   
2. internal/auth/provider.go:123
   - GenerateToken() creates JWT with 24h expiry
   - Uses RS256 algorithm

Full research prompt →


Plan Mode

Purpose: Create detailed implementation plans through interactive iteration.

When to use

Workflow

chu plan "add JWT authentication"
  1. Initial research: Gathers context about current state
  2. Interactive questioning: Clarifies requirements and constraints
  3. Design options: Presents approaches with pros/cons
  4. Phased planning: Breaks work into implementable phases
  5. Validation: Verifies plan against codebase reality

Key principles

Example output

# JWT Authentication Implementation Plan

## Phase 1: Token Generation
Files to modify:
- internal/auth/provider.go - Add GenerateJWT()
- internal/models/user.go - Add RefreshToken field
Tests:
- internal/auth/provider_test.go - Token generation tests

## Phase 2: Middleware
Files to create:
- internal/auth/middleware.go - ValidateToken middleware
Tests:
- internal/auth/middleware_test.go - Auth middleware tests

Full plan prompt →


Agent Prompts

Router Agent

Role: Fast intent classification

System prompt highlights:

Model requirements:


Query Agent

Role: Code reading and analysis

System prompt highlights:

Model requirements:

Example prompts:

explain how authentication works
show me where user sessions are stored
trace the flow from HTTP request to database

Editor Agent

Role: Code writing and modification

System prompt highlights:

Model requirements:

Example prompts:

add rate limiting to login endpoint
implement JWT token refresh
refactor user validation to use helpers

Research Agent

Role: Web search and documentation

System prompt highlights:

Model requirements:

Example prompts:

best practices for JWT implementation in Go
how do other projects handle rate limiting
compare bcrypt vs argon2 for passwords

Best Practices

Writing Good Prompts

Be specific:

❌ "fix the auth bug"
✅ "fix bug where JWT tokens expire too early in auth/provider.go"

Provide context:

❌ "add error handling"
✅ "add error handling to the database connection in main.go, similar to how redis.go handles it"

State constraints:

❌ "improve performance"
✅ "improve login performance without changing the database schema"

Leveraging Agent Specialization

Route to the right agent:

Example:

# Understanding (Query)
chu chat "how does the current auth work"

# Research external approaches (Research)
chu research "JWT best practices"

# Planning (Plan)
chu plan "add JWT authentication"

# Implementation (Editor)
chu implement plan.md

Iterative Refinement

Start broad, then narrow:

# 1. High-level understanding
chu research "authentication system"

# 2. Specific area
chu chat "show me the token validation logic"

# 3. Targeted change
chu chat "add refresh token support to the existing JWT validation"

Common Patterns

Pattern: Research → Plan → Implement

For new features:

# 1. Understand current state
chu research "current user management system"

# 2. Create detailed plan
chu plan "add role-based permissions"

# 3. Execute plan
chu implement permissions-plan.md

Pattern: Query → Edit → Verify

For bug fixes:

# 1. Find the bug
chu chat "trace the login flow to find where session expires"

# 2. Fix it
chu chat "fix session expiry in auth/session.go"

# 3. Verify
chu chat "write tests for session expiry edge cases"

Pattern: Research → Compare → Decide

For architectural decisions:

# 1. Research options
chu research "authentication libraries in Go"

# 2. Compare approaches
chu research "JWT vs session-based auth pros/cons"

# 3. Make informed decision
chu plan "implement JWT authentication using github.com/golang-jwt"

Customizing Prompts

System Prompts Location

Override Example

# ~/.chuchu/profiles/my-profile.yaml
backend:
  groq:
    agent_models:
      editor: qwen2.5-coder:32b
    agent_prompts:
      editor: |
        You are a TDD-focused code generator.
        Always write tests first.
        Keep functions under 50 lines.
        Use descriptive variable names.

Troubleshooting

Agent not understanding context

Responses too generic

Wrong agent selected