Harness Engineering

Harness mới là sản phẩm.Model chỉ là một ô. The harness is the product.The model is one box.

Mục tiêu: mỗi ngày một reel không lộ mặt, không cần người trong luồng chính. Một lần gọi LLM, năm chặng code, hai vòng lặp có giới hạn. Goal: one faceless reel a day, no human on the main path. One LLM call, five code stages, two bounded loops.

Pipeline: six stages, two bounded retry loops, one feedback loop observability 01Context buildercode 02Script + shot listLLM · 1 call 03Policy gaterules 04Render runtimecode + MCP 05Verifycode 06PostedMCP chặn≤ 2 trả lại≤ 2 blocked≤ 2 rejected≤ 2 hết lượt→ người out of tries→ human retention hôm nay = ngữ cảnh ngày mai today's retention = tomorrow's context đầu vào có căn cứbản nhápđã duyệtđã renderđạt grounded inputproposed postapprovedrenderedaccepted
Nét đứt là quyết định lúc chạy. Mọi vòng quay lui đều có số đếm, kể cả vòng ở chặng 03 mà ảnh gốc bỏ quên. Dashed means decided at runtime. Every back-edge has a counter, including the stage 03 loop the original image forgot.

Ảnh gốc cần chỉnh bốn chỗFour things the original image gets wrong

Nên xây tới đâuHow far to build

Câu hỏi thật không phải dùng chặng nào, mà là xây tới mức nào. Bắt đầu từ mức không xây gì.The real question isn't which stage, but how far to build. Start from building nothing.

Khi nào không cần gì cảWhen you need none of this

  • Chưa đăng tay đều đặn được 30 ngày.
  • Đăng ít hơn ba bài một tuần.
  • Định dạng chưa ổn định, hoặc kênh sống nhờ cá tính người làm.
  • Chưa đo được retention.
  • You haven't posted by hand consistently for 30 days.
  • You post fewer than three times a week.
  • The format isn't stable, or the channel lives on the creator's personality.
  • You can't measure retention yet.

Phương án rẻ nhất: mỗi Chủ nhật nhờ LLM trong khung chat viết bảy kịch bản, tự sửa, dựng bằng một template cố định, hẹn giờ bằng công cụ có sẵn của nền tảng. Sau một tháng bạn biết chính xác bước nào đáng tự động hoá.

Cheapest alternative: every Sunday, have an LLM in a chat window draft seven scripts, edit them yourself, cut them on one fixed template, and schedule with the platform's built-in tool. After a month you'll know exactly which step is worth automating.

  1. L0Chưa qua phần trênYou fail the checks aboveLàm tay, chưa xây gìDo it by hand, build nothing
  2. L1Viết kịch bản tốn thời gian nhấtScriptwriting is the biggest time sink01 + 02 · bạn duyệt và tự dựng· you review and edit
  3. L2Dựng video tốn thời gian nhấtVideo editing is the biggest time sink01 + 02 + 04 + 05 · bạn duyệt rồi tự đăng· you review, then post
  4. L3L2 chạy ổn hai tuần, phải sửa dưới 10%L2 stable for two weeks, under 10% edited+ 03 + 06 · đăng tự động· auto-post
  5. L4API nền tảng trả retention theo thời điểmThe platform API returns retention over timeBật vòng "what got saved"Turn on the "what got saved" loop

Một reel lỗi lọt ra ngoài? Tìm chặng nào đã báo "pass" sai. Sửa gate trước, sửa prompt sau.A broken reel slipped out? Find the stage that wrongly said "pass". Fix the gate first, the prompt second.

Tra cứu từng phầnReference

Sáu chặng, theo thứ tự chạySix stages, in run order

01

Context builder

LàmDo
posts_db(30) ─┐
source_today ─┴─► context.json ─► [02]
                  facts[] + URL, already_said[]

Gom đúng thứ model cần thấy: 30 bài gần nhất và nguồn hôm nay, mọi dữ kiện kèm URL.Gathers exactly what the model should see: the last 30 posts and today's source, every fact with a URL.

Dùng choUse for
Nhà máy nội dung hằng ngày, chatbot cần lịch sử, bản tin tổng hợp.Daily content factories, chatbots needing history, digest newsletters.
ĐượcGain
Ít bịa đặt, chống lặp, test được, gần như miễn phí.Less fabrication, no repetition, testable, nearly free.
MấtLose
Nguồn sai thì kịch bản sai rất trôi chảy; hỏng âm thầm khi trang nguồn đổi cấu trúc.A bad source yields a smoothly wrong script; breaks silently when the source page changes.

Đổi sự tự do tìm thông tin của model lấy việc biết chính xác model đã thấy gì.Trades the model's freedom to find information for knowing exactly what it saw.

Dấu hiệu cần:Signal: model hay lặp lại ý của tuần trước.the model keeps repeating last week's points.

02

Script + shot list

SinhGenerate
context.json ─► [LLM, pinned] ─► script.json
  hook · beats[5]{voice, on_screen, shot}
  claims[] → facts[i]

Lần gọi LLM duy nhất được quyết định nội dung. Trả JSON đúng schema, mỗi khẳng định trỏ về một dữ kiện.The only LLM call allowed to decide content. Returns schema-valid JSON; every claim points to a fact.

Dùng choUse for
Kịch bản theo khuôn, mô tả sản phẩm hàng loạt, biên bản họp theo mẫu.Template scripts, bulk product copy, minutes on a fixed template.
ĐượcGain
Một điểm bất định duy nhất, chi phí dự đoán được, đổi model không đụng chặng khác.One point of non-determinism, predictable cost, swap models without touching other stages.
MấtLose
Vẫn có thể bịa; năm nhịp cố định nhanh nhàm; model nâng cấp có thể đổi giọng âm thầm.Can still fabricate; five fixed beats get stale; upgrades can shift voice silently.

Đổi khả năng tự sửa nhiều vòng lấy chi phí cố định và một điểm lỗi dễ khoanh vùng.Trades multi-pass self-correction for fixed cost and one easily isolated failure point.

Dấu hiệu cần:Signal: mọi đầu ra có cùng cấu trúc, chỉ khác nội dung.every output shares a structure, only content differs.

03

Policy gate

KiểmCheck
audio_id ∈ licensed?   claim → facts[i]?
banned topic?          hook repeat?
all pass ─► [04]   any fail ─► [02] + reason

Bộ quy tắc chặn kịch bản trước khi tốn công render. Bị chặn thì quay về chặng 02, không bao giờ đi tiếp.Rules that block a script before render time is spent. Blocked goes back to 02, never forward.

Dùng choUse for
Nội dung công khai có rủi ro pháp lý, email marketing, agent được chạy lệnh.Public content with legal risk, marketing email, agents that run commands.
ĐượcGain
Chặn lỗi ở chỗ rẻ nhất; quy tắc đọc được, audit được; chạy trong mili giây.Catches errors where cheapest; rules are readable and auditable; runs in milliseconds.
MấtLose
Chỉ chặn thứ đã viết thành luật; "có trỏ nguồn" chưa phải "nguồn ủng hộ claim".Only blocks what's written down; "points to a source" isn't "the source supports it".

Đổi sự đa dạng và tốc độ ra bài lấy việc không bao giờ phải gỡ video đã đăng.Trades variety and speed for never taking down a published video.

Dấu hiệu cần:Signal: một lỗi có thể dẫn tới gỡ bài hoặc khiếu nại bản quyền.one mistake can mean a takedown or copyright claim.

04

Render runtime

LàmDo
voice ─► TTS ─► wav ─┐
shots ─► library ────┼─► ffmpeg ─► reel.mp4 9:16
captions + timing ───┘   (burned in)

Biến kịch bản thành video bằng TTS, ffmpeg và phụ đề in thẳng vào hình. Việc của máy, không phải của LLM.Turns the script into video with TTS, ffmpeg and burned-in captions. A machine job, not an LLM job.

Dùng choUse for
Video theo template, audiobook từ văn bản, báo cáo PDF định kỳ.Template video, audiobooks from text, periodic PDF reports.
ĐượcGain
Tất định, lỗi tái hiện được; render reel 60 giây dưới một phút.Deterministic, reproducible bugs; a 60-second reel renders in under a minute.
MấtLose
ffmpeg khó gỡ lỗi; giọng TTS và kho cảnh có hạn làm video giống nhau.ffmpeg is hard to debug; one TTS voice and a small library make videos look alike.

Đổi tay nghề của biên tập viên lấy một video mỗi ngày với chi phí gần bằng không.Trades an editor's craft for a daily video at near-zero cost.

Dấu hiệu cần:Signal: khung hình, font, nhịp cắt giống nhau giữa các video.framing, fonts and cut rhythm match across videos.

05

Verify

KiểmCheck
ffprobe        1080x1920, duration
silencedetect  speech < 1.5s
ebur128        true peak ≤ −1 dBTP
fail ─► [04] ×2 ─► human

