← Back to blog2026-07-20

From Chatbot to Production-Grade AI Coding

The concepts, architecture, failures, and evidence behind my Claude Code + OpenAI Codex workflow—from models, terminal/CLI, local/cloud/remote control to memory, MCP, skills, plugins, harnesses, workflows, hooks, and dual-AI delivery.

Part IChoose a surface and complete one trustworthy change

First locate where the agent runs and which entry point fits your work. Then use one small task to complete the loop from requirement to evidence.

I do not want to hype AI—or perform skepticism by underrating it

This is neither an AI advertisement nor an article built from a few failure stories to prove that AI is inherently unreliable. I want to do something simpler: open the real production ledger of how I use coding agents, explain what they helped me achieve, where they failed, and how those failures became engineering rules.

For roughly three months, I have been using Claude Code and OpenAI Codex side by side at high intensity. I pay $200 per month each for Claude Max and ChatGPT Pro, and routinely exhaust the weekly allowance on both. That capacity does not go into generating disposable demos. It supports sustained development and operations for BluffKing, a real Texas Hold’em product whose Rust game engine, Axum/WebSocket backend, PostgreSQL database, Vue H5 client, Flutter clients, replay system, and local solver coach evolve inside one production codebase.

I also brought the product into real production or release paths across H5, iOS, Android, and Telegram. The product is online; H5 payment entry points plus the subscription and entitlement system are deployed, and cancellation and refund flows are implemented: Stripe test mode and the Google Play sandbox have full closed-loop purchase, cancel, and refund evidence; Telegram Stars has proven purchase and refund on the test server, while renewal and active-subscription cancel are not yet proven; and Apple’s replay harness is green but still awaits its first sandbox purchase. I will not collapse “code deployed,” “sandbox/test loop proven,” and “every rail has passed real-money production acceptance” into one status: at the time of this review, some wallet, native-store, and on-chain rails still need final production payment or store acceptance. This is not a demo-only project, but it should not be marketed as “every payment rail is green.”

AI did not accomplish this alone. I own product intent, risk tradeoffs, account identity, payment authorization, and final accountability. The division between the two AIs is asymmetric: either can implement ordinary repository work and the other reviews it; work that depends on my signed-in Chrome, a web console, packaging/upload, or a store console goes directly to Claude Code, while Codex mainly reviews the diff, command output, and page evidence. When Claude hits a quota interruption or Codex takes implementation ownership, Claude becomes the reviewer. The useful story is the path between “can chat” and “can participate in production.”

Who this article is for

  • You have used ChatGPT, Claude, or a similar conversation product and asked AI to write functions or scripts.
  • You maintain a real repository, tests, CI, and a production environment, but you do not yet trust an agent to participate at scale.
  • You want the speed while worrying—correctly—about hallucinations, secrets, bad deployments, and polished but false claims of completion.

What you should gain from reading it

You do not need to copy my entire system. The goal is to build a map of AI coding—model, terminal, shell, CLI, agent, local/cloud/remote control, memory, MCP, skill, plugin, workflow, harness, and hooks—then see how those layers connect in a real project, and finally complete one small production-grade change that is verifiable, reversible, and reviewable.

I recommend AI coding not because AI stops making mistakes, but because those mistakes can be constrained, detected, and repaired through engineering—while, for me, the productivity gain has been real.

Put each concept back in its own layer

GPT, ChatGPT, Codex, Claude Code, a terminal, and a CLI are not competing instances of the same thing. They belong to different layers of one execution chain:

Intelligence

Model

A GPT or Claude model understands, reasons, and generates. By itself it does not possess your repository, terminal, or accounts.

Product

Chat product / coding-agent product

A conversation product such as ChatGPT emphasizes questions and discussion. Coding-agent products such as Codex and Claude Code connect a model to repositories, tools, permissions, and an execution loop.

Surface

Terminal / IDE / desktop

These are places where you interact with the product. A terminal is simply the worksite that hosts a command-line session; it is not AI.

Command

Shell / CLI

A shell such as zsh, bash, or PowerShell interprets commands. A CLI is a program’s text entry point. git is a CLI but not an agent; codex and claude are CLI entry points that start coding agents.

Terminalhosts the session
Shellinterprets commands
codex / claude CLIstarts the product
Coding agentmodel·context·tools·permissions·loop
Repository & evidencefiles·Git·tests·browser·device

My explicit recommendation for a beginner

If your goal is to bring AI into a real repository, start a coding-agent CLI—Codex CLI or Claude Code—from that repository’s terminal. Do not begin by chasing whichever model tops a temporary ranking. Pick an agent that can inspect your repository, run its existing tests, show a real diff, and expose a clear permission boundary.

  • Why not make a normal chat window the primary surface: it is excellent for explanation and discussion, but may not have the current repository, command execution, or verifiable evidence.
  • Why terminal + CLI first: the working directory, Git state, environment, test output, and exit codes are directly visible, and the same path can later become a scripted workflow or harness.
  • Where the IDE fits: keep using it to read code, inspect diffs, and debug manually. Adopting an agent does not require abandoning the editor you know.
  • When to add dual AI: first complete one small “task → diff → verification → rollback” loop with one agent; then add a second reviewer in a fresh, preferably read-only context.

Codex or Claude Code: choose by the environment you actually need

Your main needMost direct choiceReason and boundary
Repository edits, commands, tests, and Git automationEither Codex CLI or Claude CodeStart with the one whose workflow and permission boundary you understand better; correctness comes from the task contract and evidence, not the product name
Use an already signed-in Chrome profile directly from the CLIPrefer Claude Codeclaude --chrome connects Claude in Chrome and can use the current browser login state
Use OpenAI’s built-in Browser / Computer UseChatGPT web or desktopOpenAI’s documentation says built-in Browser is not in Codex CLI/IDE; desktop is the better fit when you need a local project, integrated terminal, or Computer Use, while the CLI can still run Playwright or use an additional browser MCP/plugin
Continue a local task away from the deskChoose by remote entry pointChatGPT Remote connects ChatGPT mobile to a paired host; Claude Code Remote Control connects claude.ai/code or Claude mobile to a local CLI/VS Code session
One-line conclusion: either is a sound starting point for ordinary repository work; prefer Claude Code when a CLI must use an existing Chrome login; use ChatGPT web or desktop for OpenAI’s built-in browser; then choose the matching Remote Control entry point when you need the same local host away from your desk.

Why the terminal has always been my daily entry point

For me, the terminal is not a more “professional” chat box. It is the engineering worksite. When the agent starts in the correct repository or worktree, the current directory, Git state, dependencies, environment variables, command output, and exit codes belong to one evidence chain.

cd /path/to/project
git status
codex        # or: claude

My usual path is: enter the project directory → start Codex or Claude Code → state the goal, constraints, and definition of done in natural language → let the hooks check whether the session is already isolated. A read-only task can stay in the current directory. If the agent tries to write code in the shared main worktree, a hook blocks the write and requires it to call the project script that creates a dedicated worktree. The agent then reads files, changes code, and runs tests there. This is what lets multiple sessions work in parallel without sharing one HEAD or one set of uncommitted changes. Finally, I have the other AI review the actual diff and verification evidence. The commands, working directories, Git rules, permissions, and hooks later in this article all grow from this entry point.

You do not need to build the entire system described later before an agent can write code. Start with one agent and one small task. I added worktrees, hooks, layered testing, independent review, and release gates gradually after encountering concurrent-session collisions, unintended edits, false-green verification, and production risk. The closer a project gets to production—and the more sessions run in parallel—the more these guardrails should move from reminders into automatic enforcement.

“Remote” is not one thing: conversation, cloud sandbox, and control of a local agent

The most important question is not whether you send the prompt from a phone or computer. It is: which machine actually runs the code and commands?

SurfaceWhere code runsBest use
Ordinary conversationPrimarily produces an answer on the product service; no local access by default—it sees only uploaded or connector-authorized contentConcept explanation, task briefs, and solution discussion
Cloud agent / remote sandboxAn isolated vendor-managed container, usually checking out a connected Git repository; no access to laptop files, processes, login state, or devicesContinue with the laptop off, parallel tasks, and repository diffs or PRs
Local coding agentYour computer or development host, constrained by its sandbox and permissions; local access limited to the repository, commands, MCP, browser, and devices you authorizeDaily work needing local dependencies, uncommitted code, databases, browsers, or devices
Remote Control of a local agentStill your Mac, Windows PC, or development host—phone and browser are remote windows onto a session that keeps its local files, tools, and permissionsCheck progress, redirect, answer questions, approve actions, and inspect evidence away from the desk
Remote MCP / connectorNot an execution environment; it exposes scoped data and actions from a remote service—only the authorized scope, never the whole computerCurrent data and scoped actions in GitHub, Sentry, Linear, Gmail, and other cloud services
My daily entry point remains a local terminal + agent CLI. Remote Control and cloud sandboxes are choices about execution location, not higher tiers: choose Remote Control when away from the desk but the task must retain the same local database, MCP, browser, or device; choose a cloud sandbox when the computer may be off, you need cloud parallelism, or the task should not touch the host. In product terms, Codex cloud and Claude Code on the web are the cloud sandboxes; ChatGPT Remote and Claude Code Remote Control are the remote-control entry points.

Remote Control is also not Computer Use. Remote Control means a person drives a local agent session from elsewhere. Computer Use means the agent itself sees, clicks, and types in an operating-system or application UI. They can be combined, but their authority and risk are separate.

Remote-control safety floor: keep the host running and reachable; use account authentication and pairing; preserve local sandboxing, approvals, and hooks; and isolate concurrent sessions with worktrees. Do not grant a local agent permanent full access merely because the phone view hides implementation detail.

Browser, Computer Use, and “control my existing Chrome” are three different paths

OpenAI’s built-in Browser uses a profile separate from your everyday browser. Computer Use can operate desktop applications and graphical interfaces. Only the Chrome-extension path connects to the Chrome profile I am already signed into and using. All three can look like “the AI is clicking a browser,” but they have different permissions, dependencies, and failure boundaries.

One Codex weakness I will not sugarcoat: on my Mac and in this workflow, direct Chrome control has been extremely unreliable. More than once, a minor CLI or desktop-app update broke a connection that worked the day before, and the failure returned days after I repaired it. Switching to a session labeled GPT-5.6-SOL does not help (the model label is my local UI’s, not a catalog claim), because the failing layer is the bridge between the Chrome extension, extension backend, plugin cache, and local runtime—not model reasoning. Claude Code on the same machine has not shown this repeated disconnect cycle.

My actual workaround is not to test Codex before every browser task; I route the work by tool reliability. Anything that needs my signed-in Chrome session or a web console goes to Claude Code—for example, filling out Stripe dashboard forms, packaging and uploading iOS or Android apps, and working in the store consoles. Codex serves mainly as the reviewer for this work: it checks the code diff, command output, recorded state, and the browser evidence produced by Claude instead of performing the browser operation itself. This does not mean the Codex Chrome path is fixed. It means I do not let a repeatedly failing toolchain block production work.

One capability map—not another chapter numbering scheme

This is a relationship map: it shows how capabilities stack, not six installation stages you must follow in order.

1 · Model & ContextThe model reasons while the conversation, code, and rules supply working context
2 · Terminal / CLI / Agent & ToolsThe terminal hosts the shell and CLI; the agent then invokes files, browser, Git, and other tools
3 · MCP / Skill / PluginExternal systems connect in, reusable capabilities are packaged, and extensions are installed
4 · Rules & MemoryInstruction files hold required behavior while memory recalls historical context
5 · Workflow & HarnessMulti-step work becomes a state machine executed in a controlled environment with evidence
6 · Hooks & GatesLifecycle controls prevent unauthorized actions, skipped verification, or damage to the main branch

Make your first AI task deliberately small

Do not begin with “rewrite my entire application.” Do not hand over payments, authorization, or a database migration on day one. A good first task has a clear boundary, a testable result, and an easy rollback:

  • fix one reliably reproducible bug;
  • add boundary tests to an existing function;
  • add one form validation or error message;
  • refactor a function with explicit inputs and outputs;
  • ask the AI to explain one call path without changing code.

Your first trustworthy small loop matters more than your first thousand generated lines.

A five-part task brief is enough

You do not need prompt magic. State these five things clearly:

Goal: Show the server’s specific error when login fails.

Observed behavior: Every failure currently says “Network error.”

Scope: Change only the login request and error display. Do not redesign the page.

Acceptance criteria:
1. A wrong password shows the correct message.
2. A disconnected network still shows the network error.
3. Successful login remains unchanged.
4. Add a regression test.

