Claude, Nutshell Series

Claude Exam Quick Revision 2: Context & Session Management

Important Commands

  • /compact: Summarise conversation and reclaim context.
  • /clear: Start with an empty conversation context.
  • /resume: Continue a previous session.
  • /context: Inspect context-window usage.
  • /branch: Explore an alternative path from the current conversation.
  • –fork-session: Inherit context but create an independent session.
  • /rewind: Return to an earlier checkpoint.

Preserving Critical Information

  • Immutable facts: Account ID, agreed price, transaction ID.
  • Mutable facts: Status, progress, next action.
  • Derived facts: Conclusions based on evidence.
  • Unverified facts: Claims still requiring confirmation.

Do not repeatedly summarise critical transactional facts. Keep them in a structured case-facts block or external state.

Long-Running Tasks

Persist important discoveries to external scratchpad/state files so they survive compaction, context resets and session boundaries.

Resuming Multi-Agent Work

Best pattern: each agent persists structured output, while a coordinator maintains a manifest/checkpoint and restores only relevant state.

Memory: Compact history. Persist facts. Rehydrate only what is needed.

Claude, Nutshell Series

Claude Exam Quick Revision 1: Prompt Engineering & Few-Shot Prompting

Core rule: Precise instructions beat vague instructions.

Prompting Types

  • Zero-shot: Instruction only, no examples.
  • One-shot: One example demonstrates expected behaviour.
  • Few-shot: A small number of examples guide difficult decisions.
  • Negative examples: Show what Claude should NOT identify.
  • Contrastive examples: Show why one similar case is correct and another is not.

When to Use Few-Shot Prompting

  • Ambiguous classification.
  • Sarcasm or mixed sentiment.
  • Subjective boundaries.
  • Important edge cases.

Good pattern: Use 2–4 diverse examples including at least one difficult edge case.

Reducing False Positives

Use explicit and measurable criteria instead of instructions such as “flag anything suspicious.”

Example: “Flag functions longer than 50 lines” is better than “flag overly complex functions.”

Exam Traps

  • Temperature 0 improves consistency, not correctness.
  • Few-shot examples guide behaviour but do not guarantee enforcement.
  • Critical business rules should be implemented programmatically.

Memory: Ambiguity → examples. Hard rule → code.