Moonshot Architecture
Use When
Use when a PRD or brownfield objective needs architecture decisions before planning.
Route Away
Use product-orchestrator when intent is unresolved and moonshot-plan-writer after architecture acceptance.
Role
Create an evidence-grounded design package between product definition and execution.
Modes
greenfield_prd: start from a PRD and produce architecture decisions before implementation planning.
brownfield_codebase: recover the current architecture from repository evidence, then produce fit-gap and migration guidance.
hybrid_prd_plus_existing_repo: combine PRD normalization with Brownfield constraints and produce SPEC_DELTA.
meta_harness_design: design Moonshot Relay harness changes and hand them off to moonshot-plan-writer.
Procedure
- Classify the mode.
- Build
projectKnowledgeContext with the current stage and preserve status-only metadata.
- Inspect project-local
knowledgeAnchors declared in the target root AGENTS.md, if present. Select only anchors whose mustConsultFor/keywords match the current architecture scope, then read the smallest referenced agreement documents needed for evidence.
- Build compact architecture context through
scripts/architecture-context-build.mjs when available.
- Normalize requirements into
REQUIREMENT_INVENTORY.md.
- Extract ASRs and quality attribute scenarios.
- Build domain model, capability map, and data/integration flow.
- For Brownfield/Hybrid work, recover current architecture and existing constraints from repository evidence.
8.1. Apply
docs/public/guidelines/retrieval-and-recency-policy.md and docs/public/guidelines/research-evidence-policy.md when architecture inputs include current product, dependency, platform, model, pricing, legal, or security facts.
- Generate at least two architecture options for non-trivial work.
- Run trade-off review.
- Write C4 model and ADRs for significant decisions.
- Produce
SPEC.md or SPEC_DELTA.md.
- Produce
PLAN.md and TRACEABILITY_MATRIX.md.
- Run
architecture-gate-reviewer and write ARCHITECTURE_REVIEW.md.
- Hand off to
moonshot-plan-writer, moonshot-orchestrator, or moonshot-phase-runner with explicit owned/read-only/staged paths and verification signals.
Internal stage-owner mapping is loaded conditionally from references/architecture-flow.md.
Internal Stage Owners
Owners: asr-extractor, architecture-option-generator, architecture-tradeoff-reviewer, adr-c4-writer, architecture-gate-reviewer, and codebase-architecture-recovery. architecture-gate-reviewer supplies ARCHITECTURE_REVIEW.md readiness evidence; load the reference for artifact routing.
Hard Stops
- Do not skip ASR extraction for non-trivial PRDs.
- In
greenfield_prd mode, do not require Brownfield current-architecture evidence.
- Do not claim architecture readiness without ADRs for significant decisions.
- Do not produce a Greenfield implementation
PLAN.md unless every accepted requirement maps to a quality scenario, ASR, ADR, task owner, and verification signal.
- Do not hand off to implementation without traceability from accepted requirements to owners and verification signals.
- Do not hand off to implementation without
architecture-gate-reviewer readiness evidence.
- Do not invent Brownfield current architecture without repository evidence.
- Do not inline raw MemoryGraph records, KG edge dumps, ontology dumps, runtime logs, transcripts, browser scrapes, or secret-like strings.
- Do not mutate live
.claude/**, .codex/**, account-root state, or runtime profiles during architecture design.
- Do not replace
moonshot-phase-runner completion authority or scripts/runtime-state.mjs assess-completion.
Output Contract
- Mode classification and input source path.
- Architecture package path.
- Project-local knowledge anchor disposition: consulted anchor IDs, consumed agreement paths, and skipped-anchor rationale when anchors were present.
- Retrieval/research evidence for current or volatile external facts, plus context relevance disposition for project knowledge anchors.
- Requirement inventory and ASR catalog.
- Domain/capability model or Brownfield current architecture evidence.
- Option comparison and trade-off review.
- ADR/C4 outputs for significant decisions.
- Architecture gate review status.
- Traceability matrix linking requirement IDs to implementation owners and verification signals.
- Handoff target and rationale.
Public Surface Boundary
This is the public entrypoint; stage helpers stay internal. Executable deepReferences remain skill-local for package resolution.
1---2name: moonshot-architecture3description: Convert a PRD or existing codebase objective into an evidence-grounded architecture design package before implementation planning.4policyClauseIds:5 - moonshot-architecture.policy.use-when6 - moonshot-architecture.policy.routing7 - moonshot-architecture.policy.hard-stops8 - moonshot-architecture.policy.output-contract9policyDigest: e767b62b476c046247fa2de568d0043c4a3aff79ae11dfff65343221985da58a10layer: orchestrator11loads:12 - architecture-design-artifacts13 - project-knowledge-context14 - requirements-traceability15 - verdict-summaries16deepReferences:17 - references/compatibility-contract.md18 - references/architecture-design-contract.md19 - references/architecture-flow.md20 - references/context-safety.md21 - references/handoff-boundaries.md22outputArtifacts:23 - ARCHITECTURE_BRIEF.md24 - ASR_CATALOG.md25 - DOMAIN_MODEL.md26 - ARCHITECTURE_OPTIONS.md27 - TRADEOFF_ANALYSIS.md28 - C4/*.md29 - ADR/*.md30 - ARCHITECTURE_REVIEW.md31 - SPEC.md32 - SPEC_DELTA.md33 - PLAN.md34 - TRACEABILITY_MATRIX.md35triggers:36 - "moonshot architecture"37 - "PRD to architecture"38 - "architecture design"39 - "architecture recovery"40 - "architecture fit gap"41---4243# Moonshot Architecture4445## Use When4647Use when a PRD or brownfield objective needs architecture decisions before planning.4849## Route Away5051Use `product-orchestrator` when intent is unresolved and `moonshot-plan-writer` after architecture acceptance.5253## Role5455Create an evidence-grounded design package between product definition and execution.5657## Modes5859- `greenfield_prd`: start from a PRD and produce architecture decisions before implementation planning.60- `brownfield_codebase`: recover the current architecture from repository evidence, then produce fit-gap and migration guidance.61- `hybrid_prd_plus_existing_repo`: combine PRD normalization with Brownfield constraints and produce `SPEC_DELTA`.62- `meta_harness_design`: design Moonshot Relay harness changes and hand them off to `moonshot-plan-writer`.6364## Procedure65661. Classify the mode.672. Build `projectKnowledgeContext` with the current stage and preserve status-only metadata.683. Inspect project-local `knowledgeAnchors` declared in the target root `AGENTS.md`, if present. Select only anchors whose `mustConsultFor`/keywords match the current architecture scope, then read the smallest referenced agreement documents needed for evidence.694. Build compact architecture context through `scripts/architecture-context-build.mjs` when available.705. Normalize requirements into `REQUIREMENT_INVENTORY.md`.716. Extract ASRs and quality attribute scenarios.727. Build domain model, capability map, and data/integration flow.738. For Brownfield/Hybrid work, recover current architecture and existing constraints from repository evidence.748.1. Apply `docs/public/guidelines/retrieval-and-recency-policy.md` and `docs/public/guidelines/research-evidence-policy.md` when architecture inputs include current product, dependency, platform, model, pricing, legal, or security facts.759. Generate at least two architecture options for non-trivial work.7610. Run trade-off review.7711. Write C4 model and ADRs for significant decisions.7812. Produce `SPEC.md` or `SPEC_DELTA.md`.7913. Produce `PLAN.md` and `TRACEABILITY_MATRIX.md`.8014. Run `architecture-gate-reviewer` and write `ARCHITECTURE_REVIEW.md`.8115. Hand off to `moonshot-plan-writer`, `moonshot-orchestrator`, or `moonshot-phase-runner` with explicit owned/read-only/staged paths and verification signals.8283Internal stage-owner mapping is loaded conditionally from `references/architecture-flow.md`.8485## Internal Stage Owners8687Owners: `asr-extractor`, `architecture-option-generator`, `architecture-tradeoff-reviewer`, `adr-c4-writer`, `architecture-gate-reviewer`, and `codebase-architecture-recovery`. `architecture-gate-reviewer` supplies `ARCHITECTURE_REVIEW.md` readiness evidence; load the reference for artifact routing.8889## Hard Stops9091- Do not skip ASR extraction for non-trivial PRDs.92- In `greenfield_prd` mode, do not require Brownfield current-architecture evidence.93- Do not claim architecture readiness without ADRs for significant decisions.94- Do not produce a Greenfield implementation `PLAN.md` unless every accepted requirement maps to a quality scenario, ASR, ADR, task owner, and verification signal.95- Do not hand off to implementation without traceability from accepted requirements to owners and verification signals.96- Do not hand off to implementation without `architecture-gate-reviewer` readiness evidence.97- Do not invent Brownfield current architecture without repository evidence.98- Do not inline raw MemoryGraph records, KG edge dumps, ontology dumps, runtime logs, transcripts, browser scrapes, or secret-like strings.99- Do not mutate live `.claude/**`, `.codex/**`, account-root state, or runtime profiles during architecture design.100- Do not replace `moonshot-phase-runner` completion authority or `scripts/runtime-state.mjs assess-completion`.101102## Output Contract103104- Mode classification and input source path.105- Architecture package path.106- Project-local knowledge anchor disposition: consulted anchor IDs, consumed agreement paths, and skipped-anchor rationale when anchors were present.107- Retrieval/research evidence for current or volatile external facts, plus context relevance disposition for project knowledge anchors.108- Requirement inventory and ASR catalog.109- Domain/capability model or Brownfield current architecture evidence.110- Option comparison and trade-off review.111- ADR/C4 outputs for significant decisions.112- Architecture gate review status.113- Traceability matrix linking requirement IDs to implementation owners and verification signals.114- Handoff target and rationale.115116## Public Surface Boundary117118This is the public entrypoint; stage helpers stay internal. Executable `deepReferences` remain skill-local for package resolution.