Skip to content

bug: pi-coding-agent slash-command prompts missing arg placeholders #817

Description

@taqtiqa-mark

Problem

pi-coding-agent users use .pi/prompts/opsx-*.md for /opsx-propose <desc> → OpenSpec change+artifacts.

OpenSpec prompts lack $@ placeholders → /opsx-propose <text> discards <text> (pi expands verbatim).

Root cause analysis:

Root cause:

/opsx-propose is a Pi prompt template (https://www.npmjs.com/package/@mariozechner/pi-coding-agent?activeTab=docs#prompt-templates) from .pi/prompts/opsx-propose.md.
Typing /opsx-propose <text> in Pi's editor triggers expansion: Pi replaces the command+args with the verbatim template Markdown (instructions/steps), discarding <text> because the template lacks arg placeholders ($@, ${@}, etc.).

  • Pi template assumes "The argument after /opsx:propose is..." but cannot interpolate it.
  • Result: Editor fills with fixed instructions; agent gets no <text>, so per step 1, it AskUserQuestion for description (ignores passed text).
  • Note: Template uses /opsx:propose (colon) for display/docs, but pi command is /opsx-propose (no colon, matches filename).

Evidence:

Describe a Workaround

Edit .pi/prompts/opsx-propose.md to use $@:

   **Input**: The argument after `/opsx:propose` is "$@". Use this as the change name (kebab-case) OR ...

Then /opsx-propose foo expands with "foo" inserted.

Fix works (insert $@ + /reload), but manual/fragile—dupes schema (artifacts/status/instructions).

Describe a Solution

CLI gen pi prompts w/ dynamic placeholders:

openspec gen pi-prompt propose > .pi/prompts/opsx-propose.md
# Outputs:
**Input**: Args: **$@**. Derive name/desc from "$@".
1. openspec new change "`kebab($@)`"
2. Loop `openspec status --json`...
[Schema-driven steps/deps/instructions]
  • --format pi-slash: $@ interp.
  • --workflow {apply,continue,...}
  • --out .pi/prompts/

Benefits:

  • Schema changes → auto-updates.
  • No maint dup.
  • npm pi packages share.

Alternative Solutions:

  • Static prompt files: No arg sub.
  • Custom pi ext: Reinvents schema parse.

Additional Details

  • Tested v1.2.0: Full flow works post-fix.
  • Ex: /opsx-propose "add container scripts ..." → chore-add-containerized-test-lint-scripts (4 artifacts).
  • pi docs: https://pi.dev/docs/prompt-templates.md

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions