Skip to content

Support @file syntax for loading prompts from files#6

Open
cschneid wants to merge 1 commit into
mainfrom
feat/file-prompts
Open

Support @file syntax for loading prompts from files#6
cschneid wants to merge 1 commit into
mainfrom
feat/file-prompts

Conversation

@cschneid

Copy link
Copy Markdown
Owner

Summary

  • Any prompt string can be loaded from a file by prefixing with @ (curl convention)
  • Works everywhere: work, review, gate, iterate, ralph gate, criteria, and all --flag overrides
  • Resolved at parse time — the AST always contains the actual text, rest of system is unaware
  • @@ escapes a literal @ at the start of a prompt
  • File not found produces a clear error at parse time

Examples

cook @prompts/dark-mode.md
cook "work" review @review.md @gate.md
cook "work" --review @review-prompt.txt --gate @gate-prompt.txt
cook "A" vs "B" pick @criteria.md
cook "work" ralph 5 @ralph-gate.md

Changes

  • src/parser.tsresolvePrompt() utility with @file / @@ handling, applied at all 12 prompt entry points
  • src/cli.ts — updated usage/help
  • SPEC.md — new @file prompts section

Test plan

  • echo "Hello world" > /tmp/p.txt && cook @/tmp/p.txt — reads prompt from file
  • cook @nonexistent.txt — clear error message
  • cook "@@literal" — prompt starts with literal @
  • cook @prompt.md review @review.md — both resolved
  • cook "work" --work @override.txt — flag override from file

Any prompt string can now be loaded from a file by prefixing with @,
following curl's convention. Works everywhere: work prompts, review/
gate/iterate prompts, ralph gate prompts, criteria strings, and
all --flag overrides.

  cook @prompts/work.md review @prompts/review.md
  cook "work" --gate @gate-prompt.txt
  cook "A" vs "B" pick @criteria.md

Resolved at parse time so the AST always contains the actual text.
Use @@ to escape a literal @ at the start of a prompt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant