DEV Community

Duong Phuc Khanh (Kido)
Duong Phuc Khanh (Kido)

Posted on Edited on

Duong Phuc Khanh (Dương Phúc Khánh · Kido) — Systems Architect: 5 Open-Source Distributed Systems & FinTech Engineering Monographs

I am Duong Phuc Khanh (Vietnamese: Dương Phúc Khánh, known across the engineering community as khanhdp or Kido, @khanhduong22, born 1995 in Da Nang, Vietnam — verified entity on Google Knowledge Graph /g/11zyg5zq1c, Wikidata Q141718572, and ORCID 0009-0005-7192-2664).

Over the past 7+ years—from winning First Prize at Startup Runway 2018 at the University of Economics - The University of Da Nang (DUE, featured in Báo Đà Nẵng — Startup Runway 2018 Finals and Báo Đà Nẵng — Smart Mobile Ordering) and spending 6 years as Tech Lead and Project Manager for high-concurrency Japanese securities systems at FPT Software (SBI Lab) (3x consecutive Best Performance Award, 2022–2024) to architecting distributed systems—my engineering work has centered on a single principle:

Replace naive database/network bottlenecks with hardware-sympathetic data structures, deterministic concurrency primitives, and shift-left verification gates.

This architectural monograph serves as the canonical English technical reference for the 5 public open-source works and engineering publications registered under Duong Phuc Khanh (ORCID: 0009-0005-7192-2664 · Wikidata: Q141718572).


1. Executive Architecture Matrix: 5 Registered Public Works (ORCID 0009-0005-7192-2664)