Constraints: Do not change the API contract or add a dependency.

If you cannot define what “correct” means, the model can only guess. Write the acceptance criteria before asking it to implement.

A workflow you can copy today

Step 1: protect existing work, then isolate the change

Record the current branch, baseline commit, working-tree status, and worktree list first. If uncommitted changes already exist, determine who owns them; never let an agent stash, reset, clean, or restore the whole repository on its own. Write each new task only in an isolated feature worktree, and never let two agents share one working directory.

git branch --show-current
git rev-parse HEAD
git status --short
git worktree list

# After confirming the baseline and existing changes, isolate the task
git worktree add ../project-login-fix -b fix/login-error-message HEAD
cd ../project-login-fix

Step 2: require investigation before implementation

Read the repository rules and relevant code before changing anything.

Requirements:
1. Keep the patch narrow and preserve unrelated behavior.
2. Add a regression that fails before the fix and passes after it.
3. Run the relevant tests or real-environment verification.
4. List changed files, executed evidence, and remaining risks.
5. Do not claim completion when evidence is missing.

Step 3: give the actual diff and evidence to a second AI

In my real workflow, another AI performs this step; I do not manually review the diff line by line first. The reviewer starts from an independent context and reads the actual patch, relevant code, and test evidence.

You are an independent reviewer and did not author this change.

Inspect the actual diff and any necessary upstream or downstream code. Focus on:
1. Logic errors and edge cases.
2. Security, privacy, concurrency, and compatibility issues.
3. New regression risks.
4. Missing, ineffective, or wrong-layer tests.
5. Conflicts with existing repository rules.

Do not assume the code is correct because tests passed.

Return:
VERDICT: APPROVED or CHANGES_REQUESTED
OPEN: every unresolved item

Step 4: close the loop inside the workflow

When the reviewer confirms a problem, do not stop at a report or throw the decision back to the human. Continue through “fix → test → re-review” until the evidence passes, the reviewer explicitly approves, and OPEN is empty.

Step 5: validate the result locally or in production

I do not usually inspect the code diff line by line. My main involvement is outcome validation: I exercise the relevant flow locally or in production and check that it actually works and satisfies the requirement. If it fails, I return the reproduction steps and observed behavior to the AIs for another fix → test → review loop. Account-holder identity, 2FA, signatures, and payment approval remain with me; packaging, upload, review submission, or an explicitly authorized release can be executed by Claude Code and then checked by Codex. I do not pretend that I click every step manually.

Match evidence to risk

Put the validation layer into the definition of done. Part III uses a real failure to show why unit, browser, device, and production evidence cannot substitute for one another.

Done is a claim. Evidence is the fact.
ChangeMinimum evidenceCommon mistake
Pure function or algorithmFocused unit tests and boundary casesRunning only old tests
API or state flowIntegration test, real request, error pathTesting only the happy path
Frontend visual or animationReal browser, key viewports, visual evidenceTreating jsdom as browser proof
Mobile or native behaviorDevice or emulator check plus build evidenceInspecting only shared logic
Auth, payments, migrationsCross-vendor review, rollback, and failure paths; add dual implementation only for genuine design uncertaintyTreating dual implementation as the default for every high-risk task
The pattern I use consistently is one implementer plus one reviewer: one AI writes the change, and an AI from the other vendor reviews the actual diff and evidence. I have used DualForge—two independent implementations in separate worktrees—for selected high-risk work such as the BNB-USDT HD custody path, but it is not my default for every sensitive change. Several payment and authentication hardening tasks still followed a Codex-implements, Claude-reviews flow. Beginners should first make the one-writer, one-reviewer loop reliable, then pay for dual implementation only when the risk and genuine design uncertainty justify it.
Part IIUnderstand the components behind an agent

After one practical run, Memory, MCP, Skills, Plugins, Markdown instructions, Workflows, Harnesses, and Hooks become useful parts of a system instead of a vocabulary dump.

Models, tokens, context, hallucinations, and memory

Foundation

Token

The unit a model uses to read and write information; it is not the same as a character or word. Code, logs, tool output, and conversation all consume tokens.

Trap: dumping unrelated logs into one thread buries the actual requirement and increases cost.

Foundation

Context window

The information the model can see during one run. A large window does not mean every detail remains equally salient or reliable.

Executable practice: keep goals, decisions, and acceptance criteria in the main thread; move noisy logs into evidence files, and use a bounded subagent only when the task is genuinely independent.

Task

Prompt

The current task instruction. A useful prompt is not an incantation; it is a task brief containing goal, context, constraints, and a definition of done.

Trap: “Please fix this” gives the agent permission to invent the business objective.

Risk

Hallucination

A fluent and plausible claim with no factual support. In code it can look like a nonexistent API, file, option, or an assertion that tests were run when they were not.

Countermeasure: require file paths, diffs, command output, browser evidence, or device evidence.

Across sessions

Memory

A recall layer for preferences, old decisions, and useful routes from previous work. It is not a real-time operational database.

My lesson: private memory can remember where to look, but it cannot decide current App Store, payment, or deployment state.

Facts

Source of truth

The most authoritative current location for a class of facts: code, database, live console, or a canonical repository status file.

BluffKing: mobile-store state comes from store-release-status.json; public release state comes from changelog.json, never from either model’s recollection.

A production rule worth keeping: memory is for background and routing, not volatile current state. My project added a shared handoff ledger, ops ledger, and canonical status files after Claude and Codex could otherwise inherit different stale memories.

Agents, tools, permissions, sandboxes, and subagents

Executor

Agent

A task executor made from a model, context, tools, permissions, and a loop. It inspects files, changes code, runs tests, and reacts to results instead of merely returning an answer.

Difference: chat mode optimizes for an answer; agent mode optimizes for a verifiable outcome.

Execution

Tool / tool call

An atomic capability the agent can invoke: read a file, run a shell command, search code, control a browser, or query GitHub. Each call should have clear inputs and outputs.

Trap: having a tool does not imply having authorization; having authorization does not imply it should be used.

Safety

Permission / approval

Determines whether an action runs automatically or needs approval. Reading code and deleting production data must never share the same authority level.

My boundary: OTP, 2FA, signatures, payments, live identity, and irreversible steps remain human-controlled.

Isolation

Sandbox

A system boundary over what the agent can read, write, execute, or access over the network. It assumes inputs are untrusted by default.

