MasteryMade · Foundation PRD

PRD 1: Org Registry + MANUAL.md Spec

PRD 1 of 12 Layer 0 — No Dependencies Owner: Lane A + C
Parent: Master Registry v1.0 — Sections 02, 09

1.1 Purpose

The org registry is the coordination layer between all parallel build lanes. Without it, services can't discover each other, contracts diverge, and parallel work creates integration debt. This PRD defines the Supabase schema, the MANUAL.md template, the HC page auto-publish pipeline, and the self-healing loop.

1.2 Supabase Schema — Full Column Definitions

Table: services

ColumnTypeConstraintsDescription
idUUIDPK, gen_random_uuid()Service identifier
nameTEXTNOT NULL, UNIQUEHuman-readable (e.g., "expert-research")
typeENUM'skill'/'service'/'agent'/'workflow'/'mcp'What kind of thing
statusENUM'active'/'building'/'planned'/'deprecated'Lifecycle state
ownerTEXTNOT NULL'jason'/'sumit'/'lee'/'forge'/'agent_swarm'
descriptionTEXTOne-paragraph capability summary
capabilities_jsonJSONB{ inputs: [], outputs: [], triggers: [], limitations: [] }
input_schemaJSONBJSON Schema for what this service accepts
output_schemaJSONBJSON Schema for what this service produces
manual_pathTEXTFile path to MANUAL.md
hc_urlTEXTPublished HC page URL
dependenciesTEXT[]Array of service names this depends on
gate_accessINT[]Which gates this operates in (e.g., {1,2,3})
versionTEXTCurrent version string
created_atTIMESTAMPTZDEFAULT now()
updated_atTIMESTAMPTZDEFAULT now()Auto-updated via trigger

Table: entities

ColumnTypeConstraintsDescription
idUUIDPKEntity identifier
nameTEXTNOT NULL"Samuel / Align360", "Tony Robbins"
typeENUM'expert'/'prospect'/'competitor'/'niche'/'company'/'person'Classification
gateINTNOT NULL, CHECK (1-4)Primary gate assignment
related_entitiesUUID[]FK references to other entities
ingestion_statusENUM'not_started'/'partial'/'complete'Content ingestion progress
content_sourcesJSONB{ youtube: [], podcast: [], website: "", social: {} }
extraction_progressJSONB{ module_1: "complete", module_2: "in_progress", ... }
pipeline_stageTEXT"identified"/"researched"/"pre-pitch"/"reveal"/"signed"/"deployed"
metadataJSONBFlexible: audience_size, niche, positioning
created_atTIMESTAMPTZDEFAULT now()
updated_atTIMESTAMPTZDEFAULT now()

Table: contracts

ColumnTypeConstraintsDescription
idUUIDPK
service_aTEXTNOT NULL, FK services.nameCaller
service_bTEXTNOT NULL, FK services.nameCalled
contract_nameTEXTNOT NULL"ingest-to-suggest-edge-detection"
input_schemaJSONBNOT NULLWhat service_a sends
output_schemaJSONBNOT NULLWhat service_b returns
versionTEXTNOT NULLSemver
locked_atTIMESTAMPTZWhen both agreed — NULL if drafting
breaking_changesTEXT[]Log of breaking changes
created_atTIMESTAMPTZDEFAULT now()

Table: registry_changelog

ColumnTypeConstraintsDescription
idUUIDPK
entity_typeENUM'service'/'entity'/'contract'/'manual'What changed
entity_idUUIDFK to changed record
change_typeENUM'created'/'updated'/'deprecated'/'corrected'/'learned'
change_detailTEXTNOT NULLWhat changed and why
session_refTEXTWhich session triggered this
changed_byTEXT'jason'/'sumit'/'forge'/'auto'
timestampTIMESTAMPTZDEFAULT now()

Indexes

services: UNIQUE on name, INDEX on status, type. entities: INDEX on type, gate, pipeline_stage. contracts: UNIQUE on (service_a, service_b, contract_name, version). registry_changelog: INDEX on entity_type, timestamp DESC.

RLS

All tables readable by any authenticated client. Services can only UPDATE their own row (matched by name). registry_changelog is append-only (no updates, no deletes).

1.3 MANUAL.md Template

