design_doc · json
Agent JSON, Human HTML Artifact Standard
RedKey should make structured JSON the canonical machine artifact and intentional HTML the human review surface. Markdown remains useful for notes and exports, but not as the canonical format for governed work.
Problem
- summary: Important RedKey work is currently split across Markdown docs, JSONB Studio artifacts, JSON wrappers containing Markdown, repo state files, and rendered Studio views. This is workable for agents, but it is not yet a clean operating model for humans or durable agent execution.
- pain points: 5 items
Thesis
RedKey should make structured JSON the canonical machine artifact and intentional HTML the human review surface. Markdown remains useful for notes and exports, but not as the canonical format for governed work.
Decision
- recommendation: Adopt the dual-surface model for governed RedKey artifacts: structured JSON for agents and systems, intentional HTML for Justin and other humans.
- next action: Use this prototype pair to decide whether to formalize schemas, renderer contracts, and enforcement checks.
Architecture
- layers: 6 items
- diagram: type: string, nodes: object
Implementation Plan
- Prototype Pair: phase: number, name: string, deliverables: object, status: string
- Schemas and Renderers: phase: number, name: string, deliverables: object, status: string
- Studio Integration: phase: number, name: string, deliverables: object, status: string
- Knowledge Console: phase: number, name: string, deliverables: object, status: string
Risks
- Renderer sprawl: name: string, impact: string, mitigation: string
- Schema rigidity: name: string, impact: string, mitigation: string
- HTML chaos: name: string, impact: string, mitigation: string
- Duplicate truth: name: string, impact: string, mitigation: string
Open Questions
- Should generated HTML be stored in Supabase or rendered on demand first?
- Should platform specs in repo move to JSON immediately, or only new governed specs?
- What artifact types should allow prose exports?
- Should Mermaid, SVG, or React Flow be the first diagram layer?
- What is the minimum accessibility gate for generated artifact views?