ductor icon indicating copy to clipboard operation
ductor copied to clipboard

feat(config): inject configurable files into the system prompt

Open ryuhaneul opened this issue 5 months ago • 0 comments

Motivation

Ductor already auto-appends MAINMEMORY.md to 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

  • New config key append_system_prompt_files: list[str] (default []): a list of workspace-relative filenames whose contents are appended to the agent's --append-system-prompt for agent-driven turns.
    • List multiple files to inject several — they're concatenated in the listed order, e.g. "append_system_prompt_files": ["GLOSSARY.md", "STYLE_GUIDE.md"].
  • Each agent reads the files from its own workspace, so the main agent and each sub-agent can carry different content under the same filenames. Sub-agents inherit the list from the main config.
  • Injected on every turn (not just new sessions), so it survives compaction — like the existing MAINMEMORY.md mechanism, 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

  • Default [] → no change to current behavior.
  • Missing files are silently skipped (no error).
  • Filenames are confined to the workspace: absolute paths, .., 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.

ryuhaneul avatar Jun 16 '26 06:06 ryuhaneul