% ===========================================================================
% AITP Flow Notebook Template  (v1.0 — section-based incremental)
% ===========================================================================
% This template defines the canonical section structure. The notebook builder
% (brain/flow_notebook.py) fills each section by reading the corresponding
% L0-L4 artifacts. Sections are delimited by % --- BEGIN/END --- markers
% for incremental regeneration.
%
% DO NOT reorder or rename sections without updating SECTION_ORDER in
% brain/flow_notebook.py.
% ===========================================================================

\documentclass[11pt,a4paper]{article}

% --- Encoding & Fonts ---
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

% --- Mathematics ---
\usepackage{amsmath,amssymb,amsfonts}
\numberwithin{equation}{section}
\usepackage{physics}          % \bra, \ket, \tr, \dd, etc.
\usepackage{bm}               % \bm for bold math symbols

% --- Page layout ---
\usepackage{geometry}
\geometry{margin=2.5cm}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0.5em plus 0.2em minus 0.1em}
\setcounter{secnumdepth}{-1}  % Unnumbered sections

% --- Tables ---
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{array}

% --- Lists ---
\usepackage{enumitem}

% --- Colors & Boxes ---
\usepackage{xcolor}
\usepackage[most]{tcolorbox}

% --- Cross-referencing ---
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=blue!60!black,
    urlcolor=blue!60!black,
}

% --- Code listings ---
\usepackage{listings}
\lstset{
    basicstyle=\small\ttfamily,
    breaklines=true,
    frame=single,
    numbers=left,
    numberstyle=\tiny\color{gray},
    showstringspaces=false,
}

% --- Status commands ---
\definecolor{passgreen}{RGB}{34,139,34}
\definecolor{failred}{RGB}{178,34,34}
\definecolor{warnorange}{RGB}{204,119,34}
\definecolor{infoblue}{RGB}{47,85,151}

\newcommand{\statuspass}{\textcolor{passgreen}{\textbf{PASS}}}
\newcommand{\statusfail}{\textcolor{failred}{\textbf{FAIL}}}
\newcommand{\statusactive}{\textcolor{warnorange}{\textbf{ACTIVE}}}
\newcommand{\statusdeferred}{\textcolor{gray}{\textbf{DEFERRED}}}

% --- Highlighted boxes ---
\newtcolorbox{resultbox}[1][]{
    colback=infoblue!4, colframe=infoblue!70,
    fonttitle=\bfseries, boxrule=0.6pt, arc=2pt, breakable,
    title={#1}
}
\newtcolorbox{warningbox}[1][]{
    colback=warnorange!4, colframe=warnorange!70,
    fonttitle=\bfseries, boxrule=0.6pt, arc=2pt, breakable,
    title={#1}
}
\newtcolorbox{valbox}[1][]{
    colback=passgreen!4, colframe=passgreen!70,
    fonttitle=\bfseries, boxrule=0.6pt, arc=2pt, breakable,
    title={#1}
}

% --- Metadata ---
\title{\textbf{Research Flow Notebook}\\[0.4em]
  \large {{TOPIC_TITLE}}}
\author{AITP Protocol v1.0}
\date{\today}

\begin{document}
\maketitle

\begin{abstract}
This notebook records the complete research trajectory: sources,
conventions, derivation attempts, validated results, and open questions.
It is auto-generated from L0--L4 artifacts and polished for human readability.
Mode: \texttt{{{MODE}}}.  Lane: \texttt{{{LANE}}}.
\end{abstract}

\tableofcontents
\newpage

% ===========================================================================
% §1  Research Question
% Source: L1/question_contract.md
% ===========================================================================

% --- BEGIN research_question ---
\section{Research Question}

\begin{resultbox}[Bounded Question]
\textit{(No bounded question recorded yet — complete L1/question\_contract.md.)}
\end{resultbox}
% --- END research_question ---

% ===========================================================================
% §2  Source Landscape
% Sources: L0/source_registry.md, L0/sources/*.md
% ===========================================================================

% --- BEGIN source_landscape ---
\section{Source Landscape}

\textit{(No sources registered yet — use aitp\_register\_source.)}
% --- END source_landscape ---

% ===========================================================================
% §3  Conventions \& Notation
% Source: L1/convention_snapshot.md
% ===========================================================================

% --- BEGIN conventions ---
\section{Conventions \& Notation}

\textit{(No convention snapshot recorded yet — complete L1/convention\_snapshot.md.)}
% --- END conventions ---

% ===========================================================================
% §4  Derivation Journey
% Sources: L3/*/active_*.md, L3/ideas/*.md
% ===========================================================================

% --- BEGIN derivation_journey ---
\section{Derivation Journey}

\textit{(No derivation content yet — advance to L3 and begin derivation.)}
% --- END derivation_journey ---

% ===========================================================================
% §5  Synthesis \& Claims
% Sources: L3/candidates/*.md, L3/distill/active_distillation.md
% ===========================================================================

% --- BEGIN synthesis_claims ---
\section{Synthesis \& Claims}

\textit{(No candidates submitted yet — complete L3 derivation first.)}
% --- END synthesis_claims ---

% ===========================================================================
% §6  Validation
% Sources: L4/reviews/*.md, L4/outputs/*.md
% ===========================================================================

% --- BEGIN validation ---
\section{Validation}

\textit{(No validation reviews yet — submit a candidate to advance to L4.)}
% --- END validation ---

% ===========================================================================
% §7  Negative Results \& Open Questions
% Sources: L3/deferred.md, L3/ideas/*.md (failed/abandoned)
% ===========================================================================

% --- BEGIN negative_results ---
\section{Negative Results \& Open Questions}

\textit{(No deferred items or open questions formally recorded.)}
% --- END negative_results ---

% ===========================================================================
% §8  Canonical Knowledge (L2)
% Source: global L2 graph nodes
% ===========================================================================

% --- BEGIN canonical_knowledge ---
\section{Canonical Knowledge (L2)}

\textit{(No L2 nodes promoted from this topic yet.)}
% --- END canonical_knowledge ---

% ===========================================================================
% §9  Domain Context
% Source: contracts/domain-manifest.md
% ===========================================================================

% --- BEGIN domain_context ---
\section{Domain Context}

\textit{(No domain manifest recorded — create contracts/domain-manifest.md.)}
% --- END domain_context ---

% ===========================================================================
% §10  Mode \& Session History
% Sources: state.md, runtime/sessions.md
% ===========================================================================

% --- BEGIN session_metadata ---
\section{Session Metadata}

\textit{(Topic state will appear here once bootstrapped.)}
% --- END session_metadata ---

% ===========================================================================
% §11  Execution Provenance
% Source: runtime/log.md
% ===========================================================================

% --- BEGIN execution_provenance ---
\section{Execution Provenance}

\textit{(No execution log yet.)}
% --- END execution_provenance ---

\end{document}
