mirror of
https://github.com/github/awesome-copilot.git
synced 2026-02-23 20:05:12 +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
|
## 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)
|
> **Runnable example:** [recipe/ralph-loop.cs](recipe/ralph-loop.cs)
|
||||||
>
|
>
|
||||||
> ```bash
|
> ```bash
|
||||||
> cd dotnet/recipe
|
> cd dotnet
|
||||||
> dotnet run ralph-loop.cs
|
> dotnet run recipe/ralph-loop.cs
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
## What is RALPH-loop?
|
## 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)
|
> **Runnable example:** [recipe/ralph-loop.go](recipe/ralph-loop.go)
|
||||||
>
|
>
|
||||||
> ```bash
|
> ```bash
|
||||||
> cd go/recipe
|
> cd go
|
||||||
> go run ralph-loop.go
|
> go run recipe/ralph-loop.go
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
## What is RALPH-loop?
|
## What is RALPH-loop?
|
||||||
@@ -20,13 +20,13 @@ RALPH-loop is a development methodology for iterative AI-powered task completion
|
|||||||
|
|
||||||
## Example Scenario
|
## 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
|
1. Send the initial prompt with clear success criteria
|
||||||
2. Claude writes code and tests
|
2. Copilot writes code and tests
|
||||||
3. Claude runs tests and sees failures
|
3. Copilot runs tests and sees failures
|
||||||
4. Loop automatically re-sends the prompt
|
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
|
6. Repeat until all tests pass and completion promise is output
|
||||||
|
|
||||||
## Basic Implementation
|
## 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)
|
> **Runnable example:** [recipe/ralph-loop.ts](recipe/ralph-loop.ts)
|
||||||
>
|
>
|
||||||
> ```bash
|
> ```bash
|
||||||
> cd nodejs/recipe
|
> cd recipe && npm install
|
||||||
> npm install
|
|
||||||
> npx tsx ralph-loop.ts
|
> npx tsx ralph-loop.ts
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
@@ -21,13 +20,13 @@ RALPH-loop is a development methodology for iterative AI-powered task completion
|
|||||||
|
|
||||||
## Example Scenario
|
## 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
|
1. Send the initial prompt with clear success criteria
|
||||||
2. Claude writes code and tests
|
2. Copilot writes code and tests
|
||||||
3. Claude runs tests and sees failures
|
3. Copilot runs tests and sees failures
|
||||||
4. Loop automatically re-sends the prompt
|
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
|
6. Repeat until all tests pass and completion promise is output
|
||||||
|
|
||||||
## Basic Implementation
|
## Basic Implementation
|
||||||
|
|||||||
@@ -22,8 +22,11 @@ class RalphLoop {
|
|||||||
* Run the RALPH-loop until completion promise is detected or max iterations reached.
|
* Run the RALPH-loop until completion promise is detected or max iterations reached.
|
||||||
*/
|
*/
|
||||||
async run(initialPrompt: string): Promise<string> {
|
async run(initialPrompt: string): Promise<string> {
|
||||||
|
let session: Awaited<ReturnType<CopilotClient["createSession"]>> | null = null;
|
||||||
|
|
||||||
await this.client.start();
|
await this.client.start();
|
||||||
const session = await this.client.createSession({
|
try {
|
||||||
|
session = await this.client.createSession({
|
||||||
model: "gpt-5.1-codex-mini"
|
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)}`);
|
console.error(`\nError during RALPH-loop: ${error instanceof Error ? error.message : String(error)}`);
|
||||||
throw error;
|
throw error;
|
||||||
} finally {
|
} finally {
|
||||||
|
if (session) {
|
||||||
await session.destroy();
|
await session.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
await this.client.stop();
|
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)
|
> **Runnable example:** [recipe/ralph_loop.py](recipe/ralph_loop.py)
|
||||||
>
|
>
|
||||||
> ```bash
|
> ```bash
|
||||||
> cd python/recipe
|
> cd recipe && pip install -r requirements.txt
|
||||||
> pip install -r requirements.txt
|
|
||||||
> python ralph_loop.py
|
> python ralph_loop.py
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
## What is RALPH-loop?
|
## 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:
|
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
|
## 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
|
1. Send the initial prompt with clear success criteria
|
||||||
2. Claude writes code and tests
|
2. Copilot writes code and tests
|
||||||
3. Claude runs tests and sees failures
|
3. Copilot runs tests and sees failures
|
||||||
4. Loop automatically re-sends the prompt
|
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
|
6. Repeat until all tests pass and completion promise is output
|
||||||
|
|
||||||
## Basic Implementation
|
## Basic Implementation
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ class RalphLoop:
|
|||||||
"""
|
"""
|
||||||
Run the RALPH-loop until completion promise is detected or max iterations reached.
|
Run the RALPH-loop until completion promise is detected or max iterations reached.
|
||||||
"""
|
"""
|
||||||
|
session = None
|
||||||
await self.client.start()
|
await self.client.start()
|
||||||
|
try:
|
||||||
session = await self.client.create_session(
|
session = await self.client.create_session(
|
||||||
SessionConfig(model="gpt-5.1-codex-mini")
|
SessionConfig(model="gpt-5.1-codex-mini")
|
||||||
)
|
)
|
||||||
@@ -73,7 +75,9 @@ class RalphLoop:
|
|||||||
print(f"\nError during RALPH-loop: {e}")
|
print(f"\nError during RALPH-loop: {e}")
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
|
if session is not None:
|
||||||
await session.destroy()
|
await session.destroy()
|
||||||
|
finally:
|
||||||
await self.client.stop()
|
await self.client.stop()
|
||||||
|
|
||||||
def _build_iteration_prompt(self, initial_prompt):
|
def _build_iteration_prompt(self, initial_prompt):
|
||||||
|
|||||||
Reference in New Issue
Block a user