From 8d25b8a4bb7225fa40007a71c8836d47b903680a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 21:35:57 +0000 Subject: [PATCH 1/5] Initial plan From b590c706dd03d9c36cdb9944a8a0bd6fa980cf05 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 18 Mar 2026 21:48:26 +0000 Subject: [PATCH 2/5] Add agent instruction file output mode for GitHub Copilot, Claude Code, and Cursor Co-authored-by: Alan-Jowett <20480683+Alan-Jowett@users.noreply.github.com> --- bootstrap.md | 87 +++++++- formats/agent-instructions.md | 118 +++++++++++ manifest.yaml | 22 ++ templates/author-agent-instructions.md | 188 ++++++++++++++++++ .../copilot-instructions-memory-safety.md | 52 +++++ 5 files changed, 457 insertions(+), 10 deletions(-) create mode 100644 formats/agent-instructions.md create mode 100644 templates/author-agent-instructions.md create mode 100644 tests/references/copilot-instructions-memory-safety.md diff --git a/bootstrap.md b/bootstrap.md index dcb9aee..77b0dca 100644 --- a/bootstrap.md +++ b/bootstrap.md @@ -34,6 +34,7 @@ You are the **composition engine** for PromptKit. Your job is to: - "I need to review this code for security vulnerabilities." - "I need an implementation plan for migrating our database." - "I need to design an extension framework for a verifier — let's reason through it interactively." + - "I want to create a persistent Copilot instruction file for my project." 3. Based on the user's response, **select the appropriate template** and its associated persona, protocols, and format. 4. **Check the template's `mode` field** in its YAML frontmatter: @@ -43,15 +44,38 @@ You are the **composition engine** for PromptKit. Your job is to: 5a. **Interactive mode**: Load the template's components (persona, protocols, format), then **execute the template directly in this session**. Begin the interactive workflow (e.g., ask clarifying questions, reason through - the design) — do NOT write a file. Skip steps 5b–8. + the design) — do NOT write a file. Skip steps 5b–10. 5b. **Single-shot mode**: Ask for the required parameters defined in the template's `params` field. -6. **Ask where to save the output.** Before assembling, ask the user for a - file path where the assembled prompt should be written. Suggest a sensible - default (e.g., `./assembled-prompt.md` in the current working directory). -7. **Load and assemble** the selected components by reading the referenced files. -8. **Write the assembled prompt** to the user's chosen location. -9. **Confirm** the file path and provide a brief summary of what was assembled. +6. **Ask about the output mode.** Before assembling, ask the user how they + want to receive the output: + - **(a) Raw prompt** *(default)*: A Markdown file to load into a fresh + LLM session for this specific task. + - **(b) Agent instruction file**: A persistent file automatically loaded + by an agent runtime (GitHub Copilot, Claude Code, Cursor, etc.) that + encodes the selected persona and protocols as reusable, standing + instructions. If the user chooses this mode: + - Ask which platform(s) they target: `GitHub Copilot`, `Claude Code`, + `Cursor`, or `All`. + - Switch to the `author-agent-instructions` template (if not already + selected) and set `platform` from the user's answer. + - The output file path is determined by the platform: + + | Platform | Output path | + |----------|-------------| + | GitHub Copilot | `.github/copilot-instructions.md` | + | Claude Code | `CLAUDE.md` | + | Cursor | `.cursorrules` | + + - Assemble using the `agent-instructions` format (condensed, continuous + Markdown without PromptKit section headers). +7. **Ask where to save the output.** Suggest a sensible default based on the + output mode: + - Raw prompt → `./assembled-prompt.md` + - Agent instruction file → the platform-specific path from step 6 +8. **Load and assemble** the selected components by reading the referenced files. +9. **Write the output** to the user's chosen location. +10. **Confirm** the file path and provide a brief summary of what was assembled. ## Assembly Process @@ -66,7 +90,8 @@ When assembling a prompt from components, follow this order: 6. PARAMETERS — Substitute all {{param}} placeholders with user-provided values. ``` -The assembled prompt should read as a single coherent document, structured as: +**Raw prompt output** (default): The assembled prompt reads as a single coherent +document with PromptKit section headers: ```markdown # Identity @@ -90,6 +115,17 @@ The assembled prompt should read as a single coherent document, structured as: ``` +**Agent instruction file output** (when user selects output mode (b) in step 6): +Assemble the same components, then pass them through the `agent-instructions` +format to produce a condensed, continuous document suitable for the target +platform. The output file: + +- Opens with `` +- Contains condensed persona, protocol directives, behaviors, and project context +- Uses second-person directives throughout ("You are…", "When you encounter…") +- Does **NOT** include PromptKit section headers (`# Identity`, `# Reasoning Protocols`, etc.) +- Is sized and formatted per platform constraints (see the `agent-instructions` format spec) + ## Pipeline Support Some tasks are part of a **pipeline** where the output of one template @@ -108,6 +144,12 @@ When a user's task is part of a pipeline: - **Ask clarifying questions** when the user's task does not clearly map to a single template. Suggest the closest match and explain why. +- **Suggest the agent instruction output mode** when the user's task is + recurring or project-wide (e.g., "always review my C code for memory safety"). + Explain that outputting a persistent instruction file means the behavior is + automatically applied in every session, not just the current one. If they want + a standalone agent instruction file from scratch (not tied to a specific task + template), direct them to the `author-agent-instructions` template. - **Suggest interactive mode for complex tasks.** If the task is complex, ambiguous, or requires domain expertise, suggest an interactive template (e.g., `interactive-design`, `extend-library`) instead of a single-shot @@ -133,7 +175,9 @@ When a user's task is part of a pipeline: - **Show your work.** Before presenting the assembled prompt, briefly explain which components you selected and why. -## Example Interaction +## Example Interactions + +### Raw Prompt Output (default) ``` User: I need to investigate a potential use-after-free bug in our C networking code. @@ -148,4 +192,27 @@ I am also adding the memory-safety-c protocol since you are working with C code and the issue involves use-after-free. Let me gather the parameters... What code or context can you provide? (source files, stack traces, logs, repro steps) -``` \ No newline at end of file +``` + +### Agent Instruction File Output + +``` +User: I want a persistent instruction file so Copilot always reviews C code +for memory safety in our project. + +Assistant: Great — that sounds like a recurring, project-wide behavior. Instead of a +one-off prompt, I will produce a persistent agent instruction file. + +Based on your needs, I will assemble an instruction file using: +- **Persona**: systems-engineer +- **Protocols**: anti-hallucination + memory-safety-c +- **Format**: agent-instructions +- **Template**: author-agent-instructions +- **Platform**: GitHub Copilot → .github/copilot-instructions.md + +A few quick questions: +1. Should I include the root-cause-analysis protocol as well? +2. Are there any project-specific conventions I should embed + (e.g., preferred allocator, banned functions, coding standard)? +3. Is this for the project repo or your personal Copilot settings? +``` diff --git a/formats/agent-instructions.md b/formats/agent-instructions.md new file mode 100644 index 0000000..948908b --- /dev/null +++ b/formats/agent-instructions.md @@ -0,0 +1,118 @@ + + + +--- +name: agent-instructions +type: format +description: > + Output format for persistent agent instruction files. Produces + platform-appropriate files (e.g., .github/copilot-instructions.md, + CLAUDE.md, .cursorrules) that are version-controlled and automatically + loaded by agent runtimes. +produces: agent-instruction-file +--- + +# Format: Agent Instruction File + +The output MUST be a complete, ready-to-commit agent instruction file for +the specified platform(s). Do NOT produce raw prompt output with PromptKit +section headers — the content must be a continuous, natural instruction +document suitable for direct consumption by the target agent runtime. + +## Output Structure + +### 1. File Manifest + +List each file that must be created: + +| Platform | File Path | Scope | +|----------|-----------|-------| +| GitHub Copilot | `.github/copilot-instructions.md` | Project | +| Claude Code | `CLAUDE.md` | Project | +| Cursor | `.cursorrules` | Project | +| VS Code (user-level Copilot) | *(configured via VS Code settings)* | User | + +State which file(s) will be produced and why. + +### 2. File Content + +For each target platform, produce the **complete file content** as a +fenced code block. The content MUST: + +- Begin with a brief comment stating the file's purpose and generation source + (e.g., ``) +- Contain the agent instructions as **continuous, natural Markdown** — no + PromptKit internal headers (`# Identity`, `# Reasoning Protocols`, etc.) +- Be optimized for the platform's ingestion model (see Platform Notes below) +- Be complete and self-contained — the agent runtime loads this file in full + +Present each file as: + + ### File: + + ```markdown + + ``` + +### 3. Platform Notes + +For each target platform, include a short note covering: + +- **How it is loaded**: when and how the platform reads the file +- **Known constraints**: size limits, unsupported syntax, scope restrictions +- **Recommended maintenance**: how to update and test the instructions + +### 4. Activation Checklist + +A numbered checklist of steps to activate the instructions in the target +agent runtime. For example: + +1. Commit the file to the repository. +2. Reload the agent / editor extension. +3. Verify the agent acknowledges the instructions in a test prompt. + +## Platform Notes + +### GitHub Copilot — `.github/copilot-instructions.md` + +- **Loaded automatically** by GitHub Copilot in VS Code, JetBrains, and + GitHub.com for any repository that contains this file. +- **Scope**: Project-level. Applies to all Copilot sessions within the repo. +- **Size guidance**: Keep under ~8 KB for reliable ingestion; Copilot + silently truncates very large files. +- **Syntax**: Plain Markdown. No special schema required. Headings and + bullets are interpreted but not required. +- **Testing**: Open a Copilot Chat session in the repo and ask "What are + your instructions for this project?" to confirm the file is loaded. + +### Claude Code — `CLAUDE.md` + +- **Loaded automatically** by Claude Code when it starts in a directory + that contains this file (project root or any parent). +- **Scope**: Project-level (nearest `CLAUDE.md` takes precedence). +- **Size guidance**: No hard limit documented; keep concise for best results. +- **Syntax**: Plain Markdown. Claude Code reads the full file. +- **Testing**: Start a Claude Code session and ask "What project context + do you have?" to verify the file is loaded. + +### Cursor — `.cursorrules` + +- **Loaded automatically** by Cursor as project-level rules applied to + all Cursor AI interactions within the workspace. +- **Scope**: Project-level. +- **Size guidance**: Keep under ~2 KB; Cursor may truncate longer files. +- **Syntax**: Plain text or Markdown. Cursor reads the raw content. +- **Testing**: Open Cursor in the repo and ask "What rules are you following?" + +## Formatting Rules + +- Do NOT include PromptKit-internal section headers in the generated file + content (`# Identity`, `# Reasoning Protocols`, `# Output Format`, etc.). +- Write instructions in **second person** directed at the agent + (e.g., "You are a…", "When reviewing code, always…"). +- Condense protocol and persona content — omit meta-commentary about the + protocol structure and retain only the actionable guidance. +- Every section in the output file MUST be present; omit sections only if + the platform imposes a size constraint, and note which sections were omitted. +- Do NOT embed `{{param}}` placeholders in the output — all values must be + resolved before writing the file. diff --git a/manifest.yaml b/manifest.yaml index 6feabaa..47e27db 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -190,6 +190,15 @@ formats: Structured release notes with changelog, breaking changes, upgrade instructions, and contributor acknowledgment. + - name: agent-instructions + path: formats/agent-instructions.md + produces: agent-instruction-file + description: > + Output format for persistent agent instruction files. Produces + platform-appropriate files (.github/copilot-instructions.md, CLAUDE.md, + .cursorrules) that are version-controlled and automatically loaded by + agent runtimes such as GitHub Copilot, Claude Code, and Cursor. + taxonomies: - name: stack-lifetime-hazards path: taxonomies/stack-lifetime-hazards.md @@ -288,6 +297,19 @@ templates: persona: software-architect protocols: [anti-hallucination] + agent-authoring: + - name: author-agent-instructions + path: templates/author-agent-instructions.md + description: > + Assemble PromptKit components (persona, protocols) into a persistent + agent instruction file for a specific agent runtime. Produces + ready-to-commit files for GitHub Copilot (.github/copilot-instructions.md), + Claude Code (CLAUDE.md), Cursor (.cursorrules), or all platforms. + Use to create reusable, version-controlled agent behaviors. + persona: spl-contributor + protocols: [anti-hallucination, self-verification] + format: agent-instructions + contribution: - name: extend-library path: templates/extend-library.md diff --git a/templates/author-agent-instructions.md b/templates/author-agent-instructions.md new file mode 100644 index 0000000..b443cc3 --- /dev/null +++ b/templates/author-agent-instructions.md @@ -0,0 +1,188 @@ + + + +--- +name: author-agent-instructions +description: > + Assemble a set of PromptKit components (persona, protocols) into a + persistent agent instruction file for a specific agent runtime. Produces + ready-to-commit files for GitHub Copilot, Claude Code, Cursor, or all + supported platforms. Use this template to create reusable, version-controlled + agent behaviors instead of ephemeral one-off prompts. +persona: spl-contributor +protocols: + - guardrails/anti-hallucination + - guardrails/self-verification +format: agent-instructions +params: + platform: "Target agent platform(s): 'GitHub Copilot', 'Claude Code', 'Cursor', or 'All'" + base_persona: "PromptKit persona to use as the base identity (e.g., 'systems-engineer', 'security-auditor', 'software-architect', 'devops-engineer'). Specify 'custom' to define a new persona inline." + selected_protocols: "Comma-separated list of PromptKit protocols to encode as standing instructions (e.g., 'anti-hallucination, self-verification, memory-safety-c'). Leave blank for persona-only output." + behaviors: "Description of the reusable behaviors and skills to encode. What should the agent always do, never do, and how should it reason in this context?" + scope: "Scope of the instructions: 'project' (per-repository file) or 'user' (global agent settings, if platform supports it). Defaults to 'project'." + context: "Additional project or domain context to embed in the instruction file (e.g., tech stack, coding conventions, team preferences)." +input_contract: null +output_contract: + type: agent-instruction-file + description: > + One or more ready-to-commit agent instruction files at the correct + path for each target platform, containing condensed persona and protocol + guidance as continuous, natural Markdown. +--- + +# Task: Author Agent Instruction File + +You are tasked with assembling PromptKit components into a persistent agent +instruction file for the specified platform(s). The output will be +version-controlled and automatically loaded by the agent runtime — it is +**not** a one-off prompt. + +## Inputs + +**Platform(s)**: {{platform}} + +**Base Persona**: {{base_persona}} + +**Protocols to encode**: {{selected_protocols}} + +**Behaviors**: {{behaviors}} + +**Scope**: {{scope}} + +**Additional Context**: {{context}} + +## Instructions + +### Step 1: Load and Understand the Components + +1. **Read the base persona** from `personas/{{base_persona}}.md` (or define a + custom persona inline if `{{base_persona}}` is `custom`). + - If custom, ask the user to describe the domain, expertise areas, tone, + and behavioral constraints before proceeding. + +2. **Read each protocol** listed in `{{selected_protocols}}`: + - Locate the file under `protocols/` using the manifest. + - Understand what each protocol enforces and how it interacts with the persona. + +3. **Understand the target platform(s)**: + - Review the Platform Notes in the `agent-instructions` format spec for + each target platform. + - Note any size constraints or syntax restrictions that apply. + +### Step 2: Condense and Adapt the Content + +Transform the loaded components into agent instruction prose: + +1. **Condense the persona** into a compact identity statement (3–8 sentences): + - Who the agent is and what domain expertise it has + - Core behavioral stance (how it reasons, what it refuses to do) + - How it handles uncertainty + +2. **Condense each protocol** into standing directives: + - Preserve all specific checks and phase steps from the protocol + - Omit meta-commentary about the protocol's structure + - Rewrite in second person ("When you encounter X, always Y") + - If multiple protocols overlap, merge the redundant parts + +3. **Incorporate the additional behaviors** from `{{behaviors}}`: + - Add any domain-specific or project-specific instructions + - Ensure they do not conflict with the persona or protocol directives + +4. **Incorporate the project context** from `{{context}}`: + - Include tech stack, conventions, or constraints as a short "Project Context" + section at the end of the instruction file + +5. **Check for conflicts**: + - Verify no two directives contradict each other + - If a conflict is found, resolve it in favor of the more conservative/safe + directive and note the resolution + +### Step 3: Apply Platform Constraints + +For each target platform, adapt the content: + +1. **GitHub Copilot** (`.github/copilot-instructions.md`): + - Target ~2–6 KB of content for reliable ingestion + - Use plain Markdown with clear headings and bullets + - If content exceeds 8 KB, summarize protocol sections and note what was condensed + +2. **Claude Code** (`CLAUDE.md`): + - No strict size limit — prefer completeness over brevity + - Use clear Markdown structure; Claude Code reads the full file + +3. **Cursor** (`.cursorrules`): + - Target under 2 KB; omit extended examples and rationale + - Keep directives short and imperative + - Note any omitted content in a comment at the end of the file + +4. **All platforms** (when `{{platform}}` is `All`): + - Produce a separate, platform-appropriate file for each supported platform + (GitHub Copilot, Claude Code, and Cursor) — three distinct output files + - Apply each platform's size and syntax constraints independently + - Note differences between variants in the Platform Notes section + - The File Manifest in the output MUST list all three file paths + +### Step 4: Produce the Output Files + +Following the `agent-instructions` format specification: + +1. **Write the file manifest** listing each file to be created with its path and scope. + +2. **Write the complete file content** for each target platform: + - Open with: `` + - Include condensed persona, protocol directives, behaviors, and context + - Use second-person directives throughout + - Do NOT include PromptKit-internal headers (`# Identity`, `# Reasoning + Protocols`, `# Output Format`, `# Task`) + +3. **Write the Platform Notes** section covering how each file is loaded, + known constraints, and recommended maintenance. + +4. **Write the Activation Checklist** for each platform. + +### Step 5: Verify the Output + +Apply the `self-verification` protocol: + +1. **Content completeness**: Every component from Step 1 is represented + in the output (verify each persona attribute, each protocol phase). + +2. **Platform compliance**: + - File paths are correct for each platform + - Content size is within platform guidance + - No PromptKit-internal headers appear in generated file content + +3. **Directive consistency**: No contradictory instructions exist within + a single output file. + +4. **Actionability**: All instructions are specific and actionable — no + vague guidance like "be careful" or "think deeply". + +5. **No placeholders**: All `{{param}}` references are resolved; no + unsubstituted placeholders remain in any output file. + +## Non-Goals + +- Do NOT produce a raw PromptKit-assembled prompt (that is the bootstrap's + default behavior). This template produces **persistent instruction files**. +- Do NOT implement new functionality — only encode existing PromptKit + component content into platform-appropriate format. +- Do NOT generate application code, pipeline YAML, or documents as part + of this output. Those are produced by other templates. +- Do NOT include the PromptKit assembly process itself in the output files — + the agent runtime loading the file does not need to know about PromptKit. + +## Quality Checklist + +Before presenting the output, verify: + +- [ ] All output files begin with the PromptKit generation comment +- [ ] No PromptKit-internal section headers appear in any output file +- [ ] All `{{param}}` placeholders are resolved +- [ ] File paths are correct for each target platform +- [ ] Content size is within platform guidance for each platform +- [ ] Persona identity is clearly stated in the first paragraph +- [ ] Every protocol phase is represented as a standing directive +- [ ] No contradictory directives exist within a single file +- [ ] Platform Notes and Activation Checklist are complete +- [ ] Output is ready to commit without further editing diff --git a/tests/references/copilot-instructions-memory-safety.md b/tests/references/copilot-instructions-memory-safety.md new file mode 100644 index 0000000..64da3b8 --- /dev/null +++ b/tests/references/copilot-instructions-memory-safety.md @@ -0,0 +1,52 @@ + + + + + +You are a senior systems engineer with deep expertise in memory management, +concurrency, performance, and low-level debugging. You reason from first +principles and apply structured, evidence-based methodology to every task. + +When you encounter a claim, finding, or recommendation, you MUST distinguish: +- **KNOWN**: directly observed in code, logs, or documentation +- **INFERRED**: logically derived from KNOWN facts +- **ASSUMED**: stated for clarity but not yet confirmed + +Do not present INFERRED or ASSUMED conclusions as KNOWN facts. When uncertain, +say so explicitly rather than guessing. + +## Memory Safety — C + +When reviewing or analyzing C code, apply the following checks in order: + +**Phase 1 — Allocation and Deallocation Pairing** +- Identify every allocation site (malloc, calloc, realloc, custom allocators). +- Trace each allocation to its deallocation site. +- Flag any path where deallocation is missing, occurs multiple times, or + occurs in a different lifetime scope than the allocation. + +**Phase 2 — Pointer Lifecycle** +- Identify every pointer that is passed across a function boundary, stored in + a struct, or returned from a function. +- Verify the pointed-to object outlives all pointer uses. +- Flag any pointer that may be used after its referent is freed or goes + out of scope. + +**Phase 3 — Buffer Boundaries** +- Identify every read or write through a pointer with an associated length. +- Verify the length is validated before use. +- Flag any access that may exceed the allocated size. + +**Phase 4 — Undefined Behavior** +- Flag signed integer overflow, invalid pointer arithmetic, uninitialized + reads, and type-punning that violates strict aliasing. +- Label each finding with KNOWN, INFERRED, or ASSUMED per the epistemic + labeling rules above. + +## Project Context + +**Repository**: Networking stack and filter framework analysis +**Language**: C +**Focus**: Stack lifetime hazards at driver/kernel boundaries +**Convention**: Every finding must cite an exact code excerpt with file path +and line numbers. Do not report findings you cannot cite directly. From f05dc69d92a00ca540e9f5d6a704505bdc22fad2 Mon Sep 17 00:00:00 2001 From: Alan Jowett Date: Wed, 18 Mar 2026 14:59:53 -0700 Subject: [PATCH 3/5] Rework: produce composable Copilot skill files, not monolithic copilot-instructions.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original implementation produced a single .github/copilot-instructions.md blob. This rework produces composable GitHub Copilot skill files under .github/instructions/*.instructions.md — each with YAML frontmatter (description, applyTo) for file-targeted activation. This aligns with: - Issue #8's request for 'skill files' - PromptKit's own compositional architecture (one skill per protocol) - Copilot's modern instruction file model (per-file targeting via applyTo) Changes across all 5 files in this PR: formats/agent-instructions.md: - Define skill file output structure with YAML frontmatter spec - Document decomposition strategy (persona+guardrails skill + per-protocol skills) - Add applyTo glob guidance per protocol category templates/author-agent-instructions.md: - Add Step 2 (skill decomposition planning) before content generation - Generate one skill file per logical concern with applyTo targeting - Quality checklist validates frontmatter, filenames, and composability bootstrap.md: - Output path: .github/instructions/.instructions.md (not copilot-instructions.md) - Updated example shows multiple skill files with applyTo globs manifest.yaml: - Updated descriptions to reference skill files tests/references/: - Renamed to memory-safety-c-skill.instructions.md - Added proper YAML frontmatter (description, applyTo: **/*.c, **/*.h) - Restructured as a self-contained, independently-loadable skill Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- bootstrap.md | 28 ++-- formats/agent-instructions.md | 149 ++++++++++++------ manifest.yaml | 17 +- templates/author-agent-instructions.md | 144 +++++++++++------ ... => memory-safety-c-skill.instructions.md} | 32 ++-- 5 files changed, 235 insertions(+), 135 deletions(-) rename tests/references/{copilot-instructions-memory-safety.md => memory-safety-c-skill.instructions.md} (65%) diff --git a/bootstrap.md b/bootstrap.md index 77b0dca..aa9336b 100644 --- a/bootstrap.md +++ b/bootstrap.md @@ -63,16 +63,17 @@ You are the **composition engine** for PromptKit. Your job is to: | Platform | Output path | |----------|-------------| - | GitHub Copilot | `.github/copilot-instructions.md` | + | GitHub Copilot | `.github/instructions/.instructions.md` (one per skill) | | Claude Code | `CLAUDE.md` | | Cursor | `.cursorrules` | - - Assemble using the `agent-instructions` format (condensed, continuous - Markdown without PromptKit section headers). + - Assemble using the `agent-instructions` format. For GitHub Copilot, + produce composable skill files with YAML frontmatter (`description`, + `applyTo`). For other platforms, produce a single combined file. 7. **Ask where to save the output.** Suggest a sensible default based on the output mode: - Raw prompt → `./assembled-prompt.md` - - Agent instruction file → the platform-specific path from step 6 + - Agent instruction file → the platform-specific path(s) from step 6 8. **Load and assemble** the selected components by reading the referenced files. 9. **Write the output** to the user's chosen location. 10. **Confirm** the file path and provide a brief summary of what was assembled. @@ -117,14 +118,19 @@ document with PromptKit section headers: **Agent instruction file output** (when user selects output mode (b) in step 6): Assemble the same components, then pass them through the `agent-instructions` -format to produce a condensed, continuous document suitable for the target -platform. The output file: +format to produce platform-appropriate instruction files. For GitHub Copilot, +this produces **composable skill files** under `.github/instructions/` — one +per logical concern, each with YAML frontmatter specifying `description` and +`applyTo` glob targeting. Each skill file: +- Has YAML frontmatter with `description` and `applyTo` - Opens with `` -- Contains condensed persona, protocol directives, behaviors, and project context +- Contains condensed persona or protocol directives - Uses second-person directives throughout ("You are…", "When you encounter…") - Does **NOT** include PromptKit section headers (`# Identity`, `# Reasoning Protocols`, etc.) -- Is sized and formatted per platform constraints (see the `agent-instructions` format spec) +- Is self-contained and independently coherent + +For Claude Code and Cursor, a single combined file is produced instead. ## Pipeline Support @@ -203,12 +209,14 @@ for memory safety in our project. Assistant: Great — that sounds like a recurring, project-wide behavior. Instead of a one-off prompt, I will produce a persistent agent instruction file. -Based on your needs, I will assemble an instruction file using: +Based on your needs, I will assemble skill files using: - **Persona**: systems-engineer - **Protocols**: anti-hallucination + memory-safety-c - **Format**: agent-instructions - **Template**: author-agent-instructions -- **Platform**: GitHub Copilot → .github/copilot-instructions.md +- **Platform**: GitHub Copilot → `.github/instructions/` + - `systems-engineer.instructions.md` (persona + guardrails, applyTo: `**`) + - `memory-safety-c.instructions.md` (memory safety checks, applyTo: `**/*.c, **/*.h`) A few quick questions: 1. Should I include the root-cause-analysis protocol as well? diff --git a/formats/agent-instructions.md b/formats/agent-instructions.md index 948908b..41050d1 100644 --- a/formats/agent-instructions.md +++ b/formats/agent-instructions.md @@ -6,84 +6,125 @@ name: agent-instructions type: format description: > Output format for persistent agent instruction files. Produces - platform-appropriate files (e.g., .github/copilot-instructions.md, - CLAUDE.md, .cursorrules) that are version-controlled and automatically - loaded by agent runtimes. + composable skill files for GitHub Copilot + (.github/instructions/*.instructions.md) and platform-appropriate + equivalents for Claude Code and Cursor. Files are version-controlled + and automatically loaded by agent runtimes. produces: agent-instruction-file --- -# Format: Agent Instruction File +# Format: Agent Instruction Files -The output MUST be a complete, ready-to-commit agent instruction file for -the specified platform(s). Do NOT produce raw prompt output with PromptKit -section headers — the content must be a continuous, natural instruction -document suitable for direct consumption by the target agent runtime. +The output MUST be one or more ready-to-commit agent instruction files +for the specified platform(s). For GitHub Copilot, each PromptKit +protocol produces a **separate skill file** with an `applyTo` glob so +skills compose automatically — mirroring PromptKit's own compositional +architecture. + +Do NOT produce raw prompt output with PromptKit section headers — the +content must be continuous, natural instruction prose suitable for direct +consumption by the target agent runtime. ## Output Structure ### 1. File Manifest -List each file that must be created: +List every file that will be created: + +| Platform | File Path Pattern | Scope | +|----------|-------------------|-------| +| GitHub Copilot | `.github/instructions/.instructions.md` | Per-skill (targeted via `applyTo`) | +| Claude Code | `CLAUDE.md` | Project-wide | +| Cursor | `.cursorrules` | Project-wide | + +For GitHub Copilot, produce **one skill file per logical concern**. The +recommended decomposition is: -| Platform | File Path | Scope | -|----------|-----------|-------| -| GitHub Copilot | `.github/copilot-instructions.md` | Project | -| Claude Code | `CLAUDE.md` | Project | -| Cursor | `.cursorrules` | Project | -| VS Code (user-level Copilot) | *(configured via VS Code settings)* | User | +| Skill file | Contents | `applyTo` example | +|------------|----------|-------------------| +| `.instructions.md` | Condensed persona identity and guardrail protocols (anti-hallucination, self-verification) | `**` | +| `.instructions.md` | A single analysis protocol's checks and phases | Language-specific glob (e.g., `**/*.c`) | +| `.instructions.md` | A single reasoning protocol | `**` or task-specific glob | State which file(s) will be produced and why. -### 2. File Content +### 2. File Content — GitHub Copilot Skill Files + +Each `.instructions.md` file MUST begin with YAML frontmatter: + +```markdown +--- +description: '' +applyTo: '' +--- + + +``` + +**Frontmatter fields:** + +- **`description`** *(required)* — A brief summary of the skill's purpose. + Wrap in single quotes. +- **`applyTo`** *(required)* — Comma-separated glob patterns specifying + which files activate this skill. Use `**` for all files, or + language-specific patterns like `**/*.c, **/*.h`. + +**Content rules:** -For each target platform, produce the **complete file content** as a -fenced code block. The content MUST: +- Open with `` immediately + after the frontmatter closing `---`. +- Write in **second person** ("You are…", "When you encounter…"). +- Condense protocol phases into standing directives — preserve all specific + checks but omit meta-commentary about protocol structure. +- Do NOT include PromptKit-internal headers (`# Identity`, + `# Reasoning Protocols`, `# Output Format`, etc.). +- Each skill file must be **self-contained** — it should make sense when + loaded independently by the agent runtime. -- Begin with a brief comment stating the file's purpose and generation source - (e.g., ``) -- Contain the agent instructions as **continuous, natural Markdown** — no - PromptKit internal headers (`# Identity`, `# Reasoning Protocols`, etc.) -- Be optimized for the platform's ingestion model (see Platform Notes below) -- Be complete and self-contained — the agent runtime loads this file in full +### 3. File Content — Claude Code and Cursor -Present each file as: +For Claude Code (`CLAUDE.md`) and Cursor (`.cursorrules`), produce a +**single combined file** containing all persona and protocol content +(these platforms do not support per-file skill targeting). - ### File: +The content MUST: - ```markdown - - ``` +- Begin with `` +- Contain all instructions as continuous, natural Markdown +- Be complete and self-contained -### 3. Platform Notes +### 4. Platform Notes For each target platform, include a short note covering: -- **How it is loaded**: when and how the platform reads the file +- **How it is loaded**: when and how the platform reads the file(s) - **Known constraints**: size limits, unsupported syntax, scope restrictions - **Recommended maintenance**: how to update and test the instructions -### 4. Activation Checklist +### 5. Activation Checklist -A numbered checklist of steps to activate the instructions in the target -agent runtime. For example: +A numbered checklist of steps to activate the instructions: -1. Commit the file to the repository. +1. Commit the file(s) to the repository. 2. Reload the agent / editor extension. 3. Verify the agent acknowledges the instructions in a test prompt. -## Platform Notes +## Platform Reference -### GitHub Copilot — `.github/copilot-instructions.md` +### GitHub Copilot — `.github/instructions/*.instructions.md` - **Loaded automatically** by GitHub Copilot in VS Code, JetBrains, and - GitHub.com for any repository that contains this file. -- **Scope**: Project-level. Applies to all Copilot sessions within the repo. -- **Size guidance**: Keep under ~8 KB for reliable ingestion; Copilot - silently truncates very large files. -- **Syntax**: Plain Markdown. No special schema required. Headings and - bullets are interpreted but not required. -- **Testing**: Open a Copilot Chat session in the repo and ask "What are - your instructions for this project?" to confirm the file is loaded. + GitHub.com when editing files matching the `applyTo` glob. +- **Scope**: Per-skill. Multiple skill files compose automatically; + all matching skills are combined for the current file context. +- **Size guidance**: Keep each skill file under ~4 KB for reliable + ingestion. Total combined instructions should stay under ~8 KB. +- **Naming**: Filenames must be lowercase, hyphen-separated, ending in + `.instructions.md` (e.g., `memory-safety-c.instructions.md`). +- **Syntax**: Plain Markdown with YAML frontmatter. `description` and + `applyTo` are required frontmatter fields. +- **Testing**: Open a Copilot Chat session while editing a file that + matches `applyTo` and ask "What instructions are active?" to confirm. ### Claude Code — `CLAUDE.md` @@ -106,13 +147,21 @@ agent runtime. For example: ## Formatting Rules -- Do NOT include PromptKit-internal section headers in the generated file +- Do NOT include PromptKit-internal section headers in generated file content (`# Identity`, `# Reasoning Protocols`, `# Output Format`, etc.). - Write instructions in **second person** directed at the agent (e.g., "You are a…", "When reviewing code, always…"). - Condense protocol and persona content — omit meta-commentary about the protocol structure and retain only the actionable guidance. -- Every section in the output file MUST be present; omit sections only if - the platform imposes a size constraint, and note which sections were omitted. -- Do NOT embed `{{param}}` placeholders in the output — all values must be - resolved before writing the file. +- Every section in each output file MUST be present; omit sections only + if the platform imposes a size constraint, and note which sections were + omitted. +- Do NOT embed `{{param}}` placeholders in the output — all values must + be resolved before writing the file. +- For GitHub Copilot, choose `applyTo` globs that match the protocol's + natural scope: + - Language-specific protocols → language file extensions + (e.g., `**/*.c, **/*.h` for `memory-safety-c`) + - Guardrail / reasoning protocols → `**` (all files) + - Domain-specific protocols → relevant path patterns + (e.g., `**/infra/**` for infrastructure review) diff --git a/manifest.yaml b/manifest.yaml index 47e27db..1fc3141 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -194,10 +194,10 @@ formats: path: formats/agent-instructions.md produces: agent-instruction-file description: > - Output format for persistent agent instruction files. Produces - platform-appropriate files (.github/copilot-instructions.md, CLAUDE.md, - .cursorrules) that are version-controlled and automatically loaded by - agent runtimes such as GitHub Copilot, Claude Code, and Cursor. + Output format for persistent agent instruction files. For GitHub + Copilot, produces composable skill files under + .github/instructions/*.instructions.md with applyTo targeting. + Also supports Claude Code (CLAUDE.md) and Cursor (.cursorrules). taxonomies: - name: stack-lifetime-hazards @@ -301,11 +301,10 @@ templates: - name: author-agent-instructions path: templates/author-agent-instructions.md description: > - Assemble PromptKit components (persona, protocols) into a persistent - agent instruction file for a specific agent runtime. Produces - ready-to-commit files for GitHub Copilot (.github/copilot-instructions.md), - Claude Code (CLAUDE.md), Cursor (.cursorrules), or all platforms. - Use to create reusable, version-controlled agent behaviors. + Assemble PromptKit components (persona, protocols) into composable + agent skill files. For GitHub Copilot, produces individual + .github/instructions/*.instructions.md files with applyTo targeting. + Also supports Claude Code (CLAUDE.md) and Cursor (.cursorrules). persona: spl-contributor protocols: [anti-hallucination, self-verification] format: agent-instructions diff --git a/templates/author-agent-instructions.md b/templates/author-agent-instructions.md index b443cc3..b62a9a1 100644 --- a/templates/author-agent-instructions.md +++ b/templates/author-agent-instructions.md @@ -4,11 +4,10 @@ --- name: author-agent-instructions description: > - Assemble a set of PromptKit components (persona, protocols) into a - persistent agent instruction file for a specific agent runtime. Produces - ready-to-commit files for GitHub Copilot, Claude Code, Cursor, or all - supported platforms. Use this template to create reusable, version-controlled - agent behaviors instead of ephemeral one-off prompts. + Assemble PromptKit components (persona, protocols) into composable + agent skill files. For GitHub Copilot, produces individual + .github/instructions/*.instructions.md files with applyTo targeting. + Also supports Claude Code (CLAUDE.md) and Cursor (.cursorrules). persona: spl-contributor protocols: - guardrails/anti-hallucination @@ -25,17 +24,19 @@ input_contract: null output_contract: type: agent-instruction-file description: > - One or more ready-to-commit agent instruction files at the correct - path for each target platform, containing condensed persona and protocol - guidance as continuous, natural Markdown. + One or more ready-to-commit agent instruction files. For GitHub Copilot, + produces composable skill files under .github/instructions/ with + applyTo targeting. For Claude Code and Cursor, produces a single + combined file. --- -# Task: Author Agent Instruction File +# Task: Author Agent Instruction Files -You are tasked with assembling PromptKit components into a persistent agent -instruction file for the specified platform(s). The output will be -version-controlled and automatically loaded by the agent runtime — it is -**not** a one-off prompt. +You are tasked with assembling PromptKit components into persistent agent +instruction files for the specified platform(s). For GitHub Copilot, you +will produce **composable skill files** — one per logical concern — that +the runtime loads and combines automatically. The output will be +version-controlled and automatically loaded by the agent runtime. ## Inputs @@ -63,13 +64,42 @@ version-controlled and automatically loaded by the agent runtime — it is 2. **Read each protocol** listed in `{{selected_protocols}}`: - Locate the file under `protocols/` using the manifest. - Understand what each protocol enforces and how it interacts with the persona. + - Note the protocol's category (`guardrails/`, `analysis/`, `reasoning/`) + and any language specificity — these determine `applyTo` targeting. 3. **Understand the target platform(s)**: - - Review the Platform Notes in the `agent-instructions` format spec for - each target platform. + - Review the Platform Reference in the `agent-instructions` format spec. - Note any size constraints or syntax restrictions that apply. -### Step 2: Condense and Adapt the Content +### Step 2: Plan the Skill Decomposition (GitHub Copilot) + +For GitHub Copilot output, determine how to split the content into +composable skill files. The recommended decomposition: + +1. **Persona + guardrails skill** — One file containing: + - Condensed persona identity (3–8 sentences) + - All guardrail protocols (anti-hallucination, self-verification, + operational-constraints) + - `applyTo: '**'` (applies to all files) + - Filename: `.instructions.md` + +2. **One skill file per analysis/reasoning protocol** — Each containing: + - The protocol's phases and checks as standing directives + - `applyTo` set to the protocol's natural scope: + - Language-specific → `**/*.c, **/*.h` (or appropriate extensions) + - Domain-specific → relevant path patterns + - General → `**` + - Filename: `.instructions.md` + +3. **Project context skill** *(optional, if `{{context}}` is non-empty)* — + - Project-specific conventions, tech stack, team preferences + - `applyTo: '**'` + - Filename: `project-context.instructions.md` + +For Claude Code and Cursor, combine all content into a single file (these +platforms do not support per-file skill targeting). + +### Step 3: Condense and Adapt the Content Transform the loaded components into agent instruction prose: @@ -89,22 +119,22 @@ Transform the loaded components into agent instruction prose: - Ensure they do not conflict with the persona or protocol directives 4. **Incorporate the project context** from `{{context}}`: - - Include tech stack, conventions, or constraints as a short "Project Context" - section at the end of the instruction file + - Include tech stack, conventions, or constraints 5. **Check for conflicts**: - Verify no two directives contradict each other - If a conflict is found, resolve it in favor of the more conservative/safe directive and note the resolution -### Step 3: Apply Platform Constraints +### Step 4: Apply Platform Constraints For each target platform, adapt the content: -1. **GitHub Copilot** (`.github/copilot-instructions.md`): - - Target ~2–6 KB of content for reliable ingestion +1. **GitHub Copilot** (`.github/instructions/*.instructions.md`): + - Each skill file targets ~1–4 KB + - Total combined instructions should stay under ~8 KB + - Each file has YAML frontmatter with `description` and `applyTo` - Use plain Markdown with clear headings and bullets - - If content exceeds 8 KB, summarize protocol sections and note what was condensed 2. **Claude Code** (`CLAUDE.md`): - No strict size limit — prefer completeness over brevity @@ -116,49 +146,61 @@ For each target platform, adapt the content: - Note any omitted content in a comment at the end of the file 4. **All platforms** (when `{{platform}}` is `All`): - - Produce a separate, platform-appropriate file for each supported platform - (GitHub Copilot, Claude Code, and Cursor) — three distinct output files - - Apply each platform's size and syntax constraints independently + - Produce skill files for GitHub Copilot AND a combined file each for + Claude Code and Cursor + - Apply each platform's constraints independently - Note differences between variants in the Platform Notes section - - The File Manifest in the output MUST list all three file paths -### Step 4: Produce the Output Files +### Step 5: Produce the Output Files Following the `agent-instructions` format specification: -1. **Write the file manifest** listing each file to be created with its path and scope. +1. **Write the file manifest** listing every file to be created with its + path, `applyTo` scope (for Copilot), and purpose. + +2. **Write each GitHub Copilot skill file** with proper frontmatter: + + --- + description: '' + applyTo: '' + --- + -2. **Write the complete file content** for each target platform: - - Open with: `` - - Include condensed persona, protocol directives, behaviors, and context - - Use second-person directives throughout - - Do NOT include PromptKit-internal headers (`# Identity`, `# Reasoning - Protocols`, `# Output Format`, `# Task`) + -3. **Write the Platform Notes** section covering how each file is loaded, - known constraints, and recommended maintenance. +3. **Write combined files** for Claude Code / Cursor (if targeted): + - Open with `` + - Include all persona, protocol, behavior, and context content -4. **Write the Activation Checklist** for each platform. +4. **Write the Platform Notes** section covering how each file is loaded. -### Step 5: Verify the Output +5. **Write the Activation Checklist** for each platform. + +### Step 6: Verify the Output Apply the `self-verification` protocol: 1. **Content completeness**: Every component from Step 1 is represented - in the output (verify each persona attribute, each protocol phase). + in at least one output file (verify each persona attribute, each + protocol phase). 2. **Platform compliance**: - - File paths are correct for each platform - - Content size is within platform guidance + - Copilot skill files have valid YAML frontmatter with `description` + and `applyTo` + - Filenames are lowercase, hyphen-separated, ending in `.instructions.md` + - Content size is within platform guidance per file - No PromptKit-internal headers appear in generated file content -3. **Directive consistency**: No contradictory instructions exist within - a single output file. +3. **Skill composability**: Each Copilot skill file is self-contained and + makes sense when loaded independently or in combination. + +4. **Directive consistency**: No contradictory instructions exist within + or across skill files. -4. **Actionability**: All instructions are specific and actionable — no +5. **Actionability**: All instructions are specific and actionable — no vague guidance like "be careful" or "think deeply". -5. **No placeholders**: All `{{param}}` references are resolved; no +6. **No placeholders**: All `{{param}}` references are resolved; no unsubstituted placeholders remain in any output file. ## Non-Goals @@ -176,13 +218,15 @@ Apply the `self-verification` protocol: Before presenting the output, verify: -- [ ] All output files begin with the PromptKit generation comment +- [ ] GitHub Copilot files have valid YAML frontmatter (`description`, `applyTo`) +- [ ] Filenames are lowercase, hyphen-separated, ending in `.instructions.md` +- [ ] `applyTo` globs match the protocol's natural scope +- [ ] Each skill file is self-contained and independently coherent - [ ] No PromptKit-internal section headers appear in any output file - [ ] All `{{param}}` placeholders are resolved -- [ ] File paths are correct for each target platform -- [ ] Content size is within platform guidance for each platform -- [ ] Persona identity is clearly stated in the first paragraph +- [ ] Content size is within platform guidance for each file +- [ ] Persona identity is clearly stated in the persona skill file - [ ] Every protocol phase is represented as a standing directive -- [ ] No contradictory directives exist within a single file +- [ ] No contradictory directives exist within or across files - [ ] Platform Notes and Activation Checklist are complete - [ ] Output is ready to commit without further editing diff --git a/tests/references/copilot-instructions-memory-safety.md b/tests/references/memory-safety-c-skill.instructions.md similarity index 65% rename from tests/references/copilot-instructions-memory-safety.md rename to tests/references/memory-safety-c-skill.instructions.md index 64da3b8..e747c41 100644 --- a/tests/references/copilot-instructions-memory-safety.md +++ b/tests/references/memory-safety-c-skill.instructions.md @@ -1,13 +1,15 @@ +--- +description: 'Memory safety analysis for C code — allocation pairing, pointer lifecycle, buffer bounds, and undefined behavior checks' +applyTo: '**/*.c, **/*.h' +--- -You are a senior systems engineer with deep expertise in memory management, -concurrency, performance, and low-level debugging. You reason from first -principles and apply structured, evidence-based methodology to every task. +When reviewing or analyzing C code, apply the following checks in order. -When you encounter a claim, finding, or recommendation, you MUST distinguish: +For every claim, finding, or recommendation, you MUST distinguish: - **KNOWN**: directly observed in code, logs, or documentation - **INFERRED**: logically derived from KNOWN facts - **ASSUMED**: stated for clarity but not yet confirmed @@ -15,29 +17,29 @@ When you encounter a claim, finding, or recommendation, you MUST distinguish: Do not present INFERRED or ASSUMED conclusions as KNOWN facts. When uncertain, say so explicitly rather than guessing. -## Memory Safety — C +## Phase 1 — Allocation and Deallocation Pairing -When reviewing or analyzing C code, apply the following checks in order: - -**Phase 1 — Allocation and Deallocation Pairing** - Identify every allocation site (malloc, calloc, realloc, custom allocators). - Trace each allocation to its deallocation site. - Flag any path where deallocation is missing, occurs multiple times, or occurs in a different lifetime scope than the allocation. -**Phase 2 — Pointer Lifecycle** +## Phase 2 — Pointer Lifecycle + - Identify every pointer that is passed across a function boundary, stored in a struct, or returned from a function. - Verify the pointed-to object outlives all pointer uses. - Flag any pointer that may be used after its referent is freed or goes out of scope. -**Phase 3 — Buffer Boundaries** +## Phase 3 — Buffer Boundaries + - Identify every read or write through a pointer with an associated length. - Verify the length is validated before use. - Flag any access that may exceed the allocated size. -**Phase 4 — Undefined Behavior** +## Phase 4 — Undefined Behavior + - Flag signed integer overflow, invalid pointer arithmetic, uninitialized reads, and type-punning that violates strict aliasing. - Label each finding with KNOWN, INFERRED, or ASSUMED per the epistemic @@ -45,8 +47,6 @@ When reviewing or analyzing C code, apply the following checks in order: ## Project Context -**Repository**: Networking stack and filter framework analysis -**Language**: C -**Focus**: Stack lifetime hazards at driver/kernel boundaries -**Convention**: Every finding must cite an exact code excerpt with file path -and line numbers. Do not report findings you cannot cite directly. +**Focus**: Stack lifetime hazards at driver/kernel boundaries. +Every finding must cite an exact code excerpt with file path and line +numbers. Do not report findings you cannot cite directly. From a767862b974d055df842825442fc476ade48208c Mon Sep 17 00:00:00 2001 From: Alan Jowett Date: Wed, 18 Mar 2026 15:02:25 -0700 Subject: [PATCH 4/5] Fix: ask for target project path, never write to PromptKit repo The bootstrap must ask the user for their target project directory before writing agent instruction files. The output belongs in the user's project (.github/instructions/ etc.), not in the PromptKit repository itself. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- bootstrap.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/bootstrap.md b/bootstrap.md index aa9336b..5280f1c 100644 --- a/bootstrap.md +++ b/bootstrap.md @@ -70,13 +70,18 @@ You are the **composition engine** for PromptKit. Your job is to: - Assemble using the `agent-instructions` format. For GitHub Copilot, produce composable skill files with YAML frontmatter (`description`, `applyTo`). For other platforms, produce a single combined file. -7. **Ask where to save the output.** Suggest a sensible default based on the - output mode: - - Raw prompt → `./assembled-prompt.md` - - Agent instruction file → the platform-specific path(s) from step 6 +7. **Ask for the target project directory.** The output files must be written + to the **user's project**, not to the PromptKit repository. Ask the user + for the path to their target project root. Suggest a sensible default + based on the output mode: + - Raw prompt → `./assembled-prompt.md` (current directory) + - Agent instruction file → ask for the target project root, then use + platform-specific paths relative to it (e.g., + `/.github/instructions/.instructions.md` for Copilot, + `/CLAUDE.md` for Claude Code) 8. **Load and assemble** the selected components by reading the referenced files. -9. **Write the output** to the user's chosen location. -10. **Confirm** the file path and provide a brief summary of what was assembled. +9. **Write the output** to the resolved path(s) in the user's target project. +10. **Confirm** the file path(s) and provide a brief summary of what was assembled. ## Assembly Process @@ -219,8 +224,8 @@ Based on your needs, I will assemble skill files using: - `memory-safety-c.instructions.md` (memory safety checks, applyTo: `**/*.c, **/*.h`) A few quick questions: -1. Should I include the root-cause-analysis protocol as well? -2. Are there any project-specific conventions I should embed +1. What is the path to your target project? (e.g., `../my-networking-project`) +2. Should I include the root-cause-analysis protocol as well? +3. Are there any project-specific conventions I should embed (e.g., preferred allocator, banned functions, coding standard)? -3. Is this for the project repo or your personal Copilot settings? ``` From 056eb6bc71c89f9e4716b72eb20bfc7f8ac7d1ae Mon Sep 17 00:00:00 2001 From: Alan Jowett Date: Wed, 18 Mar 2026 15:26:20 -0700 Subject: [PATCH 5/5] fix: reorder bootstrap steps and restrict scope param - Move output-mode selection (now step 5b) before parameter collection (now step 6) so that switching to author-agent-instructions does not invalidate already-collected params. - Restrict scope param to 'project' only since no platform defines user-level output paths or behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- bootstrap.md | 12 +++++++----- templates/author-agent-instructions.md | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bootstrap.md b/bootstrap.md index 5280f1c..24b147c 100644 --- a/bootstrap.md +++ b/bootstrap.md @@ -45,12 +45,10 @@ You are the **composition engine** for PromptKit. Your job is to: format), then **execute the template directly in this session**. Begin the interactive workflow (e.g., ask clarifying questions, reason through the design) — do NOT write a file. Skip steps 5b–10. -5b. **Single-shot mode**: Ask for the required parameters defined in the - template's `params` field. -6. **Ask about the output mode.** Before assembling, ask the user how they - want to receive the output: +5b. **Single-shot mode**: Ask about the output mode before collecting + template parameters (since the chosen mode may switch the active template): - **(a) Raw prompt** *(default)*: A Markdown file to load into a fresh - LLM session for this specific task. + LLM session for this specific task. Keep the current template. - **(b) Agent instruction file**: A persistent file automatically loaded by an agent runtime (GitHub Copilot, Claude Code, Cursor, etc.) that encodes the selected persona and protocols as reusable, standing @@ -70,6 +68,10 @@ You are the **composition engine** for PromptKit. Your job is to: - Assemble using the `agent-instructions` format. For GitHub Copilot, produce composable skill files with YAML frontmatter (`description`, `applyTo`). For other platforms, produce a single combined file. +6. **Collect parameters.** Ask for the required parameters defined in the + active template's `params` field (this is the template selected in step 3, + or the `author-agent-instructions` template if the user chose output + mode (b) in step 5b). 7. **Ask for the target project directory.** The output files must be written to the **user's project**, not to the PromptKit repository. Ask the user for the path to their target project root. Suggest a sensible default diff --git a/templates/author-agent-instructions.md b/templates/author-agent-instructions.md index b62a9a1..67fe1e8 100644 --- a/templates/author-agent-instructions.md +++ b/templates/author-agent-instructions.md @@ -18,7 +18,7 @@ params: base_persona: "PromptKit persona to use as the base identity (e.g., 'systems-engineer', 'security-auditor', 'software-architect', 'devops-engineer'). Specify 'custom' to define a new persona inline." selected_protocols: "Comma-separated list of PromptKit protocols to encode as standing instructions (e.g., 'anti-hallucination, self-verification, memory-safety-c'). Leave blank for persona-only output." behaviors: "Description of the reusable behaviors and skills to encode. What should the agent always do, never do, and how should it reason in this context?" - scope: "Scope of the instructions: 'project' (per-repository file) or 'user' (global agent settings, if platform supports it). Defaults to 'project'." + scope: "Scope of the instructions. Currently only 'project' (per-repository file) is supported." context: "Additional project or domain context to embed in the instruction file (e.g., tech stack, coding conventions, team preferences)." input_contract: null output_contract: