diff --git a/.agent/scripts/commands/full-loop.md b/.agent/scripts/commands/full-loop.md index 21e922ac15..090e10fceb 100644 --- a/.agent/scripts/commands/full-loop.md +++ b/.agent/scripts/commands/full-loop.md @@ -8,6 +8,45 @@ Start a full development loop that chains all phases from task implementation to Task/Prompt: $ARGUMENTS +## Step 0: Resolve Task ID and Set Session Title + +**IMPORTANT**: Before proceeding, extract the first positional argument from `$ARGUMENTS` (ignoring flags like `--max-task-iterations`). Check if it matches the task ID pattern `t\d+` (e.g., `t061`). + +If the first argument is a task ID (e.g., `t061`): + +1. Extract the task ID and look up its description from TODO.md: + + ```bash + # Extract first argument (the task ID) + TASK_ID=$(echo "$ARGUMENTS" | awk '{print $1}') + + # Look up description (matches open, completed, or declined tasks) + TASK_DESC=$(grep -E "^- \[( |x|-)\] $TASK_ID " TODO.md 2>/dev/null | head -1 | sed -E 's/^- \[( |x|-)\] [^ ]* //') + ``` + +2. Set the session title using the `session-rename` MCP tool: + + ```text + # Call the session-rename tool with the title parameter + session-rename(title: "t061: Improve session title to include task description") + ``` + + - Good: `"t061: Improve session title to include task description"` + - Bad: `"Full loop development for t061"` + +3. **Fallback**: If `$TASK_DESC` is empty (task not found in TODO.md), use: `"t061: (task not found in TODO.md)"` + +4. Store the full task description for use in subsequent steps. + +If the first argument is NOT a task ID (it's a description): +- Use the description directly for the session title +- Call `session-rename` tool with a concise version if the description is very long (truncate to ~60 chars) + +**Example session titles:** +- Task ID `t061` with description "Improve session title format" → `"t061: Improve session title format"` +- Task ID `t999` not found → `"t999: (task not found in TODO.md)"` +- Description "Add JWT authentication" → `"Add JWT authentication"` + ## Full Loop Phases ```text diff --git a/.agent/scripts/generate-opencode-commands.sh b/.agent/scripts/generate-opencode-commands.sh index 0d24f9e9be..997881e2c6 100755 --- a/.agent/scripts/generate-opencode-commands.sh +++ b/.agent/scripts/generate-opencode-commands.sh @@ -1113,6 +1113,8 @@ Start a Ralph loop for iterative development. Arguments: $ARGUMENTS +**Session Title**: Only set a session title if one hasn't been set already (e.g., by `/ralph-task` which sets `"t042: description"`). If no task-prefixed title exists, use `session-rename` with a concise version of the prompt (truncate to ~60 chars if needed). + **Usage:** ```bash /ralph-loop "" --max-iterations --completion-promise "" @@ -1358,7 +1360,8 @@ Task ID: $ARGUMENTS **Workflow:** 1. Find task in TODO.md by ID (e.g., t042) 2. Extract ralph metadata (promise, verify command, max iterations) -3. Start Ralph loop with extracted parameters +3. **Set session title** using `session-rename` tool with format: `"t042: Task description here"` +4. Start Ralph loop with extracted parameters **Task format in TODO.md:** ```markdown @@ -1381,7 +1384,8 @@ Task ID: $ARGUMENTS This will: 1. Read TODO.md and find task t042 2. Extract the ralph-promise, ralph-verify, ralph-max values -3. Start: `/ralph-loop "{task description}" --completion-promise "{promise}" --max-iterations {max}` +3. Set session title to `"t042: {task description}"` using `session-rename` tool +4. Start: `/ralph-loop "{task description}" --completion-promise "{promise}" --max-iterations {max}` **Requirements:** - Task must have `#ralph` tag @@ -1414,6 +1418,7 @@ Task Development → Preflight → PR Create → PR Review → Postflight → De ```bash /full-loop "Implement feature X with tests" /full-loop "Fix bug Y" --max-task-iterations 30 +/full-loop t061 # Will look up task description from TODO.md ``` **Options:**