Gate kiểm file video bằng code trước khi đăng. Trả lại render tối đa hai lần, rồi dừng.A code gate on the video file before posting. Back to render at most twice, then stop.

Dùng choUse for
Mọi pipeline ra file, CI/CD, kiểm JSON từ LLM.Any file-producing pipeline, CI/CD, validating LLM JSON.
ĐượcGain
Bắt sai tỷ lệ, mất tiếng, khung đen trước khi ai thấy; chạy vài giây.Catches wrong ratio, lost audio, black frames before anyone sees; runs in seconds.
MấtLose
Đúng kỹ thuật vẫn có thể nhàm; render lại cùng đầu vào thường ra cùng lỗi.Technically correct can still be boring; same input usually re-renders the same failure.

Đổi khả năng chấm chất lượng sáng tạo lấy sự chắc chắn tuyệt đối về chất lượng kỹ thuật.Trades judging creative quality for certainty about technical quality.

Dấu hiệu cần:Signal: đầu ra có đặc tả kỹ thuật đo được.the output has a measurable technical spec.

06

Posted

LàmDo
reel + caption ─► platform API ─► post_id
          24–72h later
retention ─► posts_db ─► [01] tomorrow

Lên lịch đăng qua API, rồi kéo số liệu về. Đây là chặng duy nhất không rút lại hoàn toàn được.Schedules via API, then pulls metrics back. The only stage that can't be fully undone.

Dùng choUse for
Kênh đăng theo lịch, đăng chéo nhiều nền tảng, thử A/B hook.Scheduled channels, cross-posting, A/B testing hooks.
ĐượcGain
Khép vòng phản hồi; đăng đúng giờ khi bạn vắng; gỡ nhanh bằng post_id.Closes the feedback loop; posts on time while you're away; fast takedown via post_id.
MấtLose
API đổi liên tục, cần kiểm duyệt, có quota; không dùng được nhạc trending.APIs change, need review, have quotas; no trending sounds.

Đổi lần nhìn cuối của con người lấy sự đều đặn không phụ thuộc lịch của bạn.Trades the last human look for consistency independent of your calendar.

Dấu hiệu cần:Signal: giờ đăng cố định mỗi ngày.the same publish time every day.

Thuộc tính của cả hệProperties of the whole system

Observability

Xuyên suốtCross-cutting
run_id=2026-10-02
[02] ok   6.1s $0.012
[03] FAIL claim#3 no source
[02] ok   (attempt 2)

Mỗi chặng ghi đầu vào, đầu ra, thời gian, chi phí và kết quả theo một mã chạy chung.Each stage logs input, output, duration, cost and result under one shared run ID.

Dùng choUse for
Pipeline chạy khi không ai nhìn, hệ có LLM, kiểm soát chi phí API.Unattended pipelines, LLM systems, API cost control.
ĐượcGain
Tìm chặng lỗi trong vài phút; biết chính xác chi phí mỗi reel.Find the failing stage in minutes; know exact cost per reel.
MấtLose
Log không ai đọc là vô dụng; lưu video trung gian tốn dung lượng.Unread logs are useless; storing intermediate video eats space.

Đổi công sức và dung lượng lấy khả năng trả lời "vì sao" cho mọi sự cố.Trades effort and storage for answering "why" on every incident.

Dấu hiệu cần:Signal: lỗi chỉ được phát hiện sau khi đã xảy ra.failures are only found after the fact.

What got saved

Xuyên suốtCross-cutting
[06] retention ─► posts_db
      ─► [01] top_posts + already_said
(memory lives in data, model unchanged)

Kết quả của chặng 06 chảy ngược về chặng 01. Hệ thống nhớ bằng dữ liệu, không bằng fine-tune.Stage 06 results flow back to 01. The system remembers through data, not fine-tuning.

Dùng choUse for
Nội dung cải thiện theo khán giả, agent làm dài ngày, chăm sóc khách hàng.Audience-driven content, long-running agents, customer care.
ĐượcGain
Cải thiện không tốn fine-tune; minh bạch; đổi model vẫn giữ bộ nhớ.Improves without fine-tuning; transparent; memory survives model swaps.
MấtLose
Dễ kẹt ở tối ưu cục bộ; số liệu từng bài rất nhiễu.Prone to local optima; per-post metrics are noisy.

Đổi khả năng học sâu của fine-tune lấy sự rẻ, minh bạch và đảo ngược được.Trades fine-tuning's deeper learning for cheap, transparent, reversible memory.

