From 26cbf930b4a729dfb38ff8078ecbfcb0264c5360 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 25 Aug 2026 23:54:07 +0000 Subject: [PATCH] Keep gathered sources verbatim WebFetch and "cleaned source" were inviting a paraphrase. Save files and pastes through save-source.mjs, strip page chrome only, and show first/last lines so the author can confirm it is their writing. --- .github/workflows/test.yml | 2 +- README.md | 2 +- package.json | 2 +- skills/docwriter-style-generator/SKILL.md | 46 +++- .../scripts/save-source.mjs | 219 ++++++++++++++++++ tests/lexical-analysis.mjs | 9 +- tests/save-source.mjs | 94 ++++++++ 7 files changed, 359 insertions(+), 15 deletions(-) create mode 100644 skills/docwriter-style-generator/scripts/save-source.mjs create mode 100644 tests/save-source.mjs diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 44066c1..97a8e70 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,4 +12,4 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 22 - - run: node tests/lexical-analysis.mjs + - run: npm test diff --git a/README.md b/README.md index 1f840e2..29f867a 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ A separate skill at `~/.claude/skills/my-writing-style/` (Claude Code) and ``` my-writing-style/ SKILL.md ← "write like this person" instructions - sources/ ← cleaned writing samples + sources/ ← your writing, stored verbatim references/ propositions.json ← the habit data examples.md ← your passages with key sentences highlighted diff --git a/package.json b/package.json index cdbd876..45aa1ca 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,6 @@ "private": true, "type": "module", "scripts": { - "test": "node tests/lexical-analysis.mjs" + "test": "node tests/lexical-analysis.mjs && node tests/save-source.mjs" } } diff --git a/skills/docwriter-style-generator/SKILL.md b/skills/docwriter-style-generator/SKILL.md index 13471d6..5990601 100644 --- a/skills/docwriter-style-generator/SKILL.md +++ b/skills/docwriter-style-generator/SKILL.md @@ -74,21 +74,44 @@ AskUserQuestion: description: "Some files, some URLs, some pasted" ``` -Based on their answer, ask for the paths/URLs/text. Read files with Read, -fetch URLs with WebFetch (extract the article body, strip nav/menus/footers/ -cookie banners/bylines). Label each source by what the user calls it. +Based on their answer, ask for the paths/URLs/text. Label each source by +what the user calls it. -Write each cleaned source into the style skill, not `/tmp`. Create the -directories if they do not exist: +**Sources must be the author's words, verbatim.** Do not paraphrase, +summarize, tidy, or rewrite. The later analysis quotes these files word +for word — a summary is the wrong sample. + +Do not use WebFetch to produce a stored source. WebFetch often returns a +digest. This skill ships `scripts/save-source.mjs` next to this file. +Run it once per piece so the write is a copy, not a rewrite: + +```bash +# local file +node scripts/save-source.mjs --label essay --file /path/to/essay.txt + +# pasted text +node scripts/save-source.mjs --label talk --stdin +# then pipe or type the paste; do not reword it + +# URL — fetches the page and strips nav/chrome only +node scripts/save-source.mjs --label post --url https://example.com/essay +``` + +The script writes the same file to both homes: ``` ~/.claude/skills/my-writing-style/sources/