learntodriveai.dev/Data Engineering/Designing AI Infrastructure From Scratch
Data Engineering·Project 19·6 units

Designing AI Infrastructure From Scratch

**Track:** Data Engineering

§ Brief

Domingos Soares at the National Institute of Statistics in Timor-Leste sends through a recorded meeting transcript. He runs the office that publishes the country's core figures, and he wants AI infrastructure built before any pipeline code — so the system already carries the statistical definitions, runs the recurring workflows, and refuses to publish when a number is wrong.

The discipline skills: project memory in AGENTS.md as the durable, portable layer carrying INE's statistical definitions — the CPI basket, the GDP chain, population projection methodology, the de-identification taxonomy, the publication calendar — with CLAUDE.md alongside as the Claude-Code-specific overlay; skills in the standard SKILL.md format for the recurring workflows (CPI, GDP, yearbook generation, microdata de-identification, request-handling), each referencing project-memory keys rather than reproducing values; hooks that fail loud on the recurring error classes (stale population vintage, wrong base year, draft input consumed as final, small-cell aggregates risking re-identification); MCP scopes and per-role contexts under intermittent Dili internet; the decomposition pattern, maintenance plan, verification coverage map, and dual-register handoff.

The AI-direction lesson: all four AI platform columns advance at once and have to compose. Memory encodes the invariants the skills must reference; hooks enforce the invariants the skills might violate; MCP scopes hold each agent inside its files; contexts carry only what each role needs. The dual restraint disciplines — "when NOT to delegate" and "when NOT to connect" — are the architecture. Statistical-definition calls, dependency-chain decisions, and microdata-confidentiality judgments stay with you. Every other layer is designed so AI cannot do the work the human must do, even when prompted to.

Your Role

You are the AI-infrastructure architect for INE's first proper environment. You read the transcript, open discovery with Domingos, decompose the AI-infrastructure design space on the first day, write each artefact in the constraint-flow order (memory first, then skills and hooks against memory, then connectivity and contexts against all three, then the decomposition pattern, then verification), bring the integrated system to JT Thompson for review, run a Codex CLI cross-check to confirm AGENTS.md is sufficient without CLAUDE.md, and hand Domingos a forkable repository, a verification protocol, and two-audience documentation — one for the next data engineer, one for him and the four analyst teams.

The scaffolding is thin. No CLAUDE.md template, no SKILL.md template, no hook template, no agent-context template. Domingos names a class of problem and a class of solution; you decompose everything else.

The AI relationship sits at autonomous. The agents you design are deliverables INE's analysts will direct without you in the room. The infrastructure has to keep working when the office is offline and after INE's methodology evolves.

What's New

Last project you designed a governance and quality architecture before any pipeline code for Grace Banda at the Malawi National Blood Service — per-design-surface agents, a PII taxonomy as the first artefact, a regulator-facing compliance package at the close.

This project the AI development environment is the architecture. Genuinely new: AGENTS.md alongside CLAUDE.md as the portability contract; SKILL.md files encoding INE's recurring workflows; hooks as fail-loud quality gates rather than CI checks; per-agent-role MCP scopes and per-role contexts; the decomposition pattern, the maintenance plan, and a dual-register handoff as documented deliverables analysts can follow without you; a Codex CLI portability cross-check as a verification step; the constraint that nothing can depend on the cloud being reachable. JT Thompson returns as the senior colleague — one integrated review of the whole infrastructure as a system, because the system insight only becomes evaluable when the components compose.

The hard part: holding the constraint flow when the implementation tools are familiar and AI is fluent. Asked to "write the CPI skill," AI will produce a defensible skill with the 2020 basket weighting hard-coded into the prompt. The discipline is reference-not-reproduce in skills, fail-loud in hooks, restraint in connectivity and delegation, and infrastructure that survives the office going offline and the analyst inheriting the system after you leave.

Tools

  • Claude Code, Codex CLI, MCP, path-scoped CLAUDE.md, hooks, Git + GitHub, dbt and DuckDB as the referenced infrastructure for INE's offline analytic work — all carry-forward. No new tools.
  • What's distinctive at P19: AGENTS.md paired with CLAUDE.md as the portability contract; SKILL.md files in the documented standard format as the workflow encoding; per-agent-role MCP scopes and per-role contexts replacing the per-design-surface organisation; Codex CLI used in Unit 5 to read the repository without CLAUDE.md and confirm AGENTS.md alone is sufficient.

Materials

You'll receive:

  • A project governance file (CLAUDE.md) — the engagement repository's session context: scope, the design-first discipline, the constraint-flow sequence, verification targets, commit convention. Distinct from the CLAUDE.md you author as the INE deliverable in Unit 2.
  • INE operational picture (ine-context.md) — the publication calendar, the four analyst teams, the source systems at Domingos's depth, the workflow as it runs today, the recurring error classes, the small-cell-suppression challenge, the intermittent-internet reality.
  • UN statistical standards extract (un-statistical-standards-extract.md) — the durable definitions Domingos anchors to: UN Fundamental Principles, SNA 2008 for GDP, the CPI Manual 2020, small-area-estimation guidance.
  • Discovery prompt sheet (discovery-prompts.md) — starter questions in Domingos's register for the thread in Unit 1.
  • A reference-data seed script (scripts/seed-ine-reference-data.py) — representative INE-shaped inputs so the worked examples in skills have real-shape inputs to verify against. Held in reserve through Units 1-2; invoked from Unit 3.

Deliberately not provided: any template for CLAUDE.md, AGENTS.md, the SKILL.md files, the hooks, the agent contexts, the decomposition pattern, or the handoff documentation. The Malawi engagement workspace does not carry forward — fresh project root for INE.