Bug-free gate: the deterministic lane blocks external networking, prewarms dependencies, and makes hydrated dependency roots read-only.

Delegation

Subagent / agent team

The main agent delegates independent slices to specialized roles such as backend review, visual inspection, or log analysis. It works best for parallel, read-heavy tasks.

Trap: subagents consume extra tokens, and multiple agents writing the same directory can cost more coordination than they save.

Continuity

Session / thread / handoff

A session is a running context; a thread is the conversation and tool trace. A handoff explicitly transfers branch, changed files, last successful and failed commands, and next step.

My practice: when Claude quota ends, Codex resumes from the actual worktree, Git state, and durable handoff—not from “it was nearly done.”

MCP, connectors, skills, and plugins

ConceptWhat it isWhen to use itHow I use it
MCP
Model Context Protocol
A standard protocol connecting an agent to external tools and context. An MCP server can expose tools, resources, and prompts.When work needs GitHub, a browser, Figma, documentation, internal systems, or another agent surfaceCross-review is asymmetric: Claude reaches Codex through a configured Codex tool/MCP path, while Codex-authored work goes through scripts/claude-review.mjs; MCP is a capability layer, not the mandatory review route
Connector / appAn authorized connection to a service that usually handles identity, scope, and structured actionsFor private GitHub, Gmail, Calendar, and other account data where search or model memory is inappropriateMy Codex environment can connect to GitHub, Gmail, Calendar, Browser, and Chrome; “installed/callable” is not “used in this project,” and send, delete, and publish remain separately authorized
SkillA reusable method package, usually a SKILL.md plus optional scripts, references, and assetsFor repeated work that needs stable steps, domain knowledge, examples, or helper programsbug-free-codex, visual-fidelity, visual-animation-verify, hot-fix, social-post, and memory-audit
PluginAn installable distribution unit that can bundle skills, MCP-backed apps/connectors, hooks, and assetsWhen you want a complete capability bundle or need to distribute one across a teamBrowser and Chrome capabilities are installed as plugins; GitHub connects as a connector/app; task-specific skills then load on demand
Slash commandAn explicit / entry point for a command or repeatable workflowWhen the operator should deliberately choose a mode or named routineA trigger such as bug-free-codex starts a fixed quality gate rather than sending a generic prompt
A skill tells the agent how this kind of task should be done. MCP tells it which external capabilities are available. A plugin packages those capabilities into something installable.

Installing every plugin is not a maturity strategy. Too many tools and skills consume discovery context and increase tool-selection noise. I once investigated a skills-context budget warning and fixed it by disabling unneeded plugins in global configuration, not by adding more descriptions to the agent.

Markdown files are part of the agent operating system

FilePrimary readerWhat belongs thereBluffKing use
README.mdHumans and agentsProduct overview, quick start, and repository layoutExplains the Rust engine, Vue H5, PostgreSQL database, WebSocket rooms, and replay architecture
AGENTS.mdCodex and compatible agentsAutomatically loaded repository rules, commands, constraints, and verification expectationsDefines one task per worktree, prohibits direct main edits, and specifies risk-matched testing
CLAUDE.mdClaude CodeClaude-side durable instructionsMirrors the core contract in AGENTS.md; sync checks prevent the two agents from inheriting divergent rules
SKILL.mdAn agent after the skill is selectedTriggers, boundaries, steps, scripts, and finish conditions for a task familybug-free-codex/SKILL.md defines the fixed local-to-production validation entry point
ADR-NNN.mdEngineers and agentsAn important architecture decision, rationale, alternatives, and statusOnly Accepted/Locked ADRs bind; Superseded ADRs must lead to their successors
PLANS.md / task planAgent and reviewerExecutable steps, dependencies, and acceptance points for complex workUseful for long tasks; a small fix should not grow a giant plan merely to look formal

Markdown instructions are readable by both humans and AI, versionable in Git, reviewable, and traceable. Their limitation is equally important: they instruct; they do not mechanically enforce. An agent can forget, misunderstand, or hit a conflict. Critical rules must eventually move into hooks, tests, CI, and executable gates.

My promotion ladder: keep one-off direction in the prompt; repeated context in memory; always-on rules in AGENTS.md/CLAUDE.md; repeatable tasks in skills; and mistakes that must not recur in hooks or gates.

Do not confuse workflows, harnesses, hooks, gates, and CI

Orchestration

Workflow

An ordered sequence and state transition from start to finish. It answers what comes next, where failure goes, and what counts as terminal.

Project flows: audit → fix → re-verify and produce → opposite-vendor review → reconcile → act.

Execution container

Harness

An executable program wrapping agents, environment, tests, timeouts, output schemas, and evidence collection. It does not merely describe the workflow; it runs and reports it.

BluffKing: trusted-local-launcher.mjs, bug-free-codex-pipeline.mjs, and mobile-multi-human-regress.sh.

Lifecycle interception

Hook

A script triggered at session start, before or after tool use, on commit or push, or when a turn stops. It may remind or hard-block.

Project: block-main-edits.sh blocks shared-main edits; Git pre-commit blocks direct commits to main.

Admission

Gate / guardrail

A mechanical condition deciding whether an action may continue. The hook is the event point; the gate is the policy.

Merge requirement: an independent review must explicitly return APPROVED with OPEN=[].

Safe default

Fail-closed

Missing output, invalid schema, review timeout, or uncertain authority stops the action instead of silently becoming a pass.

My review runner: only a schema-valid explicit approval succeeds; timeout, quota exhaustion, or model failure never becomes green.

Remote automation

CI/CD

CI builds and checks after commits or pushes; CD continues into release or deployment. It complements a local agent workflow rather than replacing it.

BluffKing: local bug-free owns heavy behavioral regression; the main-push GitHub Actions gate owns release builds and the changelog contract.

Scheduled

Automation / heartbeat

Unattended work triggered by time or events. A serious heartbeat needs locks, idempotency, state transitions, evidence, and escalation rules.

Evidence-backed capability: an hourly AI team manager checks production HTTP/Playwright and backend compilation, classifies failures, assigns an owner, and writes the ledger. Part III covers what its execution record does and does not yet prove.

Evidence

Artifact / receipt / ledger

Artifacts are reports, screenshots, logs, and test output; receipts prove a review or action occurred; ledgers hold current shared state across agents.

Principle: a receipt is not authority. My merge flow binds authorization to the current exact diff and live review result.

The clean distinction is: a skill is the method, a workflow is the order, a harness is the executable container, a hook is the trigger point, a gate is the admission decision, and an artifact is the evidence. A mature system usually combines them.

Part IIITurn personal technique into a production system

BluffKing shows how layered agent loops, dual-AI review, mechanical gates, and eleven recurring risks fit into one operating system.

How I connect the whole stack in BluffKing

Goal or patrol findingProduct intent·live evidence·risk
Rules and truthAGENTS/CLAUDE·ADR·status
Isolated implementationbranch·worktree·skill
Harness evidenceRust·Vue·Flutter·Browser·Device
Dual-AI reviewClaude ↔ Codex·OPEN=[]
Gated deliveryfinish-session·main·CI/CD
  1. Task intake: work may begin with my prompt or with a scheduled patrol and shared-ledger finding; AGENTS.md and CLAUDE.md supply durable repository constraints.
  2. Find current truth: code, accepted ADRs, live consoles, or canonical JSON decide state; memory only helps route the investigation.
  3. Isolate the change: new-session.sh creates a branch and worktree from main so each AI session owns its files and HEAD.
  4. Select the skill: visual changes trigger real-browser evidence; releases trigger bug-free-codex; emergency release work has a separate hot-fix boundary.
  5. Generate evidence through harnesses: the stack covers the Rust engine, PostgreSQL-backed server integration tests, Vue/Vitest, Flutter, Playwright, and iOS/Android/H5/Telegram multi-client rooms, with deterministic and external-device evidence recorded separately.
  6. Review across vendors: Codex-authored patches go to Claude; Claude-authored patches go to Codex. Confirmed findings are fixed and re-reviewed inside the same workflow.
  7. Prevent bypass structurally: agent hooks block editing the shared main checkout; Git hooks block direct or hidden main mutations; finish-session.sh is the trusted merge boundary.
  8. Continue after delivery: CI/CD checks the release contract, the heartbeat manager patrols, classifies, and assigns findings on a schedule, and ledgers keep later Claude, Codex, and sessions on the same current state.

This is what I mean by using AI at production scale: not unlimited authority, but as much autonomy as possible inside explicit rules, tools, isolation, verification, and independent review.

Did I build agent loops? Yes, but the layers have different maturity

There is no single industry-standard agent loop. The common core is goal → tool call → observation → repair, without a human copying every result into another prompt. Once that loop moves into a workflow or harness, it still needs state, a round cap, failure classes, and terminal conditions; otherwise it is just an infinite “try again.”

Loop layerThe actual loop in my projectWhat it adds beyond “try again”
Inner agent loopRead context → call a tool → observe output → choose the next stepThe native Codex/Claude Code loop; humans do not copy every command result back into chat
Implementation and verification loopscripts/loop/run.mjs runs QA → classifies failure → optionally invokes a Claude fix driver → rerunsThe repository implements state, round caps, and fail-closed terminals, but that does not prove every failure has been repaired automatically
Review loopAuthor → heterogeneous reviewer → fix confirmed finding → test → re-review until OPEN=[] or the cap is reachedThe reviewer is bound to the real diff and evidence instead of self-persuasion
Operations patrol loopScheduled patrol → production/Playwright/build evidence → triage → owner → ledgerThis segment has real GREEN and failure receipts; the AI Team Manager discovers, classifies, and records findings instead of only waiting for human bug reports
Engineering-learning loopReal failure → identify missing capability → add regression/skill/hook/facts guard → prevent recurrence automaticallyThe system fixes why the workflow missed a bug, not only the current bug

This is neither “there is no loop, so a human must operate every step” nor “the whole delivery system is already unattended.” The inner-agent loop, cross-model review loop, and scheduled patrol are proven; the repository also implements bounded QA → repair → rerun capability. What the execution record does not yet prove is a durable unattended chain from discovery through repair, review, merge, and release.

Where the human remains involved: I own product intent and final acceptance. Account-holder identity, 2FA, signatures, payment, and legal attestations remain human actions. Packaging, upload, review submission, or release may be performed by an agent when explicitly authorized, reversible, and gated; the human is no longer the approver of every tool call.

What this system actually improved

The highlight is not that I opened two AI products at once. Across many ordinary tasks, human time moved away from babysitting commands, copying logs, and approving every retry, and toward product intent, final acceptance, and high-risk boundaries. Every item below has corresponding code, scripts, hooks, commits, or execution records.

From one-shot generation to sustained deliveryAgents no longer generate one-off code; they maintain a live product through the same isolation, validation, review, and release contract.
From human prompting to bounded agent loopsscripts/loop/run.mjs can classify QA failures, invoke a configured fix driver, and rerun with a round cap and fail-closed terminal. It is implemented capability, not a claim that every task already closes automatically.
From waiting for bug reports to proactive patrolThe hourly heartbeat reads production, Playwright, and compilation evidence, triages findings, assigns an owner, and writes the ledger.
From “tests are green” to layered evidenceAlgorithms, APIs, browsers, devices, and production now have independent evidence layers. Green at one layer cannot substitute for another, and functional tests no longer answer visual correctness.
From rules in prose to fail-closed landing pathsShared-main edits, unreviewed merges, missing verdicts, and stale review receipts are rejected by hooks, bounded runners, and a reference-transaction gate; deliberate same-UID hook tampering remains outside this boundary.
From dual-AI voting to multiple failure detectorsCross-vendor review binds to the actual diff and OPEN=[], while regressions, real environments, facts guards, production feedback, and human product acceptance remain separate checks.

Why one AI can be confidently wrong—and two AIs can still miss together

The common failure is not total incompetence. It is a model continuing from a bad premise while sounding certain. It may:

  • patch the symptom without finding the root cause;
  • read one file and miss an upstream protocol or downstream state transition;
  • make old tests pass without adding a regression that reproduces the bug;
  • assume a real browser is correct because a frontend unit test passed;
  • hide missing verification behind a polished summary.

Asking the same AI to “check its work” often preserves its original assumptions. A second AI adds another reasoning path, but it is not proof of correctness. Two models can misunderstand the same requirement, trust the same incomplete tests, or agree on the same stale fact.

What still failed after dual-AI work in my Git history

