Standard: Ralph Loop compatible | Claude Code compatible | Aider compatible
This repository maintains architecture documentation for the NDX (National Digital Exchange) Innovation Sandbox ecosystem. AI agents should use this file to understand how to maintain and update the documentation.
ndx-try-arch/
├── update.prompt # Main instructions (read this first)
├── AGENTS.md # This file - AI agent instructions
│
├── docs/ # COMMITTED - The deliverables
│ ├── *.md # Documentation files (numbered 00-99)
│ └── .meta/ # Documentation metadata
│ ├── manifest.json # What docs exist, their sources
│ ├── captured-state.json # What was documented (SHAs, timestamps)
│ ├── dependency-graph.json # Doc → Source dependencies
│ └── quality-report.json # Last validation results
│
├── repos/ # GITIGNORED - Ephemeral clones
│ └── */ # Individual repo clones (regenerated)
│
├── .state/ # GITIGNORED - Runtime state
│ ├── prd.json # Task tracking (Ralph Loop format)
│ ├── progress.log # Session log
│ └── cache/ # Analysis cache
│
└── scripts/ # Helper scripts
├── diff-state.sh # Show changes since last capture
├── regenerate.sh # Force doc regeneration
└── validate.sh # Run quality gates
| File | Purpose | Committed? |
|---|---|---|
update.prompt |
Main execution instructions | Yes |
docs/.meta/captured-state.json |
What was documented (provenance) | Yes |
docs/.meta/manifest.json |
Document inventory and metadata | Yes |
.state/prd.json |
Task tracking (ephemeral) | No |
# Read captured state to see what was already documented
cat docs/.meta/captured-state.json
# Check for changes since last run
./scripts/diff-state.sh- Clone/update repositories from
co-cddoGitHub org - Query AWS organization for accounts and SCPs
- Compare discovered state to captured state
- Use dependency graph to find affected documents
- Only regenerate docs whose sources have changed
- Update
captured-state.jsonwith new SHAs
- Run quality gates (structure, content, links, mermaid)
- Update
quality-report.json - Commit all changes atomically
The update process follows this state machine:
INIT → DISCOVER → ANALYZE → SYNC → GENERATE → VALIDATE → COMMIT → COMPLETE
↓ ↓
FAILED ←←←←←←←←←←←←←←←←←←←← ROLLBACK
See update.prompt for detailed state transitions.
Output <promise>COMPLETE</promise> only when ALL of these are true:
- All tasks passed -
.state/prd.jsonhas no stories with"status": "failed" - Quality gates passed -
docs/.meta/quality-report.jsonshows no critical issues - State captured -
docs/.meta/captured-state.jsonreflects current source SHAs - Changes committed - All documentation changes are in a git commit
On error:
- Log to
.state/errors.log - Do NOT output completion promise
- Describe error and suggested fix
- Set task status to
"failed"in.state/prd.json
./scripts/diff-state.sh --verboserm -rf .state/rm docs/.meta/captured-state.json
rm -rf .state/./scripts/regenerate.sh 10-isb-core-architecture.mdrm -rf repos/ .state/
rm docs/.meta/*.json./scripts/validate.sh --all| Range | Category | Description |
|---|---|---|
| 00-09 | inventory | Discovery and overview |
| 10-19 | isb-core | ISB core components |
| 20-29 | isb-satellites | ISB extension repos |
| 30-39 | websites | NDX websites |
| 40-49 | infrastructure | LZA and Terraform |
| 50-59 | cicd | CI/CD pipelines |
| 60-69 | security | Security and compliance |
| 70-79 | data | Data flows and integrations |
| 80-89 | architecture | Master diagrams |
| 90-99 | meta | Issues and metadata |
Each document must pass:
- Structure - H1 title, executive summary, proper headings
- Content - Minimum word count, Mermaid diagrams, no TODOs
- Links - All internal links resolve
- Coverage - All sources documented
- READ-ONLY for AWS - Document issues, do NOT fix them
- Idempotent - Each task can be re-run safely
- Atomic Commits - Commit after each completed phase
- Source Citations - Always cite source files and repos
- No Premature Exit - Continue until all tasks pass
This documentation system is maintained by the NDX team at CDDO.