Skip to content

feat: dynamic context sections in the default system prompt #111

Closed

Description

@ajianaz

What (description of the change)

Assemble the DEFAULT system prompt from dynamic context sections at session start (pattern reference: ZCode context/sections/, Apache-2.0 — pattern only): identity + tool discipline (the existing incumbent text), current local date, and the session workspace path.

  • default_system_prompt() stays EXACTLY as is (identity/tool-discipline section — the replay scorer greps this function; do not rename it). New build_default_system_prompt(cwd) appends a short Context: section: working directory + today's date.
  • Applied only on the default path: explicit --system / TOLE_SYSTEM_PROMPT still win untouched (B2 precedence). The assembled prompt is pinned in the session header as today — append-only wire bodies per session, so the KV-cache property (95–98% prefix hits) is untouched; a NEW session gets a fresh prefix, which is already the case for any session start.
  • Trivial scope discipline: no env dumps, no git status, no machine fingerprint — two lines maximum.

Why (the problem you're solving)

The model currently answers "what's today's date" and "where are we working" by burning a tool call (or hallucinating). Sessions start with a stale, context-free persona. Two static lines at session start remove a whole class of silly turns at zero runtime cost.

Testing (how you verified this works)

  • Unit: builder output contains identity text verbatim + date (civil-from-days, the B3 pattern) + cwd; explicit-override path does NOT get sections.
  • Tier-1 wire-shape golden test stays green (it constructs its own system prompt; unchanged). Replay incumbent extraction still matches (fn default_system_prompt retained).
  • Live E2E: fresh chat session asks "what is today's date and the working directory?" → correct answers with ZERO tool calls; resumed session keeps its pinned header.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions