Skip to content

feat: add --prompt-file CLI flag for including file contents as system context#1618

Merged
dgageot merged 1 commit intodocker:mainfrom
derekmisler:prompt-file-cli-flag-support
Feb 7, 2026
Merged

feat: add --prompt-file CLI flag for including file contents as system context#1618
dgageot merged 1 commit intodocker:mainfrom
derekmisler:prompt-file-cli-flag-support

Conversation

@derekmisler
Copy link
Copy Markdown
Contributor

@derekmisler derekmisler commented Feb 5, 2026

Adds a new --prompt-file reusable flag that allows users to include additional files in the agent's system context, matching the behavior of add_prompt_files in agent YAML configs.

Usage

cagent exec agent.yaml "task" --prompt-file AGENTS.md --prompt-file CLAUDE.md
cagent run agent.yaml --prompt-file guidelines.md

Behavior

  • Adds files as system messages (same as agent config add_prompt_files)
  • Uses hierarchy search (finds files by traversing up directories)
  • Checks home folder as fallback (~/)
  • Merges with any add_prompt_files defined in agent config
  • Deduplicates to avoid redundant context (saves tokens)
@derekmisler derekmisler self-assigned this Feb 5, 2026
@derekmisler derekmisler force-pushed the prompt-file-cli-flag-support branch from 945d039 to b412e26 Compare February 5, 2026 19:54
@derekmisler derekmisler marked this pull request as ready for review February 5, 2026 19:56
@derekmisler derekmisler requested a review from a team as a code owner February 5, 2026 19:56
@derekmisler derekmisler marked this pull request as draft February 5, 2026 20:01
@derekmisler derekmisler marked this pull request as ready for review February 5, 2026 20:01
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

✅ No issues found in the changed code!

The implementation correctly:

  • Adds the --prompt-file CLI flag with proper flag registration
  • Merges CLI prompt files with agent config files
  • Deduplicates using the standard Go in-place filtering idiom
  • Handles nil/empty slices safely
  • Includes comprehensive test coverage

The code is well-structured and follows Go best practices.

@dgageot dgageot merged commit cfd65d3 into docker:main Feb 7, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants