feat(config): inject configurable files into the system prompt#157
Open
ryuhaneul wants to merge 1 commit into
Open
feat(config): inject configurable files into the system prompt#157ryuhaneul wants to merge 1 commit into
ryuhaneul wants to merge 1 commit into
Conversation
…pend_system_prompt_files Add an opt-in append_system_prompt_files list to AgentConfig: each workspace-relative filename's contents are appended to the system prompt of agent-driven turns. Default empty list preserves current behavior, and missing/empty files are skipped silently. A shared async helper build_appended_files_block reads the files from the agent's own workspace, with a resolve()+is_relative_to path-escape guard (absolute paths, .., and workspace symlinks escaping the workspace are skipped). It returns None when nothing applies so callers leave append_system_prompt unchanged. Wired into the 8 agent-driven AgentRequest points: normal turns (_prepare_normal, every turn after mainmemory/roster), named-session flow + streaming, inter-agent injection (_inject_prompt, interagent message, retry), the task hub, and background named sessions. The task hub resolves each task's parent-agent workspace; the background observer gains a config param. MAINMEMORY injection is unchanged. The maintenance flows are intentionally excluded (no injection): heartbeat, memory flush, and memory compaction.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Ductor already auto-appends
MAINMEMORY.mdto the system prompt (on new sessions), but there's no way to inject additional files — extra context or reference documents — that you want present on every turn. This adds a small config option to do exactly that.What it adds
append_system_prompt_files: list[str](default[]): a list of workspace-relative filenames whose contents are appended to the agent's--append-system-promptfor agent-driven turns."append_system_prompt_files": ["GLOSSARY.md", "STYLE_GUIDE.md"].MAINMEMORY.mdmechanism, but always-on.Where it injects (and where it doesn't)
Wired into the agent-driven request paths: normal chat, named sessions (sync + streaming), inter-agent messages (incl. retry), tasks, and background named sessions. Intentionally excluded from system-maintenance turns — heartbeat, memory flush, and compaction.
Safety
[]→ no change to current behavior..., and symlink escapes are ignored (resolved and checked against the workspace root).Tests
Coverage for the helper (concat / empty / missing / path-escape guards), every-turn injection (including resume), per-agent workspace resolution, and the maintenance-flow exclusions.