Course Lessons
Welcome & Orientation Starter
Welcome to AI Like a Pro

Quick Reference
⚡ Cheat Sheet 📐 Prompt Formula 📋 CLAUDE.md Guide
← Back to Course Home
Lesson 14 of 20  —  Module 3: Claude Code — Power User Track 70%
Module 3: Claude Code — Power User Track  Advanced

Advanced Claude Techniques — Memory, Context, and Long Tasks

The patterns Prime uses to get Claude to work on complex, multi-day projects without losing the thread.

The problem with long projects

Claude is excellent at single tasks. You give it one thing, it does it well. But most real work isn't one task — it's a project that spans days or weeks, with context that builds up over time.

The challenge: Claude starts fresh every session.

Without a system, you end up re-explaining everything at the start of each conversation. That wastes time and produces inconsistent results.

Here's how to solve it.


The cold-start problem

A "cold start" is what happens when Claude begins a session with zero context about your ongoing project. It doesn't know:

  • What you've already built
  • What decisions you've made
  • What failed last time
  • What the project goals are
  • How you like things done

Every minute you spend re-explaining context is a minute you're not getting work done.

The fix is structured memory — files that load context automatically.


MEMORY.md — your project's cold-start file

In Claude Code, the file at ~/.claude/projects/<project-slug>/memory/MEMORY.md is loaded into every session automatically.

This is Prime's pattern for what to put in it:

# Project Name

Status: Active / Paused / Complete
Location: C:\Users\My PC\project-name
Last Updated: 2026-02-28

---

## What This Is
One paragraph. What does this project do?

---

## Architecture
How the pieces fit together. Enough that Claude can understand the codebase without reading every file.

---

## Key Decisions
Decisions already made. Claude won't re-suggest alternatives you've already rejected.

---

## Next Step
Exactly what needs to happen next. So you can start a session and get going immediately.

Rules:
- Keep it under 200 lines — Claude Code truncates beyond that
- Update it at the end of every significant session
- Don't write step-by-step procedures here — that goes in directives/
- Only write things that will still be true next week


directives/learnings.md — never lose a discovery

Every time you figure something out — a bug fix, an API quirk, something that doesn't work — write it down immediately.

The format:

### [Short Title] (YYYY-MM-DD)
- **Problem:** What went wrong
- **Root cause:** Why it happened
- **Solution:** What fixed it
- **Tried and failed:** What did NOT work (saves future debugging time)

Why "tried and failed" matters: the next time you hit the same issue — or Claude hits it — it won't spend 20 minutes trying things that already didn't work.

This file gets committed to git. The team benefits from every discovery.


Context management for long tasks

Claude has a context window — a limit to how much it can hold in one conversation. For very long sessions, old content gets compressed or dropped.

Patterns that work:

Break work into focused sessions. Don't try to do everything in one chat. Do one thing well, update MEMORY.md, start fresh for the next thing.

Use CLAUDE.md as your persistent brief. Everything important about the project lives in CLAUDE.md. Claude reads it at the start of every session. If it's in CLAUDE.md, you never have to re-explain it.

Reference files, don't paste them. Instead of pasting a 200-line config file into the chat, say "read config/settings.py and tell me..." Claude can read files directly. Keeps the context clean.

Summarize, don't scroll. At the start of a long session, give Claude a 3-sentence summary of what you're doing before diving in. It focuses the work immediately.


The self-annealing loop

The most powerful pattern in this system is the improvement loop. When something breaks:

  1. Identify what broke and why
  2. Fix the script or approach
  3. Verify the fix actually works
  4. Update the directive — write the lesson learned to learnings.md
  5. Move on with a more robust system than before

Each time something goes wrong and you run this loop, your system gets stronger. You're not just fixing a bug — you're making it so that bug can never waste time again.

This is how Prime's setup has gotten better every month. Not because nothing goes wrong. Because everything that goes wrong gets captured and turned into a permanent improvement.


Multi-step tasks — how to structure them

For tasks that involve 5+ steps, use the TodoWrite pattern explicitly:

Before we start — let me give you a plan and you confirm before doing anything:

Task: [what we're building]
Steps I expect:
1. ...
2. ...
3. ...

Tell me if you see a better approach, then proceed.

This prevents Claude from going three steps down the wrong path before you realize it.


The 90% → 59% rule

Every step Claude takes has some chance of error. If Claude is 90% accurate per step across 5 steps, the final output is only right ~59% of the time.

The fix: push business logic into deterministic scripts. Let Claude make decisions. Let Python/scripts do the execution. The more you separate "figure out what to do" (Claude) from "do it reliably" (script), the more consistent your results.

This is the core of the 3-Layer System — AI decides, scripts execute.


Advanced prompt patterns

For complex reasoning: Start with "Think step by step before answering:" — Claude will work through the problem rather than jumping to a conclusion.

For long documents: "Read this in full before you respond. Don't start answering until you've read everything." Prevents Claude from responding to only the first paragraph.

For code review: "Point out anything that could go wrong in production, not just obvious bugs." Broader scope = better review.

For client work: "You are writing for [client name], a [industry] company. Their audience is [describe]. Their tone is [describe]. Never mention competitors." Sets the whole context up front.

For iteration: "What's one thing about this that a careful reviewer would push back on?" Forces Claude to find its own weaknesses before you have to.


When Claude Code vs Claude Chat

Use Claude Code when... Use Claude Chat when...
Working with files on your computer Quick one-off questions
Building scripts or automation Writing and editing content
Projects that last more than one session Research and summarization
You want skills, hooks, MCP connections You're on your phone
Anything that needs to remember state Brainstorming or exploring ideas

Claude Code is more powerful but needs setup. Claude Chat is faster to start but loses context between sessions. Both are useful — pick based on what the task actually needs.

HivePowered AI — AI Like a Pro Training