/ccf:updatespecfrom ccf
Updates the CCF project spec and system memory with lessons learned this session, so future sessions start with fresh context and repeat fewer mistakes. Also records new tools with usage guidance.
Ships in ccf. Installing the plugin adds it to Claude Code.
You are running CCF /ccf:updatespec. Distill this session's lessons into two places — the project spec (.claude/) and Claude Code's system memory — so future sessions start with fresh context and repeat fewer mistakes.
Why two places, and what goes where:
- Spec (
CLAUDE.md+.claude/rules/) is loaded as a user message tagged "may not be relevant", so it carries lower weight. It suits project rules: conventions, architecture, tech stack, tooling.- Memory (
~/.claude/projects/<path>/memory/) is loaded into the system prompt and is not down-weighted, so Claude follows it more strongly. It suits anti-mistake feedback and user preferences across sessions.- No duplication: anything already in
CLAUDE.mdstays there. When a rule inCLAUDE.mdkeeps getting forgotten, write afeedbackmemory that reinforces it and states why, instead of copying its content.
Scope boundary: this rule governs CCF-generated text meant for the human reader (the diff explanation, the "why" line, the plan and task sync notes shown to the user). It does NOT apply to the CCF repo's own source, which stays English per .claude/rules/components.md (never translate the repo itself).
Before step 1, run node "<plugin-root>/scripts/spec-budget.mjs" --dir <project root> and keep its total as the before figure for the Closing. The script is read-only and prints JSON: every file CLAUDE.md loads through recursive @import (at most four hops), with its bytes, lines and depth, plus total, claudeMdOver and missing imports.
Review this session for lessons, then classify each as spec or memory:
feedback) — the strongest, most-followed memory type: mistakes you (Claude) made plus their fixes, AND correct approaches the user confirmed. Record both: a losses-only memory makes future sessions timid, so logging the wins keeps confidence calibrated.user): preferences, habits and working style the user expressed (e.g. "always use X", "don't refactor unprompted").project): project constraints not derivable from code or git (deadlines, freezes). Convert relative dates to absolute ones.CLAUDE.md, and transient task progress — the latter belongs in the plan.Find every CLAUDE.md and .claude/rules/* (root + nested). Each lesson belongs to the file closest to cwd; a lesson that applies to one area of the tree goes in a rule with paths: frontmatter, which lazy-loads only when a matching file is touched.
.claude/plan/ARCHIVE.md (the iteration's ## Closed note) when it records what shipped and why, or to a feedback/project memory (step 5) when it guards against a repeat mistake. Keep it out of CLAUDE.md and the @imported rules, because every byte there is paid on every session; leave at most a pointer to where the narrative lives..claude/rules/<topic>.md when none fits, and add a @.claude/rules/<topic>.md import line to the relevant CLAUDE.md.CLAUDE.md < 200 lines. You may delegate the drafting to ccf-spec-writer via Task with run_in_background: false, since Claude Code v2.1.198 an omitted run_in_background defaults to background and this step needs the draft back before it can write anything.If this session added a new skill / MCP server / subagent / tool (e.g. the user installed the Supabase MCP), record it in .claude/rules/tooling.md with an explanation of WHEN TO USE it: the specific trigger, input and output, one example. This is the core of context-first — the spec says not just what exists but when to reach for it.
Write the lessons classified as memory in step 1 into this project's memory directory: ~/.claude/projects/<sanitized-project-path>/memory/.
Auto Memory interplay: Claude Code's
autoMemoryEnabled(on by default, v2.1.59+) may already have auto-saved notes from this session. This step is the deliberate curation pass: review and dedupe what is there, then write the high-signal lessons explicitly rather than trusting the auto-extractor.
name (kebab-case), description (one line, used for recall) and metadata.type (feedback | user | project | reference).feedback and project, follow the body with **Why:** and **How to apply:** lines. The **Why:** is mandatory, not decoration: without it Claude obeys rigidly and stalls on edge cases; with it Claude grasps the intent and handles ambiguous cases on its own.MEMORY.md (- [Title](file.md) — hook). MEMORY.md is a pure index loaded every session, and only its first 200 lines OR 25KB (whichever comes first) are read, so keep it to one line per memory, under ~200 characters, with no memory content in it, and prune as it nears the limit. Link related memories by their name: slug — [[name]], not the filename.Memory lives outside the repository's version control, so a wrong deletion cannot be undone; this pass therefore runs only when a deterministic gate opens, and every change goes through one user confirmation.
node "<plugin-root>/scripts/memory-audit.mjs" --memory-dir <this session's memory directory>. The script is read-only and prints JSON. The docs define no rule for deriving the directory name, so pass the path you know from your own memory setup.gate is false, say so in one line and end step 5b.gate is true (the reasons name which threshold opened it), work through four phases:
MEMORY.md and every memory file.danglingIndex (index lines pointing at a missing file) and unindexed (files the index does not link).keep / merge into X / drop) and reason. Ask ONCE with AskUserQuestion: apply all, choose per row, or skip. Apply only what the user approved, then rewrite MEMORY.md to one line per remaining memory.Optional Jev column. When TYPESAFE_API_KEY is set, add --jev to the step 1 command, and before running it tell the user in one sentence that every memory file, including user-type memories, and MEMORY.md are sent to api.typesafe.ai. For each file whose JSON entry carries jev, add a jev column to the table showing label score (e.g. drop 0.82). The jev column never decides an action on its own: your action column stays authoritative, and a Jev label is a hint you may cite or overrule, never by itself a reason to drop. Any top-level jev value other than ok means no column; continue exactly as without Jev and do not dwell on the status.
If .claude/plan/ changed (tasks finished, reordered, added), update PLAN.md and each task's status. This command is the SOLE writer of done: a task that is in-review AND has passed /ccf:check cleanly becomes done here. Cleanly means the report carries no FAIL: finding and no PARTIAL: line: a review cut off before it covered the whole diff has not passed, so leave that task in-review. Every task is implemented directly in the main session and only ever reaches in-review there; /ccf:check is read-only and never writes status. If a review surfaced findings, leave the task in-review or move it back to in-progress.
accepted is the other closed status, and .claude/plan/PENDING.md backs it. accepted means the owner accepts closing a task despite a residual risk, so it is never a shortcut around a failed review. Write it only when both hold:
risk row in PENDING.md points to the task (Task column). When the risk has no row yet, add it first: | <next id> | risk | <task id> | <what is unobserved or unproven> | <who can close it> | <the evidence that would close it> | open |. When the task's /ccf:check report carries a FAIL: line ending in Unresolved (ccf-finding-refuter): <fact>, put each such fact into the row's What cell, because it names the one observation that would settle the finding.AskUserQuestion, after you name the task and each of its open risk rows. Without that answer the task stays in-review.A Touches UI: yes task whose Runtime evidence reads not run: <reason> closes only as accepted, never done, with a risk row naming the unrun check, because its runtime behavior is unobserved however clean the review.
In the same pass, close an action row (Status becomes closed) only when its closing evidence exists, and write that evidence (a run log, a commit, a captured payload) into its Closing evidence cell; close a risk row the same way. PENDING.md is never archived: its rows outlive the iteration, and the session-start hook reminds the open ones every session. With no PENDING.md, create it from templates/root/.claude/plan/PENDING.md.tmpl before writing the first row.
Write the status as a BARE word (done, accepted, in-review) with no markdown emphasis around it. lib/plan.mjs strips **bold**, *italic* and `code` before matching, so a decorated cell is tolerated — write it plain anyway, because the decoration carries no information and it already caused one real misread: a **done** row counted as unfinished by the Stop nudge before that stripping existed.
Retire a CLOSED iteration out of PLAN.md in this same pass. PLAN.md holds the CURRENT iteration only. When every task of an iteration is done or accepted:
node "<plugin-root>/scripts/archive-plan.mjs" previews (writes nothing, and names any row still holding an iteration open); add --apply to perform it. It moves the iteration's ## Origin / ## Task backlog / ## Closed sections VERBATIM into .claude/plan/ARCHIVE.md newest-first, and git mvs its task-NNN-*.md files into .claude/plan/archive/. Verbatim is deliberate: the archive's value is being an auditable record, so a heading that still says OPEN next to a done row is itself part of the history. Hand-editing risks cutting the wrong section, because an iteration's headings do NOT share a common name — the script groups by position, from one ## Origin heading to the next. With no shell access, say so plainly and do it by hand following that same positional rule.CLAUDE.md's ## Current plan to the iteration now in flight and let the archive carry the rest. The script deliberately leaves this to you: picking the new lead iteration is judgment, not mechanics.git-workflow.md).Why this matters in both directions: a closed row left in PLAN.md is counted as LIVE work by lib/plan.mjs (findActiveTask / findNonDoneTasks) and by the Stop nudge, while losing the history would lose a real, auditable record of what shipped and why.
Retention: ARCHIVE.md and git history are permanent; .claude/plan/archive/ keeps only the task files of the newest 10 iterations in ARCHIVE.md. When older ones exist (the Stop nudge's clause E says so), run node "<plugin-root>/scripts/prune-archive.mjs" to preview the files to prune and the orphans it keeps, then add --apply once the user agrees: it stages a git rm per file and never commits. A pruned file comes back with git log --diff-filter=D --name-only -- .claude/plan/archive/ and then git show <sha>^:<path>.
node "<plugin-root>/scripts/spec-budget.mjs" --dir <project root> again and print one line: spec budget: <before total> → <after total> bytes, using the total you kept before step 1. When claudeMdOver is true or missing is non-empty, say so and name the file, because an over-limit CLAUDE.md or a broken import is paid or lost on every session..claude/settings.json exists with an attribution key set (the deterministic, harness-enforced replacement for the deprecated includeCoAuthoredBy and for any "never add Co-Authored-By" prose). If the file is missing or attribution is absent, nudge the user to set it (attribution.commit / attribution.pr = the trailer text they want, or "" to suppress). Leave the writing to them, since it changes how every future commit in the repo is attributed.CLAUDE.md, a PAID file (it and every file it @imports are loaded every session), yet nothing else in the workflow re-measures it. If this session edited CLAUDE.md or any .claude/rules/*.md while working ON the CCF plugin repo (not a project /ccf:init generated), run node --test .claude/tests/*.test.mjs after step 3; when the self-consistency check reports drift, re-derive the true byte count with measurePaidBytes (.claude/tests/context-budget.mjs) and refill the <!-- ccf-budget: paid=NNN --> label in .claude/rules/prompt-standard.md as the LAST write of the session, never before — refilling it earlier would race any spec edit still to come and leave the label stale again.Files this command reads when invoked
What the command file sets; muted values are Claude Code's defaults
opusccf, spec-update, memory, session-persistence, project-rules
7-day visitors to each command page
npx claudepluginhub naniiluja/ccf --plugin ccf4 commands in this plugin
/check0a. Style for user-facing text (applies to every step below that writes text for the user)Use when a task is implemented (in-review) and must be verified against the CCF spec before /ccf:updatespec marks it done — conformance, coding conventions, SOLID/OOP, and BE↔FE cross-check. Read-only review./cook0a. Style for user-facing text (applies to every step below that writes text for the user)Use only when the user explicitly asks to run the planned backlog, because it merges branches and commits. Executes the todo/in-progress backlog in parallel waves, one worktree-isolated agent per task, merge each wave through the preflight gate and integrate-wave, then run /ccf:check once and /ccf:updatespec./init0a. Style for user-facing textUse only when the user explicitly asks to bootstrap a new project or onboard an existing one into the CCF workflow, because it writes the project's spec files. Generates CLAUDE.md + .claude specs + an initial plan of vertical slices.