Beyond the Demo: Quotas and Pitfalls of Using AI Coding Tools in Production

    A practical field report on integrating AI coding assistants into a live, zero-dependency backend service. It explains why production repositories differ from demo projects, how to treat subscription quotas as a schedulable budget through tiered model usage and context compaction, and how to prevent production breakage with permission boundaries, state-transition matrices, idempotent writes, and small-step testing. It also covers which tasks should stay human-led and summarizes a reusable set of practices for turning AI output into daily productivity.

    1. Demo Repositories and Production Repositories Are Two Different Engineering Problems

    Discussion about AI coding tools has been intense in technical communities lately, and most demos focus on greenfield scenarios: small games, knowledge cards, single-page apps. These tasks share one trait: no legacy baggage. You define the directory structure, you design the data model, and if something breaks you just open a new repository. The cost of trial and error is close to zero.

    Production projects are the opposite. They are systems already serving real traffic, carrying implicit conventions, legacy branches, field semantics that downstream services depend on, and a pile of “just know it” rules that never made it into documentation. What I integrated this time was a backend service with zero third-party dependencies: a recent Node.js version with native SQLite support as the runtime, a reverse proxy in front as the traffic entry point, and data stored in a single-file database. The “thinner” the stack, the more it tests how precisely the AI understands standard library semantics and concurrency behavior.

    Over one week it handled four kinds of real work:

    • Adding multi-layer rate limiting and credential validation to external-facing endpoints;
    • Inserting an “out of stock to pre-order queue” branch into an existing order state machine;
    • Pulling the last five days of compressed, archived access logs over remote login to reconstruct the visitor conversion funnel;
    • Mounting a silent inspection job that runs every hour.

    The end result was stable code in production with all 42 native unit tests green. But what is worth writing about is not the result; it is the four general problems the process exposed.

    2. Quotas Are Not an “Unlimited Resource” but a Budget to Be Scheduled

    Most subscription quotas that roll over on a time window are essentially a budget constraint. Right after subscribing, people tend to fall into an illusion: since the highest reasoning tier and parallel sub-agents are available, run everything at full throttle. In practice, two things usually happen: the high-thinking tier has noticeable latency, so changing an ordinary endpoint parameter takes a long wait; and using the top tier for routine CRUD or minor style tweaks is a typical waste of compute. Parallel sub-agents spin up multiple independent contexts at once. They suit large changes that genuinely need multiple modules advanced in parallel and verified independently. Forcing parallelism onto a single bug fix just amplifies consumption.

    By day three I had converged on a tiered strategy that doubled output within the same time window:

    1. The main tier handled about 80% of the work: cross-file integration, routine business code, and unit test writing. This tier is the most balanced between speed and quality; after reading a dozen or so files, it rarely drifts when changing state logic.
    2. Escalate only in two situations: first, changes to core state transitions, where it needs to reason through every exception branch such as concurrent retries, idempotency, and timeout rollback; second, a strange production issue that two consecutive rounds failed to locate, which needs stronger hypothesis generation.
    3. Once solution review and root-cause analysis are done, drop back down a tier before having it write the actual implementation. Use the high-thinking tier to “think” and the mid tier to “write”; this is the division of labor that saves both quota and time.
    4. Use parallel sub-agents only for separable units that can be accepted independently, for example filling in three unrelated groups of tests at the same time, rather than having them edit the same state machine in parallel.

    Three supporting habits also save quota: state the requirement completely in one pass (goal, constraints, acceptance criteria) to reduce back-and-forth rounds; before a long task, have it output a change list and confirm it before letting it proceed; and compact the context after each verifiable small loop closes, so the conversation history does not inflate indefinitely and push up the per-turn cost.

    3. Preventing Production Breakage: Confining AI Within Engineering Constraints

    The first pitfall is permission boundaries. Once you give the tool remote login and file-write ability, the biggest risk is not that it writes wrong logic but that it “helpfully” overwrites a production config file or a secrets file. The effective approach is layered isolation: the source directory is writable, config and secrets directories are read-only, production parameters are managed through a separate injection channel, and any write first lands on a branch or working copy, validated by the pipeline before merge.

    A schematic policy declaration can be plain:

    1. // Write path allowlist
    2. const WRITE_ALLOW = [/^src\//, /^test\//];
    3. // Paths explicitly off-limits
    4. const READ_ONLY = [/^config\/prod\./, /^\.env/, /^deploy\//];
    5. function assertWritable(path) {
    6. if (READ_ONLY.some(re => re.test(path))) throw new Error('readonly: ' + path);
    7. if (!WRITE_ALLOW.some(re => re.test(path))) throw new Error('not allowed: ' + path);
    8. }

    The second pitfall is inserting a branch into a state machine. Adding “out of stock to pre-order queue” to an existing payment flow is hard not because of the new state but because of the Cartesian product of old and new states. AI easily handles only the main path and misses edge cases such as timeouts, duplicate callbacks, and partial fulfillment. My constraint was: first have it list the state and event matrix, filling the expected behavior of every (state, event) combination into a table, and only write code after confirming there are no blanks; also require every write operation to carry an idempotency key.

    1. // Minimal skeleton for an idempotent write
    2. async function transition(orderId, event, idemKey) {
    3. return db.exec(
    4. `INSERT INTO state_log(order_id,event,idem_key,created_at)
    5. VALUES(?,?,?,?) ON CONFLICT(idem_key) DO NOTHING`,
    6. [orderId, event, idemKey, Date.now()]
    7. ).then(() => load(orderId));
    8. }

    The third pitfall is a fully red test suite. After batch changes, many cases fail, usually not because the logic is wrong but because it changed a function signature or field name without updating all call sites. The response is to require “small commits plus run tests at each step” and to feed the original failing test text back rather than letting it improvise.

    The fourth pitfall is log-analysis tasks. When having it log into a machine to pull compressed archived logs for funnel statistics, the accuracy of directly given conclusions is not high. A more reliable approach is to limit it to “generating the parsing script,” with the statistical definition set by you; after the script outputs intermediate results, you make the judgment.

    1. import { createReadStream } from 'node:fs';
    2. import { createGunzip } from 'node:zlib';
    3. import { createInterface } from 'node:readline';
    4. const rl = createInterface({
    5. input: createReadStream('access.log.5.gz').pipe(createGunzip()),
    6. crlfDelay: Infinity
    7. });
    8. const funnel = new Map();
    9. for await (const line of rl) {
    10. const [, path, status] = line.split(/\s+/);
    11. if (status?.startsWith('2')) funnel.set(path, (funnel.get(path) ?? 0) + 1);
    12. }
    13. console.log([...funnel].sort((a, b) => b[1] - a[1]));

    4. Which Work Should Not Be Forced onto AI

    Three kinds of tasks should stay human-led: first, those involving irreversible operations, such as data migration, bulk deletion, and production config changes; second, those requiring business-semantic judgment, such as whether a legacy field actually means “paid” or “ordered,” which the code cannot answer; third, security-sensitive implementations, such as credential validation and rate-limit thresholds, where a human must define the rules and AI only handles implementation and test coverage.

    5. Reusable Conclusions from One Week

    Integrating AI coding tools into a production repository pays off through “tiered scheduling plus strong constraints,” not by maxing out the tier. On quota: grade the thinking tiers, compact context promptly, and use parallelism only for independently acceptable modules. On quality: produce the change list and state matrix before writing code, keep config directories read-only, and route writes through branches and the pipeline. On boundaries: keep irreversible and strongly semantic tasks human-backed. With these three points in place, AI can shift from a “demo surprise” to “daily capacity.”