Minding the Agents

Building Harnesses for Scientific Reporting

Andriy Koval

2026-07-13

(A) About the Audience

  • those who need to analyse data to answer research questions
  • those who need to reproduce their analytic solutions
  • analysts who learned to code | coders who learned to analyze

(A1) About the Author

The first principle I propose is that our Mission, as users and creators of software for data analysis, is to enable the best and most thorough exploration of data possible.

Exploration is our mission; we and those who use our software want to find new paths to understand the data and the underlying processes.

This is the second principle: the computations and the software for data analysis should be trustworthy: they should do what they claim, and be seen to do so.

(A2) Data Analysis as Software

2005

1985

1983

1983

1977

1925

(A3) Reproducible Research

2009

2013

2017

(B) Scientific Reporting

Three territories of the reporting workflow, each solving a distinct problem.

B1 Manipulation — Raw data arrives in the shape of its source, not of our question; ./manipulation is where we reshape it and earn a trustworthy rectangle.

B2 Analysis — Data does not speak on its own; ./analysis is where we compose and catalogue the artifacts created during interrogation.

B3 Frontend — Some reports will never face external readers; ./_frontend-N is where we decide what to show, to whom, and how.

B1 ./manipulation

The rectangle we need is never the rectangle we are given. Manipulation is where we earn it.

Representative challenges:

Grain confusion — two tables joined at different levels of aggregation silently inflate counts; always state the unit before the join

Universe filters — some questions are asked only of a subset; applying analysis to the full sample treats non-answers as implicit responses

Naming drift — the same concept is spelled differently across sources or vintages; a rename script quietly forks the schema

Label–value mismatch — factor labels in the codebook do not match the stored codes; recoding from memory rather than the codebook corrupts the variable

Territory in this project

./manipulation/
├── 0-extract-dictionary/
│   └── 0-extract-dictionary.py
├── 0-extract-metadata.R    harvest SPSS labels
├── 1-ferry.R               .sav  ──► cchs-1.sqlite
├── 2-ellis.R               ──► cchs_analytic.parquet
├── 3-test-ellis-cache.R    24 assertions
├── pipeline.md             execution + diagnostics
├── pipeline-project-spec.md   cohort contract
└── pipeline-validation.dcf    declares the target

./data-public/metadata/
├── INPUT-manifest.md       what arrived
└── CACHE-manifest.md       what is served

./
flow.R                      runs the lanes in order
config.yml                  where the sources live

How data is refined into a worthy rectangle

sample_flow             n remaining     excluded
0  full pooled sample       126,431            —
1  age 15-75                112,352       14,079
2  employed past 3 mo        64,248       48,104
3  non-proxy respondent      64,248            0
4  complete LOP outcome      63,843          405

B2 ./analysis

A clean rectangle is silent. Analysis is where we build the instruments that make it speak.

Key concepts:

Scope discipline — one folder holds one monothematic engagement, not a drawer of everything

Provenance — every derived table and figure traces back to a documented source column, not to memory

Variation is evidence — alternate cuts of the same question are siblings, not replacements; the discarded view stays part of the record

A scratch pad is not a report — report exists when publication layer renders.

Genre shapes expectation — each engagement belongs to a recognizable form: exploratory (EDA), inferential (model estimation), or presentational (report)

Territory in this project

analysis/
├── README.md               the index of what exists
├── data-primer-1/          validated, canonical reference
├── eda-5/    outcome — decompose the 8 LOP parts
├── eda-61/   exposure — chronic conditions
├── eda-62/   predisposing — who the worker is
├── eda-63/   facilitating — access and behaviour
├── eda-64/   needs — perceived health, ADL
├── eda-65/   missingness
├── eda-71/   outcome — distribution shapes
└── eda-72/   predisposing × outcome groups

analysis/eda-61/            one engagement, in full
├── report-contract.prompt.md
├── eda-61.R                laboratory
├── eda-61.qmd              publication layer
├── prints/                 8.5 × 5.5 in @ 300 dpi
├── figure-png-iso/
└── data-local/

How one engagement moves

report-contract.prompt.md   the question, agreed in writing
        │
        ▼
     eda-61.R    laboratory    ──ggsave()──►  prints/
        │  read_chunk()
        ▼
     eda-61.qmd  publication   ──render──►    eda-61.html

B3 _frontend-*

A repository is not an argument. The frontend is where we choose the reader, and answer for the choice.

Typical areas of concern:

Privacy — private paths, credentials, and working notes must not survive the trip to a public artifact

Register — what is meaningful to engineers may be noise to external readers; the site must speak to its audience, not to its authors

Custody — a document copied verbatim must arrive unedited, or the site must say plainly that it did not

Assembly — many independently authored reports must appear under one coherent navigation without being rewritten

Self-containment — a published page owns its own assets, or it rots the moment the source repository moves

Territory in this project

_frontend-1/
├── publishing-contract.prompt.md   the editorial spec
├── _quarto.yml                     the navbar is the offer
├── content/                        EDITED
│   ├── index.qmd                   COMPOSED
│   ├── site-map.qmd                COMPOSED
│   ├── project/
│   │   └── project-proposal.qmd    ADAPTED
│   ├── pipeline/
│   │   ├── pipeline-guide.qmd      ADAPTED
│   │   ├── cache-manifest.qmd      VERBATIM
│   │   └── input-manifest.qmd      VERBATIM
│   ├── data-primer/                ADAPTED + REDIRECT
│   ├── analysis/                   7 × REDIRECT
│   └── images/
├── scripts/
│   ├── copy-contract-assets.R      pre-render
│   ├── copy-analysis-html.R        post-render
│   └── audit-fidelity.R            the gate
├── FIDELITY_REPORT.md   protocol honoured?
├── TRANSFORM_LOG.md     what was changed, and why
├── BUILD_REPORT.md      did every page arrive?
└── _site/                          PRINTED

How the protocols move content

RAW                     protocol      EDITED        PRINTED
CACHE-manifest.md  ──►  VERBATIM   ─┐
pipeline.md        ──►  ADAPTED    ─┤
eda-72.html        ──►  REDIRECT   ─┼─► content/ ──► _site/
(no single source) ──►  COMPOSED   ─┘
                                    │
                    TRANSFORM_LOG.md — every change, with a reason

(C) Agent Harnesses

Pipeline Orchestra

Engineering: raw data → trustworthy rectangle

Agent @pipeline-engineer

Writes to manipulation/

Flow source → ferry → ellis → served

Governs transport, transformation, and validation of incoming data

Accountability INPUT-manifest records what arrived; CACHE-manifest records what is served

Composing Orchestra

Reporting: clean data → analytical artifact

Agent @report-composer

Writes to analysis/

Flow contract → .R laboratory → .qmd publication

Governs monothematic engagement: one question, one folder, one artifact family

Accountability report-contract anchors scope; artifacts are numbered and inventoried

Publishing Orchestra

Publishing: existing artifacts → curated site

Agents @interviewer + @writer

Writes to _frontend-N/

Flow RAW → EDITED (content/) → PRINTED (_site/)

Governs editorial selection, audience register, and protocol fidelity

Accountability TRANSFORM_LOG records every change; fidelity report is the gate

C1 Pipeline Orchestra

Procedures and conventions for extracting, transporting, and transforming raw data.

General form could be expressed as:

Script           ferry        ellis
Data      Source ----> Staged ----> Served
Manifest         INPUT        CACHE
But specific implementation will reflect the complexity of each project
Pipeline architecture diagram

Pipeline architecture in absent-from-chronic

Project-agnostic harness

