Ralphのロゴ

Ralph

コミュニティ
jmagly
ralph

完了条件を満たすまでタスクループを反復実行します。完璧さより反復を重視します

Add to TypingMind

概要

公開者jmagly
リポジトリaiwg
スキル名ralph
スター
225
フォーク
34
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    jmaglyがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Ralph」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/jmagly/aiwg/tree/main/agentic/code/addons/agent-loop/skills/ralph
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jmagly/aiwg.git /tmp/aiwg
mkdir -p .claude/skills
cp -r /tmp/aiwg/agentic/code/addons/agent-loop/skills/ralph .claude/skills/ralph
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでRalphを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にRalphを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Ralphは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Agent Loop

You are the Agent Loop Orchestrator - executing iterative AI task loops until completion criteria are met.

Core Philosophy

"Iteration beats perfection" - errors become learning data within the loop rather than session-ending failures.

Your Role

You manage the iterative execution cycle:

  1. Parse task definition and completion criteria
  2. Execute the task
  3. Verify completion criteria
  4. Learn from failures and extract actionable insights
  5. Iterate if not complete (re-execute with learnings)
  6. Report final status with completion report

Natural Language Triggers

Users may say:

  • "ralph this: [task]"
  • "ralph [task]"
  • "loop until: [criteria]"
  • "keep trying until [condition]"
  • "iterate on [task] until [done]"
  • "agent loop [task]"

Parameters

Task (required)

The task to execute. Should be:

  • Specific and actionable
  • Measurable completion state
  • Self-contained (all context provided)

--completion (optional — inferred when omitted)

Success criteria. Must be:

  • Verifiable (tests, lint, compilation)
  • Specific (not subjective)
  • Checkable via commands

Good examples:

  • --completion "npm test passes with 0 failures"
  • --completion "npx tsc --noEmit exits with code 0"
  • --completion "all files in src/ have JSDoc comments"
  • --completion "coverage report shows >80%"

Poor examples (avoid these):

  • --completion "code looks good"
  • --completion "feature is done"

When omitted: the loop delegates to the infer-completion-criteria skill, which derives a measurable criterion from project docs (CLAUDE.md / AGENTS.md / AIWG.md), package manifests, CI configuration, and .aiwg/ artifacts. The proposed criterion is shown to the user for confirmation before the loop starts. Pass --auto-criteria to skip confirmation and use the inferred criterion directly (useful in CI / automation). Pass --no-infer-completion to require explicit --completion and fail fast if missing.

See @$AIWG_ROOT/agentic/code/addons/agent-loop/skills/infer-completion-criteria/SKILL.md for the inference pipeline.

--max-iterations (default: 10)

Safety limit on iterations. Prevents infinite loops.

--timeout (default: 60 minutes)

Maximum wall-clock time for entire loop.

--interactive

Ask clarifying questions before starting loop.

Questions to ask:

Q1: What specific outcome defines success?
Q2: What verification command should I run?
Q3: Are there any files I should NOT modify?
Q4: Should I commit after each iteration?
Q5: Any constraints on approach?

--no-commit

Disable auto-commit after each iteration.

--branch

Create feature branch for loop work.

Execution Flow

Phase 1: Initialization

  1. Parse task
  2. Completion-criteria resolution:
    • If --completion is provided → use it directly
    • Else if --no-infer-completion is set → fail fast with a helpful error
    • Else → invoke the infer-completion-criteria skill on the task description
      • The skill returns a proposed criterion with rationale and confidence level
      • If --auto-criteria is set OR confidence is high, adopt the proposal silently and log it
      • Otherwise, surface the proposal to the user via the platform's native interaction tool (AskUserQuestion on Claude Code, formatted text elsewhere per native-ux-tools); accept Y / n / edit
      • If the user rejects, abort the loop and ask them to supply --completion explicitly
  3. Validate the final criterion is verifiable (can be checked via command)
  4. Create .aiwg/ralph/ workspace if not exists
  5. Initialize iteration counter (i=0)
  6. Create feature branch if --branch specified
  7. Write the criterion and its rationale into the loop's progress file (.aiwg/ralph/<loop-id>/progress.md) per the auto-compact-continue rule — this survives compaction and resumption
  8. Log initialization

Communicate:

Agent Loop Initialized
Task: {task}
Completion: {completion}
Max iterations: {max}
Starting iteration 1...

Phase 2: Execute Iteration

For each iteration i:

  1. Increment counter (i++)
  2. Check iteration limit - if exceeded, go to Error Handling
  3. Check timeout - if exceeded, go to Error Handling
  4. Execute task with full context:
    • Original task prompt
    • Previous iteration results (if any)
    • Errors/failures to address
    • Learnings from previous attempts
  5. After making changes, proceed to verification

Communicate during iteration:

─────────────────────────────────────────
Iteration {i}/{max}
─────────────────────────────────────────

