Scan project and populate memory with knowledge — architecture, conventions, tech stack, key features, infrastructure. Use when a project has no memories yet, or when the user wants to refresh/rebuild project understanding — e.g. "scan the project", "scan the codebase", "bootstrap memory", "initialize memory with project knowledge", "populate memory", "build project understanding", "scan this aspect", "analyze the project". This is a token-heavy operation — always warn the user before proceeding.
Scan project and populate memory with knowledge — architecture, conventions, tech stack, key features, infrastructure. Use when a project has no memories yet, or when the user wants to refresh/rebuild project understanding — e.g. "scan the project", "scan the codebase", "bootstrap memory", "initialize memory with project knowledge", "populate memory", "build project understanding", "scan this aspect", "analyze the project". This is a token-heavy operation — always warn the user before proceeding.
user-invocable
true
argument-hint
[project description]
model
sonnet
created
2026-03-16T00:00:00.000Z
updated
2026-07-04T00:00:00.000Z
/cf-scan
CLI Requirement: OPTIONAL — Uses the memory MCP from for fast indexed search and storage. Without the CLI: falls back to grep over and direct file writes. Full functionality preserved, slower memory recall. See .
Scan the project and bootstrap the memory system. User input: $ARGUMENTS
Purpose
New projects start with empty memory. This skill scans the codebase, extracts structured knowledge (architecture, conventions, tech stack, features, infrastructure), and stores it as memories. Safe to run multiple times — existing memories are updated, not duplicated.
Folder
Output goes to {docsDir}/memory/ (default: docs/memory/). Check .coding-friend/config.json for custom docsDir if it exists.
IMPORTANT — path resolution:
Use MAIN_REPO_ROOT from the SessionStart bootstrap context (injected via session-init.sh). If absent, fall back to running pwd for $CWD and use $CWD as MAIN_REPO_ROOT.
Read config from CF_CONFIG_FILE (= $MAIN_REPO_ROOT/.coding-friend/config.json) — do NOT search sub-folders
Use CF_DOCS_ROOT as the docs base dir (= $MAIN_REPO_ROOT/{docsDir} where docsDir comes from config, default docs)
Always resolve file_path as an absolute path: {CF_DOCS_ROOT}/memory/{category}/{name}.md
Never use relative paths in write specs — they may resolve incorrectly when the working directory contains nested git repos
Workflow
Step 0: Custom Guide
Custom guide — auto-loaded below (if the raw command shows instead of its output, run it yourself):
If output is not empty, integrate returned sections: ## Before → before first step, ## Rules → apply throughout, ## After → after final step.
Step 0.5: Context Budget Check
Before proceeding, assess context budget:
If context is above 50%, prefer selective reads (Read with offset/limit) over full file reads
Limit cf-explorer exploration depth — map structure broadly but only deep-read files directly relevant to memory creation
If context is above 70%, warn the user that scan quality may degrade and suggest running in a fresh session
Step 1: Warn and Confirm
This step is mandatory — do NOT skip.
Tell the user:
This skill scans your project and populates memory. It uses significant tokens (multiple explorer calls + memory writes). Estimated: 3-5 minutes depending on project size.
Existing memories will be updated, not duplicated
New memories will be created for discovered knowledge
Memory cap: Maximum 15 memories total. For large projects, merge related modules into broader memories rather than creating one per file.
4c. For each planned memory:
Check if a memory with matching {category}/{slug} exists in the lookup map
If exists → delegate to cf-writer with task: update and existing_file_action: overwrite, then call memory_update with params: id (e.g. "features/auth-module"), content (full new markdown), tags (updated tags array)
If new → assess complexity:
Simple (short, factual) → delegate to cf-writer agent (haiku)
Complex (nuanced architecture, deep trade-offs) → delegate to cf-writer-deep agent (sonnet)
Write spec for cf-writer (same format as /cf-remember):
Backward compat: When updating existing memory files without a date prefix, preserve the existing filename. Only new files use the YYYY-MM-DD-<name>.md format.