| name | customize-system-prompt |
| description | Guide for customizing OhMyCode's AI personality and behavior via system prompt. Use when user wants to change how the AI behaves, its tone, or its instructions. |
Customize OhMyCode's System Prompt
Change the AI assistant's personality, behavior rules, or domain expertise without writing code.
When to Use
- User says "make it more formal", "act like a senior engineer", "focus on Python"
- User wants to add custom instructions or constraints
- User wants the AI to have domain-specific knowledge
Three Ways to Customize
Method 1: OHMYCODE.md (Per-Project, Recommended)
Create a OHMYCODE.md (or CLAUDE.md) file in your project root:
# Project Instructions
You are working on a Django REST API project.
## Rules
- Always use type hints
- Prefer class-based views over function-based
- Write docstrings for all public functions
- Use Black formatting style
## Tech Stack
- Python 3.12, Django 5.0, PostgreSQL
- pytest for testing, factory_boy for fixtures
OhMyCode auto-detects this file and injects it into the system prompt.
Scope: Only applies when running ohmycode in this directory.
Method 2: system_prompt_append (Global Config)
Add to ~/.ohmycode/config.json:
{
"system_prompt_append": "Always respond in Chinese. Prefer simple solutions over clever ones. Never use global variables."
}
Scope: Applies to ALL conversations.
Method 3: Modify system_prompt.py (Advanced)
Edit ohmycode/core/system_prompt.py → build_system_prompt() to change the base role description or add new sections.
Scope: Permanent change to the codebase.
Examples
Friendly Tutor
# OHMYCODE.md
You are a patient coding tutor. Explain concepts step by step.
When the user makes a mistake, explain why it's wrong before showing the fix.
Use analogies to explain complex concepts.
Strict Code Reviewer
# OHMYCODE.md
You are a strict senior engineer doing code review.
Point out every issue: bugs, performance, readability, security.
Don't write code for the user — give them guidance to fix it themselves.
Rate code quality on a 1-10 scale.
Domain Expert
# OHMYCODE.md
You are an expert in machine learning with PyTorch.
When suggesting solutions, prefer PyTorch over TensorFlow.
Always consider GPU memory usage and training efficiency.
Reference relevant papers when explaining algorithms.
How It Works
ohmycode/core/system_prompt.py → build_system_prompt() assembles the prompt in this order:
- Base role — hardcoded AI assistant description
- Project instructions — from
OHMYCODE.md / CLAUDE.md (found via find_project_instructions())
- Memory — from
~/.ohmycode/memory/MEMORY.md
- Environment — working directory, OS, shell, Python version
- Mode — permission mode description
- Tools — available tool list
- Append — from
config.system_prompt_append
Tips
- Keep
OHMYCODE.md focused — don't repeat what's already in the base prompt
- Use Markdown headers to organize sections
- Test changes:
ohmycode -p "Describe yourself" --mode auto
OHMYCODE.md is searched upward from current directory — put it at the repo root