Skip to content

Instantly share code, notes, and snippets.

@ben-alkov
Created September 4, 2025 19:38
Show Gist options
  • Select an option

  • Save ben-alkov/a9fa555fb3a19393418717f27291d16a to your computer and use it in GitHub Desktop.

Select an option

Save ben-alkov/a9fa555fb3a19393418717f27291d16a to your computer and use it in GitHub Desktop.
My viewer's notes on "Advanced Context Engineering for Agents"

Context Engineering

(my viewer's notes on Advanced Context Engineering for Agents)

Optimize the context window for

  • correctness
  • completeness
  • size
  • trajectory

<-- note that "size" is 3rd! -->

Bad context data attributes!:

  • incorrect
  • missing
  • noisy

Output quality is inversly proportional to context window size: Using more context does not yield better outcomes!!

implement "intentional compacting" any way you can (automated compacting is still an anti-feature at this point)

Goal!!

Keep context use <40%

Three phase approach

  • research

    • understand the current system (how it works)
    • find all relevant files

    (to a first approximation, these are == /init in Claude Code)

    • explore causes of $foo bug
  • plan

    • outline exact implementation steps
    • include filenames/line #s/snippets
    • be very explicit about how we will test and verify
  • implement

    • go write the code duh

    "If properly planned, the implementation is easy and expected."

    (keep context < 40%!)

There's a near-exponential explosion here

                   1 bad LOC == a bug / 1 bad LOC
          1 bad Line Of Plan == 10--100 bad LOCs
      1 bad Line Of Research == 10--100 bad LOPs == 1,000+ bad LOCs
          1 bad Line Of Spec == etc...           == 10,000+ bad LOCs
       1 bad Line Of Command == etc...           == 1000,000+ bad LOCs ("Command" referring to markdown/CLAUDE.md/etc..)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment