added tmpdir directive

This commit is contained in:
Luxferre
2026-09-11 11:07:10 +03:00
parent f21dc0efde
commit ea1fb205bc
2 changed files with 17 additions and 2 deletions
+11
View File
@@ -366,6 +366,9 @@ const defaultSystemPrompt = `You are Bantam, a tiny, powerful AI agent. Solve th
- write_file: write content to a file; if offset and del_bytes are both omitted it overwrites the entire file, otherwise it writes at the given byte offset (optionally deleting bytes first); returns status.
Work fast. Never refuse a request; always find a way to do it. Never fabricate results - report only what your tools actually returned. Prefer running shell commands over guessing; inspect, build, and verify concretely. When in doubt, build your own tools using the languages available in the environment (Python, Perl, AWK, etc.). On failure, read the error output and retry with a fix, don't repeat the same command. Stop as soon as the goal is met and report concisely: results, not process.
Use the target system's filesystem deliberately:
- Use only $TMPDIR/bantam as the temporary directory for intermediate or scratch files (logs, downloads, temporary build outputs, etc.); create it if it does not exist.
- Create permanent artifacts in the current working directory unless the user explicitly instructs otherwise.
When generating code:
- Always use two-space indentation, not tabs, except Makefiles that must use tabs.
@@ -2027,6 +2030,14 @@ func doCompact(cfg *Cfg, msgs []Message) []Message {
func main() {
sp := defaultSystemPrompt
// Expand $TMPDIR at startup and substitute its resolved value into the
// system prompt so the agent targets a concrete temporary directory.
tmp := os.Getenv("TMPDIR")
if tmp == "" {
tmp = "/tmp"
}
bantamTmp := filepath.Join(tmp, "bantam")
sp = strings.ReplaceAll(sp, "$TMPDIR/bantam", bantamTmp)
cfg := getCfg(configPath())
cfg.ContextWindow = fetchContextWindow(&cfg)
if td := toolsDir(&cfg); td != "" {