Context engineering — fighting the rot — step 8 of 9
Write plan_context(tokens_avail, items) that decides which items
to load into context now and which to offload (filesystem / RAG /
fetch-on-demand). Returns a dict:
{"loaded": [<item names>], "offloaded": [<item names>]}
Rules:
- Each item is a dict with
name(str),tokens(int), andpriority(int — higher = more important). - Sort items by
prioritydescending. Ties broken bynameascending (alphabetical, for stable ordering). - Greedily load items in that order until the next item would
exceed
tokens_avail. Anything that doesn't fit goes tooffloaded. - Do NOT mutate the input list.
Six items, 4000-token budget. Expected output:
loaded: ['claude_md', 'current_task', 'recent_tool_results', 'deploy_skill']
offloaded: ['session_history', 'rust_skill']
⌘↵ runs the editor.read, then continue.
Write plan_context(tokens_avail, items) that decides which items
to load into context now and which to offload (filesystem / RAG /
fetch-on-demand). Returns a dict:
{"loaded": [<item names>], "offloaded": [<item names>]}
Rules:
- Each item is a dict with
name(str),tokens(int), andpriority(int — higher = more important). - Sort items by
prioritydescending. Ties broken bynameascending (alphabetical, for stable ordering). - Greedily load items in that order until the next item would
exceed
tokens_avail. Anything that doesn't fit goes tooffloaded. - Do NOT mutate the input list.
Six items, 4000-token budget. Expected output:
loaded: ['claude_md', 'current_task', 'recent_tool_results', 'deploy_skill']
offloaded: ['session_history', 'rust_skill']
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.