AI Market Dashboard project evidence

Trading Brief Eval Harness

This page explains the Neon-backed evaluation harness that checks whether an AI trading brief follows the right trading rules before the result is trusted. It is written twice: once like you are 12, and once like a technical reviewer is reading your portfolio.

Explain It Like I Am 12

The problem

An AI can sound confident even when it is wrong. In trading, a wrong "GO" or a missed risk flag can teach the wrong lesson.

The simple idea

We give the AI a quiz. Each question is a trading setup. The answer must say GO, WATCH, or PASS, plus the right score and risk words.

What Neon does

Neon is the online database. It already stores real dashboard picks, so the quiz can use real examples instead of fake ones.

What the harness does

The harness checks the answer. If the score is too low, the build should fail, like a school test that needs a passing mark.

Easy mental model: this is a spell-checker for AI trading judgment. It does not trade. It checks whether the AI explanation follows the rules you already decided.

Professional Explanation

The trading brief eval harness is a deterministic quality gate for LLM-assisted trading analysis. It converts real `AListCandidate` rows from Neon Postgres into eval cases and candidate result files, then scores verdict accuracy, Conviction Score range, setup classification, risk flags, forbidden failure modes, and rationale coverage.

The point is not to predict market outcomes. The point is to prevent regressions in the reasoning contract: a pullback should not be failed only because RVOL is low, a breakout should require volume expansion, and a parabolic chase should not be promoted as a clean GO.

1NeonStores real dashboard A-list candidates.
2ExporterReads rows through Prisma and writes local JSON.
3Golden SetDefines expected verdict, tags, flags, and phrases.
4Eval RunnerScores candidate outputs against the expected contract.
5GateFails if aggregate score drops below the threshold.

Tech Stack Used

Data

Neon Postgres

Serverless PostgreSQL database that stores the dashboard's real A-list trading rows.

ORM

Prisma

Typed database client used by the Node script to query `AListCandidate` safely.

Runtime

Node.js

Runs the command-line scripts that export eval data and score it.

Script format

MJS

JavaScript module files used for Node automation scripts with modern `import` syntax.

Fixtures

JSON

Portable files for eval cases and results. Easy for humans and scripts to inspect.

Automation

npm + GitHub Actions

npm runs local commands. GitHub Actions can run the gate on pull requests.

Example Use Cases

Use caseWhat it catchesWhy it matters
Prompt change reviewA new prompt starts calling weak setups GO.Stops quiet quality regressions before deployment.
Model comparisonClaude, Gemini, DeepSeek, or OpenAI disagree on the same cases.Lets you compare cost, latency, and quality with a score.
Trading-rule changeA pullback rule gets treated like a breakout rule.Protects the wiki strategy from being accidentally reversed.
Portfolio evidence"I built an AI app" with no quality proof.Shows production AI engineering: evals, real data, and gates.

What Is `.mjs`, and Why Use It?

What `.mjs` means

`.mjs` means "JavaScript module." It is still JavaScript, but it tells Node.js to use the modern module system where files can say `import fs from "node:fs"`.

What it is typically used for

Build scripts, command-line tools, data exporters, repo automation, and scripts that need clean imports without changing the whole project configuration.

Why not `.js` here?

A `.js` file can mean old CommonJS or modern modules depending on `package.json`. A `.mjs` file removes the guessing and always runs as a modern module.

Why it fits this project

The exporter and eval runner are Node scripts, not React UI components. `.mjs` is a clean fit for automation that imports Prisma, reads files, writes JSON, and exits.

import fs from "node:fs/promises";
import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient();

Line-by-Line System Walkthrough

File or commandWhat it doesBeginner translation
export-neon-trading-eval.mjsConnects to Neon with Prisma, reads `AListCandidate`, and writes generated JSON fixtures.Take real dashboard examples out of the database and turn them into quiz questions.
neon-golden-set.jsonStores the expected answer for each generated case.The answer key.
neon-results.jsonStores the baseline output being tested.The student's answers.
eval-trading-brief.mjsCompares each result against the expected verdict, score range, tags, flags, and rationale.The teacher grading the quiz.
npm run eval:trading-brief:neonExports Neon rows, then immediately runs the eval gate.Make the quiz from real data, then grade it.
trading_brief_eval.ymlGitHub Actions workflow that can run the eval gate during code review.A robot checker in GitHub.

The Agentic Loop Used

This work follows the agent-loop pattern from the AI engineering wiki: reason, act, observe, then decide whether the work is done.

ReasonDefine the checkable goal: explain the eval harness and prove it can use real Neon data.
ActAdd the exporter, npm scripts, HTML explainer, and resume project link.
ObserveRun the build, run the eval commands, and open the page in a browser.
Done?Stop only if the page renders, the resume link exists, and the eval gates pass.

Validation Target

The working validation target for this project is concrete and machine-checkable:

npm run eval:trading-brief
npm run eval:trading-brief:neon
npm run build

The Neon-backed run exports 24 rows from `AListCandidate`, generates local ignored files, and checks that the aggregate score is at least 80%. The last verified result was 100% over 24 generated cases.

Private data guardrail: generated Neon files are kept under `evals/trading-brief/generated/` and ignored by git because they may include real tickers and trading records.