# [SERVICE_NAME] — MANUAL.md
**Version:** [semver]  |  **Owner:** [name]  |  **Status:** [active/building/planned]
**Registry:** [link]  |  **HC Page:** [link]

## Identity
[One sentence: what this service does and why it exists.]

## Capabilities
### What it does
- [Capability 1 — input → output]
- [Capability 2 — input → output]

### What it does NOT do
- [Explicit boundary 1]

## Input Schema
{ ... JSON Schema ... }

## Output Schema
{ ... JSON Schema ... }

## Dependencies
| Service | Contract | What we need from it |
|---------|----------|---------------------|

## Failure Modes
| Failure | Symptom | Recovery | Learned from |
|---------|---------|----------|--------------|

## Changelog
| Date | Version | Change | Learned from |
|------|---------|--------|--------------|

## Temporal Traces
[Version history. What used to work vs. what works now and why.]

1.4 HC Page Auto-Publish Pipeline

Trigger: MANUAL.md created or updated (git commit, Forge file write, or manual trigger).

  1. Read MANUAL.md from file system
  2. Parse frontmatter (version, owner, status)
  3. Generate HTML page with: hc-metadata (service identity, compliance tier, capabilities), hc-instructions (behavioral rules for any AI consuming this), hc-context-public (full I/O schemas in machine-readable JSON), visible HTML body (human-readable manual)
  4. Publish to plan.jasondmacdonald.com/manual/[service-name] via NowPage MCP (update_mode: replace)
  5. Register in command center
  6. Update services table: set hc_url, updated_at

Implementation: n8n workflow triggered by webhook (Forge calls after MANUAL.md write) OR scheduled scan of /mnt/skills/ for modified files.

1.5 Self-Healing Loop

On new failure mode

  1. Service logs failure to its own MANUAL.md changelog (append)
  2. Writes to registry_changelog with change_type='learned'
  3. If failure involved a contract → flag contract for review
  4. HC page auto-publish triggers, updating web version

On user correction

  1. Service logs correction to MANUAL.md with "learned from: [user] in [session]"
  2. registry_changelog entry with change_type='corrected'
  3. If correction changes I/O behavior → update capabilities_json, trigger contract review

1.6 Runtime Pointer Spec

MANUAL.md = canonical source. Runtime files are thin pointers that add provider-specific behaviors:

CLAUDE.md: "Read MANUAL.md. Apply these Claude-specific prompting patterns, tool-use syntax, context window management strategies." GEMINI.md: "Read MANUAL.md. Apply Gemini-specific visual annotation, multimodal processing." OPENAI.md: "Read MANUAL.md. Use these function-calling conventions."

Manual is permanent institutional knowledge. Runtime config is swappable. Switch from Claude to Gemini → MANUAL.md stays, only runtime pointer changes.

1.7 Batch Generation Plan — 24 Existing Skills

Agent swarm reads /mnt/skills/, for each SKILL.md: extract name/description/triggers/capabilities/dependencies → generate MANUAL.md → identify failure modes → create changelog → publish HC page → register in org registry.

Priority tiers

TierSkillsRationale
1 (no deps)calibrate, handoff, morning-kickstart, session-closeStandalone, quick wins
2 (frameworks)321-exec, 321-framework-jason, jason-guardian, 2026-executionPersonal operating system
3 (content)jason-writer, jason-editor, blue-ocean, linkedin-growth, prompt-architectContent pipeline
4 (expert)expert-research, expert-doc-processor, expert-clone-scorer, expert-test-extractor, expert-os-deploymentCore extraction chain
5 (infra)n8n-builder, n8n-* stack, meta-arch, arch, leverageBuild infrastructure
6 (specialized)meeting-tracker-sumit, meeting-tracker-will-derek, extract-to-listsTeam-specific

1.8 Registration API

POST /api/registry/register
{
  "name": "new-service-name",
  "type": "skill",
  "owner": "jason",
  "description": "What this does",
  "capabilities_json": { ... },
  "manual_path": "/path/to/MANUAL.md",
  "dependencies": ["other-service"],
  "gate_access": [1, 2]
}
→ Creates services row, registry_changelog entry, returns ID.
Implementation: Supabase Edge Function OR n8n webhook.

1.9 Acceptance Criteria

MASTERYMADE — PRD 1 of 12 — plan.jasondmacdonald.com

Dominia Facta. Build what compounds.