Skip to content

AGENTS.md template uses wrong section names for post-compaction context extraction #25029

@andrade-igor

Description

@andrade-igor

Bug

The official AGENTS.md template (reference/templates/AGENTS.md) uses ## Every Session and ## Safety as section headers. However, post-compaction-context.ts extracts sections named ## Session Startup and ## Red Lines.

This means any workspace using the official template loses startup context after compactionextractSections() returns null because the expected headers don't match.

Evidence

Code (from bundled dist):

const sections = extractSections(
  await fs.promises.readFile(agentsPath, "utf-8"),
  ["Session Startup", "Red Lines"]
);

Template (reference/templates/AGENTS.md):

## Every Session    ← code expects "Session Startup"
## Safety           ← code expects "Red Lines"

The BARE_SESSION_RESET_PROMPT (used by /new and /reset) also references "Session Startup".

CHANGELOG #22338 confirms the feature expects "Session Startup".

Expected fix

Update the template to use ## Session Startup and ## Red Lines, or update the code to accept both naming conventions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions