idea_world_labDEV JOURNAL
Sunday, June 21, 2026

Godot Official Documentation RAG Classifier Schema and Architecture

Date: June 21, 2026

Purpose

Summarize the reference architecture for connecting the full collection of Godot official documentation through the flow JSONL -> PostgreSQL -> Retriever -> Validator -> Qwen 3.6. This document is not an implementation guide for creating training data, but a design guideline that defines how to structure the already‑collected official documentation Markdown in outputs/godot_docs_full/pages and turn it into a searchable evidence database.

Godot Initial RAG Classifier Architecture

Current Input Data

The results of the documentation collection are located under the repository’s outputs/godot_docs_full.

Path Role
outputs/godot_docs_full/pages/ Original Markdown for each Godot official documentation page
outputs/godot_docs_full/manifest.json Original URL, local file path, collection status, byte size
outputs/godot_docs_full/summary.json Summary of total collection count and validation
outputs/godot_docs_full/urls.txt List of actually collected URLs
outputs/godot_docs_full/searchindex_urls.txt Target URL list restored from the Sphinx search index
outputs/godot_docs_full/failed.json List of collection failures
outputs/godot_docs_full/missing_from_searchindex.txt Missing‑from‑search‑index list based on the search index

Current baseline:

Item Value
Search index target pages 1568
Collected pages 1570
Page files 1570
Failed fetches 0
Missing from search index 0

Full Pipeline

  1. The crawler collects the Godot official documentation from the internet.
  2. The collection results are saved as page‑level Markdown files.
  3. The Markdown is normalized and metadata is attached, then converted to JSONL records.
  4. The JSONL is injected into PostgreSQL.
  5. PostgreSQL stores document chunks, API mappings, and label prototypes separately.
  6. When a user requests Godot source‑code analysis, the AST Parser structures the project code.
  7. The Retriever searches for evidence in PostgreSQL based on the user question and AST analysis results.
  8. The Validator bundles the question, AST results, and retrieved evidence and sends them to Qwen 3.6.
  9. Qwen 3.6 is not the final judge; it compiles an answer using the verified evidence.
  10. After the Validator checks the response’s evidence/format/forbidden patterns, it returns the result to the user.

Converting Markdown to JSONL

pages/*.md are human‑readable page sources, which are too large for RAG. Therefore, the conversion script splits pages into section/API‑member/example units and preserves the original URL and document type.

Common Normalization Rules

Step Processing
File load Read Markdown based on file, url, status, bytes from manifest.json.
Body cleanup Remove repeated headers, Sphinx UI text, broken anchor characters, and excessive whitespace.
Document type classification Categorize into class_reference, tutorial, migration, engine_details, about, other based on URL and path.
Section splitting Create chunk candidates based on heading hierarchy and Godot class reference patterns.
Code block preservation GDScript, C#, shader, CLI examples are kept in code_blocks rather than removed from the body.
Provenance assignment Attach original URL, file path, original hash, and conversion script version to every record.

JSONL Outputs

File Purpose Target Table
work/godot_rag/jsonl/docs_chunks.jsonl Chunks for searching official documentation explanations/tutorials/references docs_chunks
work/godot_rag/jsonl/api_mapping.jsonl Godot 3 → 4 API changes, renames, deprecations, replacement rules api_mapping
work/godot_rag/jsonl/label_prototypes.jsonl Prototype examples for classification/translation/rejection/modification label_prototypes
work/godot_rag/jsonl/ingest_report.jsonl Warnings, skips, and quality‑check logs during conversion For validation before DB injection

docs_chunks.jsonl Schema

{
  "chunk_id": "godot-stable:classes/class_node.html#description:0001",
  "doc_version": "stable",
  "source_url": "https://docs.godotengine.org/en/stable/classes/class_node.html",
  "source_file": "outputs/godot_docs_full/pages/classes__class_node__....md",
  "source_sha256": "...",
  "doc_type": "class_reference",
  "symbol": "Node",
  "section_path": ["Node", "Description"],
  "heading": "Description",
  "content": "Nodes are Godot's building blocks...",
  "code_blocks": [],
  "language_tags": ["gdscript"],
  "godot_version_tags": ["4.x", "stable"],
  "api_symbols": ["Node", "_ready", "_process", "queue_free"],
  "token_count": 420,
  "metadata": {
    "status": "copied_old",
    "bytes": 12345
  }
}

Essential fields:

Field Description
chunk_id Deterministic ID that does not change even if re‑executed
doc_version Document version such as stable, 4.6, etc.
source_url Original URL of the official documentation
source_file Markdown path inside the repository
source_sha256 Hash of the original Markdown
doc_type Document type
symbol Representative symbol when it is a class/API document
section_path Title hierarchy
content Main text subject to search and embedding
code_blocks Array of code blocks extracted from the text
api_symbols Godot API symbols detected in the text

api_mapping.jsonl schema

{
  "mapping_id": "godot3-to-4:kinematicbody2d-to-characterbody2d",
  "source_api": "KinematicBody2D",
  "target_api": "CharacterBody2D",
  "change_type": "rename_or_replacement",
  "godot_from": "3.x",
  "godot_to": "4.x",
  "confidence": "verified_from_docs",
  "evidence_chunk_ids": [
    "godot-stable:tutorials/migrating/upgrading_to_godot_4.html#..."
  ],
  "match_terms": ["KinematicBody2D", "CharacterBody2D"],
  "notes": "Godot 4 character movement node replacement candidate.",
  "negative_patterns": ["do not suggest KinematicBody2D for Godot 4 projects"]
}

Principles:

Item Criteria
confidence If there is official documentation, use verified_from_docs; otherwise, keep rule candidates as candidate.
Automatic extraction Candidates can be generated from migration documents and class references.
Approval criteria Rules used for training/labeling are promoted to approved status only after human review.
exact index source_api, target_api, match_terms are exact search targets.

label_prototypes.jsonl schema

{
  "prototype_id": "label:godot3-api-in-godot4:kinematicbody2d",
  "label": "godot3_api_in_godot4",
  "task_type": "version_classification",
  "input_pattern": "extends KinematicBody2D",
  "expected_finding": "Godot 3 style physics body API detected.",
  "recommended_action": "Use CharacterBody2D or CharacterBody3D depending on project dimension.",
  "evidence_mapping_ids": [
    "godot3-to-4:kinematicbody2d-to-characterbody2d"
  ],
  "evidence_chunk_ids": [],
  "severity": "high",
  "validator_rules": {
    "requires_ast_symbol": "KinematicBody2D",
    "forbidden_answer_terms": ["KinematicBody2D is recommended in Godot 4"]
  }
}

Label candidates:

Label Meaning
godot4_valid_api Use of API valid for Godot 4
godot3_api_in_godot4 Godot 3 API mixed into a Godot 4 project
deprecated_or_removed_api Use of deprecated/removed API
migration_required Requires migration from Godot 3 → 4
ambiguous_version_signal Insufficient or conflicting version evidence
non_godot_noise Data unrelated to Godot such as Python/web/Unity
unsafe_or_obfuscated_code Obfuscated, control characters, potentially malicious code

Draft PostgreSQL schema

PostgreSQL assumes the use of pgvector. Keyword search uses tsvector or a trigram index.

docs_chunks

Column Type Description
id bigserial primary key Internal ID
chunk_id text unique not null Deterministic ID of the JSONL
doc_version text not null Document version
source_url text not null Official documentation URL
source_file text not null Markdown file path
source_sha256 text not null Original hash
doc_type text not null Document type
symbol text Representative API/class symbol
section_path jsonb not null Heading hierarchy
heading text Current chunk heading
content text not null Searchable body
code_blocks jsonb not null default '[]' Code blocks
api_symbols text[] not null default '{}' Extracted symbols
metadata jsonb not null default '{}' Additional metadata
embedding vector Embedding
search_tsv tsvector Keyword search
created_at timestamptz default now() Insertion timestamp

Indexes:

Index Purpose
unique(chunk_id) Prevent duplicate insertion
ivfflat/hnsw(embedding) Semantic search
gin(search_tsv) Keyword search
gin(api_symbols) API symbol filter
btree(doc_type, symbol) Class/API document filter

api_mapping

Column Type Description
id bigserial primary key Internal ID
mapping_id text unique not null Deterministic ID
source_api text not null Original/problematic API
target_api text Recommended API
change_type text not null rename, removed, behavior_change, etc.
godot_from text Source version
godot_to text Target version
confidence text not null Evidence level
status text not null default 'candidate' candidate, approved, rejected
evidence_chunk_ids text[] not null default '{}' Official documentation evidence chunks
match_terms text[] not null default '{}' Search keywords
notes text Description
negative_patterns jsonb not null default '[]' Forbidden patterns

Indexes:

Index Purpose
unique(mapping_id) Prevent duplicates
btree(source_api) Exact lookup
btree(target_api) Reverse lookup
gin(match_terms) Keyword search
btree(status, confidence) Approval rule filter

label_prototypes

Column Type Description
id bigserial primary key Internal ID
prototype_id text unique not null Deterministic ID
label text not null Classification label
task_type text not null classification, migration_fix, patch_generation, etc.
input_pattern text not null Detection pattern
expected_finding text not null Expected determination
recommended_action text Recommended action
evidence_mapping_ids text[] not null default '{}' API mapping evidence
evidence_chunk_ids text[] not null default '{}' Document chunk evidence
severity text not null low, medium, high
validator_rules jsonb not null default '{}' Validation rules
embedding vector Similar case search
search_tsv tsvector Keyword search

Indexes:

Index Purpose
unique(prototype_id) Prevent duplicates
btree(label, task_type) Lookup by label
ivfflat/hnsw(embedding) Similar label search
gin(search_tsv) Keyword search

AST Parser input/output

The AST Parser converts user source code into a searchable structure before passing it directly to an LLM. Initial targets are .gd, .tscn, project.godot.

Input

Input Description
User question e.g., “Check if this project is safe for Godot 4”
Source code files .gd, .tscn, .tres, project.godot
Project structure File paths, scene connections, resource paths

Output schema

{
  "project_id": "local-analysis-...",
  "godot_project": {
    "config_version": 5,
    "features": ["4.4", "Forward Plus"]
  },
  "files": [
    {
      "path": "scripts/player.gd",
      "language": "gdscript",
      "extends": "CharacterBody2D",
      "class_name": "Player",
      "symbols": ["CharacterBody2D", "Input", "move_and_slide"],
      "annotations": ["@onready"],
      "version_signals": ["godot4_annotation_syntax"],
      "diagnostics": []
    }
  ],
  "version_evidence": {
    "godot4": ["config_version=5", "@onready"],
    "godot3": []
  }
}

Initial extraction fields:

Field Purpose
extends Determine Node/API version
class_name Project internal symbol mapping
annotations Godot 4 signals such as @onready, @export, etc.
legacy_keywords Godot 3 signals such as onready var, export var, KinematicBody, etc.
method_calls Documentation search and API mapping lookup
scene_dependencies Scene/script connection verification
resource_paths Missing resources and asset connection verification

Retriever operation

The Retriever is a layer that selects evidence before the LLM.

  1. Extract the intent and target task from the user question.
  2. Retrieve API symbols, version signals, and file paths from the AST Parser results.
  3. Perform an exact lookup in api_mapping first.
  4. Perform API symbol filtering + keyword search + vector search together in docs_chunks.
  5. Retrieve similar labels and validation rules from label_prototypes.
  6. Sort the search results into evidence bundles.

Evidence bundles:

{
  "query_id": "analysis-...",
  "task_type": "version_classification",
  "ast_summary": {},
  "doc_evidence": [],
  "api_mapping_evidence": [],
  "label_evidence": [],
  "retrieval_scores": {
    "exact_api_hits": 2,
    "keyword_hits": 8,
    "vector_hits": 12
  }
}

Separation of Roles between Validator and Qwen 3.6

Qwen 3.6 is a model that reads retrieved evidence and organizes the answer. The final label, evidence adoption, and prohibited‑pattern verification are handled by the Validator.

Component Responsibility
Retriever Search for relevant official documents / API mappings / label evidence
Validator Verify missing evidence, prohibited patterns, output JSON format
Qwen 3.6 Organize explanations readable to the user, revision directions, code suggestions

Items the Validator checks:

Item Criterion
Evidence ID existence The document / mapping / label ID used in the answer must be present in the actual search results.
Godot 4 standard The Godot 4 project must not recommend the Godot 3 API.
Uncertainty indication If evidence is insufficient, a definitive judgment is prohibited and it should be set to ambiguous_version_signal.
Code suggestion verification Suggested code must not conflict with the detected project dimension (2D/3D).
JSON format Internal pipeline output must be parsable JSON.

Injection Order

  1. Check outputs/godot_docs_full/summary.json and failed.json.
  2. Load manifest.json and pages/*.md.
  3. Create a Markdown normalization report.
  4. Generate docs_chunks.jsonl.
  5. Produce api_mapping.jsonl candidates from migration/class documents.
  6. Create label_prototypes.jsonl from approved rules and representative cases.
  7. Upsert only records that pass JSONL schema validation into PostgreSQL.
  8. Generate embeddings and update the vector index.
  9. Refresh the keyword index and the exact index.
  10. Validate Retriever results with sample questions.

Quality Assurance Checklist

Stage Pass Criteria
Collection verification failed_count = 0, missing_from_searchindex = 0
Markdown normalization No empty chunks, original URLs preserved
JSONL verification Every line is JSON‑parseable, required fields present
Duplicate verification No duplicates among chunk_id, mapping_id, prototype_id
Evidence verification api_mapping.evidence_chunk_ids actually exist in docs_chunks
Search verification Representative API questions return both exact hit and docs hit
Response verification Qwen responses contain no unsupported assertions and do not recommend Godot 3 API

Implementation Priorities

  1. Write a report analyzing the structure of pages/*.md.
  2. Write a conversion script for docs_chunks.jsonl.
  3. Write a JSONL schema validation script.
  4. Write PostgreSQL DDL.
  5. Inject docs_chunks and verify search.
  6. Generate api_mapping candidates and draft the manual approval flow.
  7. Draft the initial label set for label_prototypes.
  8. Extract minimal fields with the AST Parser.
  9. Output Retriever evidence bundles.
  10. Connect the Validator + Qwen 3.6 response‑organizing loop.

Core Principles

  • Preserve the original Markdown of official documents without modification.
  • Treat JSONL as a reproducible intermediate artifact.
  • The database must retain the original path, original URL, hash, and conversion script version.
  • Prevent the LLM from inventing labels.
  • Godot 3/4 determination is made by combining AST signals, API mappings, and official‑document evidence.
  • Uncertain candidates are kept in a candidate state rather than being used directly as training data.
  • Qwen 3.6 is the answer organizer; the judgment criteria belong to the Retriever and Validator.

Next Tasks

The next step is to perform a sample analysis of the Markdown structure in outputs/godot_docs_full/pages. Because class reference, migration, and tutorial documents have different structures, we need to first decide chunking strategies per document type rather than forcing a single chunking rule.