claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[FEATURE] Add a --append-system-prompt-file <path> argument

Open grantcarthew opened this issue 4 months ago • 9 comments

I'm currently using:

claude --append-system-prompt "$(cat ROLE.md)" --permission-mode acceptEdits "Read the @SPEC.md file and start implementing the solution"

My role file is typically 30 to 200 lines of content.

The above command works but is not ideal. This is a feature request.

By adding a --append-system-prompt-file <path> argument, the command would become:

claude --append-system-prompt-file ROLE.md --permission-mode acceptEdits "Read the @SPEC.md file and start implementing the solution"

grantcarthew avatar Aug 20 '25 03:08 grantcarthew

Hey, that's a great suggestion. A dedicated --append-system-prompt-file flag would be a really clean addition, much like how other CLI tools use @filename for inputs. I can see how that would make scripting with Claude Code much tidier.

While we wait to see if the team implements that, I've found a couple of workarounds in the documentation that might achieve a similar result and could be even better for your workflow.

Option 1: Use the CLAUDE.md Memory Feature

This is probably the closest to what you want. Claude Code automatically loads instructions from a CLAUDE.md file in your project directory.

Instead of passing the role on the command line, you can tell Claude to just import your ROLE.md file as part of its permanent memory for this project.

  1. Create a file named CLAUDE.md in your project's root directory.

  2. Add this one line to it:

    # My Role
    Please follow the instructions outlined in @ROLE.md
    

Now, Claude will automatically load your ROLE.md file into its context every time you run it in this project. Your command becomes much simpler:

claude --permission-mode acceptEdits "Read the @SPEC.md file and start implementing the solution"

The --append-system-prompt part is no longer needed because it's handled automatically by the memory system. This is great because you don't have to remember to add it for every command.

(Reference: I found this in the "CLAUDE.md imports" section of the Manage Claude's memory docs).

Option 2: Create a Custom Slash Command

If this is a command you run often, you could wrap the entire thing into a custom slash command. This is more for interactive use but can be super powerful.

  1. Create the file .claude/commands/implement.md.

  2. Paste the contents of your ROLE.md into it, followed by your prompt. You can use $ARGUMENTS to pass in the spec file dynamically.

    .claude/commands/implement.md:

    ---
    description: "Implements a spec file based on our standard role."
    argument-hint: "<path_to_spec_file>"
    ---
    
    [... paste the full 30-200 lines from your ROLE.md file here ...]
    
    ---
    
    Okay, now with those instructions in mind, read the @$ARGUMENTS file and start implementing the solution.
    
  3. Now, from within an interactive claude session, you can just run:

    > /implement SPEC.md
    

This encapsulates the whole workflow into a reusable command. It's a bit different from your non-interactive script but might be useful for other situations.

(Reference: I pulled this from the Custom slash commands docs).


Hope one of those helps streamline your process! I still think your original feature request for --append-system-prompt-file is a good one for scripting use cases.

P.S. I was digging around, and it looks like the Python SDK has an option for this (add --system-prompt-file), so the concept definitely exists in the ecosystem. It would be great to see it in the CLI too.

coygeek avatar Aug 20 '25 20:08 coygeek

Option 1: Use the CLAUDE.md Memory Feature

@coygeek Memory != System Prompt

Consider the following:

  1. If OP is submitting a feature request, they are likely familiar with:
    • CLAUDE.md
    • @ imports
    • slash commands
    • etc. (CC SDK docs)
  2. Not everyone has the same workflow

p.s. Your account indicates 48 feature requests in 8 days against this repository. That could be considered beyond excessive, so perhaps keep that in mind, especially for the sake of the maintainers.

abbott avatar Aug 21 '25 05:08 abbott

  • Anthropic: A CLAUDE.md file is a memory configuration file for Claude Code that persists project-specific instructions and preferences across sessions. It's not exactly a system prompt, but serves a similar purpose in a more flexible way.

  • "If OP is submitting a feature request, they are likely familiar with" Did I say that the OP wasn't familiar or insult the OP's knowledge?

  • "Not everyone has the same workflow" Did I imply that this workflow is the only solution?

  • I guess you missed the other +700 github issues that Anthropic received during this time?

Appreciate your contributions.

coygeek avatar Aug 21 '25 07:08 coygeek

@grantcarthew, the --append-system-prompt-file is available starting from Claude Code v2.0.34.

alex-feel avatar Nov 16 '25 18:11 alex-feel

This is great news, thanks.

Although, it's not in the help:

❯ claude --version
2.0.42 (Claude Code)
❯ claude --help | rg file
  -d, --debug [filter]                              Enable debug mode with optional category filtering (e.g., "api,hooks" or "!statsig,!file")
  --mcp-config <configs...>                         Load MCP servers from JSON files or strings (space-separated)
  --settings <file-or-json>                         Path to a settings JSON file or a JSON string to load additional settings from

grantcarthew avatar Nov 17 '25 02:11 grantcarthew

Actually, the help lacks many things, but it doesn't prevent us from using "undocumented" features 🙂

alex-feel avatar Nov 17 '25 09:11 alex-feel

Actually, the help lacks many things, but it doesn't prevent us from using "undocumented" features 🙂

Hi @alex-feel, 👋

OT but do you happen to know any place where I can look up all those undocumented features?

aofei avatar Nov 27 '25 06:11 aofei

haha, I was already think about this @aofei Clone the repo, launch Claude Code, tell it to find all the undocumented stupidity that customers should not have to go hunting for, raise a pull request to this repo.

Do you guys use AI?

grantcarthew avatar Nov 28 '25 05:11 grantcarthew

I finally did the above. I cloned this repo, got Claude Code to analyse it, and this is not the source code.

grantcarthew avatar Dec 08 '25 23:12 grantcarthew