Skip to content

Commit a511f22

Browse files
committed
fix: guide Claude to use goals instead of plans and auto-continue steps
- Add behavioral guidance to goal context: use goal system for multi-step tasks instead of EnterPlanMode, and continue to next step after completing one - Stop-reorient hook now explicitly tells Claude to continue with active goal - PostToolUse hook nudges continuation when a step is completed Co-developed-by: Claude Code v2.1.50 (claude-opus-4-6)
1 parent bcff006 commit a511f22

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

hooks/goals-post-tool.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,22 @@ set -euo pipefail
66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../scripts" && pwd)"
77
PROJECT_ROOT="${PWD}"
88

9+
# Read hook input from stdin to detect which tool was called
10+
INPUT=$(cat)
11+
TOOL_NAME=$(echo "$INPUT" | python3 -c "import sys,json; print(json.load(sys.stdin).get('tool_name',''))" 2>/dev/null || true)
12+
TOOL_OUTPUT=$(echo "$INPUT" | python3 -c "import sys,json; print(json.load(sys.stdin).get('tool_result',''))" 2>/dev/null || true)
13+
914
# Get updated status
1015
GOAL_STATUS=$(bash "${SCRIPT_DIR}/goal-context-helper.sh" --status "${PROJECT_ROOT}" 2>/dev/null || true)
1116

1217
if [[ -n "${GOAL_STATUS}" ]]; then
13-
STATUS_ESCAPED=$(echo -n "${GOAL_STATUS}" | python3 -c "import sys,json; print(json.dumps(sys.stdin.read()))" | sed 's/^"//;s/"$//')
18+
# Add continuation nudge when a step was just completed
19+
NUDGE=""
20+
if [[ "${TOOL_NAME}" == *"goal_update_step"* ]] && echo "${TOOL_OUTPUT}" | grep -q "completed"; then
21+
NUDGE=" | Continue to the next step."
22+
fi
23+
MSG="${GOAL_STATUS}${NUDGE}"
24+
STATUS_ESCAPED=$(echo -n "${MSG}" | python3 -c "import sys,json; print(json.dumps(sys.stdin.read()))" | sed 's/^"//;s/"$//')
1425
cat << EOF
1526
{
1627
"systemMessage": "${STATUS_ESCAPED}"

scripts/goal-context-helper.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,5 +197,12 @@ if learnings:
197197
lines.append(f" Full goal: ~/.claude/goals/{goal_uuid}.md")
198198
lines.append(" Commands: /context-daddy:goal (manage) | /context-daddy:goal-done (complete step) | /context-daddy:goal-focus (change step)")
199199
200+
# Behavioral guidance
201+
lines.append("")
202+
lines.append(" **IMPORTANT - Goal-driven workflow:**")
203+
lines.append(" - When the user asks for a large multi-step task, use the goal system (goal_create + goal_add_step) instead of EnterPlanMode.")
204+
lines.append(" - After completing a step, use goal_update_step to mark it done, then CONTINUE to the next step without waiting to be asked.")
205+
lines.append(" - Only stop between steps if you need user input or clarification.")
206+
200207
print("\n".join(lines))
201208
' 2>/dev/null || true

scripts/stop-reorient.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ INSTRUCTIONS="${INSTRUCTIONS}
9595
1. **Read ${CLAUDE_DIR}/CLAUDE.md** (if exists) - Project rules
9696
2. **Read ${CLAUDE_DIR}/learnings.md** (if exists) - Recent discoveries
9797
3. **Update narrative** (if significant learning): Run \`/context-daddy:refresh\`
98-
99-
Then continue with the current task."
98+
4. **Check the active goal** above - identify the current step and continue working on it. Do NOT wait to be asked."
10099

101100
# Escape for JSON
102101
INSTRUCTIONS_ESCAPED=$(echo -n "$INSTRUCTIONS" | python3 -c "import sys,json; print(json.dumps(sys.stdin.read()))" | sed 's/^"//;s/"$//')

0 commit comments

Comments
 (0)