craft-project-dream
Skill2 starsChanged 7 months agoMITView on GitHub
Project maintenance through consolidation. Snapshots every change to .craft/dreams/ before applying. Forgets noise, strengthens patterns, resets capacity. Run after active sprints or when docs feel cluttered.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- craft-global-auditSkill
- craft-project-audit-fullSkill
- craft-project-auditSkill
- craft-project-exploreSkill
- craft-project-rememberSkill
- craft-project-setupSkill
- craft-project-statusSkill
- craft-session-solidifySkill
- craft-update-selfSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
27 rules. About 0 are common, 17 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈17
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Run after active sprints, at the end of a productive week, or when Claude keeps re-asking questions that should already be settled.
- Very specific: line 53
If CLAUDE.md is missing and .craft/ does not exist: stop with "This project is not set up yet.
- Distinctive: line 55
If the project looks dormant (0 commits since last dream): note it but continue — dormant projects still benefit from consolidation.
- Distinctive: line 75
Read each file fully. Identify noise.
- Very specific: line 79
Read .craft/BACKLOG.md. For each unchecked item (- [ ]):
- Distinctive: line 80
Search recent git log (30 days) for keywords from the item
- Distinctive: line 81
If the work appears done (commit message matches): flag as resolved
- Very specific: line 85
Read all files in .craft/memory/.
- Distinctive: line 86
If it references specific file paths: check if those files still exist
- Distinctive: line 87
If two entries contradict each other: flag the older one
- Distinctive: line 88
If an entry is older than 60 days and references code that changed since: flag as potentially stale
- Very specific: line 92
Read CLAUDE.md (root or .claude/CLAUDE.md):
- Very specific: line 100
If both HANDOVER.md and PROJECT_STATE.md exist:
- Distinctive: line 130
Wait for user confirmation.
- Distinctive: line 165
Check for memory entries about the same topic (similar filenames, overlapping keywords).
- Very specific: line 169
Check memory for entries typed as feedback or containing error patterns.
- Distinctive: line 205
Read current STATE. It has likely been appended to across many sessions.
- Distinctive: line 208
Only current reality: what works, what is broken, what is in progress RIGHT NOW
- Distinctive: line 209
Remove historical entries that are no longer relevant
- Distinctive: line 210
Keep the same structure/headers the project uses
- Distinctive: line 216
If the "Done" section has > 30 items: trim to the 10 most recent, note "and N earlier items"
- Very specific: line 221
If > 150 lines: identify specific sections that could move to .craft/rules/ files
- Very specific: line 222
If @-imports are not used and .craft/rules/ does not exist: suggest creating it
- Distinctive: line 242
Wait for confirmation. Snapshot first, then apply.
- Very specific: line 248
After all three phases are applied, copy every modified file into $DREAM_DIR/after/:
- Very specific: line 279
Write $DREAM_DIR/report.md with quantified metrics:
- Distinctive: line 357
Do not suggest a next action.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
craft-project-dream
Like sleep, dream processes what accumulated. Forgets what does not matter. Strengthens what does. Leaves the project rested so the next session starts sharp, not sluggish.
Every dream is auditable. Before any change is applied, every file dream will touch is snapshotted to .craft/dreams/<timestamp>/before/. After the run, the new state lands in after/ alongside a human-readable diff.md and a quantified report.md. If a dream makes things worse, rollback is one cp away.
Run after active sprints, at the end of a productive week, or when Claude keeps re-asking questions that should already be settled.
Step 0: Assess readiness
CWD=$(pwd)
NOW=$(date +%s)
STAMP=$(date +%Y-%m-%d-%H-%M)
DREAM_DIR="$CWD/.craft/dreams/$STAMP"
# Portable mtime (macOS: stat -f, Linux/WSL: stat -c)
file_mtime() { stat -f "%m" "$1" 2>/dev/null || stat -c "%Y" "$1" 2>/dev/null || echo 0; }
echo "=== FILES ==="
for f in CLAUDE.md .craft/PROJECT_STATE.md .craft/BACKLOG.md .craft/HANDOVER.md .craft/DECISIONS.md .craft/DREAM_LOG.md; do
if [[ -f "$CWD/$f" ]]; then
lines=$(wc -l < "$CWD/$f" | tr -d ' ')
age_days=$(( (NOW - $(file_mtime "$CWD/$f")) / 86400 ))
echo " FOUND $f ${lines} lines ${age_days}d ago"
else
echo " MISSING $f"
fi
done
echo "=== MEMORY ==="
mem_count=$(find "$CWD/.craft/memory/" -maxdepth 1 -type f 2>/dev/null | wc -l | tr -d ' ')
echo " $mem_count files"
ls -t "$CWD/.craft/memory/" 2>/dev/null | head -5
echo "=== GIT ==="
commits_since_last_dream=$(git log --since="$(file_mtime "$CWD/.craft/DREAM_LOG.md" 2>/dev/null | xargs -I{} date -r {} '+%Y-%m-%d' 2>/dev/null || echo '90 days ago')" --oneline 2>/dev/null | wc -l | tr -d ' ')
echo " $commits_since_last_dream commits since last dream"
echo "=== SNAPSHOT TARGET ==="
echo " $DREAM_DIR"If CLAUDE.md is missing and .craft/ does not exist: stop with "This project is not set up yet. Run /craft-project-setup first."
If the project looks dormant (0 commits since last dream): note it but continue — dormant projects still benefit from consolidation.
Create the snapshot directory structure:
mkdir -p "$DREAM_DIR/before" "$DREAM_DIR/after"Ensure .craft/dreams/ is git-ignored (local audit data, not shared):
if [[ -f "$CWD/.gitignore" ]] && ! grep -q "^\.craft/dreams/" "$CWD/.gitignore"; then
echo ".craft/dreams/" >> "$CWD/.gitignore"
fiStep 1: Forget
Read each file fully. Identify noise.
1a: BACKLOG staleness
Read .craft/BACKLOG.md. For each unchecked item (- [ ]):
- Search recent git log (30 days) for keywords from the item
- If the work appears done (commit message matches): flag as resolved
1b: Memory decay
Read all files in .craft/memory/. For each entry:
- If it references specific file paths: check if those files still exist
- If two entries contradict each other: flag the older one
- If an entry is older than 60 days and references code that changed since: flag as potentially stale
1c: CLAUDE.md lint
Read CLAUDE.md (root or .claude/CLAUDE.md):
- Rules referencing files or paths: verify they exist
- Rules without a WHY (no reason, no "because", no dash explanation)
- Line count: flag if > 150 as approaching the 200-line adherence limit
- Rules duplicated by linter config (check for
.eslintrc*,.prettierrc*,biome.json)
1d: HANDOVER overlap
If both HANDOVER.md and PROJECT_STATE.md exist:
- Find lines that appear in both (fuzzy: shared key phrases, not exact match)
- HANDOVER content that STATE already covers is noise
Output the Forget Preview:
Phase 1 — Forget
BACKLOG
3 items look resolved:
- [ ] Add input validation to API → resolved in commit abc123 (3 days ago)
- [ ] Fix login redirect → resolved in commit def456 (12 days ago)
- [ ] Update deps → resolved in commit ghi789 (5 days ago)
Memory
2 entries reference deleted files:
- memory/feedback_old_api.md → references src/api/v1.ts (deleted)
- memory/project_auth_flow.md → references lib/auth.js (renamed to lib/auth.ts)
CLAUDE.md (148 lines)
1 rule references missing path: "Always check src/legacy/ before..." → src/legacy/ does not exist
4 rules have no WHY
HANDOVER
Overlaps with STATE: 8 lines of shared content
Apply all? [y / n / pick numbers]Wait for user confirmation.
Before applying: snapshot every file that is about to change to $DREAM_DIR/before/, preserving relative paths:
# For each file that will be modified:
rel_path="CLAUDE.md" # or .craft/PROJECT_STATE.md, etc.
mkdir -p "$DREAM_DIR/before/$(dirname "$rel_path")"
cp "$CWD/$rel_path" "$DREAM_DIR/before/$rel_path"Then apply the confirmed changes.
Important: Dream never deletes files. Stale files are moved to .craft/archive/ (create if missing). Stale memory entries are moved to .craft/memory/archive/. Empty template files (placeholders that were never filled) are left in place — empty is not stale.
"Forgetting" means:
- BACKLOG: mark items as
[x]with a note(resolved, confirmed by dream) - Memory: move stale files to
.craft/memory/archive/, or if partially valid, edit to remove only the stale parts - CLAUDE.md: remove the stale rule, add WHY to rules missing it only if the WHY is clearly inferrable
- HANDOVER: remove lines that duplicate STATE content
- Other stale files: move to
.craft/archive/with a date prefix (2026-04-18_filename.md)
Step 2: Consolidate
2a: Unrecorded decisions
Scan PROJECT_STATE.md, HANDOVER.md, and memory files for decision language:
- "decided to", "we chose", "going with", "switched from", "will not", "replaced X with"
Cross-reference with DECISIONS.md. If a decision is mentioned elsewhere but not recorded: suggest adding it.
2b: Related memory entries
Check for memory entries about the same topic (similar filenames, overlapping keywords). If 2+ entries cover the same ground: suggest merging into one.
2c: Lesson promotion
Check memory for entries typed as feedback or containing error patterns. If the same lesson appears more than once, or if it is critical enough: suggest promoting it to a rule in CLAUDE.md.
Output the Consolidate Preview:
Phase 2 — Consolidate
Decisions (2 found, not in decisions.md)
1. "Switched from REST to GraphQL for the admin API" (found in STATE)
2. "Going with Tailwind instead of CSS modules" (found in memory/project_styling.md)
Merge candidates (1 group)
memory/feedback_testing_1.md + memory/feedback_testing_2.md
→ both say "always run integration tests against real DB"
→ merge into one entry
Promote to CLAUDE.md (1 candidate)
memory/feedback_no_mocks.md → "Never mock the database in integration tests"
→ appeared 3 times in different forms
Apply all? [y / n / pick numbers]Wait for confirmation.
Before applying: snapshot (same pattern as 1). Then apply:
- Decisions: append to
DECISIONS.mdwith date and source - Merge: combine into single memory file, move duplicates to
.craft/memory/archive/ - Promote: add rule to CLAUDE.md with WHY from the memory entry
Step 3: Reset
3a: Rewrite state.md
Read current STATE. It has likely been appended to across many sessions.
Propose a clean rewrite:
- Only current reality: what works, what is broken, what is in progress RIGHT NOW
- Remove historical entries that are no longer relevant
- Keep the same structure/headers the project uses
- Show before/after line count
3b: BACKLOG cleanup
- Move all
[x]items (including newly confirmed ones from Phase 1) to the "Done" section - If the "Done" section has > 30 items: trim to the 10 most recent, note "and N earlier items"
- Re-count open items per priority level
3c: CLAUDE.md capacity check
- If > 150 lines: identify specific sections that could move to
.craft/rules/files - If
@-imports are not used and.craft/rules/does not exist: suggest creating it - Show current line count and target
Output the Reset Preview:
Phase 3 — Reset
STATE: 67 lines → 28 lines
(shows key changes: what was removed, what was kept, what was reworded)
BACKLOG: 23 items → 15 open, 8 archived to Done
CLAUDE.md: 182 lines
Suggestion: move "Shopify theme rules" section (34 lines) to .craft/rules/shopify.md
After split: 148 lines (under limit)
Apply all? [y / n / pick numbers]Wait for confirmation. Snapshot first, then apply.
Step 4: Snapshot the after-state
After all three phases are applied, copy every modified file into $DREAM_DIR/after/:
for rel_path in $(ls "$DREAM_DIR/before/" -R 2>/dev/null | ...); do
mkdir -p "$DREAM_DIR/after/$(dirname "$rel_path")"
cp "$CWD/$rel_path" "$DREAM_DIR/after/$rel_path"
doneThen generate $DREAM_DIR/diff.md — a human-readable diff across all touched files:
{
echo "# Dream diff — $STAMP"
echo ""
for f in $(find "$DREAM_DIR/before/" -type f); do
rel="${f#$DREAM_DIR/before/}"
echo "## $rel"
echo ""
echo '```diff'
diff -u "$DREAM_DIR/before/$rel" "$DREAM_DIR/after/$rel" 2>/dev/null | tail -n +3
echo '```'
echo ""
done
} > "$DREAM_DIR/diff.md"Step 5: Generate the report
Write $DREAM_DIR/report.md with quantified metrics:
# Dream report — [STAMP]
## Metrics
| File | Before | After | Delta |
|------|--------|-------|-------|
| state.md | 67 lines | 28 lines | -39 (-58%) |
| backlog.md | 23 open, 40 done | 15 open, 48 done | +8 resolved |
| CLAUDE.md | 182 lines | 148 lines | -34 (-19%) |
| memory/ files | 18 | 15 | -3 (archived) |
| decisions.md | 4 entries | 6 entries | +2 recorded |
## What changed
### Forgotten
- BACKLOG: 3 items confirmed resolved (commits abc123, def456, ghi789)
- Memory: 2 entries archived (referenced deleted files)
- CLAUDE.md: 1 stale rule removed (src/legacy/ path)
- HANDOVER: 8 duplicate lines removed
### Consolidated
- 2 decisions recorded in decisions.md
- 1 memory merge (feedback_testing_1 + feedback_testing_2)
- 1 lesson promoted to CLAUDE.md (no-mocks rule)
### Reset
- STATE rewritten (historical entries removed, current reality only)
- BACKLOG reorganized (Done section trimmed)
- CLAUDE.md sectioned out (Shopify rules → .craft/rules/shopify.md)
## Expected impact on next session
- ~39% less noise in STATE → faster context load
- 34 fewer lines in CLAUDE.md → better rule adherence
- decisions.md is canonical again → no more "wait, what did we decide?"
## Rollback
cp -R .craft/dreams/[STAMP]/before/* .
Everything dream touched is in `before/`. Restore any file, all files, or ignore this run entirely.Step 6: Update dream-log.md and summarize
Prepend a new section to .craft/DREAM_LOG.md:
## [STAMP]
Snapshot: `.craft/dreams/[STAMP]/`
- Forgotten: 8 items (34 lines)
- Consolidated: 2 decisions · 1 merge · 1 promotion
- Reset: STATE 67→28 · BACKLOG 5 archived · CLAUDE.md 182→148
Report: `.craft/dreams/[STAMP]/report.md`Then output the final summary:
Dream complete — .craft/dreams/[STAMP]/
Forgotten: 8 items removed (34 lines of noise)
Consolidated: 2 decisions · 1 merge · 1 promotion
Reset: STATE 67→28 lines · BACKLOG 5 archived · CLAUDE.md 148 lines
Next session starts with ~39% less noise in project docs.
Full report: .craft/dreams/[STAMP]/report.md
Rollback: cp -R .craft/dreams/[STAMP]/before/* .Do not suggest a next action. The project is rested. End here.
Session-start trigger (banner, optional install)
The dream skill can be paired with a session-start banner that surfaces a suggestion when the project has accumulated enough change to benefit from a dream. This is an opt-in hook — it never runs dream automatically, it only asks.
Add to .claude/settings.json:
"hooks": {
"SessionStart": [
{
"matcher": "startup",
"hooks": [
{
"type": "command",
"command": "bash -c 'D=.craft/DREAM_LOG.md; L=$(stat -f %m \"$D\" 2>/dev/null || stat -c %Y \"$D\" 2>/dev/null || echo 0); A=$(( ($(date +%s) - $L) / 86400 )); C=$(git log --since=\"$A days ago\" --oneline 2>/dev/null | wc -l | tr -d \" \"); S=$(wc -l < .craft/PROJECT_STATE.md 2>/dev/null | tr -d \" \"); [[ $C -ge 10 || $S -gt 100 ]] && printf \"{\\\"systemMessage\\\":\\\"[craft] $C commits since last dream, STATE.md at $S lines. Run /craft-project-dream? (y/N/skip-for-now)\\\"}\" || printf \"{}\"'",
"timeout": 3
}
]
}
]
}The banner fires when either threshold is hit:
- 10+ commits since last dream, OR
- state.md grown past 100 lines
The user says y/N/skip-for-now. "skip-for-now" silences the banner for this session only — it returns next session. There is no permanent off switch, because a permanently-silenced dream defeats the whole point.
Craft's setup skill installs this hook automatically. Existing projects can add it via /craft-project-setup enhance mode.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

