Harness Engineering: How 8 AI Agents Collaborate to Write Wuxia Novels

The article details Harness Engineering’s deterministic multi‑agent workflow that splits novel writing into seven staged phases, enforced by strict rule files and verification scripts, enabling eight specialized AI agents to collaboratively produce complete wuxia novels with consistent characters, martial arts systems, and quality guarantees.

ZhiKe AI
ZhiKe AI
ZhiKe AI
Harness Engineering: How 8 AI Agents Collaborate to Write Wuxia Novels

Problem and Motivation

Generating a full‑length novel with a single LLM often leads to forgotten foreshadowing, inconsistent character names, and fluctuating power levels. Human publishing solves this by dividing work into planning, writing, editing and proofreading. Harness Engineering applies the same division‑of‑labour to AI agents.

Architecture Overview

Harness follows a Centralized Orchestration (Orchestrator‑Workers) pattern. A dedicated harness‑pm agent acts as the project manager and routes work based on declarative workflow definitions.

Agents (8) : harness‑character‑sage, harness‑martial‑sage, harness‑storyteller, harness‑wordsmith, harness‑grandmaster, harness‑consultant, harness‑kb, and the PM itself.

Stages (S0‑S6) : Specification, character design, martial‑arts design, outline, writing, review, delivery.

Workflow : Defined in harness‑workflow.md as a deterministic sequence (e.g., S0→S1→S2→S3→S4→S5→S6) with a fallback matrix for error handling.

Rule Layer (Policy‑as‑Code)

R‑01 – Product immutability: an agent cannot modify another agent’s file.

R‑02 – Blocked items must be recorded.

R‑04 – Three consecutive blocks force a pause for human decision.

R‑06 – No cross‑stage file reads.

R‑09 – Scripts directory is immutable.

All rules are enforced at runtime; any violation aborts the current stage.

Deterministic Orchestration

The PM reads harness‑workflow.md and the current 00‑handoff.md, then selects the next agent. Because routing is declarative, no LLM token is spent on decision‑making, eliminating latency and cost. The PM follows three core decision rules:

Completed + product present → advance.

Blocked + reason recorded → consult fallback matrix.

Three consecutive blocks → pause for human intervention.

Verification Scripts (Guardrails)

post‑verify.ps1 – Executes eight domain‑specific checks (D‑01 … D‑08) such as character‑name consistency, title symmetry, foreshadowing markers, dialogue formatting, etc. Exit code 0 means all gates passed.

baseline‑compare.ps1 – Stores a snapshot of key metrics (word count, chapter count) after each successful run and compares future runs to prevent regression.

common‑checks.ps1 – Shared checks for handoff completeness and blocked‑item detection.

workflow‑check.ps1 – Validates the presence of all agents, rule files, skill directories and templates.

# D‑01: 人物名一致性
Check-CharacterNames -Pattern "[【】()]"
# D‑02: 章节标题对仗
Validate-TitleSymmetry
# D‑03: 伏笔标记匹配
Count-Foreshadowing -Expected $ForeshadowCount

Exit code 0 = pass, non‑zero = fail. Stages S4 and S5 must pass this script before leaving.

Skill Layer (User‑Facing Commands)

/harness‑start

(or “我要开新书”) – Creates a project directory, initializes the SPEC and hands control to the PM. /harness‑init – Deploys the full Harness stack into an existing repository. /harness‑check – Runs workflow‑check.ps1 for structural sanity. /harness‑verify – Runs both post‑verify.ps1 and baseline‑compare.ps1. /harness‑post‑verify – Executes only the eight domain checks.

Agent Responsibilities

harness‑pm – Router. Reads workflow and handoff, decides next agent, enforces fallback matrix.

harness‑character‑sage – S1. Generates complete character bios, relationships and conflict arcs.

harness‑martial‑sage – S2. Designs martial‑arts systems, school lineages and power hierarchies without reading chapter outlines.

harness‑storyteller – S3. Creates chapter outlines, places foreshadowing, ensures title symmetry.

harness‑wordsmith – S4. Writes full prose (3000‑8000 chars per chapter) while obeying quality rules WQ‑01 … WQ‑10.

harness‑grandmaster – S5. Performs five‑dimensional review (character, martial, plot, style, format) and outputs PASS / NEEDS_REVISION / NEEDS_REWRITE.

harness‑consultant – Any stage. Answers user queries about rules by citing rule IDs.

harness‑kb – Post‑S5. Persists finalized characters, schools and techniques to a reusable knowledge base.

Parallelism in the Writing Stage

Stage S4 is the most resource‑intensive. In the novel 天元 , five parallel harness‑wordsmith sub‑agents each handled two chapters (1‑2, 3‑4, …). After independent generation, the outputs were merged into a UTF‑8 file, preserving global consistency while reducing wall‑clock time.

Parallel Wordsmith Sub‑agents
Parallel Wordsmith Sub‑agents

Real‑World Validation

Three full‑length wuxia novels have been produced using the same Harness pipeline:

《残剑山河》 (2026‑05‑15, 10 chapters) – Core idea: 江湖儿女,侠之大者.

《风骨》 (2026‑05‑15, 10 chapters) – Core idea: 文人风骨,朝堂江湖.

《天元》 (2026‑05‑16, 10 chapters) – Core idea: 围棋入武道——九种手筋化绝学.

For 天元 , the final manuscript contains ~93 000 characters, 2 348 lines, eight quality‑gate passes and zero blocked items. The review stage initially returned NEEDS_REVISION for six issues (including 11 martial‑arts name mismatches and 14 foreshadow markers). The PM applied the “fix” cut‑plan, corrected the issues, re‑ran post‑verify.ps1, and achieved a final PASS decision.

Design Philosophy

"When building applications with LLMs, we recommend finding the simplest solution possible, and only increasing complexity when needed. Agentic systems often trade latency and cost for better task performance." – Anthropic, *Building Effective Agents* (2024‑12)

Harness embodies two principles derived from this guidance and from Microsoft’s Conductor project:

Zero‑token routing – All control‑flow decisions are declarative, eliminating LLM latency and cost.

Strict guardrails – Policy‑as‑code rules and executable scripts make it impossible for an agent to claim completion without passing objective checks.

This combination yields an audit‑able, CI/CD‑like pipeline where developers can read the workflow file to understand the process without inspecting internal LLM logic.

Conclusion

Harness demonstrates that a rule‑driven, deterministic multi‑agent pipeline can reliably produce high‑quality, domain‑specific content at scale. By separating deterministic orchestration from token‑heavy generation, the system achieves low latency, full auditability and reproducible results for creative AI tasks.

Project repository : https://gitee.com/741852963/trae-novel.git

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Prompt engineeringsoftware-engineeringmulti-agent systemsAI orchestrationnovel generationdeterministic workflow
ZhiKe AI
Written by

ZhiKe AI

We dissect AI-era technologies, tools, and trends with a hardcore perspective. Focused on large models, agents, MCP, function calling, and hands‑on AI development. No fluff, no hype—only actionable insights, source code, and practical ideas. Get a daily dose of intelligence to simplify tech and make efficiency tangible.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.