Can we add a short summary to the notification message?
Now I can see the notification messages sent from ralph.sh. Let me look at the key notification calls:
Start (line 596): :rocket: *Ralph Started*\n\``Plan: $PLAN_BASENAME\nMode: $MODE\nRepo: $REPO_NAME````
Complete (line 667): :white_check_mark: *Ralph Complete!*\n\``Plan: $PLAN_BASENAME\nIterations: $ITERATION\nRepo: $REPO_NAME````
Max iterations (line 676): :warning: *Ralph Stopped*\n\``Plan: $PLAN_BASENAME\nReason: Max iterations reached ($MAX_ITERATIONS)\nRepo: $REPO_NAME````
Error (line 859): :x: *Ralph Error*\n\``Plan: $PLAN_BASENAME\nIteration: $ITERATION\nError: $error_type (after $claude_attempt retries)\nRepo: $REPO_NAME````
Progress (line 889): The notification appears to be cut off, but it's tracking progress updates during execution.
Planning complete (line 874): :clipboard: *Ralph Planning Complete!*\n\``Plan: $PLAN_BASENAME\nTask list created in: $PROGRESS_FILE\nRepo: $REPO_NAME````
The user wants to add a short summary to these notification messages, probably pulling recent accomplishments from the progress file to give more context about what Ralph actually did in each iteration. I'm thinking about how to extract that summary — maybe the last few lines or most recent task status from the progress file would work well.
The straightforward approach is to create a function that pulls a short summary from the progress file and then weave that into the notification messages for progress updates, completion, and stopped states. I'll write a function to extract those recent lines and include them in the relevant notifications.
Now I understand the notification flow. The notifications are sent from ralph.sh at various points (start, progress, complete, error, etc.) but they don't include any summary of what was accomplished. I'll add a function to extract a short summary from the progress file and include it in the relevant notifications.
Let me check what the progress file typically looks like.
3-## Your Inputs
4-
5-1. **Plan File**: ${PLAN_FILE}
6:2. **Progress File**: ${PROGRESS_FILE}
7-3. **Guardrails File**: ${GUARDRAILS_FILE}
8-
9-## Guardrails
--
37-## Instructions
38-
39-0a. Read the plan file to understand the overall goal.
40:0b. Read the progress file to see the task list and current state.
41:0c. If there's no task list yet, create one based on the plan (keep Status as IN_PROGRESS).
42-
43-1. **Select ONE task**: Pick the highest-priority uncompleted task (marked with [ ]).
44- - Before implementing, search the codebase to confirm it's not already done
--
54- - Run build/typecheck/lint as appropriate
55- - Fix any issues before considering the task complete
56-
57:4. **Update progress file**:
58- - Mark the completed task with [x]
59- - Add any discoveries or notes
60- - If you found bugs or new tasks, add them to the list
--
66-
67-6. **Check completion** (IMPORTANT - read carefully):
68- - Count the tasks: How many total? How many marked [x]? How many still [ ]?
69: - If there are ANY tasks still marked [ ], keep Status as IN_PROGRESS
70- - ONLY write the completion marker when ALL tasks are marked [x] complete AND verified working
71: - When in doubt, leave Status as IN_PROGRESS - another iteration will check again
72-
73-## Rules
74-
75-- **ONE task per iteration** - do not try to do multiple tasks
76-- **Search before implementing** - use subagents to explore and verify before coding
77-- **Run validation** - tests, build, lint as appropriate
78:- **Update progress file** - this is how the loop tracks state
79-- **Commit your work** - each iteration should produce a commit (unless auto-commit is disabled)
80-- **Only signal completion when truly done** - all tasks must be [x] complete and verified
81-
82-## Progress File Updates
83-
84:After completing a task, update ${PROGRESS_FILE}:
85-
86-```
87-# Progress: ${PLAN_NAME}
88-
89-## Status
90:IN_PROGRESS
91-
92-## Task List
93-- [x] Task 1: completed
--
108-1. Count ALL tasks in the task list
109-2. Confirm EVERY SINGLE task is marked [x] - not just most, ALL of them
110-3. Use subagents to verify the implementation actually works (run tests, check build)
111:4. If ANY task is still [ ] or unverified, keep Status as IN_PROGRESS
112-
113-**Only when ALL of the above are true:**
114-1. Verify everything works (tests pass, builds clean)
--
123-**If you cannot complete a task** (blocked, needs clarification):
124-- Add a note explaining why
125-- Move to the next task
126:- Keep Status as IN_PROGRESS
127-
128:**When in doubt, keep Status as IN_PROGRESS.** It's better to run an extra iteration than to exit prematurely.The user wants to add a short summary to the notification message. Let me first understand the codebase - this seems to be about the Ralph project. Let me look at the notification-related code to understand what's currently happening.
Let me check the relevant files to understand the notification system.
Good, now I can see the progress file format. The progress file has a task list with [x] for completed and [ ] for pending tasks. I'll add a function to extract a brief summary (last completed task or task counts) and include it in the notification messages.
Now I'll add the summary function and update the notification messages.
Now update the notification messages to include the summary. Let me update the completion, max-iterations, progress, and error notifications.
Let me look at how notifications are currently sent.
Now let me verify the changes look correct.
Let me also quickly verify the notification call sites look right.
615:get_progress_summary() {
704: SUMMARY=$(get_progress_summary)
705: SUMMARY_BLOCK=""
706: [ -n "$SUMMARY" ] && SUMMARY_BLOCK="\n$SUMMARY"
707: notify ":white_check_mark: *Ralph Complete!*\n\`\`\`Plan: $PLAN_BASENAME\nIterations: $ITERATION\nRepo: $REPO_NAME${SUMMARY_BLOCK}\`\`\`" ":white_check_mark:"
716: SUMMARY=$(get_progress_summary)
717: SUMMARY_BLOCK=""
718: [ -n "$SUMMARY" ] && SUMMARY_BLOCK="\n$SUMMARY"
719: notify ":warning: *Ralph Stopped*\n\`\`\`Plan: $PLAN_BASENAME\nReason: Max iterations reached ($MAX_ITERATIONS)\nRepo: $REPO_NAME${SUMMARY_BLOCK}\`\`\`" ":warning:"
902: SUMMARY=$(get_progress_summary)
903: SUMMARY_BLOCK=""
904: [ -n "$SUMMARY" ] && SUMMARY_BLOCK="\n$SUMMARY"
905: notify ":x: *Ralph Error*\n\`\`\`Plan: $PLAN_BASENAME\nIteration: $ITERATION\nError: $error_type (after $claude_attempt retries)\nRepo: $REPO_NAME${SUMMARY_BLOCK}\`\`\`" ":x:"
935: SUMMARY=$(get_progress_summary)
936: SUMMARY_BLOCK=""
937: [ -n "$SUMMARY" ] && SUMMARY_BLOCK="\n$SUMMARY"
938: notify ":gear: *Ralph Progress*: Iteration $ITERATION completed\n\`\`\`Plan: $PLAN_BASENAME\nRepo: $REPO_NAME${SUMMARY_BLOCK}\`\`\`" ":gear:"Found 22 files
ralph.sh
lib/constants.sh
notify.sh
setup-notifications.sh
update.sh
tests/test-ralph.sh
tests/test-security-fixes.sh
tests/test-security.sh
tests/test-setup.sh
tests/test-validation-lib.sh
tests/docker-test.sh
tests/run-all-tests.sh
tests/test-constants-lib.sh
tests/test-integration.sh
tests/test-monitor.sh
tests/test-notify.sh
monitor-progress.sh
install.sh
launcher.sh
configure.sh
decrypt-env.sh
detect-platform.shLet me also do a quick syntax check.
>bash -n /mnt/dest-btrfs/home/jc/ralph/ralph.sh(empty result)Syntax is clean. Here's what I added:
get_progress_summary() - parses the progress file and returns a compact summary like:
Tasks: 3/7Last: Add input validation to API endpointsThis summary is now appended to all four notification types:
The summary is omitted if there's no task list yet (e.g., the start notification stays unchanged). Task names longer than 60 chars get truncated with ....
Tasks: 3/7Last: Add input validation to API endpoints