Support script paths for system_prompt and scheduled prompts #35
Labels
No labels
in-review
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
weiwen/evie#35
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What to build
Let both
pi.system_promptandschedule[].promptpoint at an executable script instead of only holding literal text. When a configured value is a script path, Evie executes it at point-of-use and uses its stdout as the prompt. This enables programmatic/templated prompt generation (e.g. assembling today's context) instead of a fixed string.Deliver in one PR, sequenced as commits:
Commit 1 — shared resolution foundation (
src/prompt_script.rs)enum PromptSource { Literal(String), Script(PathBuf) }.async fn resolve(&PromptSource, &PromptContext) -> Result<String>usingtokio::process::Commandwith.kill_on_drop(true)+tokio::time::timeout..sh/.pyand the file exists after path resolution. Ends in.sh/.pybut missing → hard config error. Otherwise → literal (existing behavior).+xrequired. CWD = notes directory. Inherit parent env + injectEVIE_TRIGGER(system_prompt|schedule),EVIE_CHAT_ID,EVIE_NOTES_DIR. No args, no stdin. stdout → prompt.prompt_script_timeout_secs, default 10,#[serde(default)].PromptSource; for a detected script path, validate exists + executable (do NOT execute). Literal prompts keep the existing non-empty check.Commit 2 — scheduled-prompt surface
scheduler_taskresolves the entry'sPromptSourceat each cron fire (withEVIE_TRIGGER=schedule,EVIE_CHAT_ID= the target chat) before pushing to the delivery channel;DeliveryItemstays(ChatId, String).warn, skip the fire, continue the loop.Commit 3 — system-prompt surface
SessionManagerConfig.system_promptbecomes aPromptSource; resolve perpispawn (EVIE_TRIGGER=system_prompt).expose_errors(no raw stderr in chat).Acceptance criteria
.sh/.pyscheduled prompt fires on schedule and delivers the script's stdout; a broken/timing-out/empty script logs awarnand skips the fire without crashing the scheduler..sh/.pysystem prompt is executed perpispawn and passed topi; a broken script aborts the spawn and yields a clean error to chat underexpose_errors(raw stderr only in logs).EVIE_TRIGGER/EVIE_CHAT_ID/EVIE_NOTES_DIRset; interpreter comes from the shebang..sh/.pyvalue whose file is missing fails config load; a value ending otherwise is treated as literal (existing behavior unchanged).~is expanded.prompt_script_timeout_secsdefaults to 10 and bounds each execution; existing configs without the field still load.Blocked by
None - can start immediately