Paul Jialiang Wu agentic-portfolio 中文 Español 한국어 日本語✉️ Free list
← Back to portfolio

AI-Native Series · Engineering Practices

The Next Developer in Your Repo Isn't Human. Six Practices to Get It Ready.

1-minute takeaway — what you'll walk away with

An adversarial AI read my repo end to end and found 21 bugs I'd missed — including a path traversal. That reader is the new normal. So I refactored the codebase around six practices — OOP, AI-native, context engineering, harness engineering, loop engineering, graph engineering — and measured everything: code quality 56→95, AI responses 130s→3s, 9 bugs fixed before merge. Here's what each practice means and the receipt behind it.

Every practice below is explained the way I'd explain it to a smart 15-year-old, then backed by a number from one week of real work on one repo. ~8 min.

The next developer in your repo isn't human — six practices with receipts: 56→95 quality, 130s→3s latency, 21 bugs found and 9 fixed
The scoreboard first. The practices below explain how each number moved.

The reader who never skims

Last week, before merging a branch, I handed my repo to an adversarial AI reviewer with one instruction: find how this fails in production. No compliments. It came back with 21 findings. One was a real path traversal — a lexical check that would have let Recordings/../../.ssh/id_rsa walk right past it. I'd reviewed that file myself. I missed it.

That's the moment the abstraction became concrete for me: the next developer to read your code isn't a tired human skimming a diff. It's an agent that reads all 10,000 lines, follows every branch, and takes your repo's structure literally. If your codebase is only legible to humans, you're leaving its best reader — and its harshest reviewer — unable to help you.

So the question changed from "is this code clean?" to "can an agent work here?" Six practices answer it. None of them are new. What's new is what they're for.

Six practice cards: OOP, AI-native, context engineering, harness engineering, loop engineering, graph engineering — each with its receipt
Six practices, one test. Every receipt is from the same week, same repo.

1 · OOP — structure is now agent-legibility

Plain version: object-oriented programming means grouping code into small units that each own one job and hide how they do it. The unit promises "give me markdown, I give you chunks" — and nobody outside needs to know more.

The classic argument for OOP was human maintainability. The new argument is stronger: seams are where agents can safely operate. When my ingestion script was one procedural blob, an automated refactoring loop scored it 56/100 and could barely improve it (it managed +2 and gave up). When I restructured it into three seams — a MarkdownChunker, an OpenAIEmbedder, a KnowledgeStore — any one of them can be swapped (different embedding provider, different database) without touching the others. An agent asked to "switch to a local embedder" now has a one-class blast radius instead of a whole-file one.

Receipt: quality score 56 → 95/100 on the repo's Python surface — typing 100%, docstrings 100%, nesting 100% — with the repo's own test gate green the whole way.

2 · AI-native — agents are first-class users

Plain version: an AI-native repo treats agents like users, not intruders. It ships the things an agent needs to work unsupervised: a guide that explains the architecture, and — most important — a machine-discoverable finish line.

My repo has a CLAUDE.md that documents not just what the code does but the traps ("never hot-swap a binary into the signed bundle — macOS kills it at exec"). And it has a root Makefile with one target: check. That target is the repo's definition of done. The payoff came immediately: an orchestration tool I pointed at the repo discovered make check on its own, ran it, and reported an honest green. No configuration. The repo told the agent how to verify itself.

Receipt: anyagent goal --drive discovered Makefile:check, ran it, exit 0. The same gate now runs in CI on every push.

3 · Context engineering — context is a budget, not a backpack

Plain version: everything you stuff into an AI's prompt costs time and attention. Context engineering is deciding what earns a place — and right-sizing it to the model that has to carry it.

My AI assistant's system prompt had quietly grown to 87KB of accumulated knowledge packs. On a cloud model with prompt caching, that's nearly free. On the local 7B model I'd switched to during an API outage, it was catastrophic — and invisibly so: the model truncated most of the prompt unread, while every response took over two minutes. I measured it: 0.3 seconds with no system prompt, 129.7 seconds with the full pack. After trimming to 5KB and moving the packs to load-on-demand files: 3.0 seconds. Same model, same hardware, 43× faster — by deleting words the model never even saw.

Receipt: 130s → 3s per response, measured with timed calls before and after. The packs weren't deleted — they were moved to files that load only when the task needs them.

4 · Harness engineering — make truth cheap

Plain version: a harness is the apparatus around your code that makes verification cheap and lying expensive: probes, gates, self-tests. The rule is to verify at the user's altitude — test what the user experiences, not what the function returns.

This one saved the week. My app's transcription silently produced nothing. Unit tests passed — the failure lived in macOS permission machinery that only manifests for a real app bundle. The harness that found it: a probe app that reproduced the OS kill signal, crash-report forensics that identified which process's permissions mattered, and finally a speaker-to-microphone self-test — synthesized speech played into the live mic pipeline — that proved the fix end to end without a human in the loop. When my user said "I am not a testing machine," he was right. That's the harness's job.

Receipt: three root causes (permission kill, prompt attribution, run-loop starvation), each isolated by a purpose-built probe, and a final self-test that produced 51 live transcript chunks at ~1.2s cadence with zero human steps.

5 · Loop engineering — closed feedback, honest scoring

Plain version: a loop is any cycle of act → measure → adjust. Loop engineering is making those cycles closed (the measurement actually feeds back) and honest (a plateau reports as a plateau, never a fake success).

The repo runs on loops at every scale: an LLM failover chain with a circuit breaker (if the primary provider dies mid-call, the next tier answers); per-chunk fallbacks in transcription (cloud fails → local takes the chunk, nothing dropped); and the refactor loop above, whose most valuable behavior was stopping — it reported 56→58, said "no change proposed," and quit. An engine that inflates its own score is worse than no engine. The honest plateau told me exactly where machine effort ended and judgment had to take over.

Receipt: refactor loop reported its own plateau at 58/100 instead of claiming victory; human-driven pass took it to 95 with the same gate. Every step test-gated, rollback on regression.

6 · Graph engineering — memory is entities plus relations

Plain version: files and folders forget how things relate. A graph — things connected to things — is how work compounds: this meeting belongs to that project, this transcript feeds that knowledge base.

The repo's memory layer is graph-shaped end to end: transcripts become embeddings in a knowledge store (retrieval by meaning, not filename); meetings export to a knowledge-graph engine that maps who said what about what; and the newest edge — "Projectize" — lands a meeting's notes inside the project folder where the work continues, with the next step already routed. A recording used to be a dead end. Now it's a node with edges.

Receipt: one click on a meeting → a dated notes doc in the project's repo with an auto-routed next step embedded — the meeting joined the project's graph instead of rotting in a library.

What broke on the way (kept in, on purpose)

The one-sentence version

Structure your code in seams (OOP), give agents a front door and a finish line (AI-native), spend context like money (context engineering), make truth cheap to check (harness), close every feedback cycle honestly (loops), and store memory as things-with-relations (graphs). Then hand your repo to the harshest reviewer you can find — the one that never skims — and let it make you better.

Related

Paul Jialiang Wu · AI-Native Series · All numbers measured on one repo during one week; methodology in the repo's changelog.