Creates MEMORY.md index and 10 memory files documenting: - Scripts: context-load, start-claude, install-hooks, setup-formatters, git-status-report - Skills: /log, /reflect-logs, /reflect, /distill-best-practices, /linter Each file covers purpose, usage, how it works, and gotchas. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
31 lines
1.4 KiB
Markdown
31 lines
1.4 KiB
Markdown
# script: context-load
|
|
|
|
**Location:** `scripts/context-load`
|
|
**Symlinked to:** `~/sbin/context-load`
|
|
|
|
## Purpose
|
|
|
|
Gathers project context for a Claude Code session by walking from cwd upward, collecting key index files, and outputting structured text suitable for `--append-system-prompt`.
|
|
|
|
## What it loads (in order)
|
|
|
|
1. Every `CLAUDE.md` found walking up from cwd (top-down order) + directory tree (depth 3) from each
|
|
2. Every `CONTEXT.md` found walking up (top-down)
|
|
3. Every `MEMORY.md` found walking up (top-down)
|
|
4. Every `BESTPRACTICES.md` found walking up (top-down)
|
|
5. All `*.md` files in cwd (deduped against already-emitted files)
|
|
6. `git-status-report` output from the highest-level CLAUDE.md directory
|
|
|
|
## How it works
|
|
|
|
- Uses `discover_upward()` to walk from `$PWD` to `/`, collecting directories
|
|
- Resolves symlinks via `readlink -f` to deduplicate (e.g., `~/dev/claude/CLAUDE.md` symlink to `claude-foundations/CLAUDE.md`)
|
|
- Emits each file with a structured header (`=== FILE: ... ===`) for easy parsing
|
|
- Tree output uses `tree` with fallback to `find`
|
|
- ANSI codes are stripped from git-status-report output
|
|
|
|
## Gotchas
|
|
|
|
- Only walks **upward** from cwd — does not descend into subdirectories. Launch from within a project directory to get that project's context.
|
|
- Index files (MEMORY.md, CONTEXT.md, BESTPRACTICES.md) should be thin indexes, not large documents, since they're injected into the system prompt.
|