Skip to content

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

@Alan-Jowett

Description

@Alan-Jowett

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions