Skip to content

fix(agents,instructions): make distributed artifacts portable by replacing hve-core-specific references with discoverable patterns #1334

@katriendg

Description

@katriendg

Summary

Distributed AI artifacts (agents, instructions, prompts) contain hve-core-specific references that break, confuse, or degrade when installed in consumer repositories via the VS Code extension or plugin system. A portability audit identified 8 categories of non-portable references across 30+ files, with a two-phase migration plan to fix them.

Related: #741 (covers workspace-root .github/ path references — a subset of this work)

Problem

When a developer installs hve-core artifacts via extension into a repos with React SPA, C# backend, or Python, or other repo, the following categories of references fail:

# Category Severity Files Affected
1 Hardcoded scripts/ paths in PowerShell and bash instructions breaking pester.instructions.md, powershell.instructions.md, bash.instructions.md
2 Hardcoded npm run commands that don't exist in consumer repos breaking pester.instructions.md, powershell.instructions.md, bash.instructions.md, doc-ops.agent.md, markdown.instructions.md
3 Missing template fallbacks — agents fail when docs/templates/ absent breaking brd-builder.agent.md, ux-ui-designer.agent.md, code-review-full.agent.md, adr-creation.agent.md, system-architecture-reviewer.agent.md, incident-response.prompt.md
4 Hardcoded output directories (docs/prds/, docs/brds/, docs/decisions/, docs/risks/) confusing prd-builder.agent.md, brd-builder.agent.md, adr-creation.agent.md, system-architecture-reviewer.agent.md, risk-register.prompt.md
5 extension/, collections/, logs/ directory assumptions degraded doc-ops.agent.md, commit-message.instructions.md, pester.instructions.md, powershell.instructions.md
6 Commit message scope list hardcodes hve-core directories confusing commit-message.instructions.md
7 Collection/plugin system assumptions in prompt-builder confusing prompt-builder.instructions.md
8 Schema validation paths and HVE Core example text degraded markdown.instructions.md

The code-review-standards agent already demonstrates the correct fallback pattern ("If the file is not found, apply a best-effort structure") after #1286 was fixed. This issue extends that pattern to remaining artifacts.

Proposed Solution

A two-phase migration ensures hve-core retains identical behavior while distributed artifacts become portable:

Phase 1: Add hve-core-specific content to copilot-instructions.md

Add ~54 lines across 6 new subsections to .github/copilot-instructions.md. These sections preserve hve-core-specific paths, npm scripts, and conventions that will be removed from distributed artifacts. Some content already exists in copilot-instructions.md (npm scripts, scripts organization, PowerShell testing) and only needs cross-referencing.

New subsections needed:

  1. Documentation Templates — maps docs/templates/*.md files to their consuming agents
  2. Documentation Output Conventions — maps PRDs to docs/prds/, BRDs to docs/brds/, etc.
  3. Commit Message Scopes — maps scopes like (agents), (scripts), (extension) to directories
  4. Frontmatter Schema Validation — records scripts/linting/schemas/ path and validation command
  5. PowerShell Conventions — records copyright header script, CI helpers module, test directory patterns
  6. Documentation Operations — records doc-ops scanning targets and validation commands

Phase 2: Replace hardcoded references in distributed artifacts with discoverable patterns

For each distributed artifact, replace hve-core-specific content with generic language:

Pattern Before After
Script paths scripts/linting/PSScriptAnalyzer.psd1 "Use the PSScriptAnalyzer configuration found in your repository"
npm commands npm run lint:md "Run available lint scripts from package.json"
Template refs Read docs/templates/brd-template.md "Read the output format template if one exists in the repository; if not found, apply a best-effort structure"
Output dirs "Place PRDs in docs/prds/" "Place the output in the repository's standard location for this artifact type"
Commit scopes Hardcoded scope list "Derive commit scopes from the repository's top-level directory structure"
Branding "9-method HVE framework" "9-method Design Thinking framework"

Files to edit

Phase 1 (copilot-instructions.md only):

  • .github/copilot-instructions.md — add 6 new subsections

Phase 2 (18 distributed artifact edits):

  • .github/agents/coding-standards/code-review-full.agent.md — template fallback
  • .github/agents/project-planning/brd-builder.agent.md — template fallback, output dir
  • .github/agents/project-planning/ux-ui-designer.agent.md — template fallback
  • .github/agents/project-planning/adr-creation.agent.md — template fallback, output dir, remove "for HVE Core"
  • .github/agents/project-planning/system-architecture-reviewer.agent.md — template fallback, output dir
  • .github/agents/project-planning/prd-builder.agent.md — output dir
  • .github/agents/hve-core/doc-ops.agent.md — npm scripts, directory scanning, logs
  • .github/instructions/coding-standards/powershell/pester.instructions.md — script paths, npm scripts
  • .github/instructions/coding-standards/powershell/powershell.instructions.md — script paths, npm scripts
  • .github/instructions/coding-standards/bash/bash.instructions.md — copyright script path
  • .github/instructions/hve-core/commit-message.instructions.md — scope list
  • .github/instructions/hve-core/markdown.instructions.md — schema paths, example text
  • .github/instructions/hve-core/prompt-builder.instructions.md — collection manifest reference
  • .github/prompts/security/incident-response.prompt.md — template fallback
  • .github/prompts/security/risk-register.prompt.md — output dir

Acceptance Criteria

  • Phase 1: copilot-instructions.md contains all 6 new subsections with hve-core-specific content
  • Phase 2: No distributed artifact contains hardcoded hve-core scripts/ paths in runtime instructions
  • Phase 2: No distributed artifact contains npm run commands without conditional/discoverable framing
  • Phase 2: All agents that reference docs/templates/ files include a missing-file fallback
  • Phase 2: Hardcoded output directories replaced with discoverable or configurable patterns
  • Phase 2: Commit message scope list uses discoverable approach
  • Validation: hve-core agents still resolve all paths via copilot-instructions.md (no behavior regression)
  • Validation: npm run lint:md, npm run lint:frontmatter pass after all edits
  • Validation: npm run plugin:generate and npm run plugin:validate pass

Out of Scope

Metadata

Metadata

Assignees

Labels

agentsCustom chat agents (.agent.md)bugSomething isn't workinginstructionsCopilot instruction files (.instructions.md)promptsCopilot prompt files (.prompt.md)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions