← All courses

EDGE FDE

Intermediate

Build a context packer for on-device AI

Cut wasted tokens and wrong answers by packing only the memory, search hits, and tools the model needs right now.

Build a token-budgeted context assembler for LanguageModelSession / Dynamic Profiles.

Rank memory, search hits, and tools into a token budget, then hand that pack to a LanguageModelSession through Dynamic Profiles. iOS 27 and macOS 27 only.

Lessons

  1. Why packing context matters
  2. Count tokens and set a budget
  3. Rank memory, search, and tools
  4. Use Dynamic Profiles as the pack
  5. Build and measure the assembler

Key concepts

Takeaways

Agent briefs

Related courses

Search private files on the phone · Route work to the right Apple model · Run an agent with a state machine · Stream tokens and measure speed