thincoder 0.12.26 → 0.12.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/agent/setup.mjs +16 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thincoder",
3
- "version": "0.12.26",
3
+ "version": "0.12.27",
4
4
  "description": "Thin coding agent - zero dependencies, no build step, Node.js native. Sharp code, zero bloat.",
5
5
  "keywords": [
6
6
  "ai",
@@ -1,6 +1,11 @@
1
1
  /**
2
2
  * agent/setup.mjs — runAgent pre-flight setup: context injection, system prompt construction, tool injection
3
3
  */
4
+ /** Local time, second precision, for the per-run transient reminder. */
5
+ function timeNowLocal() {
6
+ return new Date().toLocaleString("sv-SE")
7
+ }
8
+
4
9
  import { search as memorySearch, docSearch } from "../memory.mjs"
5
10
  import { pushReal } from "../context.mjs"
6
11
  import { toOpenAISchema } from "../tools/index.mjs"
@@ -119,12 +124,14 @@ export async function prepareRun(agent, input, callbacks, {
119
124
  })
120
125
  }
121
126
  }
127
+ // Time grounding for EVERY agent depth (subagents are short-lived; they also need
128
+ // to know "now"). Transient — dropped on persist, fresh at every run start.
129
+ agent.history.push({
130
+ role: "user",
131
+ content: `[System reminder: current time is ${timeNowLocal()} (local; timezone ${Intl.DateTimeFormat().resolvedOptions().timeZone || "local"}).]`,
132
+ transient: true,
133
+ })
122
134
  if (depth === 0) {
123
- agent.history.push({
124
- role: "user",
125
- content: `[System reminder: current time is ${new Date().toISOString()}.]`,
126
- transient: true,
127
- })
128
135
  // Checklist injection: inject pending + in_progress items from .thincoder/checklist.md
129
136
  try {
130
137
  const { pendingItems } = await import("../tools/checklist.mjs")
@@ -221,14 +228,10 @@ export async function prepareRun(agent, input, callbacks, {
221
228
  ? `${base}\n\n${mainOverlay}`
222
229
  : base
223
230
 
224
- // Local time + timezone on every agent (main, subagent, consult) without it "today"/
225
- // "just now"/"recent" in user messages and search freshness are ungrounded.
226
- // MINUTE precision, deliberately: system prompts must stay byte-identical across runs
227
- // within the same minute or provider prefix caches (DeepSeek cache_hit) never hit.
228
- const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || "local"
229
- const now = new Date()
230
- const mins = String(now.getMinutes()).padStart(2, "0")
231
- systemPrompt += `\n\nCurrent time: ${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, "0")}-${String(now.getDate()).padStart(2, "0")} ${String(now.getHours()).padStart(2, "0")}:${mins} (${timeZone}).`
231
+ // Time injection deliberately does NOT live here: system prompts must be byte-identical
232
+ // across runs (provider prefix caches). The time rides a transient user reminder per turn
233
+ // (see the current-time injection below) variable content belongs in the history, not
234
+ // the cached prefix.
232
235
 
233
236
  const projectRules = await loadProjectInstructions(agent.cwd)
234
237
  if (projectRules) {