Dấu hiệu cần:Signal: có chỉ số thành công đo được sau khi phát hành.there's a success metric measurable after release.

Bounded loops

Xuyên suốtCross-cutting
for try in 1..2:
    r = step(input, feedback)
    if gate(r).ok: return r
escalate_to_human(run_id)

Mọi vòng thử lại có số đếm; hết lượt thì chuyển cho người. Không giới hạn thì harness chỉ là while(true) đắt tiền.Every retry loop has a counter; out of tries goes to a human. Unbounded, a harness is an expensive while(true).

Dùng choUse for
Gọi lại LLM khi sai, gọi API hay lỗi tạm thời, agent sửa code tới khi test xanh.LLM retries, flaky API calls, agents fixing code until tests pass.
ĐượcGain
Chi phí tối đa biết trước; lỗi im lặng thành lỗi có tiếng.Known maximum cost; silent failures become loud.
MấtLose
Có ngày không có bài; báo động liên tục làm người nhận chai lì.Some days ship nothing; constant alerts cause fatigue.

Đổi khả năng "cuối cùng cũng xong" lấy chi phí và thời gian tối đa biết trước.Trades "it'll get there eventually" for known maximum cost and time.

Dấu hiệu cần:Signal: sơ đồ có một cạnh quay lui.the diagram has a back-edge.

Bảng đánh đổiTrade-off table

ChặngStage Tính tất địnhDeterminism Chi phí mỗi lầnCost per run Cách testHow to test Sai có rút lại đượcReversible if wrong
01 ContextCaoHighGần 0Near 0Unit testCóYes
02 ScriptThấpLowCao nhấtHighestBộ mẫu + chấmExample set + scoringCóYes
03 PolicyCaoHighGần 0Near 0Test từng luậtTest per ruleCóYes
04 RenderCaoHighThấpLowSo đầu raCompare outputCóYes
05 VerifyCaoHighGần 0Near 0File mẫuSample filesCóYes
06 PostedCaoHighThấpLowChế độ chờ duyệtApproval modeKhông hoàn toànNot fully

Rủi ro nội dung dồn vào chặng 02, rủi ro không rút lại được dồn vào chặng 06. Vì vậy có đúng hai gate đứng giữa chúng.Content risk concentrates in 02, irreversible risk in 06. That's why exactly two gates stand between them.

Sai lầm thường gặpAnti-patterns

Sai lầmMistake Vì sao saiWhy it's wrong Sửa thế nàoFix
LLM làm mọi bướcLLM does every stepĐiểm bất định chồng lên nhau, lỗi không tái hiện đượcNon-determinism compounds; bugs can't be reproducedGiữ LLM ở chỗ cần sáng tạo, còn lại viết codeKeep the LLM where creativity is needed; code the rest
Thử lại không giới hạnUnbounded retriesLỗi xác định không tự hết, vòng lặp đốt tiềnDeterministic failures don't go away; the loop burns moneyĐặt N cho mọi cạnh quay lui, hết lượt báo ngườiAn N on every back-edge; out of tries notifies a human
Thử lại y nguyên đầu vàoIdentical retriesCùng đầu vào cho cùng lỗiSame input, same failureGửi kèm lý do bị chặnSend the block reason along
Gate vừa kiểm vừa sửaGate that also fixesKhông biết lỗi từ đâu; gate thành bước sinh thứ haiError origin is lost; the gate becomes a second generatorGate chỉ trả qua/không qua kèm lý doGates return pass/fail with a reason only
Model tự chấm mìnhModel grades itselfModel hay đồng tình với chính nóModels tend to agree with themselvesƯu tiên kiểm bằng code; chấm bằng model thì prompt riêng, ghi log điểmPrefer code checks; if a model scores, use a separate prompt and log scores
Đăng tự động ngày đầuAuto-post on day oneLỗi đầu tiên đi thẳng tới khán giảThe first failure goes straight to viewersHai tuần chế độ chờ duyệtTwo weeks in approval mode
Học từ từng bàiLearning per postMột bài là nhiễuOne post is noiseSo theo nhóm 7–14 bài cùng khuônCompare cohorts of 7–14 same-pattern posts
Tự động hoá trước khi làm tayAutomate before doing it by handKhông biết bước nào thật sự tốn thời gianYou don't know which step really takes timeLàm tay 30 ngày trướcDo it by hand for 30 days first

Ba câu cần nhớThree things to remember