Skip to content
prod 352bb92
Browse

Copy-as-prompt button

Copy as prompt · Copy page · Open in ChatGPT/Claude

Every doc page carries a small split-button beside its title (and at the foot of the article). It turns the page into something an AI assistant can act on — framed by what kind of page it is. A Build playbook tells the assistant to execute the steps in your repo; a Learn guide tells it to tutor you; a system page tells it to help author the library.

The button is one control with three outputs, each built from the same page metadata:

ActionBuilder (page-prompt.ts)What you getUse it when
Copy as prompt (main button)buildPagePrompt()The page wrapped in a persona + mission + rules preamble, then the full bodyYou want an assistant to act on the page (run the steps, tutor you, fill the template)
Copy page (menu)buildPageMarkdown()The raw page as clean Markdown — # title + > Source: + body, no persona wrapperYou want the plain content (paste into a doc, or into a chat where you’ll frame it yourself)
Open in ChatGPT / Claude (menu)buildOpenAsk()A short, persona-aware ask + the live URL (the assistant fetches the page itself)You want to jump straight into a chat without pasting the whole page

The persona system — framing by doc-type

Section titled “The persona system — framing by doc-type”

The core idea: the receiving assistant’s role changes with the page’s doc-type, so the copied prompt produces the right behaviour. The preamble is built in three layers:

  1. Personawho the assistant is (“You are a senior implementation assistant…”).
  2. Missionwhat to do with this page (“Execute the procedure below in your real workspace…”).
  3. Autonomy contract + authentication boundaryhow far to proceed without asking (do agent-owned work, update ledgers when state changes, ask only at true human gates; never type passwords, log in, or create accounts).
  4. Rulesbinding constraints (steps in order, verify against # Expected:, checklist gates, evidence-backed stop points…).
flowchart TD
  A[Doc page] --> B["PageCopyPrompt.astro<br/>builds one meta object"]
  B --> C{"resolvePersona()<br/>path type → kind → shelf"}
  C --> D["Posture<br/>execute · verify · understand · use · evaluate · author"]
  D --> E1["buildPagePrompt()<br/>Copy as prompt"]
  D --> E2["buildOpenAsk()<br/>Open in ChatGPT / Claude"]
  B --> E3["buildPageMarkdown()<br/>Copy page"]
  E1 --> F[CopyPageButton.astro]
  E2 --> F
  E3 --> F
Shelf · typePostureThe assistant becomes
build / playbooks · sops · runbooksexecuteSenior implementation assistant — runs the steps in your real repo
build / checklistsverifyVerification partner — confirms each item is genuinely done
build / blueprintsunderstandArchitecture advisor — explains the design before you touch code
learn / handbooks · guides · concepts · research · case-studiesunderstandTechnical tutor — explains, then helps you apply
resources / templates · kits · cheatsheets · referenceuseHands-on assistant — adapts the artifact for your project
directoryevaluateResearch assistant — compares options and helps you choose
system_docs · any …/meta/authoring/… pageauthorZajLibrary documentation assistant — the only place the “documentation assistant” framing is correct

resolvePersona() picks the posture in this order (most reliable first):

  1. Authoring overridesystem_docs shelf or any …/meta/authoring/… path → author.
  2. Path type segment<shelf>/<type>/… (the IA enforces this; content-path-audit.py validates it).
  3. kind frontmatter — fallback when the path type is unknown (the enum in content.config.ts).
  4. Shelf default — then a neutral generic persona.

Every Copy as prompt payload includes:

  • Autonomy contract — the prompt includes AUTONOMY CONTRACT — complete accurate work unless a real human gate is required, so a receiving agent does routine agent-owned work itself, updates progress/customization/feedback ledgers when guide state changes, and asks the human only for credentials, production/DNS, destructive operations, legal/commercial/product calls, or genuinely equal options.
  • Authentication boundary — executable prompts include AUTHENTICATION BOUNDARY — hard, non-overridable, so a receiving agent never types passwords, logs in, or creates accounts in any environment. For login-gated checks, the human performs the one login/dashboard sign-in/account creation/credential-entry transaction; the agent resumes after the session exists and drives navigation, screenshots, non-secret fields, and verification.

For execute pages the rules block also gets:

  • Playbook cold-start orientation — every playbook Copy as prompt payload starts with STEP 0 — COLD-START ORIENTATION, so a fresh agent first identifies the project, reads ledgers, checks git/concurrent work, inherits project rules, and records feedback before fetching a Part.
  • Part-awareness — when a document has partNumber (or legacy stepNumber), a line like “This is Part 1 of phase 1 (~10 min) — execute this Part fully, then stop at its ## Checklist.”
  • Category-scoped rules — CodeCanyon/Laravel pages (category: laravel or a codecanyon tag/collection) append a secrets-discipline rule. Narrow rules stay scoped — they never appear on unrelated pages.
  • Execution coverage contract — executable Parts with ## Steps or ## Checklist append the shared anti-skip contract from playbook-execution-contract.ts, requiring every Step, sub-step, checklist box, state update, and server-continuity check to be classified with evidence before an agent can claim done. MUST, SHOULD, and OPTIONAL labels are scope labels, not automatic skip permission; MUST-only, MUST+SHOULD-only, or fast mode must be an explicit user request and skipped items still need coverage rows.

Runnable playbook Phase overview documents also render PhaseRunnerPrompt.astro in two places: a compact Run this Phase action beside Copy as prompt, and a contextual Run this Phase button beside the visible Part cards. Both buttons copy the same Phase prompt with the cold-start orientation first, the autonomy contract next, current-origin URLs plus MCP slugs after it, and the shared execution contract below the ordered Part list. Phase-runner prompts default to full Phase execution: every ordered Part URL is in scope, including SHOULD / optional-quality Parts, unless the user explicitly asks for MUST-only, gate-only, or fast mode. Before fetching Part 1, the copied Phase prompt asks the receiving agent to confirm FULL (recommended/default), MUST-only, or MUST+SHOULD-only, so paste-time behavior is visible.

Numbered playbook Part documents also render PartRunnerPrompt.astro as Run this Part beside Copy as prompt. That button copies a generated one-Part execution prompt, not raw Markdown: cold-start orientation, autonomy/full-coverage clauses, the current-origin URL and MCP slug, terminal-only progress scaffolding, and the shared execution contract. The copied text uses Part for the document-level unit and Step for each action in ## Steps.

You want to…Do this in page-prompt.ts
Add a new doc-typeAdd a row to TYPE_META ({ label, posture }), and to KIND_TO_SEGMENT if a kind value should map to it
Change a persona’s wordingEdit the relevant entry in POSTURES (persona / mission / rules / openAsk)
Add a category-scoped ruleExtend CODECANYON_EXECUTE_RULES (or add a sibling set + a guard in resolvePersona)
Surface a new metadata fieldAdd it to PagePromptMeta, pass it from PageCopyPrompt.astro, and add a metadataLines entry

After any change, run npm run build — the persona text ships inside each page’s static HTML, so a green build plus a spot-check of the rendered data-prompt is the verification.