Skip to content

fix: inject current date into spawned agent prompts - #1106

Closed
diberry wants to merge 1 commit into
bradygaster:devfrom
diberry:fix/inject-current-date-in-spawn-prompt
Closed

fix: inject current date into spawned agent prompts#1106
diberry wants to merge 1 commit into
bradygaster:devfrom
diberry:fix/inject-current-date-in-spawn-prompt

Conversation

@diberry

@diberry diberry commented May 9, 2026

Copy link
Copy Markdown
Contributor

Problem

Spawned squad agents frequently hallucinate dates — especially the year — producing timestamps like 2025-05-09 instead of 2026-05-09. This causes incorrect dates in commit messages, status reports, orchestration logs, and any time-stamped content agents produce.

Root Cause

Two contributing factors combine to cause date hallucination in spawned agents:

  1. No date in spawn prompt: buildInitialPrompt() in fan-out.ts constructs the initial message sent to sub-agents but includes no date/time information. Copilot CLI injects <current_datetime> into the session, but in 80KB+ contexts it gets buried.
  2. Hardcoded 2025 dates in templates: scribe-charter.md contains hardcoded 2025-07-01 dates in the Memory Architecture diagram. These get compiled into agent prompts and prime the LLM to use 2025 as the current year.

Fix

1. Date injection in buildInitialPrompt() (fan-out.ts)

Adds **Current Date:** {ISO 8601 UTC timestamp} as a line in every spawned agent's prompt. UTC is sufficient — agents only need the current date/year to stop hallucinating.

2. Remove hardcoded 2025 dates from scribe-charter.md (3 copies)

Replaced 2025-07-01T10-00-river.md etc. with {timestamp}-river.md placeholders in the Memory Architecture diagram across all 3 copies.

3. Test coverage

Added a test in fan-out.test.ts that verifies the spawned prompt contains a valid ISO 8601 timestamp.

Files Changed

File Change
packages/squad-sdk/src/coordinator/fan-out.ts Added UTC date injection in buildInitialPrompt()
templates/scribe-charter.md Replaced hardcoded 2025 dates with {timestamp}/{date} placeholders
packages/squad-cli/templates/scribe-charter.md Same as above
packages/squad-sdk/templates/scribe-charter.md Same as above
test/fan-out.test.ts Added test for date injection in spawned prompt
.changeset/fix-date-hallucination.md Changeset for squad-sdk patch

Notes

  • Minimal change: 6 files, +43/-12 lines
  • No new dependencies
  • Hardcoded dates also exist in retro-enforcement/SKILL.md but are in skill documentation examples, not compiled into spawn prompts — out of scope

Closes #232

Copilot AI review requested due to automatic review settings May 9, 2026 14:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Squad SDK coordinator fan-out spawn prompt so that spawned agent sessions receive an explicit “Current Date” line, reducing date/year hallucinations caused by missing authoritative time context.

Changes:

  • Injects a **Current Date:** ... line at the top of spawned agents’ initial prompts.
  • Adds brief inline rationale explaining why date injection is necessary.

Comment thread packages/squad-sdk/src/coordinator/fan-out.ts
Comment thread packages/squad-sdk/src/coordinator/fan-out.ts
…ination

Spawned agents had no awareness of the current date, causing them to
hallucinate dates (often defaulting to training data cutoff dates).

Changes:
- Add current ISO timestamp to spawned agent initial prompts (fan-out.ts)
- Replace hardcoded 2025-07-01 dates in scribe-charter templates with
  dynamic placeholders
- Add test coverage for date injection in fan-out

Closes bradygaster#232

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@diberry
diberry force-pushed the fix/inject-current-date-in-spawn-prompt branch from 5cbecdb to 7128668 Compare May 9, 2026 14:46
@bradygaster

Copy link
Copy Markdown
Owner

oh wow - good one. reviewing with copilot and manually.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comment on lines 213 to +218
├── orchestration-log/ # Per-spawn log entries
│ ├── 2025-07-01T10-00-river.md
│ └── 2025-07-01T10-00-kai.md
│ ├── {timestamp}-river.md
│ └── {timestamp}-kai.md
├── log/ # Session history — searchable record
│ ├── 2025-07-01-setup.md
│ └── 2025-07-02-api.md
│ ├── {date}-setup.md
│ └── {date}-api.md
Comment on lines 213 to +218
├── orchestration-log/ # Per-spawn log entries
│ ├── 2025-07-01T10-00-river.md
│ └── 2025-07-01T10-00-kai.md
│ ├── {timestamp}-river.md
│ └── {timestamp}-kai.md
├── log/ # Session history — searchable record
│ ├── 2025-07-01-setup.md
│ └── 2025-07-02-api.md
│ ├── {date}-setup.md
│ └── {date}-api.md
Comment on lines 213 to +218
├── orchestration-log/ # Per-spawn log entries
│ ├── 2025-07-01T10-00-river.md
│ └── 2025-07-01T10-00-kai.md
│ ├── {timestamp}-river.md
│ └── {timestamp}-kai.md
├── log/ # Session history — searchable record
│ ├── 2025-07-01-setup.md
│ └── 2025-07-02-api.md
│ ├── {date}-setup.md
│ └── {date}-api.md
Comment thread test/fan-out.test.ts
Comment on lines +136 to +141
// Prompt must contain a Current Date with ISO timestamp
expect(sentPrompt).toContain('**Current Date:**');
const dateMatch = sentPrompt.match(/\*\*Current Date:\*\*\s*(\S+)/);
expect(dateMatch).not.toBeNull();
const timestamp = dateMatch![1];
expect(timestamp).toMatch(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/);
@diberry

diberry commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

@bradygaster I can't reliably get the fix to work so closing until I do.

@diberry diberry closed this May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants