📜LLM Guide
A rule sheet to paste into an LLM's context window so it generates correct vcon-js 0.5.2 code.
Paste this page into a model's context when it writes code against vcon-js 0.5.2.
Spec target:
draft-ietf-vcon-vcon-core, syntax"vcon": "0.4.0". Library version0.5.2. Field rules: field reference.
Rules
Output that breaks these is not a valid vCon.
Syntax parameter.
Vcon.buildNew()setsvcon: "0.4.0". Do not override it.Field names.
amended, neverappended.critical, nevermust_supportormust_understand.mediatype, nevermimetype. UseaddCriticalExtension(name)to writecritical[].Attachments use
purpose. There is notypefield on attachments, including the lawful basis attachment:purpose: 'lawful_basis'. Always passstart; the core schema requires it andaddAttachmentdoes not fill it in.Analysis requires
vendor. Useschemato name the body format. Never writeschema_version.Structured bodies. Pass objects and arrays as the value.
addAnalysisserializes an object or array body to a string and setsencoding: 'json'for you.addAttachmentstores the body as given, so passencoding: 'json'with an object body.External media needs
urlandcontent_hash. The hash issha512-<base64url>of the file bytes. Compute it withcreateHash('sha512').update(bytes).digest('base64url')fromnode:crypto. Never write a placeholder hash into output.Timestamps are RFC 3339 with timezone. Use
new Date().toISOString()or an explicit offset.Do not emit empty
group: []orredacted: {}.Transcripts are analysis, not attachments. Use
type: 'wtf_transcription'for the WTF extension.There is no signing in the library. Do not call
vcon.sign()or readvcon.signatures. Version 0.5.2 removedSignature,signature,signatures, andpayloadfrom the types.
API at a glance
Vcon: buildNew(), buildFromJson(json), addParty(party) (returns void), addDialog(dialog), addAttachment(params), addAnalysis(params), addTag(key, value), getTag(key), tags, addExtension(name), addCriticalExtension(name), hasExtension(name), isCriticalExtension(name), findPartyIndex(by, val), findDialog(by, val), findAttachmentByPurpose(purpose), findAnalysisByType(type), toJson(), toDict().
Party: identifiers tel, sip, mailto, stir, did. Descriptive name, role, type, org, dept, validation, civicaddress, timezone, meta.
Dialog: type is 'recording' | 'text' | 'transfer' | 'incomplete' | 'recording-set'. Required type and start. Inline: addInlineData(body, mediatype, { encoding, filename }). External: addExternalData(url, mediatype, { filename, content_hash }). Checks: isText, isRecording, isAudio, isVideo, isEmail, isInlineData, isExternalData, validate().
Attachment: purpose required, party and dialog default to 0. Attachment.VALID_ENCODINGS is ['base64url', 'json', 'none'].
Analysis is a type. Pass a plain object to addAnalysis() with type and vendor. dialog is optional because an analysis may key off attachment.
Party indices. addParty returns nothing. Use vcon.parties.length - 1 or vcon.findPartyIndex('name', 'Alice').
Canonical example
Common bugs in generated code
const idx = vcon.addParty(...).addPartyreturnsvoid. Usevcon.parties.length - 1.vcon.addAttachment({ type: 'lawful_basis', ... }). Attachments have notype. Usepurpose: 'lawful_basis'.vcon.addAttachment({ type: 'transcript', ... }). Transcripts live inanalysis[]. UseaddAnalysis.appended: {...}ormust_support: [...]. Useamendedandcritical[].start: '2026-05-18 14:00:00'with no timezone. Use.toISOString().External media without
content_hash, or with a made-up hash.Importing
Signatureor calling a signing method. Removed in 0.5.2.Mutating an
Attachmentaftervcon.addAttachment(att)and expecting the vCon to change. The vCon holds a copy.
Extension shapes
vcon-js has no per-extension helpers. Build the attachment or analysis yourself from the page for that extension: Lawful Basis, WTF Transcription, and the rest of the Extensions section. Only provenance on dialog and analysis is typed.
See also
Last updated
Was this helpful?