1"use strict";(globalThis.webpackChunkdocs=globalThis.webpackChunkdocs||[]).push([[3771],{84687(e,s,n){n.r(s),n.d(s,{assets:()=>l,contentTitle:()=>i,default:()=>a,frontMatter:()=>c,metadata:()=>r,toc:()=>o});const r=JSON.parse('{"id":"reference/chat-import-schema","title":"Chat Import Schema","description":"Reference for the graph schema produced by the Claude AI and ChatGPT chat history import connectors.","source":"@site/docs/reference/chat-import-schema.md","sourceDirName":"reference","slug":"/reference/chat-import-schema","permalink":"/docs/reference/chat-import-schema","draft":false,"unlisted":false,"editUrl":"https://github.com/neo4j-labs/create-context-graph/tree/main/docs/docs/reference/chat-import-schema.md","tags":[],"version":"current","sidebarPosition":8,"frontMatter":{"sidebar_position":8,"title":"Chat Import Schema"},"sidebar":"docs","previous":{"title":"Claude Code Session Schema","permalink":"/docs/reference/claude-code-schema"},"next":{"title":"How Domain Ontologies Work","permalink":"/docs/explanation/how-domain-ontologies-work"}}');var d=n(74848),t=n(28453);const c={sidebar_position:8,title:"Chat Import Schema"},i="Chat Import Schema",l={},o=[{value:"Entity Types",id:"entity-types",level:2},{value:"Conversation",id:"conversation",level:3},{value:"Message",id:"message",level:3},{value:"Document",id:"document",level:3},{value:"DecisionTrace (deep mode only)",id:"decisiontrace-deep-mode-only",level:3},{value:"TraceStep (deep mode only)",id:"tracestep-deep-mode-only",level:3},{value:"Relationships",id:"relationships",level:2},{value:"Platform Differences",id:"platform-differences",level:2},{value:"Claude AI Export Format",id:"claude-ai-export-format",level:3},{value:"ChatGPT Export Format",id:"chatgpt-export-format",level:3},{value:"Example Cypher Queries",id:"example-cypher-queries",level:2}];function h(e){const s={code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",mermaid:"mermaid",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,t.R)(),...e.components};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(s.header,{children:(0,d.jsx)(s.h1,{id:"chat-import-schema",children:"Chat Import Schema"})}),"\n",(0,d.jsx)(s.p,{children:"Reference for the graph schema produced by the Claude AI and ChatGPT chat history import connectors."}),"\n",(0,d.jsx)(s.mermaid,{value:'graph LR\n Conv["Conversation"] --\x3e|HAS_MESSAGE| Msg1["Message"]\n Msg1 --\x3e|NEXT| Msg2["Message"]\n Conv -.->|deep mode| DT["DecisionTrace"]\n DT --\x3e|HAS_STEP| TS1["TraceStep"]\n TS1 --\x3e|NEXT| TS2["TraceStep"]'}),"\n",(0,d.jsx)(s.h2,{id:"entity-types",children:"Entity Types"}),"\n",(0,d.jsx)(s.h3,{id:"conversation",children:"Conversation"}),"\n",(0,d.jsx)(s.p,{children:"One node per imported conversation."}),"\n",(0,d.jsxs)(s.table,{children:[(0,d.jsx)(s.thead,{children:(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.th,{children:"Property"}),(0,d.jsx)(s.th,{children:"Type"}),(0,d.jsx)(s.th,{children:"Description"})]})}),(0,d.jsxs)(s.tbody,{children:[(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"name"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsxs)(s.td,{children:["Conversation title (from export) or ",(0,d.jsx)(s.code,{children:"conv-{uuid}"})," fallback"]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"conversation_id"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsx)(s.td,{children:"Original platform UUID"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"source"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsxs)(s.td,{children:[(0,d.jsx)(s.code,{children:'"claude-ai"'})," or ",(0,d.jsx)(s.code,{children:'"chatgpt"'})]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"created_at"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsx)(s.td,{children:"ISO 8601 timestamp of conversation creation"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"updated_at"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsx)(s.td,{children:"ISO 8601 timestamp of last update"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"message_count"})}),(0,d.jsx)(s.td,{children:"integer"}),(0,d.jsx)(s.td,{children:"Number of messages in the conversation"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"model_slug"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsxs)(s.td,{children:["Default model used (ChatGPT only, e.g. ",(0,d.jsx)(s.code,{children:'"gpt-4o"'}),")"]})]})]})]}),"\n",(0,d.jsx)(s.h3,{id:"message",children:"Message"}),"\n",(0,d.jsx)(s.p,{children:"One node per message within a conversation."}),"\n",(0,d.jsxs)(s.table,{children:[(0,d.jsx)(s.thead,{children:(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.th,{children:"Property"}),(0,d.jsx)(s.th,{children:"Type"}),(0,d.jsx)(s.th,{children:"Description"})]})}),(0,d.jsxs)(s.tbody,{children:[(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"name"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsxs)(s.td,{children:[(0,d.jsx)(s.code,{children:"msg-{uuid[:12]}"})," identifier"]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"role"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsxs)(s.td,{children:[(0,d.jsx)(s.code,{children:'"user"'}),", ",(0,d.jsx)(s.code,{children:'"assistant"'}),", or ",(0,d.jsx)(s.code,{children:'"tool"'})]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"content"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsx)(s.td,{children:"Message text (truncated to 2,000 characters)"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"created_at"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsx)(s.td,{children:"ISO 8601 timestamp"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"conversation_id"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsx)(s.td,{children:"Parent conversation UUID"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"has_tool_calls"})}),(0,d.jsx)(s.td,{children:"boolean"}),(0,d.jsx)(s.td,{children:"Whether this message contains tool use blocks (Claude AI)"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"has_tool_results"})}),(0,d.jsx)(s.td,{children:"boolean"}),(0,d.jsx)(s.td,{children:"Whether this message contains tool results (ChatGPT)"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"model_slug"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsx)(s.td,{children:"Model used for this specific message (ChatGPT only)"})]})]})]}),"\n",(0,d.jsx)(s.h3,{id:"document",children:"Document"}),"\n",(0,d.jsx)(s.p,{children:"One document per conversation, containing the full concatenated text for search and RAG."}),"\n",(0,d.jsxs)(s.table,{children:[(0,d.jsx)(s.thead,{children:(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.th,{children:"Property"}),(0,d.jsx)(s.th,{children:"Type"}),(0,d.jsx)(s.th,{children:"Description"})]})}),(0,d.jsxs)(s.tbody,{children:[(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"title"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsxs)(s.td,{children:[(0,d.jsx)(s.code,{children:'"Claude AI: {title}"'})," or ",(0,d.jsx)(s.code,{children:'"ChatGPT: {title}"'})]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"content"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsx)(s.td,{children:"Full conversation text with role labels"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"template_id"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsxs)(s.td,{children:["Always ",(0,d.jsx)(s.code,{children:'"chat-import"'})]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"template_name"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsxs)(s.td,{children:[(0,d.jsx)(s.code,{children:'"Claude AI Conversation"'})," or ",(0,d.jsx)(s.code,{children:'"ChatGPT Conversation"'})]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"conversation_id"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsx)(s.td,{children:"Source conversation UUID"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"source"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsxs)(s.td,{children:[(0,d.jsx)(s.code,{children:'"claude-ai"'})," or ",(0,d.jsx)(s.code,{children:'"chatgpt"'})]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"created_at"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsx)(s.td,{children:"ISO 8601 timestamp"})]})]})]}),"\n",(0,d.jsx)(s.h3,{id:"decisiontrace-deep-mode-only",children:"DecisionTrace (deep mode only)"}),"\n",(0,d.jsx)(s.p,{children:"Tool call sequences captured as reasoning traces."}),"\n",(0,d.jsxs)(s.table,{children:[(0,d.jsx)(s.thead,{children:(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.th,{children:"Property"}),(0,d.jsx)(s.th,{children:"Type"}),(0,d.jsx)(s.th,{children:"Description"})]})}),(0,d.jsxs)(s.tbody,{children:[(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"id"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsxs)(s.td,{children:[(0,d.jsx)(s.code,{children:'"claude-ai-trace-{uuid}"'})," or ",(0,d.jsx)(s.code,{children:'"chatgpt-trace-{uuid}"'})]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"task"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:'"Tool usage in: {conversation title}"'})})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"outcome"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsx)(s.td,{children:"Summary of tool call count"})]})]})]}),"\n",(0,d.jsx)(s.h3,{id:"tracestep-deep-mode-only",children:"TraceStep (deep mode only)"}),"\n",(0,d.jsx)(s.p,{children:"Individual steps within a decision trace."}),"\n",(0,d.jsxs)(s.table,{children:[(0,d.jsx)(s.thead,{children:(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.th,{children:"Property"}),(0,d.jsx)(s.th,{children:"Type"}),(0,d.jsx)(s.th,{children:"Description"})]})}),(0,d.jsxs)(s.tbody,{children:[(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"thought"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsx)(s.td,{children:"What triggered the tool call"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"action"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsxs)(s.td,{children:["Tool name and type (",(0,d.jsx)(s.code,{children:"tool_use:"})," or ",(0,d.jsx)(s.code,{children:"tool_result:"}),")"]})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"observation"})}),(0,d.jsx)(s.td,{children:"string"}),(0,d.jsx)(s.td,{children:"Tool input or output (truncated to 500 chars)"})]})]})]}),"\n",(0,d.jsx)(s.h2,{id:"relationships",children:"Relationships"}),"\n",(0,d.jsxs)(s.table,{children:[(0,d.jsx)(s.thead,{children:(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.th,{children:"Relationship"}),(0,d.jsx)(s.th,{children:"From"}),(0,d.jsx)(s.th,{children:"To"}),(0,d.jsx)(s.th,{children:"Description"})]})}),(0,d.jsxs)(s.tbody,{children:[(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"HAS_MESSAGE"})}),(0,d.jsx)(s.td,{children:"Conversation"}),(0,d.jsx)(s.td,{children:"Message"}),(0,d.jsx)(s.td,{children:"Conversation contains this message"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"NEXT"})}),(0,d.jsx)(s.td,{children:"Message"}),(0,d.jsx)(s.td,{children:"Message"}),(0,d.jsx)(s.td,{children:"Sequential message ordering within a conversation"})]}),(0,d.jsxs)(s.tr,{children:[(0,d.jsx)(s.td,{children:(0,d.jsx)(s.code,{children:"HAS_STEP"})}),(0,d.jsx)(s.td,{children:"DecisionTrace"}),(0,d.jsx)(s.td,{children:"TraceStep"}),(0,d.jsx)(s.td,{children:"Trace contains this reasoning step"})]})]})]}),"\n",(0,d.jsx)(s.h2,{id:"platform-differences",children:"Platform Differences"}),"\n",(0,d.jsx)(s.h3,{id:"claude-ai-export-format",children:"Claude AI Export Format"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.strong,{children:"File:"})," ",(0,d.jsx)(s.code,{children:"conversations.jsonl"})," (one JSON object per line, streamed)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.strong,{children:"Messages:"})," Flat ",(0,d.jsx)(s.code,{children:"chat_messages"})," array with ",(0,d.jsx)(s.code,{children:'sender: "human"'})," or ",(0,d.jsx)(s.code,{children:'"assistant"'})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.strong,{children:"Content blocks:"})," Array of ",(0,d.jsx)(s.code,{children:"{type, text}"})," objects; supports ",(0,d.jsx)(s.code,{children:"text"}),", ",(0,d.jsx)(s.code,{children:"tool_use"}),", ",(0,d.jsx)(s.code,{children:"tool_result"}),", ",(0,d.jsx)(s.code,{children:"thinking"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.strong,{children:"Timestamps:"})," ISO 8601 strings"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.strong,{children:"Tool calls:"})," Inline ",(0,d.jsx)(s.code,{children:"tool_use"})," content blocks with ",(0,d.jsx)(s.code,{children:"name"}),", ",(0,d.jsx)(s.code,{children:"id"}),", ",(0,d.jsx)(s.code,{children:"input"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.strong,{children:"Thinking:"})," Extended thinking captured in ",(0,d.jsx)(s.code,{children:"thinking"})," content blocks (Claude AI exclusive)"]}),"\n"]}),"\n",(0,d.jsx)(s.h3,{id:"chatgpt-export-format",children:"ChatGPT Export Format"}),"\n",(0,d.jsxs)(s.ul,{children:["\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.strong,{children:"File:"})," ",(0,d.jsx)(s.code,{children:"conversations.json"})," (single JSON array)"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.strong,{children:"Messages:"})," Tree-structured ",(0,d.jsx)(s.code,{children:"mapping"})," with ",(0,d.jsx)(s.code,{children:"parent"}),"/",(0,d.jsx)(s.code,{children:"children"})," references; the importer walks the tree following the last child at each branch point"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.strong,{children:"Author roles:"})," ",(0,d.jsx)(s.code,{children:"user"}),", ",(0,d.jsx)(s.code,{children:"assistant"}),", ",(0,d.jsx)(s.code,{children:"system"})," (filtered), ",(0,d.jsx)(s.code,{children:"tool"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.strong,{children:"Content types:"})," ",(0,d.jsx)(s.code,{children:"text"}),", ",(0,d.jsx)(s.code,{children:"code"}),", ",(0,d.jsx)(s.code,{children:"execution_output"}),", ",(0,d.jsx)(s.code,{children:"multimodal_text"})]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.strong,{children:"Timestamps:"})," Unix float (seconds since epoch), converted to ISO 8601"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.strong,{children:"Hidden messages:"})," Nodes with ",(0,d.jsx)(s.code,{children:"is_visually_hidden_from_conversation: true"})," are filtered out"]}),"\n",(0,d.jsxs)(s.li,{children:[(0,d.jsx)(s.strong,{children:"System messages:"})," Root and intermediate system messages are excluded from import"]}
1),"\n"]}),"\n",(0,d.jsx)(s.h2,{id:"example-cypher-queries",children:"Example Cypher Queries"}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"All conversations from a specific platform:"})}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-cypher",children:"MATCH (c:Conversation)\nWHERE c.source = 'claude-ai'\nRETURN c.name, c.message_count, c.created_at\nORDER BY c.created_at DESC\n"})}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Full message thread for a conversation:"})}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-cypher",children:"MATCH path = (first:Message)-[:NEXT*]->(last:Message)\nWHERE first.conversation_id = $conv_id\n AND NOT ()-[:NEXT]->(first)\nRETURN [n IN nodes(path) | {role: n.role, content: left(n.content, 200)}] AS thread\n"})}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Cross-platform conversation count:"})}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-cypher",children:"MATCH (c:Conversation)\nRETURN c.source, count(c) AS conversations, sum(c.message_count) AS total_messages\n"})}),"\n",(0,d.jsx)(s.p,{children:(0,d.jsx)(s.strong,{children:"Search across all imported conversations:"})}),"\n",(0,d.jsx)(s.pre,{children:(0,d.jsx)(s.code,{className:"language-cypher",children:"MATCH (d:Document)\nWHERE d.template_id = 'chat-import'\n AND d.content CONTAINS $search_term\nRETURN d.title, d.source, d.created_at\nORDER BY d.created_at DESC\n"})})]})}function a(e={}){const{wrapper:s}={...(0,t.R)(),...e.components};return s?(0,d.jsx)(s,{...e,children:(0,d.jsx)(h,{...e})}):h(e)}},28453(e,s,n){n.d(s,{R:()=>c,x:()=>i});var r=n(96540);const d={},t=r.createContext(d);function c(e){const s=r.useContext(t);return r.useMemo(function(){return"function"==typeof e?e(s):{...s,...e}},[s,e])}function i(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(d):e.components||d:c(e.components),r.createElement(t.Provider,{value:s},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.