Real recordWhy two models can still miss itDefense added afterward
46c9b57d: nine Vitest cases passed while cards still remained face-down in real ChromiumBoth author and reviewer can accept the wrong evidence layer; jsdom can prove that an element exists, not that a CSS transform is visibly correctvisual-animation-verify: animation changes require real-Chromium outcome evidence
Phase 3 Table: build, 758 tests, and 10/10 smoke were green, but the implementation had silently simplified the designFunctional checks answer “does it work?”, not “is this what the user asked to see?”visual-fidelity: completion binds to the design source, target viewports, and side-by-side visual evidence
7767eede: a round-three review fix introduced an empty-SHA deduplication bug found only in round fourA review fix is new code; closing one finding does not prove that no new regression was createdEvery fix adds RED→GREEN coverage and reruns tests plus review, rather than merely checking the old finding
4083b0d8 and a23646c7: marketing and payment status drifted away from the product and Stripe control planeTwo models reading one stale document only agree more consistently on an obsolete answerCanonical status, live read-back, facts guards, and ledgers that validate downstream consumers

These failures came from the wrong verification layer, missing requirement acceptance, regressions introduced during repair, and external fact drift. An extra vote cannot solve them by itself.

What I actually use is layered defense, not dual-AI magic

These are system-control layers, not another list of test types: the earlier evidence table answers “what should run”; this one answers “what stops an error from moving forward.”

DefensePrimary failure addressedHow it works in my project
1 · Task contractBoth AIs misunderstand the requirementA task card states goal, scope, prohibitions, and acceptance; visual work also binds design source and target viewports
2 · State isolationAgents overwrite files, switch branches, or contaminate resultsOne branch/worktree per task; author and reviewer do not share writable state
3 · Current sources of truthMemory, documents, or summaries are staleCode, databases, canonical status, ledgers, live consoles, and control-plane read-back decide current state
4 · Risk-matched evidenceA green result from the wrong layerUnits for algorithms, integration for APIs, real browsers for animations, devices for native behavior, and production smoke after release
5 · Regressions and invariantsA fix creates a new bugWrite a failing regression first; critical money, chip, and concurrency paths also check conservation and ordering invariants
6 · Independent reviewAuthor blind spots and evidence gapsFresh context, read-only access, actual diff, related call paths, an explicit rubric, VERDICT, and OPEN
7 · Mechanical enforcementAn AI forgets a Markdown rule or declares victory earlyHooks, CI, harnesses, fail-closed gates, and a trusted merge entry point block bypasses
8 · Production feedback and human acceptanceUncovered user experience or external changeMonitoring, logs, production regression, rollback; humans retain product, identity, money, and irreversible decisions
Reliability is not voted into existence by two models. It emerges from multiple independent failure detectors.

The right role for dual AI: another independent check, not proof

Human: definer and accountable ownerSets the actual problem, protected boundaries, acceptance criteria, and which operations must never run automatically.
AI A: implementerReads repository rules, investigates the root cause, makes the smallest change, adds a regression, and reports executed verification.
AI B: independent reviewerReads the real diff and relevant call paths, then searches for logic errors, omissions, regressions, and evidence gaps.
Tools: evidence layerGit diffs, tests, builds, browsers, devices, and runtime logs provide repeatable evidence, but their coverage and harness validity must also be checked.

Whether Claude writes and Codex reviews, or the reverse, is secondary. What matters is role separation, reviewer independence, and access to the actual code and evidence instead of the author’s summary. Even two approvals mean only that neither reviewer found an issue in the supplied context; they do not prove that the full user requirement is satisfied.

Can different versions of the same model review each other?

Yes. The core idea is still to create a second judgment path, but the degree of independence is different. Versions may differ in capability, context, and reasoning behavior, so this is usually more useful than self-review in one session. Yet models from the same family may still share training preferences, tool habits, and blind spots.

ArrangementValueAppropriate use
Same model, same sessionCheapest, but most anchored to the original premiseQuickly find obvious omissions; never treat as independent approval
Same model, fresh sessionBreaks part of the contextual anchoring and forces a rereadA second pass for routine low-risk changes
Same vendor, different versionsBehavior differs, but correlated errors can remain highA valid reviewer when paired with tests, real-environment evidence, and an explicit rubric
Different vendors or model familiesMore diverse training, tools, and alignment pathsPrefer for important or high-risk changes, while still requiring verification and human acceptance

Eleven traps when bringing AI into production

These risks have not vanished permanently; the workflow keeps defending against them. The goal is not zero bugs. It is to make errors easier to detect, block, roll back, and remember across sessions.

TrapMinimum executable fixMechanism in my project
1 · Treating a model as an agentConfirm working directory, repository, tools, network, sandbox, and read/write permissions first; without tools, ask only for a planStart the CLI agent from the project terminal; if a write task lands in shared main, a hook blocks it and directs creation of an isolated worktree
2 · Giving the AI an enormous scopeOne task card solves one problem and names scope, prohibitions, and executable acceptance criteriaOne branch/worktree per task; large work is split into independently verifiable stages
3 · Treating memory as live truthUse memory for routing; reread code, ledger, database, or live console before reporting current stateCanonical status JSON, ops/bug-free ledgers, live read-back, and facts guards
4 · Reviewing the summary instead of the diffUse a fresh, read-only session with the actual diff, requirement, call paths, and test output; check each acceptance criterion and treat prose as an indexThe reviewer binds to the exact patch; Claude/Codex cross-review returns VERDICT and OPEN, and fixes rerun the loop
5 · Treating Markdown as enforcementDocument the rule first; promote recurring or high-risk failures into a hook, test, or gateAGENTS.md/CLAUDE.md explain; agent hooks, Git hooks, and finish-session.sh block bypasses
6 · Installing every pluginUse a minimal allowlist; skip an extension until you can name its use case, authority, and verification pathVisual, release, and review skills load on demand instead of placing every tool in every conversation
7 · Giving MCP excessive authoritySeparate read, write, delete, send, and publish; default to read-only and require explicit identity, target, and audit for external actsIdentity, 2FA, signatures, payments, and irreversible actions retain human boundaries; evidence excludes secrets
8 · Treating green tests as complete correctnessAsk what the test actually observes, then add integration, real-browser, device, production smoke, and human acceptance as risk requiresVitest does not replace Chromium; the harness records layered evidence and continues verification after release
9 · Letting two AIs share one directoryGive every writer a separate branch/worktree; keep reviewers read-only where possiblenew-session.sh creates isolation; hooks block changes in the shared main checkout
10 · Spawning subagents without disciplineParallelize only independent work with no shared write state; otherwise use one orchestrated owner pathMulti-surface verification can parallelize, while merges and tightly dependent repairs use a controlled workflow and ledger
11 · No stop condition or authority boundaryDefine completion as commands, observable outcomes, rollback, explicit verdict, and an empty open listGates fail closed; humans control OTPs, secrets, payments, and destructive data actions; releases need explicit authority, rollback, and gates but may be executed by an agent

