mirror of
https://github.com/github/awesome-copilot.git
synced 2026-02-24 04:15:14 +00:00
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -87,4 +87,4 @@ go run <filename>.go
|
||||
|
||||
## Status
|
||||
|
||||
Cookbook structure is complete with 5 recipes across all 4 supported languages. Each recipe includes both markdown documentation and runnable examples. The RALPH-loop recipe demonstrates iterative self-referential AI loops for autonomous task completion.
|
||||
Cookbook structure is complete with 6 recipes across all 4 supported languages. Each recipe includes both markdown documentation and runnable examples. The RALPH-loop recipe demonstrates iterative self-referential AI loops for autonomous task completion.
|
||||
|
||||
@@ -5,8 +5,8 @@ Implement self-referential feedback loops where an AI agent iteratively improves
|
||||
> **Runnable example:** [recipe/ralph-loop.cs](recipe/ralph-loop.cs)
|
||||
>
|
||||
> ```bash
|
||||
> cd dotnet/recipe
|
||||
> dotnet run ralph-loop.cs
|
||||
> cd dotnet
|
||||
> dotnet run recipe/ralph-loop.cs
|
||||
> ```
|
||||
|
||||
## What is RALPH-loop?
|
||||
|
||||
@@ -5,8 +5,8 @@ Implement self-referential feedback loops where an AI agent iteratively improves
|
||||
> **Runnable example:** [recipe/ralph-loop.go](recipe/ralph-loop.go)
|
||||
>
|
||||
> ```bash
|
||||
> cd go/recipe
|
||||
> go run ralph-loop.go
|
||||
> cd go
|
||||
> go run recipe/ralph-loop.go
|
||||
> ```
|
||||
|
||||
## What is RALPH-loop?
|
||||
@@ -20,13 +20,13 @@ RALPH-loop is a development methodology for iterative AI-powered task completion
|
||||
|
||||
## Example Scenario
|
||||
|
||||
You need to iteratively improve code until all tests pass. Instead of asking Claude to "write perfect code," you use RALPH-loop to:
|
||||
You need to iteratively improve code until all tests pass. Instead of asking Copilot to "write perfect code," you use RALPH-loop to:
|
||||
|
||||
1. Send the initial prompt with clear success criteria
|
||||
2. Claude writes code and tests
|
||||
3. Claude runs tests and sees failures
|
||||
2. Copilot writes code and tests
|
||||
3. Copilot runs tests and sees failures
|
||||
4. Loop automatically re-sends the prompt
|
||||
5. Claude reads test output and previous code, fixes issues
|
||||
5. Copilot reads test output and previous code, fixes issues
|
||||
6. Repeat until all tests pass and completion promise is output
|
||||
|
||||
## Basic Implementation
|
||||
|
||||
@@ -5,8 +5,7 @@ Implement self-referential feedback loops where an AI agent iteratively improves
|
||||
> **Runnable example:** [recipe/ralph-loop.ts](recipe/ralph-loop.ts)
|
||||
>
|
||||
> ```bash
|
||||
> cd nodejs/recipe
|
||||
> npm install
|
||||
> cd recipe && npm install
|
||||
> npx tsx ralph-loop.ts
|
||||
> ```
|
||||
|
||||
@@ -21,13 +20,13 @@ RALPH-loop is a development methodology for iterative AI-powered task completion
|
||||
|
||||
## Example Scenario
|
||||
|
||||
You need to iteratively improve code until all tests pass. Instead of asking Claude to "write perfect code," you use RALPH-loop to:
|
||||
You need to iteratively improve code until all tests pass. Instead of asking Copilot to "write perfect code," you use RALPH-loop to:
|
||||
|
||||
1. Send the initial prompt with clear success criteria
|
||||
2. Claude writes code and tests
|
||||
3. Claude runs tests and sees failures
|
||||
2. Copilot writes code and tests
|
||||
3. Copilot runs tests and sees failures
|
||||
4. Loop automatically re-sends the prompt
|
||||
5. Claude reads test output and previous code, fixes issues
|
||||
5. Copilot reads test output and previous code, fixes issues
|
||||
6. Repeat until all tests pass and completion promise is output
|
||||
|
||||
## Basic Implementation
|
||||
|
||||
@@ -22,8 +22,11 @@ class RalphLoop {
|
||||
* Run the RALPH-loop until completion promise is detected or max iterations reached.
|
||||
*/
|
||||
async run(initialPrompt: string): Promise<string> {
|
||||
let session: Awaited<ReturnType<CopilotClient["createSession"]>> | null = null;
|
||||
|
||||
await this.client.start();
|
||||
const session = await this.client.createSession({
|
||||
try {
|
||||
session = await this.client.createSession({
|
||||
model: "gpt-5.1-codex-mini"
|
||||
});
|
||||
|
||||
@@ -62,7 +65,11 @@ class RalphLoop {
|
||||
console.error(`\nError during RALPH-loop: ${error instanceof Error ? error.message : String(error)}`);
|
||||
throw error;
|
||||
} finally {
|
||||
if (session) {
|
||||
await session.destroy();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
await this.client.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,9 @@ Implement self-referential feedback loops where an AI agent iteratively improves
|
||||
> **Runnable example:** [recipe/ralph_loop.py](recipe/ralph_loop.py)
|
||||
>
|
||||
> ```bash
|
||||
> cd python/recipe
|
||||
> pip install -r requirements.txt
|
||||
> cd recipe && pip install -r requirements.txt
|
||||
> python ralph_loop.py
|
||||
> ```
|
||||
|
||||
## What is RALPH-loop?
|
||||
|
||||
RALPH-loop is a development methodology for iterative AI-powered task completion. Named after the Ralph Wiggum technique, it embodies the philosophy of persistent iteration:
|
||||
@@ -21,13 +19,13 @@ RALPH-loop is a development methodology for iterative AI-powered task completion
|
||||
|
||||
## Example Scenario
|
||||
|
||||
You need to iteratively improve code until all tests pass. Instead of asking Claude to "write perfect code," you use RALPH-loop to:
|
||||
You need to iteratively improve code until all tests pass. Instead of asking Copilot to "write perfect code," you use RALPH-loop to:
|
||||
|
||||
1. Send the initial prompt with clear success criteria
|
||||
2. Claude writes code and tests
|
||||
3. Claude runs tests and sees failures
|
||||
2. Copilot writes code and tests
|
||||
3. Copilot runs tests and sees failures
|
||||
4. Loop automatically re-sends the prompt
|
||||
5. Claude reads test output and previous code, fixes issues
|
||||
5. Copilot reads test output and previous code, fixes issues
|
||||
6. Repeat until all tests pass and completion promise is output
|
||||
|
||||
## Basic Implementation
|
||||
|
||||
@@ -25,7 +25,9 @@ class RalphLoop:
|
||||
"""
|
||||
Run the RALPH-loop until completion promise is detected or max iterations reached.
|
||||
"""
|
||||
session = None
|
||||
await self.client.start()
|
||||
try:
|
||||
session = await self.client.create_session(
|
||||
SessionConfig(model="gpt-5.1-codex-mini")
|
||||
)
|
||||
@@ -73,7 +75,9 @@ class RalphLoop:
|
||||
print(f"\nError during RALPH-loop: {e}")
|
||||
raise
|
||||
finally:
|
||||
if session is not None:
|
||||
await session.destroy()
|
||||
finally:
|
||||
await self.client.stop()
|
||||
|
||||
def _build_iteration_prompt(self, initial_prompt):
|
||||
|
||||
Reference in New Issue
Block a user