From 09e74bbf768a9f25f75152666d0c62ac3d63745c Mon Sep 17 00:00:00 2001 From: Alex Newman Date: Thu, 21 May 2026 01:48:33 -0700 Subject: [PATCH] feat(skills): add weekly-digests skill for serial timeline narrative (#2399) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(skills): add weekly-digests skill for serial timeline narrative Generate a chapter-per-ISO-week narrative digest of a project's full claude-mem history. Splits the timeline by ISO week, then runs consecutive (non-parallel) subagents — each receiving the prior week's carry-forward block — to produce a coherent multi-chapter serial. Encodes the pipeline discipline that emerged from running it end-to-end: narrative budget scaled to obs count, carry-forward capped and pruned, register evolution tracked explicitly, components as characters, silence as story, no false ending in the final chapter. Co-Authored-By: Claude Opus 4.7 (1M context) * fix(skills/weekly-digests): degeneralize from hardcoded 30-week assumption The skill was overfit to a single run that happened to span 30 ISO weeks. On a 2-week project the prompt template would tell the subagent it was writing chapter N of a "30-part serial narrative" — which lies. Changes: - Frontmatter and opening prose no longer claim a fixed chapter count. - Subagent prompt template uses "chapter N of TOTAL" wording that scales to any N including 1. - Added explicit N=1 handling: apply first-and-final treatment together. - Genericized component-as-character and meta-recursion examples — they no longer import claude-mem's specific cast as if mandatory. - Filename zero-pad width now derived from N (works past 99 weeks). - Examples section shows long-project, short-project, and N=1 flows. Co-Authored-By: Claude Opus 4.7 (1M context) --------- Co-authored-by: Claude Opus 4.7 (1M context) --- plugin/skills/weekly-digests/SKILL.md | 262 ++++++++++++++++++++++++++ 1 file changed, 262 insertions(+) create mode 100644 plugin/skills/weekly-digests/SKILL.md diff --git a/plugin/skills/weekly-digests/SKILL.md b/plugin/skills/weekly-digests/SKILL.md new file mode 100644 index 00000000..99338ab3 --- /dev/null +++ b/plugin/skills/weekly-digests/SKILL.md @@ -0,0 +1,262 @@ +--- +name: weekly-digests +description: Generate a serial week-by-week narrative digest of a project's full claude-mem timeline. Splits the timeline into per-ISO-week files, then runs one consecutive subagent per week — each receiving the prior week's carry-forward block — to produce one chapter per ISO week of data. Use when asked for "weekly digests", "week-by-week story", "serial timeline", or "narrative chapters" of a project's history. +--- + +# Weekly Digests + +Produce a serial, multi-chapter narrative digest of a project's complete claude-mem history. Differs from `timeline-report` (one long report) — this generates one digest *per ISO week*, with each subagent reading the prior week's carry-forward block so the story stays coherent. + +**The chapter count equals the number of ISO weeks the timeline covers.** A project with 2 weeks of data produces 2 chapters; one with 30 weeks produces 30. There is no fixed length — count the weeks first, then drive the pipeline off that count. + +## When to Use + +Trigger when the user asks for: + +- "Weekly digests" +- "Week-by-week story" +- "Serial timeline" +- "Story chapters of [project]" +- "Run a digest for each week" +- "Continue the story week by week" + +If the user wants a single sweeping report, use `timeline-report` instead. This skill is for serial chapter format. + +## Prerequisites + +- claude-mem worker running +- Project has at least one ISO week of observations (the pipeline degenerates gracefully — even N=1 works) +- A clean output directory the user is comfortable writing into + +**Resolve the worker port** (do this once, reuse `$WORKER_PORT`): + +```bash +WORKER_PORT="${CLAUDE_MEM_WORKER_PORT:-$(node -e "const fs=require('fs'),p=require('path'),os=require('os');const uid=(typeof process.getuid==='function'?process.getuid():77);const fallback=String(37700+(uid%100));try{const s=JSON.parse(fs.readFileSync(p.join(os.homedir(),'.claude-mem','settings.json'),'utf-8'));process.stdout.write(String(s.CLAUDE_MEM_WORKER_PORT||fallback));}catch{process.stdout.write(fallback);}" 2>/dev/null)}" +``` + +## Workflow + +### Step 1: Determine the Project Name + +Same worktree-detection pattern as `timeline-report`. In a worktree, the data source is the **parent project**: + +```bash +git_dir=$(git rev-parse --git-dir 2>/dev/null) +git_common_dir=$(git rev-parse --git-common-dir 2>/dev/null) +if [ "$git_dir" != "$git_common_dir" ]; then + parent_project=$(basename "$(dirname "$git_common_dir")") +else + parent_project=$(basename "$PWD") +fi +echo "$parent_project" +``` + +### Step 2: Fetch the Full Timeline and Save It + +```bash +mkdir -p .scratch +curl -s "http://localhost:${WORKER_PORT}/api/context/inject?project=PROJECT_NAME&full=true" \ + > .scratch/cm-timeline.md +wc -l .scratch/cm-timeline.md +``` + +Sanity-check: confirm the file is non-empty and has the expected structure (preamble, then date headers like `### Mon DD, YYYY`, then numeric observation lines `