Analyze architecture/spec documents for contradictions, ambiguities, and inconsistencies. Produces an encyclopedia-style canonical specification series.
You are analyzing architecture and technical specification documents to surface contradictions, inconsistencies, and consequential ambiguities. The ultimate goal is to compile a comprehensive canonical specification encyclopedia—a three-tiered collection of documents organized by change cost.
What it IS:
What it is NOT:
The canonical specification organizes content by answering: "How expensive would this be to change?"
| Tier | Directory | Meaning | Contents |
|---|---|---|---|
| 1_foundational | 1_foundational/ | Cannot change. Would make this a different application. | Core invariants, fundamental principles |
| 2_structural | 2_structural/ | Can change, but it's work. Affects many other things. | Architecture, type system, core topology |
| 3_optional | 3_optional/ | Use it or don't. Change freely if something works better. | Examples, implementation notes, details |
Lower number wins.
If content in 3_optional/ conflicts with 1_foundational/, the foundational tier wins. No exceptions.
1_foundational/ (small and critical)2_structural/ (core architecture context)3_optional/ (reference material)IMPORTANT: Source documents may have been written for previous versions of the system and contain outdated assumptions, terminology, and architectural patterns that no longer apply.
The canonicalization process must:
When integrating source documents into the canonical spec:
If a UI spec document says "Domain blocks have jitter, spacing, and origin parameters," but the canonical spec defines DomainDecl with only shape parameters, the canonical spec wins. The UI spec's claims about domain parameters are rejected as outdated speculation from a previous system iteration.
The final output organizes content by topic (directories) and tier (file prefixes):
CANONICAL-<topic>-<timestamp>/
├── INDEX.md # Master navigation and overview
├── TIERS.md # Explains the tier system
├── type-system/ # Topic directory
│ ├── t1_core-types.md # Foundational: float, int, 5 axes
│ ├── t2_block-roles.md # Structural: BlockRole architecture
│ └── t3_diagnostics.md # Optional: event type details
├── topology/
│ ├── t1_invariants.md # Foundational: multi-in/multi-out
│ ├── t2_dataflow.md # Structural: edge semantics
│ └── t3_examples.md # Optional: example graphs
├── principles/ # Not all topics need all tiers
│ └── t1_identity.md # What makes this app unique
├── GLOSSARY.md # Complete terminology reference
├── RESOLUTION-LOG.md # Decision history with rationale
└── appendices/
├── source-map.md # Which sources contributed to what
└── superseded-docs.md # List of archived originals
**/t1_*.md, **/t2_*.md, **/t3_*.mdThe user has provided: $ARGUMENTS
This may be:
Before reading any source files, determine the run type by checking for existing outputs.
Output Directory: Determine the common ancestor directory of all input files.
Check for existing files/directories:
CANONICAL-<topic>-*/ directory (completed encyclopedia)CANONICALIZED-SUMMARY-*.md (in-progress working files)CANONICALIZED-QUESTIONS-*.mdCANONICALIZED-GLOSSARY-*.mdCANONICALIZED-TOPICS-*.md (topic breakdown)EDITORIAL-REVIEW-*.md (editorial review)USER-APPROVAL-*.md (user approval record)Decision table:
| Condition | Run Type | Action |
|---|---|---|
CANONICAL-<topic>-*/ directory exists AND user chooses "update existing" | UPDATE | Load references/run-update.md |
CANONICAL-<topic>-*/ directory exists AND user chooses "start fresh" | FIRST | Archive old, load references/run-first.md |
CANONICAL-<topic>-*/ directory exists AND user chooses "abort" | ABORT | Exit without changes |
No CANONICALIZED-* files exist | FIRST | Load references/run-first.md |
CANONICALIZED-* exist with indexed: true, progress < 100% | MIDDLE | Load references/run-middle.md |
CANONICALIZED-* exist, progress = 100%, no EDITORIAL-REVIEW-*.md exists | REVIEW | Load references/run-review.md |
EDITORIAL-REVIEW-*.md exists, no USER-APPROVAL-*.md exists | APPROVAL | Load references/run-approval.md |
USER-APPROVAL-*.md exists with approved: true | FINAL | Load references/run-final.md |
Print the detected run type, then load and follow the appropriate reference file.
These rules apply to all run types:
RESOLVED item, that resolution is authoritativeRESOLVED item from prior QUESTIONS files must appear in the new outputDuring analysis, identify distinct topics that warrant separate documents AND classify them into tiers.
Topic Boundaries:
Tier Classification:
For each topic, ask: "How expensive would this be to change?"
1_foundational: "Cannot change" / "Would make this a different application"
2_structural: "Can change, but it's work" / "Touches many other things"
3_optional: "Use it or don't" / "Change freely"
Naming Convention: Use kebab-case slugs:
principles (tier 1)type-system (tier 2)examples/basic-flow (tier 3)All timestamps: YYYYMMDD-HHMMSS
---