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.
What the control does — three payloads
Section titled “What the control does — three payloads”The button is one control with three outputs, each built from the same page metadata:
| Action | Builder (page-prompt.ts) | What you get | Use it when |
|---|---|---|---|
| Copy as prompt (main button) | buildPagePrompt() | The page wrapped in a persona + mission + rules preamble, then the full body | You 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 wrapper | You 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:
- Persona — who the assistant is (“You are a senior implementation assistant…”).
- Mission — what to do with this page (“Execute the procedure below in your real workspace…”).
- Autonomy contract + authentication boundary — how 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).
- Rules — binding 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
Doc-type → posture
Section titled “Doc-type → posture”| Shelf · type | Posture | The assistant becomes |
|---|---|---|
| build / playbooks · sops · runbooks | execute | Senior implementation assistant — runs the steps in your real repo |
| build / checklists | verify | Verification partner — confirms each item is genuinely done |
| build / blueprints | understand | Architecture advisor — explains the design before you touch code |
| learn / handbooks · guides · concepts · research · case-studies | understand | Technical tutor — explains, then helps you apply |
| resources / templates · kits · cheatsheets · reference | use | Hands-on assistant — adapts the artifact for your project |
| directory | evaluate | Research assistant — compares options and helps you choose |
system_docs · any …/meta/authoring/… page | author | ZajLibrary documentation assistant — the only place the “documentation assistant” framing is correct |
Routing precedence
Section titled “Routing precedence”resolvePersona() picks the posture in this order (most reliable first):
- Authoring override —
system_docsshelf or any…/meta/authoring/…path →author. - Path type segment —
<shelf>/<type>/…(the IA enforces this;content-path-audit.pyvalidates it). kindfrontmatter — fallback when the path type is unknown (the enum incontent.config.ts).- Shelf default — then a neutral
genericpersona.
Common prompt extras
Section titled “Common prompt extras”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.
Execution extras
Section titled “Execution extras”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 legacystepNumber), 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: laravelor acodecanyontag/collection) append a secrets-discipline rule. Narrow rules stay scoped — they never appear on unrelated pages. - Execution coverage contract — executable Parts with
## Stepsor## Checklistappend the shared anti-skip contract fromplaybook-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, andOPTIONALlabels 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.
How to extend it
Section titled “How to extend it”| You want to… | Do this in page-prompt.ts |
|---|---|
| Add a new doc-type | Add a row to TYPE_META ({ label, posture }), and to KIND_TO_SEGMENT if a kind value should map to it |
| Change a persona’s wording | Edit the relevant entry in POSTURES (persona / mission / rules / openAsk) |
| Add a category-scoped rule | Extend CODECANYON_EXECUTE_RULES (or add a sibling set + a guard in resolvePersona) |
| Surface a new metadata field | Add 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.