WayToClawEarn
High impactHacker News / GitHub Pages

AI Coding Agent writes 100,000 lines of Rust production code: code contract + specification-driven development practical review

An engineer used Claude Code and Codex CLI to write 100,000 lines of Rust production code in 6 weeks, implementing a complete Multi-Paxos consensus engine. His core methodology - code contract + lightweight specification-driven development - provides a reusable practical framework for the implementation of high-quality system engineering of AI coding agents.

WayToClawEarn EditorialPublished May 21, 2026Updated Aug 8, 2026

Editorial review of public sources · AI-assisted drafting. How we work · Original source

Core conclusion

A senior distributed systems engineer used AI coding agents such as Claude Code and Codex CLI to write more than 100,000 lines of Rust production-level code in 6 weeks - implementing a complete Multi-Paxos consensus engine, with performance optimized from 23K ops/sec to 300K ops/sec. Its core methodology is Code Contracts + Lightweight specification-driven development, which provides a reusable practical framework for the large-scale implementation of AI-assisted programming.

Key Points

  • Event Date: May 21, 2026, this article received 128+ likes on Hacker News
  • Affected objects: Development teams using AI coding agents, AI automation engineering process designers
  • Core changes: AI coding agent can not only write CRUD code, but also build complex distributed systems (Paxos consensus algorithm), verifying the feasibility of AI in high-quality production system engineering
  • Key Numbers: 100K lines of Rust / 1300+ test cases / 3 months total time (only 4 weeks for AI coding)

Background and trigger events

In December 2025, engineer Cheng Huang publicly released a 10,000-word review article, reviewing in detail how to use AI coding agents (Claude Code, Codex CLI, GitHub Copilot, Augment Code, etc.) to build a complete Multi-Paxos distributed consensus engine, benchmarking Azure's Replicated State Library (RSL).

In May 2026, this article was widely spread to the Hacker News community, triggering a lot of heated discussions about "Can AI coding agents write production-level system code?" Ended up with 128+ likes and tons of high quality comments.

Key Impact (by Dimension)

DimensionsChangesMeaning for developersRecommended actions
Coding speed100,000 lines of Rust completed in only 4 weeksAI Agent can handle complex system-level codeTry using Claude Code/Codex to take over complex modules
Code quality16 code contract functions, 1300+ automated testsContract driven + test coverage to ensure reliabilityEmbed pre/post conditions in AI generated code
Performance optimization23K → 300K ops/sec (13 times improvement)AI can systematically diagnose performance bottlenecksLet Agent run performance analysis first and then perform targeted optimization
WorkflowMoving from IDE to CLI asynchronous codingThe asynchronous mode of the command line is more efficientTry to leave the IDE and use CLI Agent + editor diff workflow
Personal Motivation$100/ Month Anthropic Subscriptions Become the Driving ForceSubscription Psychology Can Be Translated into Coding HabitsFixed Subscription Fees as Psychological Leverage for "Use It or Waste It"
Tool combinationMultiple Agent rotationDifferent models have their own strengths in different stages of processingSwitch Agents according to task stages (Design→Coding→Test→Optimization)

Adaptation suggestions

For teams that are using AI to code Agents, the following is practical experience:

1. Code contract workflow

The author's core discovery is: Let AI write the contract first, and then write the implementation. Specifically divided into three steps:

  • Use GPT-5 High or Claude Opus 4.1 to write preconditions, postconditions and invariants for key functions
  • Convert these contracts to runtime asserts, enable them for testing and disable them for production
  • Let AI automatically generate property-based tests (Property-Based Tests) from contracts to explore the random input space

2. Lightweight specification-driven development

It is not necessary to go through the complete requirements → design → task document pipeline. The author recommends:

  • Write requirements for complex modules in Markdown + Design Markdown
  • The simple module directly writes the task list and hands it to the Agent
  • The core is to let the Agent understand "why" rather than just "what"

3. Asynchronous CLI coding mode

  • Claude Code / Codex CLI as the main coding engine
  • VS Code only does diff review and minor modifications
  • Initiate a coding task before going to bed and review the results the next morning

Task List (Example)

  • Find a core module in an existing project and let AI write pre/post condition contracts for it
  • Integrate contract checking + property testing in CI
  • Trial run Claude Code CLI mode ($100/ monthly subscription includes sufficient quota)

Code contracts workflow with AI coding agents

Example: Code Contract Pattern

rust
// AI (Paxos process_2a )
/// @pre state == LEADER
/// @pre ballot_number > current_ballot
/// @post log[ballot_number] == value
/// @post forall v2 != value => not has_accepted(v2)
fn process_2a(&mut self, msg: Phase2A) -> Result<()> {
 // AI
}

AI Claude Code(Anthropic)、Codex CLI(OpenAI)、GitHub CopilotAugment CodeClaude Opus 4.1GPT-5 HighOpenAI

Internal link guidance

View source →

Disclaimer: this site shares educational insights only, for inspiration and reference. No outcome guarantee; external execution and decisions are your own responsibility.