Whitepaper · Convert · from code

Universal Translator

Repo AgenticOp-io/chrysalis · lane engines/chrysalis-convert (junction PHP_converter). Hub SPA on :19090 / hub.agenticop.io/hub/. Models propose; WebIR + oracle + verify dispose. Convert does not own CWL grammar or smoke:ut-spine.

Docs · Product · CWL · WebIR

Job

AI-assisted Universal Translator for the web (canon D6438): peel origin stacks into WebIR/CWL, emit modern targets, grow under Chimera — never one-shot dump trust. Four layers: engine · CWL hub · intelligence (propose only) · Hub ops / evidence. Adoption wedge historically: PHP → TypeScript (Hono / Fastify / Next). The 601/601 matrix is an oracle-product census, not “every stack rewritten.”

Hub architecture

PieceFact
Serverscripts/chrysalis-operator-web.mjs — REST + SSE
PortCHRYSALIS_OPERATOR_PORT19090
Startpnpm run hub:serve
Data~/.chrysalis-hub/projects.json, workspaces under ~/.chrysalis-hub/workspaces/
ParallelismCHRYSALIS_HUB_MAX_PARALLEL (default 3)
AuthCHRYSALIS_OPERATOR_TOKEN Bearer for writes
Publicnginx /hub/127.0.0.1:19090

API examples: POST …/sites, POST …/run-batch, GET …/batch-progress, GET /api/hub/translation-path-matrix, GET /api/hub/language-readiness.

Laws

IDLawEnforcement
D6442Translate only — no invent features/backendsCanon + holes on lower failure
D6447No demo-only / force-settle façadesProtocol refuses deep-lift-all-holes as completeness
D6448Close holes until zero data-cwl-hole or residual ledgerwisp-complete-conversion-protocol.mjs
Propose ≠ disposeLLM proposes; oracle + verify disposeNo LiteRT.js convert path

Protocol constants: COMPLETE_CONVERSION_KIND = chrysalis.complete-conversion-protocol, COMPLETE_CONVERSION_GATE = D6448, forceSettleResidualHoles: false on every evidence round.

Correctness loop

Capture (oracle) → Lift (WebIR) → CWL ↔ emit → Verify (replay)
                         ↑                    │
              LLM / IS / chat propose         │
                         └────── dispose ─────┘

Peel / emit modules

Dispatcher hub-lift-dispatch.mjs tries specialized peels before generic lift-to-webir.mjs. AST peels cover PHP, JS/TS, Python, Java, Go, Ruby, Rust, C#, Kotlin, Scala, Swift, Dart, Elixir, C++, Nest — plus SvelteKit / Next / Nitro. COBOL: cobol-pattern-lift.mjs / cobol-pattern-emit.mjs.

Emit: emit-*-from-hub.mjs family, emit-cwl-from-hub.mjs, emit-runtime-cwl-from-hub.mjs, wptp-emit-pipeline.mjs. Packages: ingest, webir (junction), verify, oracle + language oracles, emit-hono / emit-fastify, runtime-chimera, cwl (junction).

Oracle and verify

@chrysalis/oracle: capture legacy behavior into a TraceCorpus (NDJSON — header, body events, footer; schema version 1.0.0). Event types include http.request, http.response, sql.query, plus determinism hooks for time/RNG. Redaction is mandatory before persist. Oracle does not translate or replay.

@chrysalis/verify: replayCorpus sorts traces, filters by route/traceId/shard, diffs responses via replay-http. Also SQL replay and UI markup/CSS parity helpers.

Hub verify laneWhen
legacy-oracle-phpPHP → TS/Hono/Fastify gold
hub-structural-goldLiteral → Hono/Fastify gold
hub-trace-replayIn-process @chrysalis/verify
oracle-python / oracle-nodeLive capture on origin hosts
wptp-contractOpenAPI / Swagger / HAR
noneSilver/open — no trace parity claim

Complete conversion (D6448)

Hole-close until zero data-cwl-hole (vendor islands excepted) or fail incomplete. Three rounds with no improvement → incomplete. CLI: pnpm run hub:complete-conversion (--allow-incomplete · --max-rounds · --stop-after · --no-terminal-settle. Bind traces with forceSettleResidualHoles: false.

Residual ledger when total !== 0reports/wisp/complete-conversion-residuals.json:

{
  "kind": "chrysalis.complete-conversion-residuals",
  "schemaVersion": 1,
  "gate": "D6448",
  "total": N,
  "buckets": { /* classifyCwlHoleBuckets */ },
  "reasons": { /* counts */ },
  "topPages": …,
  "engineDebt": [ "Close svelteInterp…", "…" ],
  "nextActions": [ "Improve packages/ingest…", "Do not use deep-lift-all-holes" ]
}

D6448-ST prove profiles: hub:complete-conversion-prove:plain-php, :tiny-blog (RFC-0021), plus express/typescript/python/go/csharp/elixir/dart/wisp-ui variants.

COBOL peels

pnpm run pilot:cobol-clbs — inventory + best-fit + residual; no Db2/CICS/VSAM invent. Residual ledger kind chrysalis.cobol.residual.v1 with priorities P0–P3. EXTFMAP is the sole open COBOL P0 until licensed drop or CHRYSALIS_EXTFMAP_ABSENT=1 attestation — never invent. Tokens: EXTFMAP_RESIDUAL_HONEST_OK; smokes hub:cobol-best-fit-smoke, hub:cobol-clbs-prove-smoke, hub:cobol-extfmap-residual-smoke.

See published.html#cobol.

How Convert consumes CWL

MechanismFact
packages/cwlJunction → chrysalis-cwl/packages/cwl
packages/webirJunction → chrysalis-cwl/packages/webir
Pinfile:../chrysalis-cwl/packages/cwl (tip 1.0.26) or @agenticop-io/cwl
Provehub:cwl-pin-smoke, hub:cwl-language-pillar-smoke
Cutover consumehub:cwl-helix-cutover-smokeCWL_HELIX_CUTOVER_OK or honest SKIP
Fat stay Convertcwl-ingest.mjs, cwl-control-lower.mjs (not thin junction)

Pilot Kit

MCP + Cursor rule + pilot:laravel-min + optional COBOL. hub:cursor-pilot-kit-smokePILOT_KIT_OK. Explicit: Pilot Kit is GTM — not DNA cutover. Also: PUBLIC_CLAIM_OK, OSS_SCRUB_OK, CONVERT_GRAVITY_OK.

Owns / does not

OwnsDoes not own
Peelers, emitters, Hub SPA, oracle harnesses, Pilot Kit, Chimera shell CWL RFCs/golds; Helix learn/enforce; smoke:ut-spine

Anti-patterns: IR-v0 as second DNA; editing CWL grammar under Convert; WISP chrome as north star.

Gates

  • CONVERT_WHOLE_SYSTEM_OK
  • hub:traffic-decides-bar-smokeTRAFFIC_DECIDES_CONVERT_OK
  • hub:ut-maintain-packaging-smoke
  • PILOT_KIT_OK · CWL_HELIX_CUTOVER_OK / SKIP

CWL · Traffic decides · Helix