fix: inject current date into spawned agent prompts - #1106
Closed
diberry wants to merge 1 commit into
Closed
Conversation
Contributor
There was a problem hiding this comment.
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.
…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
force-pushed
the
fix/inject-current-date-in-spawn-prompt
branch
from
May 9, 2026 14:46
5cbecdb to
7128668
Compare
Owner
|
oh wow - good one. reviewing with copilot and manually. |
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 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}/); |
Contributor
Author
|
@bradygaster I can't reliably get the fix to work so closing until I do. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Spawned squad agents frequently hallucinate dates — especially the year — producing timestamps like
2025-05-09instead of2026-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:
buildInitialPrompt()infan-out.tsconstructs 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.scribe-charter.mdcontains hardcoded2025-07-01dates 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.mdetc. with{timestamp}-river.mdplaceholders in the Memory Architecture diagram across all 3 copies.3. Test coverage
Added a test in
fan-out.test.tsthat verifies the spawned prompt contains a valid ISO 8601 timestamp.Files Changed
packages/squad-sdk/src/coordinator/fan-out.tsbuildInitialPrompt()templates/scribe-charter.md{timestamp}/{date}placeholderspackages/squad-cli/templates/scribe-charter.mdpackages/squad-sdk/templates/scribe-charter.mdtest/fan-out.test.ts.changeset/fix-date-hallucination.mdNotes
retro-enforcement/SKILL.mdbut are in skill documentation examples, not compiled into spawn prompts — out of scopeCloses #232