Skip to content

refactor(framework): move all prompting into prompts/**/*.md (#551)#553

Merged
suleimansh merged 1 commit into
mainfrom
feat/decoupled-prompts-551
Jul 15, 2026
Merged

refactor(framework): move all prompting into prompts/**/*.md (#551)#553
suleimansh merged 1 commit into
mainfrom
feat/decoupled-prompts-551

Conversation

@suleimansh

Copy link
Copy Markdown
Member

Closes #551.

All prompting is now markdown under packages/framework/prompts/. No agent-facing text is written in TypeScript any more.

prompts/
  system_prompt.md          # your #326 doc
  protocols/await.md        # how to emit an awaited choice
  protocols/signal.md       # setSessionName / setReadyForMerge
  presets/{research,readability,maintainability,security_audit,ux}.md

The text is unchanged. Verified byte-identical against the previous build: all 8 constants, plus the composed run system channel, still exactly 3874 chars. This PR is a move, not an edit, so there is nothing to review prompt-wise. That is deliberate: syncing your 13 Jul rewrite is the next PR, and it will be a markdown diff you can read.

Why generated, not read from disk. @gemstack/ai-autopilot reads its prompts/*.md with node:fs at run time. That does not work here: the system prompt and the presets are reachable from src/client.ts, which the dashboard imports in the browser to show the prompt before a run (#520). A node:fs edge there breaks the browser bundle, and client.test.ts fails the build over it. So scripts/gen-prompts.mjs compiles prompts/**/*.md into src/prompts.generated.ts (git-ignored, rebuilt by build/test/typecheck), and the code imports plain strings. The markdown is the only source of truth, and the package stays files: ["dist"].

Editing a prompt is: edit the .md, pnpm build. Adding foo/bar.md exports FOO_BAR.

Not done here, on purpose: user-customizable prompts (post-MVP, your call on #551), and the phase-hook idea. This is the MVP shape.

No changeset: the published surface and every prompt byte are identical.

522 tests green, root typecheck green (21/21), dashboard bundle builds.

Every agent-facing prompt now lives as markdown under packages/framework/prompts/:
the system prompt (#326), the two emit protocols, and the five preset prompts. No
prompt text is written in TypeScript any more.

The text is unchanged. Verified byte-identical against the previous build for all
eight constants and for the composed run system channel (3874 chars).

scripts/gen-prompts.mjs compiles prompts/**/*.md into src/prompts.generated.ts
(git-ignored), which the code imports. Generated rather than read from disk with
node:fs like @gemstack/ai-autopilot does, because the system prompt and presets are
reachable from src/client.ts, which the dashboard imports in the browser to show the
prompt before a run (#520). A node:fs edge there breaks the browser bundle and
client.test.ts fails the build over it. A module of plain strings crosses that
boundary for free and keeps the package files: ["dist"].
@suleimansh suleimansh self-assigned this Jul 15, 2026
@suleimansh suleimansh added the-framework ♻️ enhancement New feature or request priority: medium Worth doing, not urgent labels Jul 15, 2026
@suleimansh
suleimansh merged commit c7d8db5 into main Jul 15, 2026
2 checks passed
@suleimansh
suleimansh deleted the feat/decoupled-prompts-551 branch July 15, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: medium Worth doing, not urgent the-framework ♻️

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decoupled prompts

1 participant