Skip to content

Commit 9224eb0

Browse files
joshariansketch
andcommitted
loop: change current_datetime to current_date
So that we don't always invalidate the k/v cache. Co-Authored-By: sketch <[email protected]> Change-ID: s330e5fc0212d37d4k
1 parent 7cae9d5 commit 9224eb0

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

loop/agent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2434,7 +2434,7 @@ func (a *Agent) renderSystemPrompt() string {
24342434
Codebase: a.codebase,
24352435
UseSketchWIP: a.config.InDocker,
24362436
InstallationNudge: a.config.InDocker,
2437-
Now: now.Format(time.DateTime),
2437+
Now: now.Format(time.DateOnly),
24382438
}
24392439
if now.Month() == time.September && now.Day() == 19 {
24402440
data.SpecialInstruction = "Today is international talk like a pirate day. Occasionally drop a 🏴‍☠️ into the conversation (not code!), but subtly."

loop/agent_system_prompt.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ Direct user instructions from the current conversation always take highest prece
100100
<pwd>
101101
{{.WorkingDir}}
102102
</pwd>
103-
<current_datetime>
103+
<current_date>
104104
{{.Now}}
105-
</current_datetime>
105+
</current_date>
106106
</system_info>
107107

108108
<git_info>

loop/agent_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -921,31 +921,31 @@ func TestSystemPromptIncludesDateTime(t *testing.T) {
921921
// Render the system prompt
922922
systemPrompt := agent.renderSystemPrompt()
923923

924-
// Check that the system prompt contains a current_datetime section
925-
if !strings.Contains(systemPrompt, "<current_datetime>") {
926-
t.Error("System prompt should contain <current_datetime> section")
924+
// Check that the system prompt contains a current_date section
925+
if !strings.Contains(systemPrompt, "<current_date>") {
926+
t.Error("System prompt should contain <current_date> section")
927927
}
928928

929-
// Check that it contains what looks like a date/time
930-
// The format is "2006-01-02 15:04:05" (time.DateTime)
931-
if !strings.Contains(systemPrompt, "-") || !strings.Contains(systemPrompt, ":") {
932-
t.Error("System prompt should contain a formatted date/time")
929+
// Check that it contains what looks like a date
930+
// The format is "2006-01-02" (time.DateOnly)
931+
if !strings.Contains(systemPrompt, "-") {
932+
t.Error("System prompt should contain a formatted date")
933933
}
934934

935-
// Verify the expected fixed time (2025-07-25 19:37:57)
936-
expectedDateTime := "2025-07-25 19:37:57"
937-
if !strings.Contains(systemPrompt, expectedDateTime) {
938-
t.Errorf("System prompt should contain expected fixed date/time %s", expectedDateTime)
935+
// Verify the expected fixed date (2025-07-25)
936+
expectedDate := "2025-07-25"
937+
if !strings.Contains(systemPrompt, expectedDate) {
938+
t.Errorf("System prompt should contain expected fixed date %s", expectedDate)
939939
}
940940

941941
// Print part of the system prompt for manual verification in test output
942-
// Find the current_datetime section
943-
start := strings.Index(systemPrompt, "<current_datetime>")
942+
// Find the current_date section
943+
start := strings.Index(systemPrompt, "<current_date>")
944944
if start != -1 {
945-
end := strings.Index(systemPrompt[start:], "</current_datetime>") + start
945+
end := strings.Index(systemPrompt[start:], "</current_date>") + start
946946
if end > start {
947-
datetimeSection := systemPrompt[start : end+len("</current_datetime>")]
948-
t.Logf("DateTime section in system prompt: %s", datetimeSection)
947+
dateSection := systemPrompt[start : end+len("</current_date>")]
948+
t.Logf("Date section in system prompt: %s", dateSection)
949949
}
950950
}
951951
}

loop/testdata/agent_loop.httprr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
httprr trace v1
2-
18187 2419
2+
18170 2455
33
POST https://api.anthropic.com/v1/messages HTTP/1.1
44
Host: api.anthropic.com
55
User-Agent: Go-http-client/1.1
6-
Content-Length: 17989
6+
Content-Length: 17972
77
Anthropic-Version: 2023-06-01
88
Content-Type: application/json
99

@@ -546,7 +546,7 @@ Content-Type: application/json
546546
],
547547
"system": [
548548
{
549-
"text": "You are the expert software engineer and architect powering Sketch,\nan agentic coding environment that helps users accomplish coding tasks through autonomous analysis and implementation.\n\n\u003cworkflow\u003e\nStart by asking concise clarifying questions as needed.\nOnce the intent is clear, work autonomously.\nWhenever possible, do end-to-end testing, to ensure fully working functionality.\nAim for a small diff size while thoroughly completing the requested task.\nPrioritize thoughtful analysis and critical engagement over agreeability.\n\nBreak down the overall goal into a series of smaller steps.\nUse the todo_read and todo_write tools to organize and track your work systematically.\n\nFollow this broad workflow:\n\n- Think about how the current step fits into the overall plan.\n- Do research. Good tool choices: bash, think, keyword_search\n- Make edits.\n- If you have completed a standalone chunk of work, make a git commit.\n- Update your todo task list.\n- Repeat.\n\nTo make edits reliably and efficiently, first think about the intent of the edit,\nand what set of patches will achieve that intent.\nThen use the patch tool to make those edits. Combine all edits to any given file into a single patch tool call.\n\nYou may run tool calls in parallel.\n\nComplete every task exhaustively - no matter how repetitive or tedious.\nPartial work, pattern demonstrations, or stubs with TODOs are not acceptable, unless explicitly permitted by the user.\n\nThe done tool provides a checklist of items you MUST verify and\nreview before declaring that you are done. Before executing\nthe done tool, run all the tools the done tool checklist asks\nfor, including creating a git commit. Do not forget to run tests.\n\n\n\n\n\nWhen communicating with the user, take it easy on the emoji, don't be over-enthusiastic, and be concise.\n\nDocker is available. Before running the docker command, start dockerd as a background process.\nAlways use --network=host when running docker containers.\n\u003c/workflow\u003e\n\n\u003cstyle\u003e\nDefault coding guidelines:\n- Clear is better than clever.\n- Minimal inline comments: non-obvious logic and key decisions only.\n- When no commit message style guidance is provided: write a single lowercase line starting with an imperative verb, ≤50 chars, no period\n\u003c/style\u003e\n\n\u003csystem_info\u003e\n\u003cplatform\u003e\nlinux/amd64\n\u003c/platform\u003e\n\u003cpwd\u003e\n/\n\u003c/pwd\u003e\n\u003ccurrent_datetime\u003e\n2025-07-25 19:37:57\n\u003c/current_datetime\u003e\n\u003c/system_info\u003e\n\n\u003cgit_info\u003e\n\u003cgit_root\u003e\n\n\u003c/git_root\u003e\n\u003cHEAD\u003e\nHEAD\n\u003c/HEAD\u003e\n\n\u003c/git_info\u003e\n\n",
549+
"text": "You are the expert software engineer and architect powering Sketch,\nan agentic coding environment that helps users accomplish coding tasks through autonomous analysis and implementation.\n\n\u003cworkflow\u003e\nStart by asking concise clarifying questions as needed.\nOnce the intent is clear, work autonomously.\nWhenever possible, do end-to-end testing, to ensure fully working functionality.\nAim for a small diff size while thoroughly completing the requested task.\nPrioritize thoughtful analysis and critical engagement over agreeability.\n\nBreak down the overall goal into a series of smaller steps.\nUse the todo_read and todo_write tools to organize and track your work systematically.\n\nFollow this broad workflow:\n\n- Think about how the current step fits into the overall plan.\n- Do research. Good tool choices: bash, think, keyword_search\n- Make edits.\n- If you have completed a standalone chunk of work, make a git commit.\n- Update your todo task list.\n- Repeat.\n\nTo make edits reliably and efficiently, first think about the intent of the edit,\nand what set of patches will achieve that intent.\nThen use the patch tool to make those edits. Combine all edits to any given file into a single patch tool call.\n\nYou may run tool calls in parallel.\n\nComplete every task exhaustively - no matter how repetitive or tedious.\nPartial work, pattern demonstrations, or stubs with TODOs are not acceptable, unless explicitly permitted by the user.\n\nThe done tool provides a checklist of items you MUST verify and\nreview before declaring that you are done. Before executing\nthe done tool, run all the tools the done tool checklist asks\nfor, including creating a git commit. Do not forget to run tests.\n\n\n\n\n\nWhen communicating with the user, take it easy on the emoji, don't be over-enthusiastic, and be concise.\n\nDocker is available. Before running the docker command, start dockerd as a background process.\nAlways use --network=host when running docker containers.\n\u003c/workflow\u003e\n\n\u003cstyle\u003e\nDefault coding guidelines:\n- Clear is better than clever.\n- Minimal inline comments: non-obvious logic and key decisions only.\n- When no commit message style guidance is provided: write a single lowercase line starting with an imperative verb, ≤50 chars, no period\n\u003c/style\u003e\n\n\u003csystem_info\u003e\n\u003cplatform\u003e\nlinux/amd64\n\u003c/platform\u003e\n\u003cpwd\u003e\n/\n\u003c/pwd\u003e\n\u003ccurrent_date\u003e\n2025-07-25\n\u003c/current_date\u003e\n\u003c/system_info\u003e\n\n\u003cgit_info\u003e\n\u003cgit_root\u003e\n\n\u003c/git_root\u003e\n\u003cHEAD\u003e\nHEAD\n\u003c/HEAD\u003e\n\n\u003c/git_info\u003e\n\n",
550550
"type": "text",
551551
"cache_control": {
552552
"type": "ephemeral"
@@ -557,24 +557,24 @@ Content-Type: application/json
557557
Anthropic-Organization-Id: 3c473a21-7208-450a-a9f8-80aebda45c1b
558558
Anthropic-Ratelimit-Input-Tokens-Limit: 2000000
559559
Anthropic-Ratelimit-Input-Tokens-Remaining: 2000000
560-
Anthropic-Ratelimit-Input-Tokens-Reset: 2025-07-25T19:52:15Z
560+
Anthropic-Ratelimit-Input-Tokens-Reset: 2025-07-26T04:46:24Z
561561
Anthropic-Ratelimit-Output-Tokens-Limit: 400000
562562
Anthropic-Ratelimit-Output-Tokens-Remaining: 400000
563-
Anthropic-Ratelimit-Output-Tokens-Reset: 2025-07-25T19:52:20Z
563+
Anthropic-Ratelimit-Output-Tokens-Reset: 2025-07-26T04:46:30Z
564564
Anthropic-Ratelimit-Requests-Limit: 4000
565565
Anthropic-Ratelimit-Requests-Remaining: 3999
566-
Anthropic-Ratelimit-Requests-Reset: 2025-07-25T19:52:14Z
566+
Anthropic-Ratelimit-Requests-Reset: 2025-07-26T04:46:23Z
567567
Anthropic-Ratelimit-Tokens-Limit: 2400000
568568
Anthropic-Ratelimit-Tokens-Remaining: 2400000
569-
Anthropic-Ratelimit-Tokens-Reset: 2025-07-25T19:52:15Z
569+
Anthropic-Ratelimit-Tokens-Reset: 2025-07-26T04:46:24Z
570570
Cf-Cache-Status: DYNAMIC
571-
Cf-Ray: 964e3251fd2f2523-SJC
571+
Cf-Ray: 965140c378c0fc54-SJC
572572
Content-Type: application/json
573-
Date: Fri, 25 Jul 2025 19:52:20 GMT
574-
Request-Id: req_011CRUKYkWzHLghwuujhzGNS
573+
Date: Sat, 26 Jul 2025 04:46:30 GMT
574+
Request-Id: req_011CRV2HDgCqjHTZ6M9m9CS6
575575
Server: cloudflare
576576
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
577577
Via: 1.1 google
578578
X-Robots-Tag: none
579579

580-
{"id":"msg_01GoGZTgeHvh4S9L9RryNM2L","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"text","text":"Here are the tools available to me:\n\n**File & Code Management:**\n- `bash` - Execute shell commands\n- `patch` - Modify files with precise text edits\n- `keyword_search` - Search codebase by keywords and concepts\n\n**Task Management:**\n- `todo_read` / `todo_write` - Read and manage task lists\n- `think` - Internal note-taking and planning\n\n**Development Workflow:**\n- `codereview` - Run automated code review\n- `done` - Final checklist before completion\n\n**Browser Automation:**\n- `browser_navigate` - Navigate to URLs\n- `browser_click` - Click elements\n- `browser_type` - Type text into inputs\n- `browser_wait_for` - Wait for elements\n- `browser_get_text` - Read page text\n- `browser_eval` - Execute JavaScript\n- `browser_scroll_into_view` - Scroll to elements\n- `browser_resize` - Resize browser window\n- `browser_recent_console_logs` - Get console logs\n- `browser_clear_console_logs` - Clear console logs\n- `browser_take_screenshot` - Take screenshots\n\n**Utilities:**\n- `read_image` - Read and encode image files\n- `about_sketch` - Get help with Sketch itself"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":3,"cache_creation_input_tokens":4167,"cache_read_input_tokens":0,"output_tokens":299,"service_tier":"standard"}}
580+
{"id":"msg_01Q3vJkUd9kohDxvJvG7Nmjt","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"text","text":"Here are the tools available to me:\n\n**File & Code Management:**\n- `bash` - Execute shell commands\n- `patch` - Edit files with precise text operations\n- `keyword_search` - Search codebase by keywords/concepts\n\n**Task Management:**\n- `todo_read` - Read current task list\n- `todo_write` - Create/update structured task list\n- `think` - Record thoughts and plans\n\n**Development Workflow:**\n- `codereview` - Run automated code review\n- `done` - Complete work with checklist verification\n\n**Browser Automation:**\n- `browser_navigate` - Navigate to URLs\n- `browser_click` - Click elements\n- `browser_type` - Type into inputs\n- `browser_wait_for` - Wait for elements\n- `browser_get_text` - Read element text\n- `browser_eval` - Execute JavaScript\n- `browser_scroll_into_view` - Scroll to elements\n- `browser_resize` - Resize browser window\n- `browser_recent_console_logs` - Get console logs\n- `browser_clear_console_logs` - Clear console logs\n- `browser_take_screenshot` - Take screenshots\n\n**Utility:**\n- `read_image` - Read and encode image files\n- `about_sketch` - Get help with Sketch functionality"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":3,"cache_creation_input_tokens":4161,"cache_read_input_tokens":0,"output_tokens":302,"service_tier":"standard"}}

0 commit comments

Comments
 (0)