Schema Sync
Prerequisites & Dependencies
- Access to external toolkit APIs (Composio, Canva, ClickHouse, etc.)
- Python 3.10+ (for schema diffing and HTTP requests)
- No external runtime dependencies beyond standard library (urllib, json)
Execution Steps
Identify workflow: Determine which multi-step toolkit workflow is about to execute (e.g., "create design from brand template", "generate presentation", "autofill design").
Ping live schema: Query the live tool for its current schema definition:
- For Composio: call
COMPOSIO_GET_TOOL_SCHEMAS with the toolkit slug
- For Canva: call
canva_get_brand_template_dataset with the template ID
- For ClickHouse: query information schema tables
- Capture the live schema's field names, types, required/optional flags
Diff against cached schema: Compare the live schema against my internally cached schema (last refreshed at schema-sync last-run):
- Added fields: New fields not in my cache → flag as
schema-updated
- Removed fields: Fields in my cache but not live → flag as
schema-deprecated
- Type changes: Type mismatches (string→number, etc.) → flag as
schema-broken
- Required flag changes: Optional→required or vice versa → flag as
schema-breaking
Rewrite workflow plan on mismatch: If any diff is detected (added, removed, type change, required-flag change):
- Halt the current workflow plan
- Regenerate the workflow using the live schema
- Surface a diff report to the user showing what changed
- Update my internal cached schema to the live version
No mismatch → proceed silently: If diff is empty, proceed with the existing workflow plan without user interruption.
Schema Diff Report Example
Schema Sync Report (Composio GMAIL)
==============================
Last synced: 2026-09-11T09:00:00Z
✅ Added fields (2):
- "reply_body" (string, optional)
- "thread_id" (string, required)
⚠️ Removed fields (1):
- "old_attachment_flag" (string, optional) — deprecated in v2 API
🔧 Type changes (1):
- "priority": was "low|medium|high" (string), now "1-5" (string) — non-breaking
❌ Required flag change:
- "to": was optional, now required — BREAKING; workflow regenerated
Action: Workflow plan regenerated using live schema. Cached schema updated.
Workflow Guard Example
Before schema-sync: I'd build a Canva design generation workflow using my cached schema, which might assume certain autofill fields exist. If Canva API changed those fields, my workflow would silently fail at runtime.
After schema-sync: Before each Canva workflow, I ping the live dataset schema, diff it, and either auto-update my plan or alert the user to the changes — never proceeding with stale assumptions.
Windows PowerShell Notes
- API ping via
Invoke-RestMethod with proper auth headers
- Schema diff comparison: use
Compare-Object PowerShell cmdlet
- Cached schema stored at
~\.opencode\schema-cache.json with UTC timestamp
- On mismatch, re-download and overwrite cache automatically
1---2name: schema-sync3description: Before multi-step toolkit workflows, pings the live tool (via schema-style endpoints / search tools) and diffs against my cached schema; on mismatch, rewrites the workflow plan, never the cached assumptions silently.4metadata:5 source: skills/schema-sync/schema-sync.md6---78# Schema Sync910## Prerequisites & Dependencies1112- Access to external toolkit APIs (Composio, Canva, ClickHouse, etc.)13- Python 3.10+ (for schema diffing and HTTP requests)14- No external runtime dependencies beyond standard library (urllib, json)1516## Execution Steps17181. **Identify workflow**: Determine which multi-step toolkit workflow is about to execute (e.g., "create design from brand template", "generate presentation", "autofill design").19202. **Ping live schema**: Query the live tool for its current schema definition:21 - For Composio: call `COMPOSIO_GET_TOOL_SCHEMAS` with the toolkit slug22 - For Canva: call `canva_get_brand_template_dataset` with the template ID23 - For ClickHouse: query information schema tables24 - Capture the live schema's field names, types, required/optional flags25263. **Diff against cached schema**: Compare the live schema against my internally cached schema (last refreshed at `schema-sync last-run`):27 - **Added fields**: New fields not in my cache → flag as `schema-updated`28 - **Removed fields**: Fields in my cache but not live → flag as `schema-deprecated`29 - **Type changes**: Type mismatches (string→number, etc.) → flag as `schema-broken`30 - **Required flag changes**: Optional→required or vice versa → flag as `schema-breaking`31324. **Rewrite workflow plan on mismatch**: If any diff is detected (added, removed, type change, required-flag change):33 - Halt the current workflow plan34 - Regenerate the workflow using the live schema35 - Surface a diff report to the user showing what changed36 - Update my internal cached schema to the live version37385. **No mismatch → proceed silently**: If diff is empty, proceed with the existing workflow plan without user interruption.3940## Schema Diff Report Example4142```43Schema Sync Report (Composio GMAIL)44==============================45Last synced: 2026-09-11T09:00:00Z4647✅ Added fields (2):48- "reply_body" (string, optional)49- "thread_id" (string, required)5051⚠️ Removed fields (1):52- "old_attachment_flag" (string, optional) — deprecated in v2 API5354🔧 Type changes (1):55- "priority": was "low|medium|high" (string), now "1-5" (string) — non-breaking5657❌ Required flag change:58- "to": was optional, now required — BREAKING; workflow regenerated5960Action: Workflow plan regenerated using live schema. Cached schema updated.61```6263## Workflow Guard Example6465**Before schema-sync**: I'd build a Canva design generation workflow using my cached schema, which might assume certain autofill fields exist. If Canva API changed those fields, my workflow would silently fail at runtime.6667**After schema-sync**: Before each Canva workflow, I ping the live dataset schema, diff it, and either auto-update my plan or alert the user to the changes — never proceeding with stale assumptions.6869## Windows PowerShell Notes7071- API ping via `Invoke-RestMethod` with proper auth headers72- Schema diff comparison: use `Compare-Object` PowerShell cmdlet73- Cached schema stored at `~\.opencode\schema-cache.json` with UTC timestamp74- On mismatch, re-download and overwrite cache automatically