From 846ab487c1a452d615078ac29799ed68f8b80311 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 30 Oct 2026 15:17:45 +0100 Subject: [PATCH] fix(install): drop stale skills and stamp dream once per repository Co-Authored-By: Claude Opus 5.5 (1M context) --- scripts/install.sh | 3 ++- skills/dream/SKILL.md | 2 +- skills/dream/hooks/reminder.sh | 2 +- tests/test_dream.py | 24 ++++++++++++++++++++++++ 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index bc3cce3..ccc5860 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -23,10 +23,11 @@ if [[ ! -d "${TARGET}" ]]; then fi cd "${REPO_ROOT}" +src="${REPO_ROOT}/.agents/skills" +rm -rf "${src}" log "skills: restoring from skills-lock.json..." npx --yes skills experimental_install -src="${REPO_ROOT}/.agents/skills" if [[ ! -d "${src}" ]]; then warn "skills: ${src} not found after install." exit 1 diff --git a/skills/dream/SKILL.md b/skills/dream/SKILL.md index d281717..11ca4e0 100644 --- a/skills/dream/SKILL.md +++ b/skills/dream/SKILL.md @@ -120,7 +120,7 @@ for the operator corrections the window revealed. Both keep their own confirmation steps; the dream never writes a skill on their behalf. Close the run by refreshing this repository's reminder stamp, so the next hint -is twelve hours out: `date +%s > "$(git rev-parse --absolute-git-dir)/.dream-stamp"`. +is twelve hours out: `date +%s > "$(git rev-parse --path-format=absolute --git-common-dir)/.dream-stamp"`. ## Rules diff --git a/skills/dream/hooks/reminder.sh b/skills/dream/hooks/reminder.sh index eedaca5..58c318a 100755 --- a/skills/dream/hooks/reminder.sh +++ b/skills/dream/hooks/reminder.sh @@ -10,7 +10,7 @@ interval="${DREAM_INTERVAL_SECONDS:-43200}" if [[ -n "${DREAM_STAMP:-}" ]]; then stamp="${DREAM_STAMP}" else - git_dir="$(git rev-parse --absolute-git-dir 2>/dev/null)" || exit 0 + git_dir="$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null)" || exit 0 stamp="${git_dir}/.dream-stamp" fi diff --git a/tests/test_dream.py b/tests/test_dream.py index 6dcefad..3a00090 100644 --- a/tests/test_dream.py +++ b/tests/test_dream.py @@ -82,6 +82,30 @@ class TestDreamHook(unittest.TestCase): self.assertTrue((repo / ".git" / ".dream-stamp").is_file()) self.assertEqual(_run_hook(repo).stdout, "") + @unittest.skipUnless(shutil.which("git"), "git not installed") + def test_linked_worktrees_share_the_stamp(self): + repo = self.cwd / "main" + tree = self.cwd / "tree" + env = { + "PATH": "/usr/bin:/bin", + "HOME": str(self.cwd), + "GIT_AUTHOR_NAME": "t", + "GIT_AUTHOR_EMAIL": "t@t", + "GIT_COMMITTER_NAME": "t", + "GIT_COMMITTER_EMAIL": "t@t", + } + repo.mkdir() + for args in ( + ["init", "-q"], + ["commit", "-q", "--allow-empty", "-m", "init"], + ["worktree", "add", "-q", str(tree)], + ): + subprocess.run( + ["git", *args], check=True, capture_output=True, env=env, cwd=str(repo) + ) + self.assertIn("/dream", _run_hook(repo).stdout) + self.assertEqual(_run_hook(tree).stdout, "") + @unittest.skipUnless(shutil.which("node"), "node not installed") class TestSettingsRegistration(unittest.TestCase):