feat: add Ralph Loop self-referential development loop (#337)

* feat(config): add RalphLoopConfigSchema and hook name

- Add ralph-loop to HookNameSchema enum
- Add RalphLoopConfigSchema with enabled, default_max_iterations, state_dir
- Add ralph_loop field to OhMyOpenCodeConfigSchema
- Export RalphLoopConfig type

* feat(ralph-loop): add hook directory structure with constants and types

- Add constants.ts with HOOK_NAME, DEFAULT_STATE_FILE, COMPLETION_TAG_PATTERN
- Add types.ts with RalphLoopState and RalphLoopOptions interfaces
- Export RalphLoopConfig from config/index.ts

* feat(ralph-loop): add storage module for markdown state file management

- Implement readState/writeState/clearState/incrementIteration
- Use YAML frontmatter format for state persistence
- Support custom state file paths via config

* feat(ralph-loop): implement main hook with session.idle handler

- Add createRalphLoopHook factory with event handler
- Implement startLoop, cancelLoop, getState API
- Detect completion promise in transcript
- Auto-continue with iteration tracking
- Handle max iterations limit
- Show toast notifications for status updates
- Support session recovery and cleanup

* test(ralph-loop): add comprehensive BDD-style tests

- Add 17 test cases covering storage, hook lifecycle, iteration
- Test completion detection, cancellation, recovery, session cleanup
- Fix storage.ts to handle YAML value parsing correctly
- Use BDD #given/#when/#then comments per project convention

* feat(builtin-commands): add ralph-loop and cancel-ralph commands

* feat(ralph-loop): register hook in main plugin

* docs: add Ralph Loop feature to all README files

* chore: regenerate JSON schema with ralph-loop config

* feat(ralph-loop): change state file path from .opencode to .sisyphus

🤖 Generated with assistance of https://github.com/code-yeongyu/oh-my-opencode

* feat(ralph-loop): integrate ralph-loop and cancel-ralph command handlers into plugin hooks

- Add chat.message hook to detect and start ralph-loop or cancel-ralph templates
- Add slashcommand hook to handle /ralph-loop and /cancel-ralph commands
- Support custom --max-iterations and --completion-promise options

🤖 Generated with assistance of https://github.com/code-yeongyu/oh-my-opencode

---------

Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
This commit is contained in:
YeonGyu-Kim
2025-12-30 17:41:03 +09:00
committed by GitHub
parent c401113537
commit 0f0f49b823
17 changed files with 974 additions and 6 deletions

View File

@@ -628,6 +628,12 @@ Oh My OpenCode는 다음 위치의 훅을 읽고 실행합니다:
에이전트들이 행복해지면, 당신이 제일 행복해집니다, 그렇지만 저는 당신도 돕고싶습니다.
- **Ralph Loop**: 작업이 완료될 때까지 계속 실행되는 자기 참조 개발 루프. Anthropic의 Ralph Wiggum 플러그인에서 영감을 받았습니다. **모든 프로그래밍 언어 지원.**
- `/ralph-loop "REST API 구축"`으로 시작하면 에이전트가 지속적으로 작업합니다
- `<promise>DONE</promise>` 출력 시 완료로 감지
- 완료 프라미스 없이 멈추면 자동 재시작
- 종료 조건: 완료 감지, 최대 반복 도달 (기본 100회), 또는 `/cancel-ralph`
- `oh-my-opencode.json`에서 설정: `{ "ralph_loop": { "enabled": true, "default_max_iterations": 100 } }`
- **Keyword Detector**: 프롬프트의 키워드를 자동 감지하여 전문 모드를 활성화합니다:
- `ultrawork` / `ulw`: 병렬 에이전트 오케스트레이션으로 최대 성능 모드
- `search` / `find` / `찾아` / `検索`: 병렬 explore/librarian 에이전트로 검색 극대화
@@ -865,7 +871,7 @@ Schema 자동 완성이 지원됩니다:
}
```
사용 가능한 훅: `todo-continuation-enforcer`, `context-window-monitor`, `session-recovery`, `session-notification`, `comment-checker`, `grep-output-truncator`, `tool-output-truncator`, `directory-agents-injector`, `directory-readme-injector`, `empty-task-response-detector`, `think-mode`, `anthropic-context-window-limit-recovery`, `rules-injector`, `background-notification`, `auto-update-checker`, `startup-toast`, `keyword-detector`, `agent-usage-reminder`, `non-interactive-env`, `interactive-bash-session`, `empty-message-sanitizer`, `preemptive-compaction`, `compaction-context-injector`, `thinking-block-validator`, `claude-code-hooks`
사용 가능한 훅: `todo-continuation-enforcer`, `context-window-monitor`, `session-recovery`, `session-notification`, `comment-checker`, `grep-output-truncator`, `tool-output-truncator`, `directory-agents-injector`, `directory-readme-injector`, `empty-task-response-detector`, `think-mode`, `anthropic-context-window-limit-recovery`, `rules-injector`, `background-notification`, `auto-update-checker`, `startup-toast`, `keyword-detector`, `agent-usage-reminder`, `non-interactive-env`, `interactive-bash-session`, `empty-message-sanitizer`, `preemptive-compaction`, `compaction-context-injector`, `thinking-block-validator`, `claude-code-hooks`, `ralph-loop`
**`auto-update-checker`와 `startup-toast`에 대한 참고사항**: `startup-toast` 훅은 `auto-update-checker`의 하위 기능입니다. 업데이트 확인은 유지하면서 시작 토스트 알림만 비활성화하려면 `disabled_hooks`에 `"startup-toast"`를 추가하세요. 모든 업데이트 확인 기능(토스트 포함)을 비활성화하려면 `"auto-update-checker"`를 추가하세요.