Files
claude-foundations/memory/script-context-load.md
Paul O'Reilly f41c22d0ac Add question-reframing guidance to CLAUDE.md; commit accumulated project files
- CLAUDE.md: add "Question the question" and "One clarifying question" rules
  to Tone and Interaction — XY problem detection, false premise checks, and
  explicit reframe pattern before answering
- Add claude/ detail-file directory (topic docs referenced from CLAUDE.md)
- Add ABOUT.md, FUTURE.md
- Update memory/, scripts/, settings.yaml with accumulated session changes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 09:37:28 +12:00

1.8 KiB

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. Paths to every CLAUDE.md found walking up from cwd (not contents — Claude Code loads those natively via claudeMd), annotated with description: from sibling ABOUT.md if present
  2. Paths to every project CLAUDE.md found under each CLAUDE.md directory (depth 2-4) — for project discovery, also annotated with ABOUT.md descriptions
  3. Every CONTEXT.md found walking up (top-down) — full contents
  4. Every MEMORY.md found walking up (top-down) — full contents
  5. Every BESTPRACTICES.md found walking up (top-down) — full contents

What it does NOT load

  • CLAUDE.md contents (loaded natively by Claude Code)
  • Directory trees (Claude can run tree on demand for fresh results)
  • README.md files (human-oriented, read on demand)
  • git-status-report (moved to /housekeeping skill)

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
  • Uses find to discover project CLAUDE.md files under each hierarchy directory

Gotchas

  • Only walks upward from cwd for index files — but scans downward for project CLAUDE.md discovery. 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.