> ## Content Index
> Fetch the complete content index at: https://sanghunkang.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# [Powerlevel10k+Oh-My-Zsh] Cursor Agent 터미널 출력/잘림/깨짐 해결법
- URL: https://sanghunkang.com/ko/powerlevel10k-oh-my-zsh-how-to-fix-cursor-agent-terminal-output-truncation-and-formatting-issues-ko/
- Published: 2025-09-15T04:30:31.000Z
- Updated: 2025-09-15T04:30:31.000Z
- Author: Sanghun Kang
- Tags: dev, #ko, #multi, cursor, ai

**⚠️ Powerlevel10k/Powerlevel9k 사용자라면 반드시 읽어보세요!**

Powerlevel10k나 Powerlevel9k 테마를 사용하고 있다면, Cursor AI Assistant와 터미널 작업 시 명령어 완료 감지가 제대로 되지 않는 문제를 겪고 있을 가능성이 높습니다. Cursor 공식 문서에서 이 문제를 명시적으로 언급하고 있으며, **`CURSOR_AGENT` 환경변수를 사용하는 것이 유일한 공식 해결책**입니다.

## 🐛 현상 및 원인 - Cursor 공식 문서 확인

[Cursor – TerminalRun terminal commands automatically as part of agent operations![](https://sanghunkang.com/content/images/icon/apple-touch-icon.png)Cursor![](https://sanghunkang.com/content/images/thumbnail/terminal.png)](https://docs.cursor.com/en/agent/terminal?ref=sanghunkang.com)

Cursor 공식 문서에서 이 문제의 원인을 명확히 설명하고 있습니다:

> **"Some shell themes (for example, Powerlevel9k/Powerlevel10k) can interfere with the inline terminal output. If your command output looks truncated or misformatted, disable the theme or switch to a simpler prompt when Agent runs."**

**문제 현상:**

```
Cursor AI → run_terminal_cmd → 쉘 프로세스 → 명령어 실행
    ↑                                          ↓
수동 Skip ←←←← 여기서 멈춤 ←←←← 출력 결과 + 새 프롬프트

```

**실제로 일어나는 상황:**

1. ✅ 명령어가 성공적으로 실행됨
2. ✅ 출력 결과가 표시됨 (하지만 잘리거나 형식이 깨질 수 있음)
3. ✅ 새로운 쉘 프롬프트가 나타남
4. ❌ **Cursor가 "터미널 명령어 실행 중..."에서 무한 대기**
5. 🖱️ 사용자가 매번 수동으로 "Skip" 버튼을 클릭해야 함

**핵심 원인:**

- **Powerlevel9k/Powerlevel10k가 인라인 터미널 출력을 방해**
- 복잡한 프롬프트 렌더링이 Cursor의 명령어 완료 감지 메커니즘과 충돌
- 터미널 출력이 잘리거나 형식이 깨져서 Agent가 완료 신호를 파싱하지 못함

## ✅ 해결책 - Cursor 공식 권장 방법

Cursor에서 제공하는 **유일한 공식 해결책**:

> **"Disable heavy prompts for Agent sessions"** 
> **"Use the `CURSOR_AGENT` environment variable in your shell config to detect when the Agent is running and skip initializing fancy prompts/themes."**

Cursor 측에서 제공한 공식 해결책은 `CURSOR_AGENT` 환경변수를 사용하는 것이 유일합니다.

### Powerlevel10k 사용자를 위한 설정

`.zshrc` 파일에 다음 코드를 추가하세요:

```zsh
# ~/.zshrc — disable Powerlevel10k when Cursor Agent runs
if [[ -n "$CURSOR_AGENT" ]]; then
  # Skip theme initialization for better compatibility
else
  [[ -r ~/.p10k.zsh ]] && source ~/.p10k.zsh
fi
```

```bash
# ~/.bashrc — fall back to a simple prompt in Agent sessions
if [[ -n "$CURSOR_AGENT" ]]; then
  PS1='\u@\h \W \$ '
fi
```

## 🛠️ 내가 사용중인 해결책 - Oh-My-Zsh + Powerlevel10k 조합

**문제 상황:** 공식 해결책을 그대로 적용했을 때, oh-my-zsh와 Powerlevel10k를 함께 사용하는 환경에서는 일반 터미널에서도 테마가 제대로 로드되지 않는 문제가 발생했습니다. 모든 터미널이 기본 형태가 되어버리는 현상이었죠.

**해결 방법:** oh-my-zsh 초기화 라인을 추가해주니 완벽하게 작동했습니다.

```bash
# Oh-My-Zsh + Powerlevel10k 사용자를 위한 개선된 설정
if [[ -n "$CURSOR_AGENT" ]]; then
  # Agent 세션: 테마 초기화 건너뛰기 (호환성 향상)
else
  # 일반 세션: Oh-My-Zsh와 Powerlevel10k 정상 로드
  source $ZSH/oh-my-zsh.sh
  [[ -r ~/.p10k.zsh ]] && source ~/.p10k.zsh
fi
```

**핵심 포인트:**

- `source $ZSH/oh-my-zsh.sh` 라인이 추가되어 oh-my-zsh가 정상적으로 초기화됨
- Agent 터미널에서는 여전히 모든 복잡한 테마가 비활성화됨
- 일반 터미널에서는 oh-my-zsh와 Powerlevel10k가 완벽하게 작동함

**Oh-My-Zsh + Powerlevel10k 조합 사용자라면 이 방법을 권장합니다!**

## 마무리

Cursor에서 제공하는 공식 해결책인 `CURSOR_AGENT` 환경변수를 활용하면 이 문제를 완벽하게 해결할 수 있습니다. **이것이 Cursor에서 제공하는 유일하고 공식적인 해결책**입니다. (2025.09 기준)

# 참​조

- [https://docs.cursor.com/en/agent/terminal](https://docs.cursor.com/en/agent/terminal?ref=sanghunkang.com)
- [https://github.com/cursor/cursor/issues/3165](https://github.com/cursor/cursor/issues/3165?ref=sanghunkang.com)
- [https://github.com/cursor/cursor/issues/3215](https://github.com/cursor/cursor/issues/3215?ref=sanghunkang.com)