From f19eb775c1784d9d72b8c1a6383aa8b152cf30da Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 21 Jan 2026 00:25:47 +0000 Subject: [PATCH] Sync capture_prompt_work_tree.sh from .deepwork to standard_jobs The .deepwork version was updated in PR #85 with HEAD ref capture functionality, but the standard_jobs source was not updated. This syncs the newer version which includes: - Capture HEAD commit ref at prompt time - Used by get_changed_files_prompt() to detect committed changes --- .../deepwork_rules/hooks/capture_prompt_work_tree.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/deepwork/standard_jobs/deepwork_rules/hooks/capture_prompt_work_tree.sh b/src/deepwork/standard_jobs/deepwork_rules/hooks/capture_prompt_work_tree.sh index 3f2cefad..c9cedd82 100755 --- a/src/deepwork/standard_jobs/deepwork_rules/hooks/capture_prompt_work_tree.sh +++ b/src/deepwork/standard_jobs/deepwork_rules/hooks/capture_prompt_work_tree.sh @@ -8,12 +8,20 @@ # The baseline contains ALL tracked files (not just changed files) so that # the rules_check hook can determine which files are genuinely new vs which # files existed before and were just modified. +# +# It also captures the HEAD commit ref so that committed changes can be detected +# by comparing HEAD at Stop time to the captured ref. set -e # Ensure .deepwork directory exists mkdir -p .deepwork +# Save the current HEAD commit ref for detecting committed changes +# This is used by get_changed_files_prompt() to detect files changed since prompt, +# even if those changes were committed during the agent response. +git rev-parse HEAD > .deepwork/.last_head_ref 2>/dev/null || echo "" > .deepwork/.last_head_ref + # Save ALL tracked files (not just changed files) # This is critical for created: mode rules to distinguish between: # - Newly created files (not in baseline) -> should trigger created: rules