AI Persona System

What are Personas? Role definitions that tell AI HOW to behave - like job descriptions for AI.


Why Use Personas?

Without Personas:

  • AI uses generic responses
  • No domain-specific knowledge
  • Inconsistent coding standards

With Personas:

  • ✅ AI follows your team's conventions
  • ✅ Domain-specific expertise
  • ✅ Consistent code style
  • ✅ Enforced security standards
Persona Effectiveness Report showing 100% scores across all tests

Persona effectiveness validation - Security, Performance, and Role Drift tests


Built-In Personas

1. ranex_architect (Default)

Role: Lead Architect
Best For: Setting up Ranex, architecture decisions

ranex persona set ranex_architect

2. python_engineer

Role: Senior Python Engineer
Best For: General Python development

ranex persona set python_engineer

3. fastapi_contributor

Role: FastAPI Expert
Best For: Building FastAPI applications

ranex persona set fastapi_contributor

4. django_contributor

Role: Django Core Developer
Best For: Django web applications

ranex persona set django_contributor

5. flask_contributor

Role: Flask Expert
Best For: Lightweight Flask apps

ranex persona set flask_contributor

6. security_researcher

Role: Security Analyst
Best For: Security audits, vulnerability fixes

ranex persona set security_researcher

7. database_admin

Role: Database Administrator
Best For: SQL, migrations, database optimization

ranex persona set database_admin

8. devops_engineer

Role: DevOps Engineer
Best For: CI/CD, Docker, deployment

ranex persona set devops_engineer

9. qa_engineer

Role: QA Engineer
Best For: Testing, test automation

ranex persona set qa_engineer

Commands

View Current Persona

ranex persona get

Output:

Current Persona: python_engineer
Role: Senior Python Engineer
Expertise: Python 3.12+, type hints, testing

Change Persona

ranex persona set <persona_name>

List All Personas

ranex persona list

Output:

Available Personas
────────────────────────────────────────────────
  ranex_architect    - Lead Architect (default)
  python_engineer    - Senior Python Engineer
  fastapi_contributor - FastAPI Expert
  django_contributor  - Django Core Developer
  flask_contributor   - Flask Expert
  security_researcher - Security Analyst
  database_admin      - Database Administrator
  devops_engineer     - DevOps Engineer
  qa_engineer         - QA Engineer

How Personas Work

When you set a persona, Ranex tells the AI:

  1. What standards to follow (PEP 8, FastAPI patterns, etc.)
  2. What tools to use (pytest, SQLAlchemy, etc.)
  3. What to avoid (anti-patterns, security risks)
  4. How to structure code (layers, naming, etc.)
Ranex System Context showing architecture rules and file structure

System context injected into AI - architecture rules, file structure, and coding standards

Example: FastAPI Persona

When fastapi_contributor is active:

# AI will generate code like this:
from fastapi import APIRouter, Depends, HTTPException
from pydantic import BaseModel

router = APIRouter(prefix="/users", tags=["users"])

class UserCreate(BaseModel):
    email: str
    password: str

@router.post("/", response_model=UserResponse)
async def create_user(
    user: UserCreate,
    db: AsyncSession = Depends(get_db)
) -> UserResponse:
    """Create a new user."""
    ...

Best Practices

  1. Match persona to task - Use security_researcher for security work
  2. Switch when context changes - Different personas for different features
  3. Start with ranex_architect - For new projects and setup
  4. Use python_engineer - For general development

Next Steps