Mobile Development 16 min read

HarmonyOS AI Coding: Dual-Engine Tooling, Three-Loop Harness, and Four-Layer Verification

Huawei details its dual-engine AI coding strategy for HarmonyOS — DevEco Code with a three-loop Harness (syntax, compile, UI intent) and DevEco CLI with atomic commands, a 20M-token knowledge base, 70+ Skills, and a four-level Skill router — plus a four-layer verification stack achieving 80%+ crash-fix rates.

HarmonyOS Developer Technology
HarmonyOS Developer Technology
HarmonyOS Developer Technology
HarmonyOS AI Coding: Dual-Engine Tooling, Three-Loop Harness, and Four-Layer Verification

The article outlines Huawei's engineering response to the unique challenges of AI-assisted coding for HarmonyOS: ArkTS has limited public training corpus compared to Java/Kotlin or Swift/Obj-C, and Huawei's diverse device form factors (straight, dual-fold, tri-fold) multiply adaptation complexity. Traditional IDEs are built for human GUI interaction, not AI agent workflows.

Dual-Engine Layout: DevEco Code + DevEco CLI + 格物市场

Huawei splits the tooling into two layers plus an open marketplace:

DevEco Code — a one-stop HarmonyOS AI IDE covering project creation, requirements design, code generation, functional verification, integration testing, and ops. It ships with Zhipu models and supports custom/third-party model integration.

DevEco CLI — an atomic command-line suite (create project, syntax check, compile/build, get device/emulator, run, knowledge retrieval, Skills management) that turns GUI interactions into programmable primitives for AI agents. A single devecocli init bootstraps the environment and installs Skills.

格物市场 — an open platform aggregating official, community, and partner Skills, MCP tools, and knowledge bases.

The decoupling lets DevEco Code serve developers who want zero-config, while DevEco CLI serves teams with existing AI pipelines needing HarmonyOS atomic capabilities.

DevEco Code: Three-Loop Harness & Three Development Modes

Three-Loop Quality Assurance (Harness)

DevEco Code's Harness runs four progressive verification loops:

Lightweight syntax check — LSP-based dependency analysis, call-chain analysis, reference lookup to help the agent understand project structure quickly.

Compile diagnosis — invokes atomic CLI compile tools; errors feed back to the agent for repair.

UI intent verification — a multimodal agent launches the emulator, simulates human interactions (tap, swipe, long-press, input), captures screenshots, and produces a visual diff report. Failures auto-feedback to the agent for repair.

Auto-fix agent — covers syntax, build errors, runtime crashes, UI display and interaction issues. For runtime crashes, a dedicated Skill collects logs and analyzes; built on 100+ crash localization cases, fix success rate exceeds 80%, achieving minute-level crash resolution.

Benchmarks across GLM5.1, DeepSeek-V4-Pro, and MiniMax-M2.7 show DevEco Code consistently outperforms OpenCode on HarmonyOS task completion rates when Harness is enabled.

Three Development Modes

Build mode — maximum autonomy; agent writes and iterates code with minimal human interaction. Suits clear, fast-iteration tasks.

Plan + Build mode — two-phase: Plan Agent scans the codebase, analyzes dependencies, emits a structured task plan for user confirmation; Build Agent then executes each task with auto build-verify-fix loops.

Goal mode (Spec-Driven Development) — developer states natural-language requirements; agent interacts briefly to confirm acceptance criteria, then runs the full autonomous loop: code gen → syntax check → auto-fix → build → push to emulator → functional self-verification. Developer only does final sign-off.

DevEco CLI: Atomic Tools, 20M-Token Knowledge Base, 70+ Skills

Knowledge Base

DevEco CLI bundles a 20-million-character official knowledge base (best practices, guides, API refs, FAQs, version notes, change previews) with four engineering advantages: local response (no network), progressive loading (avoids context overflow), dedicated vocabulary (precise HarmonyOS term mapping), and structured API output (agent-friendly parsing). This directly compensates for ArkTS's scarce public corpus.

70+ Skills & Multi-Device Adaptation

Skills cover ArkTS syntax, ArkUI, multi-device adaptation, engineering tools, auto bug-fix, log analysis, testing, and app quality. The multi-device Skill hmos-multidevice-scenario-entry demonstrates concrete impact: without it, the agent generates single-column layouts for dual-fold and dual-column for tri-fold; with the Skill, dual-fold correctly yields two columns and tri-fold three columns.

Four-Level Skill Routing (L0–L3)

As Skill count grows, model selection degrades. Huawei designed a hierarchical router:

L0 (Syntax/Framework) — routes to ArkTS syntax rules, preventing TS-style code.

L1 (Component/System API) — routes to specific HarmonyOS API docs for correct system calls.

L2 (Engineering Context) — routes to project-specific build conventions, common error fix paths.

L3 (Business Rules) — routes to domain-level constraints and standards.

Principle: "core first, then scenario" — solve language and API universals before contextual and business specifics, avoiding context overload.

HarmonyOS Verify: Four-Layer Verification Stack

Complementing Skill routing ("can write"), Verify ensures "writes correctly":

ETS syntax check + compile/build repair — static analysis and compilation baseline.

UI automation + multimodal image verification — agent executes simulated interactions per spec, screenshots compared by multimodal model against expectations.

Diagnostic tooling — Hidumper dumps UI element trees (coordinates, attributes); log collectors stream compile/runtime logs for root-cause analysis.

One-to-many adaptation verification — auto-runs on straight, dual-fold, tri-fold, tablet form factors to validate multi-device consistency.

Layers form a progressive chain: static → compile → runtime UI → multi-device, covering code-correct → functional-correct → cross-device-consistent.

Conclusion

The framework is in place: DevEco Code's Harness guarantees quality, DevEco CLI's atomic tools and knowledge base enable end-to-end automation, HarmonyOS Verify's four layers close the reliability loop, and Native Flow (mentioned briefly) handles multi-demand isolation and checkpoint recovery. These are already validated in partner scenarios. Next-phase ecosystem priorities: HarmonyOS-specific high-quality code corpus, global understanding of ultra-large complex projects, and goal anchoring/segmented checkpoints for long-horizon tasks. HarmonyOS's latecomer status becomes a structural advantage — tooling designed from zero for AI workflows, not retrofitted onto human-centric chains.

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.

AI codingHarmonyOSArkTSmulti-device adaptationsoftware verificationDevEco CLIDevEco CodeAI agent workflow
HarmonyOS Developer Technology
Written by

HarmonyOS Developer Technology

HarmonyOS developers provide key technology analysis, version updates, Codelabs practice, and event information for HarmonyOS. Welcome developers to join the HarmonyOS ecosystem and create infinite possibilities together!

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.