You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DDD context document helps AI coding sessions understand the domain language, core flows, and invariants of an existing repository. A small complementary feature would be useful: derive a lightweight architecture guardrails document from the current repo.
The goal is not to introduce a heavy architecture framework or force the repo into DDD, Hexagonal Architecture, or Clean Architecture. The goal is simpler: give future AI coding sessions a concise set of practical rules that help avoid unsafe or messy changes.
In the AI coding workflow, this can act as a small "map of what not to break": module boundaries, dependency direction, testing expectations, and important constraints that should be respected when changing code.
MVP scope
Add one command/menu item, for example:
ai-code-derive-architecture-guardrails
menu label: Derive Architecture Guardrails
The command should:
Work on the current project/repo.
Ask the configured AI backend to inspect the repository at a high level.
Generate or update a concise Markdown file under .ai.code.files/.
Keep the output practical and small enough to be injected into future AI prompts.
Suggested output location:
.ai.code.files/architecture-guardrails.md
or, if we want room for future expansion:
.ai.code.files/architecture/guardrails.md
Suggested generated document structure
# Architecture Guardrails## Purpose
What these guardrails are trying to protect in this repository.
## Important Modules / Areas
Main modules or files and their responsibilities.
## Dependency Rules
Practical rules about which modules should or should not depend on each other.
## State and Ownership Rules
Which module owns important state or side effects.
## AI Change Rules
Guidance for future AI coding tasks, such as where changes should be localized and what should not be touched casually.
## Required Validation
Tests, byte-compilation, lint/checkdoc, or other commands that should be run after changes.
## Notes and Uncertainties
Things inferred from the repo that need human review.
Prompt behavior
The prompt should explicitly tell the AI:
This is an existing repo; derive guardrails from current code, tests, docs, and filenames.
Do not invent an ideal architecture.
Prefer simple, practical rules over abstract architecture theory.
Mark uncertain conclusions clearly.
Focus on what helps future AI coding sessions avoid breaking boundaries or introducing messy dependencies.
Do not suggest large refactors unless listed separately as optional future ideas.
Example instruction:
Derive a lightweight architecture guardrails document for this existing repository.
Infer practical module boundaries, dependency rules, state ownership rules, and validation expectations from the current code, tests, docs, and filenames.
Do not force an ideal architecture or suggest large refactors.
The output is intended to help future AI coding sessions make safer changes and avoid breaking important boundaries.
Keep it concise, practical, and mark uncertainty explicitly.
Write the result to .ai.code.files/architecture-guardrails.md.
Motivation
Follow-up to #355.
The DDD context document helps AI coding sessions understand the domain language, core flows, and invariants of an existing repository. A small complementary feature would be useful: derive a lightweight architecture guardrails document from the current repo.
The goal is not to introduce a heavy architecture framework or force the repo into DDD, Hexagonal Architecture, or Clean Architecture. The goal is simpler: give future AI coding sessions a concise set of practical rules that help avoid unsafe or messy changes.
In the AI coding workflow, this can act as a small "map of what not to break": module boundaries, dependency direction, testing expectations, and important constraints that should be respected when changing code.
MVP scope
Add one command/menu item, for example:
ai-code-derive-architecture-guardrailsDerive Architecture GuardrailsThe command should:
.ai.code.files/.Suggested output location:
or, if we want room for future expansion:
Suggested generated document structure
Prompt behavior
The prompt should explicitly tell the AI:
Example instruction:
Relationship to #355
They should remain separate for now because they answer different questions:
A future prompt-context feature could inject one or both files depending on the task.
Non-goals for the first version
Future expansion ideas
architecture-guardrails.mdinto future AI coding prompts.Acceptance criteria
.ai.code.files/.