OpenParable
Skip to content
← Back to skills

Customize Response Style

Design
customize-response-style

Customize Response Style is an Agent Skill for design published in the AlphaLab-USTC/OhMyCode repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Guide for customizing OhMyCode's terminal output style and rendering. Use when user wants to change colors, formatting, or how responses look in the terminal.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/AlphaLab-USTC/OhMyCode/blob/HEAD/.claude/skills/customize-response-style/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/customize-response-style, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Customize OhMyCode's Response Style

Change how OhMyCode renders output in the terminal — colors, formatting, tool call display, token usage display.

When to Use

  • User says "change the colors", "make output cleaner", "customize the theme"
  • User wants to modify how tool calls, errors, or streaming text are displayed
  • User wants to add/remove elements from the output (e.g., hide token counts)

Where Rendering Happens

All rendering logic is in ohmycode/cli.py → render_stream() function. It consumes events from the conversation loop and prints them using rich.console.Console.

Current rendering:

EventCurrent Style
TextChunkPlain text, streamed character by character
ToolCallStart▶ <tool_name> in cyan + params in dim
ToolCallResult (success)✓ + green output (truncated to 500 chars)
ToolCallResult (error)✗ + red error message
TurnCompleteTokens: prompt=X completion=Y total=Z in dim

How to Customize

Option 1: Edit render_stream() Directly

Open ohmycode/cli.py and find async def render_stream(). Modify the rich markup:

# Change tool call header color from cyan to blue
console.print(f"\n[blue]▶ {event.tool_name}[/blue]", highlight=False)

# Add a box around tool results
from rich.panel import Panel
console.print(Panel(output, title="Tool Result", border_style="green"))

# Hide token usage
# Comment out or delete the TurnComplete rendering block

Option 2: Add Rich Themes

Create a custom theme at the top of cli.py:

from rich.theme import Theme

ohmycode_theme = Theme({
    "tool.name": "bold magenta",
    "tool.success": "green",
    "tool.error": "bold red",
    "tool.params": "dim italic",
    "status": "dim cyan",
    "prompt": "bold yellow",
})

console = Console(theme=ohmycode_theme)

Then use style names in print calls:

console.print(f"▶ {event.tool_name}", style="tool.name")

Option 3: Add Markdown Rendering for AI Responses

Replace plain text streaming with rich Markdown rendering:

from rich.markdown import Markdown

# In render_stream(), after collecting all TextChunks for a turn:
if collected_text:
    console.print(Markdown(collected_text))

Trade-off: Markdown rendering requires buffering the full response (no streaming feel). A hybrid approach: stream plain text, then re-render as Markdown after the turn completes.

Option 4: Customize the REPL Prompt

In run_repl(), change the prompt appearance:

# Simple change
user_input = session.prompt("ohmycode> ")

# With color (prompt_toolkit style)
from prompt_toolkit.formatted_text import HTML
user_input = session.prompt(HTML("<ansigreen>ohmycode</ansigreen><ansiyellow>></ansiyellow> "))

# With model name
user_input = session.prompt(f"[{config.model}]> ")

Customization Ideas

ChangeWhereDifficulty
Change colorsrender_stream() rich markupEasy
Add panels/borders around tool resultsrender_stream() + rich.PanelEasy
Show full tool params (not truncated)render_stream() truncation logicEasy
Hide token usagerender_stream() TurnComplete blockEasy
Add timestamps to outputrender_stream()Easy
Markdown renderingrender_stream() + rich.MarkdownMedium
Custom REPL promptrun_repl() prompt_toolkit configMedium
Add spinner during tool executionrender_stream() + rich.StatusMedium
Progress bar for long operationsrender_stream() + rich.ProgressMedium
Split-pane layout (output + status)rich.LayoutHard

Testing Changes

After modifying cli.py:

  1. Quick visual test: ohmycode -p "List python files here" --mode auto
  2. Test tool calls: ohmycode -p "Read pyproject.toml" --mode auto
  3. Test errors: ohmycode -p "Read /nonexistent/file" --mode auto
  4. Test REPL: ohmycode → type a message → /exit

Tips

  • Use rich documentation: https://rich.readthedocs.io/
  • Preview colors: python3 -c "from rich import print; print('[bold red]Red[/bold red] [green]Green[/green]')"
  • Keep changes in render_stream() — don't modify core/loop.py for display concerns
  • The REPL prompt uses prompt_toolkit, not rich — they have different styling systems