repl: configurable prompt template via config.shell.prompt (closes #10)
At-a-glance situational awareness: see the active model, context fill,
mode flags, and cwd in the prompt itself — prevents "wait, am I still
in plan mode?" surprises.
Example config:
shell = {
prompt = "[{model} {ctx_used}/{ctx_max}t T{turn} {mode}] {cwd_short} > ",
}
Variables (substituted via {name}):
{model} active preset name
{ctx_used} char/4 token heuristic (Phase 0 §8; accurate is Q1)
{ctx_max} config.context.token_budget
{turn} #ctx.turns
{cwd} libc.getcwd() (chdir-aware; PWD env may drift)
{cwd_short} cwd with $HOME -> ~
{last_status} last exec exit code, "" if none yet
{mode} "norris" | "plan" | "normal"
Default behavior unchanged when shell.prompt is unset — keeps the
"[aish:<model>]>" form with norris ⚡ and plan markers.
Side wiring:
- ffi/libc.lua gains getcwd() (chdir() doesn't update PWD).
- run_shell records exit code into last_exec_code for {last_status}.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,14 @@ return {
|
||||
},
|
||||
capture_output = true, -- inject exec output into context
|
||||
confirm_cmd = true, -- prompt before executing CMD: suggestions
|
||||
|
||||
-- Issue #10: prompt template. When set, replaces the default
|
||||
-- "[aish:<model>]> " prompt. Variables (substituted via {name}):
|
||||
-- {model} {ctx_used} {ctx_max} {turn}
|
||||
-- {cwd} {cwd_short} (cwd with $HOME -> ~)
|
||||
-- {last_status} (last exec exit code, empty if none yet)
|
||||
-- {mode} (norris / plan / normal)
|
||||
-- prompt = "[{model} {ctx_used}/{ctx_max}t T{turn} {mode}] {cwd_short} > ",
|
||||
},
|
||||
|
||||
context = {
|
||||
|
||||
Reference in New Issue
Block a user