Skip to content

feat(prompt): slim squad.agent.md (83KB → ~40KB) by extracting Routing / Team Mode / Source-of-Truth / Response Mode / Spawn / Init Mode to satellite skills #1308

Closed

Description

@tamirdresher

Symptom

The coordinator file squad.agent.md is now 83KB / 1,137 lines (the canonical .squad-templates/squad.agent.md on dev tip 89a1b96a). For every Copilot session against a Squad coordinator, that entire blob is loaded as the agent prompt before the first tool call. This is wasteful and only growing — the v0.10 stabilisation set added another +10.6KB / +114 lines.

Measured (today, on dev)

Top sections by byte count:

Section Bytes
Routing 9,173
Team Mode 5,474
Source of Truth Hierarchy 4,416
Response Mode Selection 3,920
How to Spawn an Agent 3,196
Init Mode — Phase 2: Create the Team 3,171
Init Mode — Phase 1: Propose the Team 2,208
Role Emoji in Task Descriptions 2,059
MCP Integration 2,042
Memory Governance Tools 1,972

These ten sections alone account for 37.6KB / 45% of the file. Most of them describe machinery the coordinator only needs in specific situations (during init, during a spawn, when picking a response mode, etc.) — not on every prompt.

Proposal

Apply the same canonical-doc + load-on-demand-skill pattern we used for cross-squad (discovery in main file, full protocol in cross-squad-communication/SKILL.md):

  1. Keep in squad.agent.md (under ~40KB target):

  2. Extract to satellite skills (lazy-loaded via the skill tool when the routing table fires):

    New skill Source section ~Bytes saved
    coordinator-routing (full algorithm + examples) Routing 7,000
    coordinator-team-mode Team Mode 5,000
    coordinator-source-of-truth Source of Truth Hierarchy 4,000
    coordinator-response-mode Response Mode Selection 3,500
    coordinator-spawn How to Spawn an Agent + Role Emoji 4,500
    coordinator-init-mode Init Mode Phase 1 + Phase 2 + Casting 5,000
    (existing cross-squad-communication) unchanged —
  3. Routing-table action cells become: Load coordinator-{xxx} skill, then follow the {xxx} protocol. Same shape as the spawn-a-squad row (fix(coordinator): route "spawn a squad" / "another squad" prompts through the cross-squad skill #1307) and the squad-commands row (feat(skills): make /squad a real slash command (user-invocable: true + rename squad-commands → squad) #1303).

Target

  • squad.agent.md: 83KB → ~40KB (51% reduction)
  • New coordinator-* skills installed alongside the existing ones via MANIFEST_SKILL_NAMES
  • Behaviour unchanged — same triggers fire the same actions; just the action knowledge is loaded on demand

Why now

Risks

Out of scope

  • Tier-aware loading by session-frequency (e.g., "load coordinator-routing only on first prompt of a session, cache for the rest") — that's a runtime optimisation; this issue is purely about prompt size.
  • Slimming the rich agent charters (Rai 4.5KB, Fact Checker 3KB) — those are per-agent prompts loaded only when the agent is spawned, not on every coordinator session.

Validation plan

Before merging the slimming PR:

  1. Run the full test/ suite — must pass.
  2. Smoke-test the same end-to-end "build a small Node CLI" scenario we used for v0.10.0-insider.1 — coordinator must dispatch + complete in similar time.
  3. Smoke-test the routing for each extracted section (spawn-a-squad, init-mode, response-mode-selection, etc.) — each must fire its satellite skill before acting.

Filed by the v0.10 stabilisation effort. Tracking: tamirdresher/squad-stack feat/coordinator-md-slimming (to be created).

Metadata

Metadata

Assignees

No one assigned

    Labels

    triagedIssue has been triagedwave:2-soonWave 2 — next 2-4 weeks

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions