Skip to content

Extract cold-path sections from squad.agent.md into satellite files #98

Closed

Description

@bradygaster

Problem

squad.agent.md is ~27K tokens / ~108K chars / ~1,900 lines. It's loaded as the system prompt on every turn of every conversation. Users are experiencing "response was interrupted due to a server error. retrying" loops — even on simple chat turns with no agents spawned. The system prompt alone consumes too much of the context window.

Proposed Solution — Satellite File Extraction

Extract cold-path sections from squad.agent.md into satellite files that the coordinator reads on demand via view tool calls when specific features are triggered.

Hot path (~7-10K tokens, stays in squad.agent.md)

  • Coordinator identity + refusal rules
  • Init/Team mode gate
  • Routing logic + trigger tables
  • Response mode selection + model selection
  • Spawn templates (standard + lightweight)
  • Anti-patterns list
  • One-line trigger summaries for every cold-path feature with read {file} before executing pointers

Cold path → satellite files in .github/agents/squad/

Section Est. tokens Trigger
Casting & Persistent Naming (tables, algorithm) ~3K Init mode, adding members
Ralph — Work Monitor ~2.5K "Ralph go", "keep working"
Ceremonies ~2K Ceremony requests, auto-triggers
GitHub Issues Mode ~2K Issue commands
PRD Mode ~1.5K "here's the PRD"
Human Team Members ~1K "add {name} as {role}"
Copilot Coding Agent ~1.5K "add copilot"
Client Compatibility details ~1K VS Code detection

Implementation notes

  • Satellite files live in .github/agents/squad/ alongside squad.agent.md
  • index.js copy logic needs to recursively copy .github/agents/squad/ to consumer repos
  • Platform loads ONE .agent.md file — satellites must be explicitly read via view tool (each costs one tool call)
  • Each extracted feature keeps a 1-2 line trigger description in the hot prompt so the LLM never forgets a capability exists
  • VS Code: same behavior, no platform-specific issues
  • Estimated reduction: 70%+ (from ~27K to ~7-10K tokens)

Risks

  • False negatives: If trigger descriptions are too terse, coordinator may skip loading a satellite when it should. Needs empirical testing.
  • Latency: First turn of a cold-path feature adds one tool call. Acceptable tradeoff vs. server errors.

Why bundle with v0.5.0

The .ai-team/ → .squad/ rename (#69) already touches every path reference in squad.agent.md. Doing extraction simultaneously avoids rewriting paths twice.

Team consensus (from discussion 2026-02-19)

  • Keaton (Lead): Target 8-10K hot path. Move whole sections out intact — don't compress. Ship casting tables first.
  • Verbal (Prompt Engineer): Tiered prompting with trigger-gated lazy loading. Keep one-line summaries of every capability in hot path.
  • Fenster (Core Dev): Mechanically straightforward. Flag index.js copy logic as real work. Prototype with 2-3 satellites first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions