Skip to the content.

๐Ÿ› Architecture

โ† Home

NanoResearch is a 5-stage pipeline orchestrated around two persistent stores and one trainable planner. Each stage is a subclass of Stage that the Orchestrator invokes in sequence, pausing for user feedback at strategic points.

Pipeline overview

flowchart LR
  T[("๐Ÿ“ Topic")] --> O((Orchestrator))
  O -->|retrieve top-k| SB[(Skill Bank ๐’ฎ)]
  O -->|retrieve top-k| MM[(Memory Module โ„ณ)]
  O --> I[Ideation]:::s1
  I --> P[Planning]:::s1
  P --> C[Coding + Execution]:::s2
  C --> A[Analysis]:::s2
  A --> W[Writing]:::s3
  W --> R[Review]:::s3
  R --> Paper[("๐Ÿ“„ paper.pdf")]
  W -.->|distil| SB
  W -.->|distil| MM
  I -.->|narrations| U["๐Ÿ’ฌ Chat"]
  P -.-> U
  C -.-> U
  A -.-> U
  W -.-> U
  U -.->|feedback โ„ฑ| O
  classDef s1 fill:#1e3a8a,stroke:#3b82f6,color:#fff
  classDef s2 fill:#92400e,stroke:#f59e0b,color:#fff
  classDef s3 fill:#065f46,stroke:#10b981,color:#fff

Pipeline overview

System layout

flowchart TB
  subgraph User["๐Ÿ‘ค User"]
    Chat["๐Ÿ’ฌ Chat UI<br/>(React + Vite)"]
  end

  subgraph API["โšก FastAPI server"]
    Intent["/api/intent<br/>NL โ†’ action"]
    RunMgr["RunManager<br/>(background thread)"]
    Narr["Narrator<br/>event โ†’ English"]
    SSE["GET /stream<br/>(SSE narrations)"]
    Files["/paper.pdf<br/>/paper.tex"]
  end

  subgraph Pipe["๐Ÿ”ฌ Orchestrator"]
    direction LR
    I[Ideation] --> P[Planning]
    P --> C[Coding]
    C --> An[Analysis]
    An --> W[Writing]
  end

  subgraph Stores["๐Ÿ’พ Per-user stores"]
    Profile[(Profile<br/>JSON)]
    Skill[(Skill Bank<br/>JSON)]
    Mem[(Memory Module<br/>JSON)]
    LoRA[(LoRA adapter<br/>safetensors)]
  end

  subgraph Models["๐Ÿค– LLM backends"]
    Azure["Azure OpenAI<br/>GPT-5.1 ยท AAD auth"]
    Qwen["Qwen2.5-7B<br/>local ยท MPS ยท planner only"]
  end

  Chat <-->|HTTP| Intent
  Chat <-->|EventSource| SSE
  Chat -->|download| Files
  Intent --> RunMgr
  RunMgr --> Pipe
  Pipe --> Narr --> SSE
  Pipe <-->|retrieve / distil| Stores
  Pipe -->|9/10 of calls| Azure
  Pipe -->|planner calls only| Qwen
  Qwen <-->|SDPO LoRA training| LoRA

System layout

Co-evolution loop

sequenceDiagram
  autonumber
  participant U as ๐Ÿ‘ค User
  participant C as ๐Ÿ’ฌ Chat
  participant O as Orchestrator
  participant SB as Skill Bank
  participant MM as Memory Module
  participant LLM as GPT-5.1
  participant FQ as Feedback Queue
  participant SDPO as SDPO Trainer
  participant Q as Qwen + LoRA

  U->>C: "Start a run on X"
  C->>O: POST /api/runs
  loop For each stage
    O->>SB: retrieve top-k skills
    O->>MM: retrieve top-k memories
    O->>Q: plan(context) [if planner stage]
    O->>LLM: stage prompt
    LLM-->>O: stage artefact
    O-->>C: trajectory + narration (SSE)
    C-->>U: "๐Ÿ’ก Drafted hypothesesโ€ฆ"
    U->>C: feedback โ„ฑ
    C->>O: POST /feedback
    O->>FQ: enqueue (x, y, โ„ฑ)
    O->>LLM: distil trajectory
    LLM-->>O: new skills + memories
    O->>SB: persist
    O->>MM: persist
  end
  O->>SDPO: drain queue
  SDPO->>Q: update LoRA via Eq. 14-15
  Note over Q: User's preferences are now<br/>internalised in the planner.

Co-evolution sequence

Per-user filesystem layout

data/users/<user_id>/
โ”œโ”€โ”€ profile.json
โ”œโ”€โ”€ skills/
โ”‚   โ”œโ”€โ”€ skill-1a2b3c4d.json
โ”‚   โ””โ”€โ”€ โ€ฆ
โ”œโ”€โ”€ memories/
โ”‚   โ”œโ”€โ”€ mem-9f8e7d6c.json
โ”‚   โ””โ”€โ”€ โ€ฆ
โ””โ”€โ”€ lora/
    โ””โ”€โ”€ <user_id>/
        โ”œโ”€โ”€ adapter_config.json
        โ””โ”€โ”€ adapter_model.safetensors

runs/
โ”œโ”€โ”€ workspaces/proj-<id>/    # โ† CodingStage writes here
โ”‚   โ”œโ”€โ”€ run.py
โ”‚   โ”œโ”€โ”€ analysis.py
โ”‚   โ””โ”€โ”€ tables/, figures/
โ”œโ”€โ”€ papers/proj-<id>/        # โ† WritingStage writes here
โ”‚   โ”œโ”€โ”€ paper.tex
โ”‚   โ””โ”€โ”€ paper.pdf            # if pdflatex/tectonic installed
โ””โ”€โ”€ <run-id>/
    โ””โ”€โ”€ events.jsonl         # full audit trail (one line per event)

What runs where

Stage Inputs Output artefact LLM role
Ideation Topic, profile, skills, memories IdeationArtefacts (h*) IDEATION
Planning h*, profile Blueprint (peer-reviewed) PLANNING + REVIEW
Coding Blueprint GeneratedProject + ExecutionResult CODING + DEBUG
Analysis ExecutionResult AnalysisReport ANALYSIS
Writing Blueprint + Analysis PaperDraft + CompiledPaper WRITING + REVIEW

Key design decisions