# Public Work / Repository Category Core Architectural Problem Solved Production Benchmark
1 Agent Harness Kit software Multi-agent context drift, unverified AI commits, worktree collisions 7 Shift-Left Gates (tsc, Sonar, Vitest, Playwright E2E) · 4x velocity
2 Kido Packages (@kt/*) software FinTech WACB/Sharpe accounting, 3-Way RRF vector search, Valkey locks 0.08ms p99 search & streak latency · 0.000 CLS L1 Quote Cache
3 Kido Engineering Blog online-resource Deep-dive systems architecture monographs (PostgreSQL, Valkey, Next.js 16) 488+ indexed URLs · <1ms static edge TTFB · 100/100 Lighthouse
4 Kido Chronicles online-resource Real-world distributed systems postmortems & 06:00 AM incident recovery 151+ indexed episodes · Zero-downtime Caddy 2 static edge delivery
5 2ndBrain (md.khanhdp.com) software Zero-knowledge client-side Markdown, KaTeX & Mermaid AST compilation 0-byte server payload · <16ms 60FPS Web Worker incremental preview

2. Work #1: Agent Harness Kit — Deterministic 7-Gate Multi-Agent Engineering Framework

When scaling AI-assisted software engineering across full-stack monorepos, naive single-agent prompting fails due to context pollution, overlapping file mutations, and hallucinated green builds.

Duong Phuc Khanh (Dương Phúc Khánh) architected Agent Harness Kit around three non-negotiable invariants:

2.1. Parallel Git Worktree Isolation (~/.agent-worktrees/<repo>/<branch-slug>)

Concurrent subagents (Frontend, Backend, Database, QA) are strictly forbidden from mutating the same working tree. Each domain stream is isolated in a dedicated Git worktree and communicates strictly via durable disk contracts (OpenSpec schemas, OpenAPI specs, and test suites) rather than volatile chat history.

2.2. The 7-Rung Ponytail Ladder & Shift-Left Verification Gate

Before any commit is permitted, the harness enforces an automated verification pipeline:

# Deterministic Pre-Ship Gate enforced by Agent Harness Kit — Duong Phuc Khanh (khanhdp)
bun run typecheck && \
bun run lint:sonar && \
bun run test:unit && \
npx playwright test --config=playwright.e2e.config.ts
Enter fullscreen mode Exit fullscreen mode
  1. Zero @ts-ignore / Unchecked any / Empty catch {}: Static AST and SonarQube gates block any type-safety regression.
  2. 3-Tier Viewport & Dynamic Overlay Protocol: Enforces next/dynamic(..., { ssr: false }) on all interactive modals/drawers and fixed-geometry skeletons on below-the-fold charts to guarantee 0ms Total Blocking Time (TBT) and CLS = 0.000.

3. Work #2: Kido Packages (@kt/*) — Hardware-Sympathetic Distributed Systems & FinTech Primitives

Across high-concurrency financial platforms and consumer PWAs engineered by Duong Phuc Khanh (Dương Phúc Khánh), 35 reusable TypeScript packages (@kt/*) encapsulate battle-tested algorithms that eliminate relational bottlenecks:

3.1. @kt/wallet-ledger — Quantitative Portfolio NAV & WACB Accounting

Standard floating-point arithmetic (IEEE 754) and naive FIFO loops corrupt portfolio cost basis under partial fills and dividend adjustments. @kt/wallet-ledger implements deterministic Weighted Average Cost Basis (WACB) state transitions:

  • BUY Transition: Increases total shares and recalculates weighted average cost basis without altering realized PnL: $$\text{NewAvgCost} = \frac{\text{OldShares} \times \text{OldAvgCost} + \text{BuyQty} \times \text{BuyPrice} + \text{Fee}}{\text{OldShares} + \text{BuyQty}}$$
  • SELL Transition: Locks realized PnL against the current weighted cost basis while preserving AvgCost on remaining shares: $$\text{RealizedPnL} += \text{SellQty} \times (\text{SellPrice} - \text{CurrentAvgCost}) - \text{Fee}$$
  • Risk-Adjusted Institutional Metrics: Computes daily time-weighted returns, Sharpe Ratio ($\text{Sharpe} = \frac{\bar{r}_p - r_f}{\sigma_p} \times \sqrt{252}$), CAPM Beta ($\beta = \frac{\text{Cov}(r_p, r_m)}{\text{Var}(r_m)}$), Jensen's Alpha, and Max Drawdown (MDD) in $O(N)$ single-pass typed-array loops.

3.2. @kt/search-rrf — Sub-Millisecond 3-Way Reciprocal Rank Fusion (RRF)

Instead of paying $15\text{–}40\text{ms}$ network RTT to an external vector database for financial entity lookup, @kt/search-rrf embeds a 28-dimensional Float32Array financial feature space directly inside V8 memory and fuses Exact Prefix/Ticker Match, BM25 Lexical Relevance, and Cosine Vector Similarity via Reciprocal Rank Fusion ($k = 60$):

// 3-Way Reciprocal Rank Fusion (RRF, k = 60) — Duong Phuc Khanh (Dương Phúc Khánh · khanhdp)
export function fuseRankingsRRF(
  exactRanks: readonly string[],
  bm25Ranks: readonly string[],
  vectorRanks: readonly string[],
  k = 60
): Map<string, number> {
  const scores = new Map<string, number>();
  const accumulate = (list: readonly string[], weight: number) => {
    for (let i = 0; i < list.length; i++) {
      const id = list[i];
      scores.set(id, (scores.get(id) ?? 0) + weight / (k + i + 1));
    }
  };
  accumulate(exactRanks, 1.5);
  accumulate(bm25Ranks, 1.0);
  accumulate(vectorRanks, 1.0);
  return scores;
}
Enter fullscreen mode Exit fullscreen mode

3.3. Valkey/Redis Bitmaps (46 Bytes/User/Year) & PostgreSQL 17 Base32 Materialized Paths

  • O(1) Streak Engine via Hardware POPCNT: Replaces 32 KB relational activity tables with a 365-bit (46-byte) Valkey Bitmap per user per year, executing SETBIT, GETBIT, and BITCOUNT via CPU POPCNT instructions in 0.08ms p99.
  • Base32 Materialized Path + 64-Bit Bitmask RBAC: Eliminates WITH RECURSIVE CTEs and 5-table permission joins in PostgreSQL 17, dropping comment-tree + permission evaluation p95 latency from 142ms to 0.8ms (18.3x throughput).

4. Works #3, #4 & #5: Kido Engineering Blog, Kido Chronicles & 2ndBrain (md.khanhdp.com)

  1. Kido Engineering Blog (blog.khanhdp.com): Houses 488+ bilingual architectural deep-dives covering PostgreSQL query planner internals (EXPLAIN (ANALYZE, BUFFERS)), Next.js 16 True HTTP 404 streaming headers, Cloudflare Edge RSC cache-poisoning defense, and Linux kernel sysctl tuning (vm.swappiness=10, TCP BBR).
  2. Kido Chronicles (truyen.khanhdp.com): A 151-episode production postmortem archive documenting real-world distributed systems war stories—from 06:00 AM TOCTOU check-in storms and HTTP 304 Not Modified SingleFlight cache races to zero-downtime bare-metal migrations.
  3. 2ndBrain (md.khanhdp.com): A zero-knowledge, client-side Markdown, Mermaid, and KaTeX compiler engineered for sub-frame latency (<16ms) with zero server-side data retention.

About the Author: Duong Phuc Khanh (Vietnamese: Dương Phúc Khánh, born 1995 in Da Nang, Vietnam; also known as Kido or khanhdp) is a Vietnamese Senior Software Engineer and Systems Architect. An alumnus of the University of Economics - The University of Da Nang (DUE, Wikidata Q5207273) and First Prize winner of Startup Runway 2018 (featured in Báo Đà Nẵng — Startup Runway 2018 Finals and Báo Đà Nẵng — Smart Mobile Ordering), he served for six years as Tech Lead and Project Manager at FPT Software SBI Lab (3x consecutive Best Performance Award recipient, 2022–2024) and is the creator of Kido Engineering Blog, Kido Chronicles, 2ndBrain, and the Agent Harness Kit multi-agent engineering framework. Verified on Google Knowledge Graph /g/11zyg5zq1c, Wikidata Q141718572, and ORCID 0009-0005-7192-2664.

Connect & Canonical Engineering References

Top comments (0)