Module 2 · Orientation

The Agents Active Memory

The agent's attention is a budget, and everything you add spends from it.

6 min read

Lesson 1.1

Context is a shared budget

An agent is a language model wrapped in a loop. In any single moment, everything it "knows" lives in one place: its context window. That window holds the system prompt, your conversation so far, the results of tools it has run, and any files it has opened, all at once.

The context window
active memory 0 / 256k tokens
  1. System prompt + AGENTS.mdalways loaded
    You are an agent. Tools: read, edit, bash… Follow the house rules. Be concise.
  2. Skill Libraryalways loaded

    Available Skills

    design-guide: Apply the house visual system… coding-standards: Applies the coding standards… commit-message-format: Shows the agent how to format commit message
  3. User inputyour turn
    > Add a dark-mode toggle to the settings page.
  4. Agent thinkinggrows as it works
    The toggle needs a saved preference… read settings.js → found themeContext select coding-standards reads the body of the skill editing settings.js read theme.js, storage.js, 38 more files… multiple user/agent interactions - dozens of tool results, reasoning over many turns
  5. Compactionreplaces the conversation
    ↺ user input & agent thinking summarized: “built dark-mode toggle, wired to themeContext, tests green” system prompt & skills stay; the bulky turns are folded away
What's in a compaction

When the window nears its ceiling, the harness compacts: it rewrites the oldest, bulkiest turns into a short summary so the agent can keep working instead of hitting the wall. It's deliberate about what survives and what gets folded away.

Kept, verbatim: the system prompt, your original goal, the decisions made so far, and the most recent turns; the agent still needs these to act. Summarized to their conclusions: long-finished tool results, file reads, and the step-by-step reasoning from earlier turns; the details are spent, so only what they concluded is carried forward.

The trade-off is real: compaction buys room but loses fidelity. Anything folded into the summary is gone at full detail, which is exactly why keeping the window lean in the first place matters. The more times you compact in a single conversation the less detail is retained from earlier turns.

The window is finite. And here's the part that shapes every decision you'll make in this course: everything you add to an agent competes for that same space. A capability that loads a thousand lines of instructions up front is a thousand lines that aren't available for the actual problem, and that the model has to read past on every turn. Start new conversations as often as possible to reduce token consumption.

The one rule

Add only what the agent doesn't already have, and only when it needs it. Every token you introduce is a bet that it earns its place in the window. This single principle is why skills, subagents, and hooks are shaped the way they are.

Keep this image in mind: not "how do I give the agent more?" but "how do I give it the right thing at the right moment, and nothing else?"

Lesson 1.2

Primitives

Skill: reusable knowledge, on demand

A skill is a folder with instructions the agent loads only when a task calls for it. It's the default building block, and most of this course. A skill teaches a procedure once so you never have to paste it again. Reach for it when you keep re-explaining the same how-to.

Subagent: a worker with its own window

A subagent is a delegated assistant with its own context window, its own tools, and often a cheaper model. Whatever it reads and produces stays in its window, not yours. Reach for it when a side task would otherwise flood your main conversation with output you'll never look at again.

Slash command: a skill you trigger by name

A slash command is not a separate thing to learn: it's simply a skill you invoke directly, by typing its name. Same file, same format; you just pull the trigger instead of waiting for the agent to decide it's relevant. Reach for it when you want to run something on demand.

Commands and skills used to be separate. They've been merged: a skill you can call by name is the slash command. So learn one primitive, not two; you'll see exactly how in Module 2.

Hook: a guarantee, run by the harness

A hook is deterministic code that fires on lifecycle events: before a tool runs, after a file is saved, when a session starts. Crucially, the harness runs a hook, not the model. That's the whole point: the model can forget or decide not to; a hook happens every time. Reach for it when something must be guaranteed.

You need the agent to grep a huge log, producing thousands of lines you'll never read again. Which primitive fits best?

Pick one. You'll get instant feedback.

Lesson 1.3

Choosing between them

You don't need to memorize a table. Almost every choice comes down to four questions, asked in order:

  1. Is it recurring knowledge or a procedure? → a skill.
  2. Does it need isolation: its own context, tools, or a cheaper model? → a subagent.
  3. Must it happen deterministically, every single time? → a hook.
  4. Do you want to trigger it yourself, by name? → a skill, invoked as a command.
Our running example

Across these modules we'll build one thing: a design-guide helper. It starts as a simple skill, learns to keep its own reference material out of the way, gets a sharp description so the agent actually reaches for it, and finally grows a subagent and a hook. Watch it evolve: each module adds one real capability.

Hands-on

Name the primitive

Three quick calls. Read each situation and decide which primitive earns its place; the goal is to make the four questions above feel automatic.

1. Every week you paste the same 40 lines explaining your team's commit-message format.

2. You must never let the agent run rm -rf without a confirmation, no exceptions.

Takeaways

1. The context window is a shared, finite budget: spend it deliberately.
2. Four primitives: skill (knowledge on demand), subagent (isolated worker), slash command (a skill you trigger), hook (a guarantee).
3. Choose by asking: recurring? isolate? guarantee? trigger?

Finished The Agents Active Memory?

Mark it done to track your progress across the course.