|
| 1 | +--- |
| 2 | +name: copilotkit-demo-parity |
| 3 | +description: Keeps examples/integrations/* demos aligned to the north-star (langgraph-python). Use when the user says "sync demos", "sync integrations", "port to north-star", "align integration demos", "parity check", or when working inside examples/integrations/ and tracked files diverge. Drives the pnpm parity:sync / parity:verify commands and handles the manual-merge zones (agent code, api route, Dockerfile). |
| 4 | +--- |
| 5 | + |
| 6 | +# CopilotKit demo parity |
| 7 | + |
| 8 | +Keeps the three (soon more) integration demos under `examples/integrations/` |
| 9 | +aligned. `langgraph-python` is north-star; every other entry is an instance |
| 10 | +that tracks it via `examples/integrations/_parity/manifest.json`. |
| 11 | + |
| 12 | +## When this skill fires |
| 13 | + |
| 14 | +- User says "sync demos", "align integrations", "port to north-star", |
| 15 | + "parity check", "run parity sync". |
| 16 | +- User edits a file under `examples/integrations/langgraph-python/**` that is |
| 17 | + listed in `manifest.json` → tracked.verbatimFiles. |
| 18 | +- User is about to add a new integration under `examples/integrations/`. |
| 19 | +- `pnpm parity:verify` is failing locally or in CI. |
| 20 | + |
| 21 | +## Ground truth |
| 22 | + |
| 23 | +Read these first before making any parity decision — they override |
| 24 | +anything memorized: |
| 25 | + |
| 26 | +- `examples/integrations/_parity/manifest.json` — what is tracked, what is |
| 27 | + allowed to diverge, per-instance overrides. |
| 28 | +- `examples/integrations/_parity/canonical/PROMPT.md` — the canonical |
| 29 | + system prompt. Every instance's `agent/PROMPT.md` must equal this. |
| 30 | +- `examples/integrations/_parity/README.md` — human-facing how-to. |
| 31 | + |
| 32 | +## Procedure: sync from north-star to instance(s) |
| 33 | + |
| 34 | +Use when north-star changed and instances need to catch up, OR when a new |
| 35 | +instance is being bootstrapped. |
| 36 | + |
| 37 | +1. **Confirm the north-star change is intentional.** If the user changed |
| 38 | + a file under `langgraph-python/`, ask whether it should propagate. |
| 39 | + Changes to `agent/` are never auto-propagated. |
| 40 | +2. **Dry-run first.** |
| 41 | + ```bash |
| 42 | + pnpm parity:sync --target=<instance> --dry-run |
| 43 | + ``` |
| 44 | + Read the report: file count, rewritten package.json keys, prompt update. |
| 45 | +3. **Apply.** |
| 46 | + ```bash |
| 47 | + pnpm parity:sync --target=<instance> |
| 48 | + # or --all to sync every instance |
| 49 | + ``` |
| 50 | +4. **Resolve manual-merge zones.** Sync does NOT touch: |
| 51 | + - `agent/**` — port agent code by hand. See `tracked.agentSurface.toolNames` |
| 52 | + and `stateKeys` in `manifest.json` for what must be present. |
| 53 | + - `src/app/api/copilotkit/**` — api route differs across instances |
| 54 | + (north-star=LangGraphAgent, Docker instances=HttpAgent). |
| 55 | + - `Dockerfile`, `docker/Dockerfile.agent`, `serve.py`, `scripts/**` — |
| 56 | + language-specific. Each instance keeps its own. |
| 57 | +5. **Verify.** |
| 58 | + ```bash |
| 59 | + pnpm parity:verify --target=<instance> |
| 60 | + ``` |
| 61 | + Exit 0 = green. Exit 1 = unresolved drift; fix until green. |
| 62 | + |
| 63 | +## Procedure: verify (CI-equivalent) |
| 64 | + |
| 65 | +```bash |
| 66 | +pnpm parity:verify # all instances |
| 67 | +pnpm parity:verify --target=<instance> |
| 68 | +pnpm parity:verify --json # machine-readable |
| 69 | +``` |
| 70 | + |
| 71 | +Output kinds: |
| 72 | + |
| 73 | +- `verbatim-file` — byte-compare against north-star. |
| 74 | +- `package-json` — tracked key mismatch vs expected value. |
| 75 | +- `prompt` — `agent/PROMPT.md` missing or differs from canonical. |
| 76 | +- `agent-tool` — tool name from manifest not found in instance agent |
| 77 | + source. Usually means a tool was renamed or dropped; update manifest |
| 78 | + OR port the tool. |
| 79 | +- `agent-state` — state key from manifest not found (warn only). |
| 80 | + |
| 81 | +## Procedure: add a new instance |
| 82 | + |
| 83 | +1. Create the demo dir under `examples/integrations/<name>/` with the |
| 84 | + usual Next.js frontend root and an `agent/` subdir. |
| 85 | +2. Add an entry to `manifest.json` → `instances`: |
| 86 | + ```json |
| 87 | + "<name>": { |
| 88 | + "role": "instance", |
| 89 | + "agent": { "language": "...", "runtime": "..." }, |
| 90 | + "allowedDivergence": [ |
| 91 | + "agent/**", |
| 92 | + "src/app/api/copilotkit/**", |
| 93 | + "Dockerfile", |
| 94 | + "docker/Dockerfile.agent", |
| 95 | + "serve.py", |
| 96 | + "scripts/**" |
| 97 | + ], |
| 98 | + "packageJsonOverrides": { |
| 99 | + "scripts.dev:agent": "<invocation>", |
| 100 | + "scripts.install:agent": "<install>" |
| 101 | + } |
| 102 | + } |
| 103 | + ``` |
| 104 | +3. `pnpm parity:sync --target=<name>` |
| 105 | +4. Port agent code (tool implementations, state schema, prompt loading). |
| 106 | + Agent must read prompt from `agent/PROMPT.md` at startup. |
| 107 | +5. `pnpm parity:verify --target=<name>` until green. |
| 108 | + |
| 109 | +## Procedure: change the canonical prompt |
| 110 | + |
| 111 | +1. Edit `examples/integrations/_parity/canonical/PROMPT.md`. |
| 112 | +2. `pnpm parity:sync --all` — writes the new prompt to every instance's |
| 113 | + `agent/PROMPT.md`. |
| 114 | +3. If the prompt change requires new tools or state keys, update |
| 115 | + `manifest.json` → `tracked.agentSurface` to match, then port each |
| 116 | + instance's agent. |
| 117 | + |
| 118 | +## Procedure: change the tracked surface |
| 119 | + |
| 120 | +To track a new file or key: |
| 121 | +1. Edit `manifest.json` → `tracked.verbatimFiles` or `tracked.packageJsonPaths`. |
| 122 | +2. Run `pnpm parity:verify` — instances will flag as drifted until synced. |
| 123 | +3. `pnpm parity:sync --all` to apply. |
| 124 | + |
| 125 | +To stop tracking something, remove it from `manifest.json`. The verifier |
| 126 | +and sync stop touching it. Any drift that already exists stays. |
| 127 | + |
| 128 | +## Red flags |
| 129 | + |
| 130 | +| Signal | What it means | Do instead | |
| 131 | +|--------|---------------|------------| |
| 132 | +| "Just copy the file manually" | Bypasses the manifest | Add to `tracked.verbatimFiles` then sync | |
| 133 | +| "Add a try/catch so verify doesn't fail" | Silencing drift | Resolve the drift or declare divergence | |
| 134 | +| "Move this into `allowedDivergence` to unblock" | Scope creep | Only add to divergence with explicit reason | |
| 135 | +| `pnpm parity:sync` on north-star directly | Overwrites canonical | Sync is instance-only; script refuses | |
| 136 | +| Agent code copied between languages | Doesn't work | Port by hand; `tracked.agentSurface` names what | |
| 137 | + |
| 138 | +## Related skills |
| 139 | + |
| 140 | +- `copilotkit-integrations` — framework-specific wiring (LangGraph, CrewAI, |
| 141 | + Mastra, etc.) when bootstrapping a new instance. |
| 142 | +- `copilotkit-dev-workflow` — monorepo conventions, Nx, commit format. |
| 143 | +- `docker-ci-safety` — Dockerfile safety when editing per-instance |
| 144 | + container builds. |
0 commit comments