Portfolio and notes

Haowei Chan

I build web products and AI systems, document engineering decisions, and keep a public trail of projects, technical notes, and experiments.

Featured

Projects

TinBoker — AI Audio & Podcast Knowledge Platform

An AI-native content platform combining unstructured speech processing, LangGraph multi-agent DAGs, and tiered caching.

React 19TypeScriptViteFastAPIPython 3.12LangGraphRedisDockerCaddy

Architecture & Key Features

  • Multi-Agent Topology: Filters ad noise, dynamically consolidates chapters by length, and extracts key insights.
  • Step-by-step Checkpoints: Stores Raw / Checkpoint / Serving data layers for rerun_from failure recovery.
  • Tiered Caching: FastAPI + Redis cache-aside with Single-Flight locks to prevent cache stampedes.

Kuroshio — Open-Source Quantamental Portfolio Engine

Multi-factor screening, LLM agent research, and IPS-driven rebalancing proposals. It ranks, argues, and proposes — it never places an order.

Python 3.11+Multi-Agent ResearchIPS Policy EngineBacktestApache-2.0

Architecture & Key Features

  • Screen: multi-factor momentum screeners for US and TW equities, scored by cross-sectional percentile so both markets sit on one scale.
  • Research: one LLM agent pass per holding, facet-cached so a daily run costs cents rather than dollars.
  • Propose: challenger-vs-weakest-incumbent swap cards, each citing the IPS clause that triggered it — resource competition instead of a binary veto.

Hermes Agent — Resident Personal AI Assistant System

Dual-entry resident assistant with Discord gateway, cron scheduler, plain-text vault memory, and automated portfolio tracking.

Python 3.11Discord GatewayCron SchedulerObsidian VaultGit SweeperShioaji APISchwab API

Architecture & Key Features

  • Channels as Roles: Configures Discord channels as Kuroshio desk (#trading), report feeds (#reports), and research (#research).
  • Automated Portfolio Engine: Daily encrypted PDF statement parsing, Schwab/Shioaji API integration, T+2 settlement calculations, and auto-charting.
  • Single Git Sweeper: Decouples file writing from Git operations with scheduled automated commits & rebases.

TaifexDesk — TAIFEX Futures & Options Trading Infrastructure

Backtesting, paper trading, and live execution on one engine for Taiwan index futures, single-stock futures, and TXO options — Python + FastAPI backend, React war-room dashboard, shioaji broker adapter.

PythonFastAPIReactShioajiBacktestingPaper TradingRisk Engine

Architecture & Key Features

  • Signals separated from execution: a strategy is just an entry / add / stop policy triple, so the engine ships open-source while the strategies stay private.
  • Intra-bar stop checking: reconstructs a plausible price path from OHLC, so a bar whose low pierced the stop counts as stopped out — removing the systematic optimism of close-only backtests.
  • One cost model everywhere: backtest, paper, and live share the same commission and tax math, so results do not drift apart as the index moves.

Latest

Writing

Every Node Reported Success and the Output Was Still Wrong: Debugging Partial Success in a Content Pipeline

A reader said "every post has a fair few typos", but that month no node in the pipeline had failed once. Six defects, none of them a failure: every one was a component doing exactly what it was told, returning 200, then going wrong in the inch it was never told about. Plus the question I now keep on my review list: is this success signal load-bearing?

Predeclare and Three Gates: Building Internal Controls for Factor Research

Researcher degrees of freedom are the real adversary in quantitative research. From predeclaration, orthogonality prescreens, and Gate A to the neutralization ladder and a forward shadow book: a control process I have run for over a year and violated a few times myself. It does not guarantee profit; it guarantees I can tell when a result is fake.

The Last Mile of a Cloud Exit: Moving 140GB of Media and Every Secret Onto My Own VPS

Large immutable files and small highly sensitive config are the two poles a database migration never covers: an in-place storage-layer swap, a three-tier secret resolution order, half-finished-work archaeology, and the discipline of export, off-site backup, reconcile, only then delete.

From a Document Database Back to PostgreSQL: A Six-Phase Data Layer Exit Playbook

How to cut a migration that touches every read and write path into six independently shippable, independently reversible phases: same-interface swaps, the dual-write safety net, write-stop as the only irreversible point, and the fourteen production bombs adversarial review caught.

When the Cloud Bill Jumps 20x Overnight: A Full Forensic Trail of a Database Traffic Leak

The bill went from a few hundred NTD to over forty thousand, and nobody broke in — every cent was spent by my own code. A five-layer drill-down from invoice total to function name, and why payload x distance costs more than read count.

Automating Portfolio Tracking and Broker Report Ingestion: From Encrypted PDFs to Daily Account Equity Pipelines

Resident Personal Assistant Series: Parsing encrypted PDF statements, integrating multi-broker APIs, handling T+2 settlement lags, and building automated research report crawlers.

My Personal Assistant Is Not a Chatbot

Building a resident assistant on Hermes Agent: six traits that stop it being a chatbot, what is genuinely clever about the Hermes agent mechanism, and the day it became trustworthy.

FastAPI + Redis: Tiered Cache Design for Read-Heavy APIs

Full-Stack Architecture Series: Not all APIs deserve the same TTL. How to combine Edge CDNs, Redis in-memory caching, and Cache-Aside patterns to prevent Cache Stampedes.

Dev / Staging / Production: Environment Layering Strategies for Small Teams

Environment layering is not enterprise ceremony, but a risk-reduction pattern: how to boost release reliability using branch-to-environment mapping, preview deploys, secrets isolation, and production guardrails.

Designing a Reliable Agentic Ingestion Pipeline (Part 2): Step-by-Step Checkpoints, Reasoning Token Budgets, and Pre-Persistence Gates

Production lessons: Step-by-step checkpoints and rerun_from recovery, preventing reasoning model token truncation, pre-persistence gates, and concurrency budgets.

Designing a Reliable Agentic Ingestion Pipeline (Part 1): From Single-Prompt Bottlenecks to LangGraph Multi-Agent Workflows

How an unstructured financial podcast data pipeline evolved from a single prompt into a decoupled multi-agent topology using LangGraph.