fix: replace static dates in agent prompts
Some checks failed
Build / Build (push) Has been cancelled
Build / Verify Plugin (push) Has been cancelled

This commit is contained in:
Carl-Robert Linnupuu 2026-01-13 15:33:59 +00:00
parent db1c69edb7
commit 2b425bdc50
5 changed files with 13 additions and 3 deletions

View file

@ -4,9 +4,12 @@ import ee.carlrobert.codegpt.settings.models.ModelRegistry
import ee.carlrobert.codegpt.settings.models.ModelSelection
import ee.carlrobert.codegpt.settings.service.ServiceType
import ee.carlrobert.codegpt.util.file.FileUtil
import java.time.LocalDate
import java.time.format.DateTimeFormatter
internal object AgentSystemPrompts {
private const val WORKING_DIRECTORY_TOKEN = "{{WORKING_DIRECTORY}}"
private const val CURRENT_DATE_TOKEN = "{{CURRENT_DATE}}"
private const val OPENAI_KEY = "openai"
private const val GEMINI_KEY = "gemini"
@ -55,7 +58,10 @@ internal object AgentSystemPrompts {
private fun renderPrompt(key: String, projectPath: String?): String {
val workingDirectory = projectPath ?: "unknown"
return getPrompt(key).replace(WORKING_DIRECTORY_TOKEN, workingDirectory)
val currentDate = LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE)
return getPrompt(key)
.replace(WORKING_DIRECTORY_TOKEN, workingDirectory)
.replace(CURRENT_DATE_TOKEN, currentDate)
}
private fun getPrompt(key: String): String {

View file

@ -10,6 +10,8 @@ import kotlinx.serialization.Serializable
import org.jsoup.Jsoup
import java.net.URLEncoder
import java.nio.charset.StandardCharsets
import java.time.LocalDate
import java.time.format.DateTimeFormatter
class WebSearchTool(
private val userAgent: String = "Mozilla/5.0 (compatible; ProxyAI/1.0; +https://tryproxy.io)"
@ -46,7 +48,7 @@ Usage notes:
- Web search is only available in the US
IMPORTANT - Use the correct year in search queries:
- Today's date is 2025-12-04. You MUST use this year when searching for recent information, documentation, or current events.
- Today's date is ${LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE)}. You MUST use this year when searching for recent information, documentation, or current events.
- Example: If today is 2025-07-15 and the user asks for "latest React docs", search for "React documentation 2025", NOT "React documentation 2024"
""".trimIndent()
) {

View file

@ -105,7 +105,7 @@ You can use the following tools without requiring user approval: Bash(curl:*), B
Here is useful information about the environment you are running in:
<env>
Working directory: {{WORKING_DIRECTORY}}
Today's date: 2025-12-04
Today's date: {{CURRENT_DATE}}
</env>
IMPORTANT: Assist with authorized security testing, defensive security, CTF challenges, and educational contexts. Refuse requests for destructive techniques, DoS attacks, mass targeting, supply chain compromise, or detection evasion for malicious purposes. Dual-use security tools (C2 frameworks, credential testing, exploit development) require clear authorization context: pentesting engagements, CTF competitions, security research, or defensive use cases.

View file

@ -1,6 +1,7 @@
You are a ProxyAI Agent, a JetBrains IDE assistant specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.
Working directory: {{WORKING_DIRECTORY}}
Today's date: {{CURRENT_DATE}}
# Core Mandates

View file

@ -6,6 +6,7 @@ Your capabilities:
- Emit tool calls to read, search, edit, and write files, plus run shell commands when needed.
Working directory: {{WORKING_DIRECTORY}}
Today's date: {{CURRENT_DATE}}
# How you work