Title: Context window optimization: decisions.md pruning, spawn template dedup, Init Mode compression · Issue #37 · github/squad · GitHub
Open Graph Title: Context window optimization: decisions.md pruning, spawn template dedup, Init Mode compression · Issue #37 · github/squad
X Title: Context window optimization: decisions.md pruning, spawn template dedup, Init Mode compression · Issue #37 · github/squad
Description: Problem decisions.md has ballooned to 298KB (~80K tokens) — that's 40% of a 200K context window consumed on every agent spawn. Combined with squad.agent.md growth (29K tokens) and agent histories (~47K tokens), each agent spawn now costs...
Open Graph Description: Problem decisions.md has ballooned to 298KB (~80K tokens) — that's 40% of a 200K context window consumed on every agent spawn. Combined with squad.agent.md growth (29K tokens) and agent histories (...
X Description: Problem decisions.md has ballooned to 298KB (~80K tokens) — that's 40% of a 200K context window consumed on every agent spawn. Combined with squad.agent.md growth (29K tokens) and agent histori...
Opengraph URL: https://github.com/github/squad/issues/37
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Context window optimization: decisions.md pruning, spawn template dedup, Init Mode compression","articleBody":"## Problem\n\ndecisions.md has ballooned to 298KB (~80K tokens) — that's 40% of a 200K context window consumed on every agent spawn. Combined with squad.agent.md growth (29K tokens) and agent histories (~47K tokens), each agent spawn now costs 82-93K tokens (41-46% of context). This leaves agents working with barely half a context window.\n\n## Root Causes\n\n1. **decisions.md bloat** — 266 blocks, 131 of which are sub-section fragments from old analysis docs. No pruning/archival mechanism exists (unlike history.md which has Scribe summarization). Most blocks are stale sprint artifacts from v0.3.0 planning.\n\n2. **squad.agent.md spawn template duplication** — Three near-identical spawn templates (background, sync, generic) at lines 592-809, each ~1,800 tokens. They differ only in mode/description examples and placeholder names.\n\n3. **Init Mode dead weight** — Init Mode (lines 28-112, ~1,471 tokens) is loaded on every message but only used once per repo lifetime (when .ai-team/team.md doesn't exist).\n\n## Solution\n\n### Immediate (this issue — v0.4.0)\n\n- [x] **Prune decisions.md**: Manual pass — keep ~30-40 active decisions, archive rest to decisions-archive.md. Target: 298KB → ~50KB (~13K tokens)\n- [x] **Dedup spawn templates**: Collapse 3 templates into 1 generic template with mode as a variable. Save ~3,600 tokens\n- [x] **Compress Init Mode**: Reduce redundancy, compress post-setup sources. Target: ~1,471 → ~800 tokens\n- [x] **Update README**: Context Window Budget table with post-optimization numbers\n\n### Future (v0.5.0 — automated)\n\n- Add Scribe-driven decisions.md pruning: identify blocks older than N weeks, summarize, archive originals to decisions-archive.md\n- Similar to existing history.md summarization (Scribe step 6) but for the shared decision ledger\n- Add an `evergreen` tag for decisions that should never be pruned (e.g., \"zero dependencies\", \"cost-first model selection\")\n\n## Impact\n\n| Metric | Before | After (target) |\n|--------|--------|----------------|\n| decisions.md | ~80K tokens | ~13K tokens |\n| squad.agent.md | ~29K tokens | ~23K tokens |\n| Per-agent spawn cost | 82-93K tokens (41-46%) | 19-28K tokens (10-14%) |\n| Context remaining for work | 54-59% | 86-90% |\n\n## Labels\n\ntype:chore, priority:p0, release:v0.4.0","author":{"url":"https://github.com/bradygaster","@type":"Person","name":"bradygaster"},"datePublished":"2026-02-13T10:44:49Z","url":"https://github.com/github/squad/issues/37"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0c59fb75-c900-6399-90bc-9a34c900819e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E008:16AB79:1B80ABA:22F50ED:6B0153E0 |
| html-safe-nonce | c083c9f271058439ceeec3052eb1057bfc76bfb255fe92190dfcf919d6007cf5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDA4OjE2QUI3OToxQjgwQUJBOjIyRjUwRUQ6NkIwMTUzRTAiLCJ2aXNpdG9yX2lkIjoiODE1NzE5MTM0NTY2MDg0Mjk3NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 670067d84dd946d7e408c006fb4833946ed004d2c71d805e59d353e3088134ed |
| hovercard-subject-tag | issue:3936543876 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/squad/37/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2b4e999986bca9ae21452ca2a68f48906b6169dfdd489000b8a9ba15ac688f44/github/squad/issues/37 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2b4e999986bca9ae21452ca2a68f48906b6169dfdd489000b8a9ba15ac688f44/github/squad/issues/37 |
| og:image:alt | Problem decisions.md has ballooned to 298KB (~80K tokens) — that's 40% of a 200K context window consumed on every agent spawn. Combined with squad.agent.md growth (29K tokens) and agent histories (... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bradygaster |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/github/squad git https://github.com/github/squad.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 1151205052 |
| octolytics-dimension-repository_nwo | github/squad |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1151205052 |
| octolytics-dimension-repository_network_root_nwo | github/squad |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width