From 02c12f773e75bd7f99a0ab88c3dbdc5656d4ecf5 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sun, 6 Dec 2026 17:55:41 +0100 Subject: [PATCH] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=201=20=F0=9F=9F=A1=20(0=20misread);=20link=20only?= =?UTF-8?q?=20folders=20holding=20a=20SKILL.md,=20so=20a=20synced/=20or=20?= =?UTF-8?q?.trash/=20that=200.18.0=20let=20Claude=20Code=20write=20into=20?= =?UTF-8?q?the=20clone=20is=20never=20linked=20back,=20with=20prose=20roun?= =?UTF-8?q?d=201's=20comment=20wording=20in=20home.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/claude_home/home.py | 9 +++++---- bin/claude_home/test_home.py | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/bin/claude_home/home.py b/bin/claude_home/home.py index 874adf31..61ee3afc 100644 --- a/bin/claude_home/home.py +++ b/bin/claude_home/home.py @@ -15,7 +15,7 @@ from text_files.file_writes import replace_file # What the home links to in the clone: the instruction files Claude Code reads from its home, and the two folders those files name beside them. So a claude opens each file of the setup that they name in its own home: the setup's CLAUDE.md → "Vocabulary", "setup". LINKED = ("CLAUDE.md", "agents", "bin", "principles", "rules") -# The folder of skills, a folder of the home's own that holds a link to each of the clone's skills: Claude Code writes in it, such as the signed-in account's skills at sign-in, and a whole link would carry those writes into the clone. +# A folder of the home's own: Claude Code writes in it, such as the signed-in account's skills at sign-in, and a link to the whole folder would carry those writes into the clone. SKILLS = "skills" # Stands for the clone's folder in the clone's settings.json. Every value that holds it is a shell command, such as a hook's. CLONE = "{clone}" @@ -103,13 +103,14 @@ def linked(home: pathlib.Path, clone: pathlib.Path) -> Failure | None: if skills.is_symlink(): skills.unlink() skills.mkdir(exist_ok=True) - # Only links are replaced, so a skill the clone dropped loses its own, and what Claude Code wrote here stays. + # Only links are replaced, so a skill the clone dropped loses its link, and what Claude Code wrote here stays. for entry in skills.iterdir(): if entry.is_symlink(): entry.unlink() - # A clone without skills, as a test's may be, links none, as a whole link to a missing folder linked none. + # A skill is a folder that holds a SKILL.md, so the `synced/` and `.trash/` that a release before 0.18.1 let Claude Code write into the clone stay unlinked. A clone without skills/, as a test's may be, leaves the folder empty. for skill in sorted((clone / SKILLS).iterdir()) if (clone / SKILLS).is_dir() else []: - (skills / skill.name).symlink_to(skill) + if (skill / "SKILL.md").is_file(): + (skills / skill.name).symlink_to(skill) return None diff --git a/bin/claude_home/test_home.py b/bin/claude_home/test_home.py index 6fe8423e..7730976d 100644 --- a/bin/claude_home/test_home.py +++ b/bin/claude_home/test_home.py @@ -28,6 +28,8 @@ class Home(unittest.TestCase): self.clone = self.temp / "the clone" for folder in ("agents", "bin", "principles", "rules", "skills/larv-review", "skills/comprehension-panel"): (self.clone / folder).mkdir(parents=True) + for skill in ("larv-review", "comprehension-panel"): + (self.clone / "skills" / skill / "SKILL.md").write_text(f"# {skill}\n", encoding="utf-8") (self.clone / "CLAUDE.md").write_text("# The setup's rules\n", encoding="utf-8") (self.clone / "settings.json").write_text(json.dumps(SETTINGS), encoding="utf-8") self.home = self.temp / "share" / "claude-home" @@ -89,6 +91,19 @@ class Home(unittest.TestCase): self.assertFalse((self.home / "skills").is_symlink()) self.assertEqual((self.home / "skills" / "comprehension-panel").resolve(), (self.clone / "skills" / "comprehension-panel").resolve()) + def test_what_an_older_release_let_claude_code_write_into_the_clones_skills_is_not_linked_as_a_skill(self) -> None: + for leftover in ("synced/account/docx", ".trash/1-docx"): + (self.clone / "skills" / leftover).mkdir(parents=True) + (self.clone / "skills" / leftover / "SKILL.md").write_text("an account's skill\n", encoding="utf-8") + signed_in = self.home / "skills" / "synced" / "account" / "pdf" / "SKILL.md" + signed_in.parent.mkdir(parents=True) + signed_in.write_text("an account's skill\n", encoding="utf-8") + + self.assertIsNone(self.unready()) + + self.assertEqual(sorted(entry.name for entry in (self.home / "skills").iterdir() if entry.is_symlink()), ["comprehension-panel", "larv-review"]) + self.assertEqual(signed_in.read_text(encoding="utf-8"), "an account's skill\n") + def test_a_clone_without_skills_builds_a_home_with_an_empty_skills_folder(self) -> None: subprocess.run(["rm", "-r", str(self.clone / "skills")], check=True) @@ -98,7 +113,7 @@ class Home(unittest.TestCase): def test_a_skill_the_clone_dropped_loses_its_link_at_the_next_refresh(self) -> None: self.assertIsNone(self.unready()) - (self.clone / "skills" / "comprehension-panel").rmdir() + subprocess.run(["rm", "-r", str(self.clone / "skills" / "comprehension-panel")], check=True) self.commit = "4d5e6f\n" self.assertIsNone(self.unready())