Skip to content

fix(install): don't duplicate guidelines into a hand-merged CLAUDE.md#20

Merged
pallaoro merged 4 commits into
mainfrom
sidenote-command-sometimes-i-think-about
Jul 17, 2026
Merged

fix(install): don't duplicate guidelines into a hand-merged CLAUDE.md#20
pallaoro merged 4 commits into
mainfrom
sidenote-command-sometimes-i-think-about

Conversation

@pallaoro

Copy link
Copy Markdown
Member

Problem

An agent ran npx @clawnify/greybeard against a ~/.claude/CLAUDE.md that already contained the guidelines hand-merged (verbatim ## 1. Think Before Coding heading, no <!-- karpathy-skills --> markers). fenceInto only strips its own fenced block before re-appending, so it didn't recognize the hand-merged copy and appended a second full copy — silent duplication in the user's config. Confirmed happening in the wild.

Fix

  • Detect the verbatim heading outside our fenced block and skip with a warning instead of appending a duplicate. Reuses the exact heading hooks/greybeard-activate.js keys on, so the installer and the activate hook now dedupe identically (comment cross-references to keep them in sync).
  • Wire up the previously dead --force flag as the override (append anyway), documented in --help.
  • Warnings surface in both the changed and unchanged cases, so a skip is never masked by "Already up to date".

Kept it as skip + warn, not auto-convert: wrapping an arbitrarily-interleaved hand-merge in markers means guessing its boundaries in someone's config file — too risky. --force is the escape hatch.

Verification

Ran the real installer against throwaway HOMEs (not just typecheck):

  • Hand-merged + no force → CLAUDE.md skipped/warned (heading stays single, no markers), skills/commands still install.
  • --force → appends the fenced block.
  • Fresh install → re-run → idempotent "Already up to date", no false skip (managed file's heading lives inside the stripped block).
  • Uninstall → removes our block cleanly.
  • npm run check-sync green; guidelines source untouched.

pallaoro added 4 commits July 17, 2026 08:55
… current task

A passing thought dropped mid-task reads as a new request, so the agent
rushes the big task to get to it. /sidenote reframes it as a parked
later-task: log it verbatim to .claude/sidenotes.md, one-line ack, resume
with scope and pace unchanged. Bare /sidenote flushes the list. Wired into
the installer (copy on install, remove on uninstall) and documented in
the README alongside /scalable, including the plain-text SIDENOTE: prefix
for agents without slash commands.
fenceInto only stripped its own <!-- karpathy-skills --> block before
re-appending, so running the installer against a file where the guidelines
were hand-merged (verbatim '## 1. Think Before Coding' heading, no markers)
appended a second full copy. Detect that heading outside our block and skip
with a warning instead; wire up the previously-dead --force flag as the
override. Mirrors the activate hook's dedup so both paths behave the same.
@pallaoro
pallaoro merged commit 6360c91 into main Jul 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant