%% ─────────────────────────────────────────────────────────────────────────────
%% Appendix A – Agent Prompts   (two-column, balanced layout, CVPR style)
%% ─────────────────────────────────────────────────────────────────────────────
\appendix
\clearpage

%% ── Section header spanning both columns ──────────────────────────────────────
\twocolumn[{%
{\large\bfseries\sffamily Appendix~A\;}\\[2pt]
{
\\ Compact version of prompt for Parser, Planner, self-critics, and safety evaluator Agents.}
\vspace{12pt}
}]

%% ── Shared tcolorbox style ────────────────────────────────────────────────────
% REMOVED tcbset for IEEE compliance
\vspace{6pt}

%% ── Prompt 1 : Parser Agent ──────────────────────────────────────────────────
\begin{promptenv}{Parser Agent}
{\fontfamily{pcr}\selectfont\footnotesize\linespread{1.0}\selectfont
\begin{verbatim}
You are an AI analysing architectural
floor plan images. TASK: Extract
room-connectivity graph + metadata.
Return ONLY valid JSON.
{detection_context}

ADJACENCY RULE (CRITICAL): Two rooms
are adjacent ONLY IF they share a
direct door/passage. Transitive
connections via room C are forbidden:
use A--C and C--B instead of A--B.
USE detected door positions to
validate adjacency.
DUPLICATE NAMES: Number distinct areas
sharing a label (e.g. "Bathroom 1",
"Bathroom 2").
EVERY NODE MUST HAVE >= 1 EDGE.

JSON schema:
{ "approach": "<strategy>",
  "nodes_elements": [{"name":"<room>"}],
  "adjacency_matrix": [[0,1,...], ...],
  "edges": [{"from":"..","to":"..",
             "via":"<Door_D1|passage>",
             "door_bbox":[x1,y1,x2,y2]}],
  "rooms_info": [{"name":"..",
                  "size":"..","doors":[..],
                  "connected_rooms":[..]}]}
VALIDATION:
(1) len(nodes)==len(matrix)==len(row)
(2) matrix[i][j]==matrix[j][i] (symmetric)
(3) values in {0,1}, diagonal=0
(4) every node >= 1 edge
\end{verbatim}}
\end{promptenv}

%% ── Prompt 3 : Self-Critic ───────────────────────────────────────────────────
\begin{promptenv}{Self-Critic Agent}
{\fontfamily{pcr}\selectfont\footnotesize\linespread{1.0}\selectfont
\begin{verbatim}
You are a spatial reasoning expert
reviewing a floor plan graph for
structural errors.

GRAPH:  {graph_json}
EDGES:  {edges_json}
{detection_summary}
ISSUES ALREADY FOUND: {structural_issues}

CHECKLIST:
(1) All rooms that should be connected?
(2) Do edges match the detection data?
(3) Any rooms wrongly connected?
(4) Adjacency matrix consistent with
    edges?

Return ONLY JSON:
{ "passed": true/false,
  "issues": ["..."],
  "suggested_fixes": ["..."] }
\end{verbatim}}
\end{promptenv}

%% ── Prompt 4 : Planner Agent ─────────────────────────────────────────────────
\begin{promptenv}{Planner Agent}
{\fontfamily{pcr}\selectfont\footnotesize\linespread{1.0}\selectfont
\begin{verbatim}
Generate step-by-step navigation for a
visually impaired user.

GRAPH (validated): {graph_json}
EDGES:             {edges_json}
{safety_context}
TASK: {start} --> {destination}
      Step size: {step_size} cm.

HEADING (internal, not for user):
  N=0, E=90, S=180, W=270 deg.
  User starts facing start-room door.
  Turn left: heading-90;
  Turn right: heading+90.

LANDMARKS: Reference doors by ID
  (e.g."Door_D3"). Inject safety
  warnings if present.

OUTPUT JSON array:
[{ "step":               <int>,
   "action":             "<verb>",
   "heading_after_step": "<N|E|S|W>",
   "sensory_feedback":   "<feels/hears>",
   "current_position":   "<location>",
   "confirmation":       "<verify how>" }]
ALLOWED: Move forward N | Turn left |
         Turn right | Turn around | Stop
Final step MUST be Stop at destination.
\end{verbatim}}
\end{promptenv}

%% ── Prompt 5 : Safety Evaluator ──────────────────────────────────────────────
\begin{promptenv}{Safety Evaluator}
{\fontfamily{pcr}\selectfont\footnotesize\linespread{1.0}\selectfont
\begin{verbatim}
You are a safety analyst reviewing a
route for a visually impaired user.

GRAPH:  {graph_json}
ROUTE:  {path}
EDGES:  {edges_json}
{detection_summary}
KNOWN HAZARDS: {existing_hazards}

ASSESS:
(1) Tight turns / complex manoeuvres?
(2) Risk of user disorientation?
(3) Sufficient landmarks for
    confirmation?
(4) Overall route complexity reasonable?

Return ONLY JSON:
{ "safe": true/false,
  "hazards": [{
    "hazard_type": "<type>",
    "severity":    <1--5>,
    "location":    "<where>",
    "mitigation":  "<how to mitigate>" }],
  "recommendation": "<overall>" }
\end{verbatim}}
\end{promptenv}