Repository navigation
feat(history): add historical log context for Ralph iterations - #10
Merged
Merged
Conversation
Enable fresh Ralph iterations to optionally access historical logs from earlier runs to avoid repeating failed approaches. Features: - Three modes: off (default), smart (recommended), full - Configurable token budget (default 4000) - Parses existing run-*.md summary files - CLI flags: --with-history, --no-history, --history-mode Configuration in .agents/ralph/config.sh: - RALPH_HISTORY_MODE: off|smart|full - RALPH_HISTORY_TOKEN_BUDGET: max tokens for context - RALPH_HISTORY_MAX_RUNS: max historical runs to index Smart mode prioritizes: 1. Failures for current story 2. Successful approaches for current story 3. Recent failures from other stories Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Owner
Author
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant CLI as bin/ralph
participant LoopScript as loop.sh
participant Indexer as indexer.js
participant ContextCLI as context-cli.js
participant Prompt as PROMPT_build.md
User->>CLI: ralph build 5 --with-history
CLI->>CLI: Parse flags and set env
CLI->>LoopScript: Execute with RALPH_HISTORY_MODE
LoopScript->>LoopScript: Start iteration
LoopScript->>LoopScript: Select next story and set STORY_ID
alt History enabled and STORY_ID exists
LoopScript->>ContextCLI: Invoke node context-cli.js
ContextCLI->>Indexer: buildIndex prdFolder
Indexer->>Indexer: Parse run-*.md files
Indexer-->>ContextCLI: Return structured index
alt Smart mode
ContextCLI->>Indexer: Get story runs and failures
ContextCLI->>ContextCLI: Generate focused context
else Full mode
ContextCLI->>ContextCLI: Score and rank all runs
ContextCLI->>ContextCLI: Generate complete context
end
ContextCLI-->>LoopScript: Return markdown context
LoopScript->>LoopScript: Export HISTORICAL_CONTEXT
LoopScript->>LoopScript: Log context generation
end
LoopScript->>Prompt: Call render_prompt
Prompt->>Prompt: Replace HISTORICAL_CONTEXT placeholder
Prompt-->>LoopScript: Rendered prompt with history
LoopScript->>LoopScript: Execute agent iteration
LoopScript-->>User: Complete with learning
|
Greptile's behavior is changing!From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
AskTinNguyen
added a commit
that referenced
this pull request
Jan 19, 2026
Address GreptileAI review comments: - Prefix unused 'success' function with underscore (line 42) - Prefix unused 'parallelModule' variable with underscore (line 749) - Add missing 'warn()' function definition (line 876 - CRITICAL) This resolves all critical logic issues flagged in PR #10. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
off(default),smart(recommended),fullrun-*.mdsummary files for contextChanges
New files:
lib/history/indexer.js- Parses run-*.md summary files into structured datalib/history/context-cli.js- CLI to generate{{HISTORICAL_CONTEXT}}markdownlib/history/index.js- Module exportsModified files:
.agents/ralph/config.sh- AddedRALPH_HISTORY_*configuration variables.agents/ralph/PROMPT_build.md- Added{{HISTORICAL_CONTEXT}}section.agents/ralph/loop.sh- Added history generation beforerender_prompt()bin/ralph- Added--with-history,--no-history,--history-modeflagsUsage
Configuration
Test plan
🤖 Generated with Claude Code