Reference appendix: Claude and Codex terms to look up when needed

These terms are not a prerequisite exam for AI coding. Return when a relevant situation appears; on a first read, you can skip this appendix.

ConceptOne-line meaningProduction use
Plan modeInspect, decompose, and define acceptance points before editingUse for ambiguous, complex, or high-risk work; do not over-plan a tiny fix whose acceptance criteria are already clear
Reasoning effortHow much inference effort the model spends on a taskUse lower settings for mechanical edits and higher settings for architecture, auth, payments, concurrency, and difficult debugging; never substitute it for tests
Context rot / compactionLong threads bury important facts or compress history into summariesPut must-preserve rules in files and branch, failure, and next-step state in handoffs; do not bind the whole project to one chat window
Config
config.toml / settings
Durable defaults for models, reasoning, sandbox, approvals, MCP, hooks, and pluginsKeep personal defaults global, repository behavior local, and one-off overrides temporary
Environment variable / secretRuntime configuration; a secret must not enter code, logs, prompts, or memoryGit-ignore .env, use least privilege and a secret store, and record only configured/not-configured status in evidence
Prompt injectionUntrusted pages, files, or tool output try to override the real instruction hierarchyTreat external content as data, not authority; use sandboxing, tool allowlists, approvals, and explicit deny-or-approve boundaries for high-risk actions
Test vs evalTests verify software behavior; evals measure model or workflow behavior across tasksTest the code and also test whether the harness misclassifies known failure fixtures as green
Deterministic / nondeterministicWhether the same input reliably produces the same resultKeep units and locked dependencies deterministic; record device, network, store, and time-dependent checks as a separate external-evidence lane
Trace / logThe record of tool calls, outputs, transitions, and errorsUse it to replay why a verdict occurred, but bound size, redact secrets, and distinguish raw logs from final verdicts
Idempotency / lockRepeating a run does not duplicate effects; a lock prevents conflicting runsA scheduled heartbeat needs a run lock, repeat-safe state transitions, and evidence of final release
Part IVTransfer the method into your own repository

Use a four-week path, a decision-oriented FAQ, and a prompt you can hand to an agent to build the smallest trustworthy loop.

From GPT chat user to AI-coding beginner: a four-week path

This is an execution index, not a second copy of the article: add one capability layer each week and return to the corresponding exercise above.

Week 1: read-only understanding and trust calibration

Use the surface recommendation and execution-location guide to start an agent. Ask it to explain architecture, map one call path, and locate tests without editing; spot-check where it guesses.

Week 2: complete one reversible change

Choose a reversible change using the small-task brief, then follow the five-step workflow through “inspect → change → AI review → local or test-environment acceptance → rollback if needed.”

Week 3: turn repeated lessons into a system

Return to capability extensions, Markdown instructions, and mechanical controls: create a short AGENTS.md, turn one repeated routine into a Skill, and add one Hook that blocks an obvious failure.

Week 4: add the second AI and evidence-based gates

Use the dual-AI failure modes and eleven traps to build “implement → independent review → fix → re-verify.” The reviewer is one sensor; real-environment evidence and human acceptance still constrain the result.

Skimmable FAQ: ten decisions beginners face

This is an index into the argument, not a second tutorial. Use the direct answer to decide, then return to the relevant chapter when you need the reasoning.

QuestionDirect answer
Do I need to learn “prompt engineering” first?No. Learn to state goal, observed behavior, scope, acceptance criteria, and constraints. That is more useful than memorizing incantations.
Can I start if I am not comfortable in a terminal?Yes. Begin with cd, git status, starting the agent, running the project’s test command, and git diff. You do not need to become a shell expert first.
Do I need two $200-tier subscriptions like yours?No. One repository-capable agent is enough for the beginner loop. Dual AI increases reviewer independence; it is not the entry fee.
Must I install memory, MCP, skills, and plugins first?No. Week one needs an agent, a repository, a task card, and the existing tests. Add extensions only after real repeated problems justify them.
If every test is green, why not ship?Tests observe only what they were written to observe. Visual, device, payment, authorization, and production-state changes need different evidence layers.
With two AIs, can I stop looking?You do not need to read every diff line or supervise every command, but you must define observable acceptance and, as I do, validate the final behavior locally or in production.
Should an agent ask me before every step?No. Local, reversible work inside the sandbox can proceed autonomously. Humans control identity, secrets, payments, and deletion; an authorized, reversible release can be executed by an agent.
If I send a task from my phone, does it run on my computer?Not necessarily. A cloud agent runs in a hosted container. Only Remote Control or Dispatch explicitly connected to a host uses that host’s local files and tools.
Will pasting this article reproduce your entire system?Not in one shot. It can guide a tool-using agent to build a minimum loop. A mature system grows from the failures it actually encounters.
Who remains accountable for production?The human. Agent autonomy does not transfer product, legal, financial, identity, or final-delivery accountability.

Can your AI really build this if you paste in the article?

It can build a minimum viable version, but pasting HTML into an ordinary chat window will not install a system. Start a coding-agent CLI with file, edit, and command tools from the repository directory, then give it this article and the prompt below. An AI without repository tools can produce only a proposal.

A reasonable first deliverable: a concise project instruction file, task-card template, executable verification script or harness, an independent-review contract with a fail-closed gate, and operating plus rollback instructions. Independent Review is READY only when a reviewer is genuinely callable and passes positive and negative tests; otherwise mark it UNSUPPORTED. Memory, MCP, plugins, multiple agents, and automated release do not need to arrive together.

The default authority below is intentionally more conservative than my mature project. A beginner should initially block commit, push, merge, and deploy, then authorize agent execution one capability at a time only after review, rollback, and release gates really work. It is a bootstrap policy, not a reverse description of my current workflow.

Bootstrap prompt to paste into Codex or Claude Code

