Per-project constitution: auto-injected project governance for assembled prompts

Open
#131 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Quiet
Tech stack
javascript

Research direction

Begin by reviewing the existing guardrail protocols and tracing prompt assembly through the bootstrap engine or CLI. Define the author-project-constitution template and injection behavior, with completion demonstrated by a project constitution being included in assembled prompts only when present and its project-specific rules remaining distinct from generic guardrails.

Written by the indexing model from the issue text.

Description

enhancement

Summary

Add a per-project constitution concept — a project-specific governance document (principles, constraints, coding standards, banned patterns) that auto-injects into every assembled prompt for that project.

Motivation

GitHub Spec Kit introduced a "constitution" pattern that has proven highly effective: a per-project governance document that all downstream artifacts must comply with. Constitution violations are flagged as CRITICAL, and exceptions require explicit justification.

PromptKit already has guardrail protocols (anti-hallucination, self-verification, operational-constraints), but these are generic — they apply identically to every project. A project constitution would let teams encode project-specific rules like:

  • "Always enforce MISRA-C compliance"
  • "Never suggest adding dependencies without approval"
  • "All public APIs must have OpenAPI specifications"
  • "Use the company's internal auth library, never roll your own"

Proposed Design

  1. New template: author-project-constitution — interactive template that walks users through defining their project's principles, constraints, and development guidelines
  2. New protocol category or injection mechanism: The assembled constitution becomes a project-specific guardrail that the bootstrap engine or CLI auto-injects during assembly when present in the project directory
  3. Format: Could follow Spec Kit's MUST / SHOULD / MAY hierarchy for principles
Key difference from generic guardrails

Generic guardrails say "don't hallucinate." A constitution says "in this project, we use PostgreSQL, we follow the Airbnb style guide, and we never use any in TypeScript."

Credit

This pattern is inspired by GitHub Spec Kit's constitution concept. See their constitution-template.md and spec-driven workflow for the original implementation.

Dominant language
JavaScript
Stars
105
Forks
23
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/PromptKit

All issues in microsoft/PromptKit

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.