Claude and Claude Code 2027Section 4 · introduction
1234section 4 lessons
Section 4. Context and Memory — CLAUDE.md, Session Hygiene, and Your Second Brain

Context and Memory — CLAUDE.md, Session Hygiene, and Your Second Brain

≈ 2 minNeuroBober

In Section 3, you installed and configured the Claude Code CLI, structured your settings.json hierarchy, locked down secrets with permissions.deny, mastered the slash-command control panel, and connected the Chrome browser bridge. Yet as soon as you move into multi-day work on a real repository, a new bottleneck emerges: bloated instructions confuse the model, context rots in long conversations until the agent starts going in circles, and the next morning every session starts cold with no record of past decisions. In this section, you will build a multi-layered system for managing context and long-term memory—from a disciplined CLAUDE.md to a local second brain and team-scale memory stores.

In this section

  • Audit your project instructions, unpack the CLAUDE.md loading hierarchy and the cross-agent AGENTS.md standard, and trim bloated rulebooks down to the 200-line rule by extracting modular blocks into .claude/rules/ and @path/to/file imports.
  • Spot context rot before auto-compaction triggers at ~37% of a 1M-token window, compare the real cost of /compact against a clean /clear, and adopt a structured handoff-note protocol.
  • Connect built-in Auto Memory (the MEMORY.md index and four typed note categories) to a local Obsidian vault via --add-dir and autoMemoryDirectory, turning a folder of Markdown files into a transparent second brain with zero cloud lock-in.
  • Evaluate the criteria for graduating from local Markdown to team and enterprise memory stores—ClickHouse Loom with symbol-level code bindings, managed Databricks Delta Lake and Unity Catalog MCP servers, and a local Rust-based semantic CodeGraph.
Section Deliverable

After Lesson 4, your repository will have a lean CLAUDE.md or AGENTS.md under 200 lines, a ready-to-use handoff-note template with clear session-reset triggers, an Auto Memory setup wired to a local Obsidian vault, and a practical roadmap for scaling memory as your team and codebase grow.