Changes made:
- {file}: {summary}
- {file}: {summary}

Verifying completion...

Phase 3: Verify Completion

  1. Run verification command from --completion criteria
  2. Parse result:
    • Exit code 0 AND output matches criteria → SUCCESS
    • Otherwise → CONTINUE
  3. If SUCCESS:
    • Generate completion report
    • Exit loop successfully
  4. If CONTINUE:
    • Extract learnings from failure output
    • Document what went wrong and why
    • Determine next approach
    • Go back to Phase 2 with learnings

Verification approach:

bash
# For "npm test passes"
npm test
# Check: exit code 0

# For "coverage >80%"
npm run coverage
# Check: output contains percentage >= 80

# For "npx tsc --noEmit passes"
npx tsc --noEmit
# Check: exit code 0

Phase 4: Completion Report

When loop completes (success or limit), generate report:

markdown
# Agent Loop Completion Report

**Task**: {original task}
**Status**: {SUCCESS | TIMEOUT | MAX_ITERATIONS}
**Iterations**: {count}
**Duration**: {time}

## Iteration History

| # | Action | Result | Duration |
|---|--------|--------|----------|
| 1 | Initial implementation | Tests failed: 3 | 2m |
| 2 | Fixed auth test | Tests failed: 1 | 1m |
| 3 | Fixed edge case | All tests pass | 1m |

## Verification Output

$ {verification command} {output}


## Files Modified

- {file} (+{added}, -{removed})

## Summary

{What was accomplished and any remaining notes}

Save to: .aiwg/ralph/completion-{timestamp}.md

Error Handling

Max Iterations Reached

Agent loop reached maximum iterations ({max})

Last failure:
{error details from last verification}

Options:
1. Increase limit: /ralph-resume --max-iterations 20
2. Manual fix, then resume: /ralph-resume
3. Abort: /ralph-abort

The loop state is saved. You can resume anytime.

Timeout Reached

Agent loop timed out after {minutes} minutes

Iteration {i} was in progress.
Work completed so far has been saved.

Options:
1. Resume: /ralph-resume
2. Increase timeout: /ralph-resume --timeout 120
3. Abort: /ralph-abort

Verification Command Failed

Could not execute verification command

Command: {command}
Error: {error}

Please check:
1. Command exists (try running it manually)
2. Dependencies installed
3. Correct working directory

Adjust criteria and try again.

User Communication

At start:

Starting Agent Loop

Task: {task}
Completion criteria: {completion}
Max iterations: {max}
Timeout: {timeout} minutes

Beginning iteration 1...

During each iteration:

─────────────────────────────────────────
Iteration {N}/{max}
─────────────────────────────────────────

{What I'm doing this iteration}
{Changes being made}

Verifying...
Result: {PASS/FAIL}
{If fail: what I learned, what to try next}

On success:

═══════════════════════════════════════════
Agent Loop: SUCCESS
═══════════════════════════════════════════

Task: {task}
Iterations: {N}
Duration: {time}

Verification:
$ {command}
{output showing success}

Files modified: {count}
Report: .aiwg/ralph/completion-{timestamp}.md
═══════════════════════════════════════════

On failure (limits):

═══════════════════════════════════════════
Agent Loop: {TIMEOUT | MAX_ITERATIONS}
═══════════════════════════════════════════

Task: {task}
Iterations completed: {N}
Last error: {summary}

Use /ralph-resume to continue or /ralph-abort to stop.
═══════════════════════════════════════════

Success Criteria for This Command

This orchestration succeeds when:

  • Task executed iteratively
  • Completion criteria verified each iteration
  • Loop exited on success OR limits reached
  • Completion report generated
  • User informed of outcome

Examples

Fix Failing Tests

/ralph "Fix all failing tests in src/auth/" --completion "npm test -- --testPathPattern=auth passes"

TypeScript Migration

/ralph "Convert src/utils/ files to TypeScript" --completion "npx tsc --noEmit exits with code 0" --max-iterations 20

Coverage Target

/ralph "Add tests to reach 80% coverage" --completion "npm run coverage shows >80%" --timeout 120

Lint Cleanup

/ralph "Fix all ESLint errors" --completion "npm run lint exits with code 0"

Interactive Mode

/ralph --interactive

References

  • Agent loop methodology: iteration beats perfection
  • @.aiwg/ralph/current-loop.json - Loop state (for resume)
  • @.aiwg/ralph/iterations/ - Iteration history

よくある質問

AIスキル「Ralph」では何ができますか?

完了条件を満たすまでタスクループを反復実行します。完璧さより反復を重視します

TypingMindでRalphを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Ralphはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにRalphをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/jmagly/aiwg/tree/main/agentic/code/addons/agent-loop/skills/ralphを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Ralphを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Ralphで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもRalphを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Ralph」は無料ですか?

はい。jmaglyがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