You are running inside my project repository. I have attached an article titled “From Chatbot to Production-Grade AI Coding.”
Do not copy BluffKing-specific paths, commands, or technology. Adapt a “minimum trustworthy AI-coding loop” to this repository.

Working method:
1. Begin with read-only inventory. Identify the stack, Git/CI, test entry points, existing instruction files, hooks/scripts, high-risk areas, and your current tools and permissions. Record the current branch, baseline commit, git status --short, git worktree list, and pre-change diff. Do not guess or print content that may contain secrets.
2. Protect existing work before writing. If this is a shared main tree, contains changes unrelated to this task, or ownership is unclear, do not write here. Prefer an existing isolated feature worktree; if Git state permits, create a new worktree from the recorded baseline; otherwise mark NEEDS_USER. Never stash, reset, clean, rebase, or restore the whole repository on your own.
3. First output a “current state → gap → minimum change” table. Then implement only safe, local, reversible changes inside the isolated worktree; do not wait for confirmation on every ordinary file.
4. Reuse existing conventions instead of creating a parallel system. Keep instruction files concise. Turn recurring critical rules into executable checks.
5. Deliver at minimum:
   - A project instruction file for the current agent; improve an existing file instead of overwriting it blindly.
   - A task-card template with goal, observation, scope, acceptance criteria, and constraints.
   - A minimum verification script or harness that calls existing project tests and exits non-zero on failure.
   - An independent-review gate: first detect whether a second independent session/model is genuinely callable. If it is, use a fresh read-only session to review a harmless patch; it must read the real diff, requirement, and evidence and return parseable VERDICT and OPEN. A template alone is not READY. If no independent reviewer is callable, mark UNSUPPORTED or NEEDS_USER and keep the delivery gate closed.
   - Operating instructions from branch/worktree creation through verification, review, and rollback.
6. Verify the new loop with existing project commands. Failure self-tests may only create a disposable fixture, inject a temporary environment variable, or call an explicit false command; never damage existing business source, tests, or configuration. Compare exact status/diff before and after, remove only the fixture you created, and prove the user’s original state is unchanged.
7. Exercise at least four review-gate paths: an end-to-end dry run where a real independent reviewer examines a harmless patch; reviewer missing or timed out; malformed verdict; and non-empty OPEN. The last three must block. If no reviewer is callable, mark the first path UNSUPPORTED rather than manufacturing a green result.
8. Finish with changed files, commands actually executed and results, intentionally unimplemented items and reasons, remaining risks, and the complete rollback method. Rollback may remove only files created in this run or reverse this run’s exact patch; never use a repository-wide restore that overwrites prior work.
9. Output a capability matrix for Memory, MCP, Skill, Plugin, Markdown instructions, Hooks, Harness, Workflow, Worktree, independent Review, Automation, and Remote Control. Mark each READY / BUILD_NOW / NOT_NEEDED / UNSUPPORTED / NEEDS_USER, with evidence and the smallest next step. READY means genuinely callable and verified with positive and negative cases, not merely represented by a template or config file. Do not install capabilities merely for completeness.

Default authority boundary:
- Do not install global software, add paid services, or read or print secrets.
- Do not change global Git configuration or install hooks directly. You may create reviewable repository-local hook/gate scripts and installation instructions.
- Do not touch pre-existing changes or run stash, reset, clean, rebase, or a repository-wide restore on your own.
- Do not commit, push, merge, deploy, send external messages, or write production data.
- Stop at OTP, 2FA, signatures, payments, data deletion, production release, or any irreversible action and state the exact human step required.
- If evidence is missing, mark NOT_VERIFIED and do not claim completion.

This prompt can bootstrap a minimum loop; it cannot reproduce in one pass a system that evolved over three months.

AI coding is worth using—and you can start today

If you have already used ChatGPT or Claude, you do not need to master memory, MCP, skills, and hooks before you begin. The real first step is to open your project in a terminal and start Codex CLI or Claude Code. Let it read the repository, change code, and run the existing tests. Your job is to explain the problem and define what a correct result looks like.

I now use this setup—one founder working with Claude Code and Codex—to develop and operate a live product across H5, iOS, Android, and Telegram, including payment, subscription, refund, store-release, and production work. That is enough evidence for me that agents can handle substantial real engineering. They still write bugs and miss requirements, and two AIs can miss the same problem. “The agent says it is done” is therefore not the result. Tests, browsers, devices, live state, or your own use of the feature must confirm it.

Tomorrow, do only these four things

  1. Open a project you know in a terminal and start one coding-agent CLI.
  2. Give it one reversible task with the goal, observed behavior, scope, acceptance criteria, and prohibitions.
  3. Let the agent inspect, edit, and test on its own, then report exactly what changed and what it ran.
  4. Exercise the result once in your local or test environment. If it does not meet the requirement, return the observed behavior and let the agent continue fixing it.

At that point, you have moved beyond chatting with GPT and started AI coding. Once this basic workflow is reliable, add a second AI reviewer, isolated worktrees, skills, hooks, MCP, and automated gates. These concepts are not a shopping list to install at once. They are the next tools to add when a real failure shows you what your current workflow is missing.

Sources and receipts: Project practice can be verified in README.md, AGENTS.md, CLAUDE.md, docs/AGENTS-CONTRACT.md, docs/ops/HEARTBEAT-SOP.md, docs/architecture/ai-team-manager.html, docs/mobile/store-release-status.json, docs/ops/billing-provider-status.json, scripts/ai-team-manager.mjs, scripts/loop/run.mjs, scripts/bugfree/trusted-local-launcher.mjs, scripts/claude-review.mjs, .agents/skills/visual-animation-verify/SKILL.md, and .agents/skills/visual-fidelity/SKILL.md. Real fixes and workflow commits cited include 46c9b57d, 7767eede, 4083b0d8, a23646c7, 7c3142bb, af86fbcd, and 5b3e01b0. Product and concept boundaries follow official OpenAI documentation for customization, hooks, plugins, cloud environments, Browser, ChatGPT Remote, and harness engineering, plus Anthropic’s official Claude Code with Chrome and Claude Code Remote Control documentation. Claims about reviewer bias also draw on ACL-published research on LLM-as-a-judge bias and self-correction bias. Product status, Remote capabilities, and official concepts were checked on 2026-07-19 and may evolve. No unsupported productivity, speed, or defect-rate figures are used.