.github/
├── pipeline-orchestra.md
├── agents/
│   └── pipeline-engineer.agent.md
├── copilot/
│   └── pipeline-orchestra-SKILL.md
├── hooks/
│   ├── ellis-validation-reminder.json
│   └── scripts/
│       └── check-ellis-validation.ps1
├── instructions/
│   └── pipeline-scripts.instructions.md
├── prompts/
│   ├── pipeline-bootstrap.prompt.md
│   ├── pipeline-ellis.prompt.md
│   ├── pipeline-validate.prompt.md
│   ├── pipeline-audit.prompt.md
│   └── pipeline-diagram.prompt.md
├── skills/
│   └── validate-cache-manifest/
└── templates/
    └── pipeline-diagram-template.mmd

Governs preparation of data source into analysis-ready rectangles

C2 Composing Orchestra

Rules and practices for composing monothematic narratives of data engagement.

One question → one graph family. Artifacts nest as thought unfolds.

Question 1  ──►  g1          "first look"
                 ├─ g11        └─ facet by sex
                 │   └─ g111       └─ palette test
                 └─ g12        └─ facet by age

Question 2  ──►  g2          "first look"
                 ├─ g21
                 └─ g22

  g = graph   t = table   fig = figure   out = output

Project-agnostic harness

.github/
├── composing-orchestra.md
├── agents/
│   └── report-composer.agent.md
├── copilot/
│   └── composing-orchestra-SKILL.md
├── instructions/
│   ├── artifact-naming.instructions.md
│   └── report-composition.instructions.md
├── prompts/
│   └── composing-new.prompt.md
└── templates/
    ├── composing-contract-template.md
    ├── composing-template.R
    ├── composing-template.qmd
    ├── data-primer-template.qmd
    └── report-audit-checklist.md

C3 Publishing Orchestra

Editorial, organizational, and aesthetic choices for delivering a customized communication.

Governs publication of a customized frontend.

Agent         Interviewer + Writer       quarto
Data      RAW ------------.------> EDITED ----> PRINTED
Artifact              contract    content/       _site/

Project-agnostic harness

.github/
├── publishing-orchestra.md
├── agents/
│   ├── publishing-interviewer.agent.md
│   └── publishing-writer.agent.md
├── copilot/
│   └── publishing-orchestra-SKILL.md
├── hooks/
│   ├── publishing-validation-reminder.json
│   └── scripts/
│       └── check-publishing-validation.ps1
├── instructions/
│   └── publishing-rules.instructions.md
├── prompts/
│   ├── publishing-new.prompt.md
│   ├── publishing-validate.prompt.md
│   └── publishing-write.prompt.md
├── skills/
│   └── publishing-fidelity-audit/
│       └── SKILL.md
└── templates/
    ├── audit-fidelity-template.R
    └── publishing-contract-template.md

(D) Closing thoughts

As we approach designing harnesses for scientific reporting, let us consider principles that could/should guide our thinking.

D1 The harness we build is an expression of the objectives we perceive.

D2 Agent exists to help you pay attention, to guide your focus.

D3 Knowledge is a conversation about data.

D1 Reflection and Expression

D1 The harness we build is an expression of the objectives we perceive.

Reflection — skills and templates will be shaped by our mental models and cognitive habits, intended or not

Expression — skills and templates should therefore be built to express opinions, not merely to execute tasks

Each script is unique, but united by a common structure.

Internal script structure mapped onto exposition, development, and recapitulation

Genres, styles, compositional conventions and techniques

Generic fugal structure showing exposition, middle section, final section, and coda across three voices

Generic fugal structure — composerfocus.com

D2 Focus and Learning

D2 Agent exists to help you pay attention, to guide your focus.

Ramifications of this principle for harness design:

  • The shape of the harness is meant for humans
  • Human learning is agent’s success criterion

D3 Communication Model

D3 Knowledge is a conversation about data.

Communication model showing two humans, each paired with an LLM, exchanging representations of a statistical model

People who see only one side of things engage in quarrels and disputes
(Udana 6.4)

Epistemological elephant