Back to diary list

Diary

Technical Document Digest 11/01–11/07: Agent Harnesses, Deterministic Tool Design, and Edge Boundary Insights

November 8, 202634 minShin Yamaguchi (Representative Partner, FLARES LLC)
A desk in a study bathed in gentle morning light. A calm workspace with a laptop, blueprints, and a warm cup of coffee.

Over the week from November 1st to November 7th, 2026, flares.jp published a total of six technical documents.

The areas covered were diverse, including AI agent harness design, deterministic CLI tools, infrastructure ownership boundary contracts, bot defense at the edge, coexistence of legacy email infrastructure with serverless, and codebase hygiene management through CI/CD. While these may seem like disparate technical challenges, the underlying engineering philosophy that unifies them is:eliminating reliance on inference and ambiguity, clearly defining boundaries, and mechanizing systems deterministically.

As AI agent implementations and cloud-native infrastructure operations advance, systems become more complex, leading to increased instances of black boxes and unexpected behavior. When faced with such uncertainties, what criteria should be used to define boundaries, where should automation be applied, and where should mechanical defenses be implemented? This review organizes and reflects on the practical design judgments and insights from the six documents published this week.


1. Agent Harness Design with a Fast, Lightweight Model as the Commander

In recent years, the inference capabilities of LLMs have dramatically improved. However, over-reliance on these capabilities, leading to a single-agent operation where "the smartest and most robust model handles everything from dialogue reception to file scanning, implementation, testing, and review," results in two fatal obstacles: increased latency, with waits of several to tens of seconds per dialogue turn, and rapid token consumption (quota exhaustion and cost explosion) due to context bloat.

This paper explains an agent harness architecture designed to solve this problem by "minimizing the operational turns of the parent agent (commander) and delegating tasks in parallel to agile workers."

[User Request]
       │
       ▼
[Command Center: Gemini 3.8 Flash] ── Task Decomposition / Triage (Low Latency)
       │
       ├───────────────────┬───────────────────┐
       ▼                   ▼                   ▼
[Implementation: Grok 4.8 / GPT 6.1]  [Research: Flash Worker]  [Testing: Grok 4.8]
       │                   │                   │
       └───────────────────┴───────────────────┘
                           │ Aggregate Deliverables
                           ▼
[Independent Review: Claude Opus 5.5] ── Critical Defect Judgment Only

Specifically, it positions an ultra-fast and inexpensive model like Gemini 3.8 Flash as the "Commander (Thin Orchestrator)," dedicating it to interpreting requests, decomposing tasks, and triaging difficulty. Actual code writing and research are delegated in parallel to specialized models like Grok 4.8 or GPT 6.1, adopting a "sandwich structure" where only the final independent review is entrusted to a top-tier model like Claude Opus 5.5.

Furthermore, to prevent autonomous agents from running wild, the following deterministic guardrails are incorporated as design specifications:

  • Goal Contract: Objectively defined criteria for completion (e.g., exit code 0, all tests pass) are established in advance, prohibiting termination based on the model's subjective "I'm done."
  • Termination Boundary: Processing is physically halted when a specified number of turns or consecutive failures is reached, preventing retry loops.
  • Spend-Cap Reservation: An upper limit for allowable tokens and costs is reserved at the start of a task, systematically blocking budget overruns.

This approach balances speed, quality, and cost through the structure of the harness (exoskeleton), rather than relying solely on the model's intelligence.


2. Bot Countermeasures at the Edge—Cloudflare Bot Fight Mode Specification Boundaries and PHP Infrastructure Evolution

When you publish websites or business systems, you are routinely exposed to countless accesses from automated crawling bots, vulnerability scanning tools, and content scrapers. If these requests reach your origin server (PHP, WordPress, or container-based environments) and are processed there, CPU and memory are wasted, leading to slower response times for legitimate users and potential server downtime.

This paper discusses an architecture that blocks malicious access at the network's forefront (Cloudflare's edge) without letting it touch the origin, along with operational considerations for such a setup.

A particularly common issue in practice is the specification boundary between Cloudflare's "Free Bot Fight Mode (BFM)" and the "Paid Super Bot Fight Mode (SBFM)". Since the free BFM is applied uniformly across the entire domain, it risks misidentifying legitimate webhook notifications from external SaaS or API requests for mobile apps as "bots," presenting challenge screens, and thus breaking external integrations.

In response, this paper proposes the following practical boundary design.

  1. API Exclusion via WAF Custom Rules: A design that explicitly identifies authentication headers or specific endpoint paths (/api/*, /webhooks/*) to safely bypass them from bot management.
  2. Historical Evolution of PHP Infrastructure and Separation of Concerns: The transition from an era where everything was handled and defended by server-side PHP processes, to a modern architecture where static asset distribution, bot blocking, and SSL termination are offloaded to the edge layer (CDN/WAF), allowing the origin to focus purely on business logic.

This paper organizes design insights on how to minimize the load and operational costs of origin infrastructure by drawing the boundary of "where to defend and where to process" at the edge.


3. Deterministic Tool Design Independent of AI Inference. CLI Handles and Safe Boundary Architecture to Prevent LLM Agent Drift

When autonomously operating LLM-powered coding agents, what is the biggest cause of wasted time and failure? Our analysis in this paper suggests it's not "failure in code generation itself," but rather "inference drift during environment investigation, file searching, and state checking."

If AI agents are only given generic shell execution privileges and low-level file read/write tools, they will repeatedly execute incomplete grep or find commands based on their own inference, fill the context with a large amount of irrelevant logs, and eventually lose sight of their original goal and hang.

This paper advocates an architecture that "solves problems in one go with deterministic CLI tools (handles) rather than relying on inference."

  • Provision of High-Level CLI Handles: Provide agents with specialized CLIs (e.g., a tool that outputs the entire project's dependency graph and related files as JSON with a single command) pre-implemented in Go or TypeScript for complex exploration procedures and routine processing.
  • Compression of Inference Space: Allow the agent to make only a single decision: "which arguments to call the specialized CLI with," thereby physically reducing the number of trial-and-error steps.
  • Mechanical Evidence Verification (Fail-Closed Gate): When determining completion of a fix, completely disregard the AI's self-declaration ("Fix completed" text output). The task is not considered complete unless objective evidence exists, such as an exit code of 0, successful type checking, or JSON output of test results.

Minimizing the area reliant on inference to "creative code editing," and solidifying exploration and verification with deterministic mechanisms. This is the key to dramatically increasing agent completion rates.


4. Customer Account or Our Own Account—A Design Contract to Define "Infrastructure Ownership Boundaries" Before Letting AI Write Code

In contract development and product development utilizing AI agents, a significant rework issue has become frequent in recent years. This occurs when, after instructing an AI to quickly create a prototype based on requirements, it's discovered during deployment to a production environment that the infrastructure ownership or account design is fundamentally flawed.

When given instructions, AI tends to build IAM policies, environment variables, and SaaS connection code assuming the most readily available and easily configurable environment (e.g., the company's development AWS/GCP account or a shared database). However, actual enterprise, government, or general customer projects involve complex ownership boundaries, such as "compute infrastructure on the customer's cloud account, databases within the customer's VPC, and email delivery SaaS on the company's multi-tenant operational platform."

This paper defines "four ownership boundary contracts" that should be agreed upon between humans and AI before a single line of code is written.

Ownership Boundary LayerMatters to be DecidedImpact of Failure in Boundary Setting
1. Compute InfrastructureAccount attribution of execution hosts like Cloud Run, ECS, WorkersIAM redesign, complete rewrite of deployment pipelines
2. Data StoreOwnership and access paths for DBs, storage bucketsDifficulty in data migration, issues raised in security audits
3. External SaaS/APIsContract names and API key management responsibilities for SendGrid, Stripe, etc.Billing confusion, troubles during cancellation/handover
4. Operations/Monitoring (Ops)Log collection, alert notification destinations, leadership in incident responseDelayed incident detection, ambiguity in responsibility demarcation

By clearly defining these boundaries beforehand as a "contract specification (manifest)" and injecting them as AI prompts and profiles, IaC (Terraform, etc.) and application code based on the correct account configuration and privilege separation will be generated from the start.


5. Coexisting Cloudflare Workers SendEmail with XSERVER operational domains: Secure system sending design through MX protection, SPF concatenation, and DKIM selector separation.

In practical scenarios, development is not always ideal greenfield (completely new). It is extremely common to have a requirement to send automated notification emails from a newly established web application (Cloudflare Workers) using the same domain name, for domains where the operator's daily business emails have been stably running for many years on a rental server (such as XSERVER).

However, performing this task with insufficient knowledge of DNS settings can lead to irreversible accidents. A typical example is the trouble caused by "casually enabling Cloudflare's Email Routing, which overwrites MX records and completely stops existing business emails."

This article provides a detailed explanation of the "three boundary defenses" for safely coexisting system email sending from Workers without interrupting the existing email reception environment for even a second.

[Sender 1: XSERVER (Daily Business Email)]
       │ Existing SPF: include:vsv.jp
       ▼
[DNS Records (Cloudflare DNS)]
  ├─ MX Record: Maintain existing server (do not overwrite with Email Routing)
  ├─ SPF Merged: "v=spf1 include:vsv.jp include:_spf.mx.cloudflare.net ~all"
  ├─ DKIM Selector Separation:
  │    ├─ default._domainkey (for existing email)
  │    └─ cfworkers._domainkey (for Workers sending - newly established)
  └─ DMARC Record: p=quarantine / p=reject (alignment compliant for both sending paths)
       ▲
[Sender 2: Cloudflare Workers SendEmail (System Email)]
       │ Dedicated Selector: cfworkers._domainkey
  1. Complete MX record protection: Sending from Workers (SendEmail API) operates independently of receiving functions (Email Routing), so MX records do not change any values of the existing rental server.
  2. SPF record concatenation syntax: Do not delete the existing SPF (e.g., include:vsv.jp), but correctly concatenate Cloudflare's sending permission (include:_spf.mx.cloudflare.net) within a single TXT record.
  3. Physical separation of DKIM selectors: To avoid conflicts with DKIM signatures used by existing email software, assign a unique selector name (e.g., cfworkers._domainkey) to the Workers side and register the public key.

This is practical knowledge for achieving safe coexistence while passing DMARC authentication 100% by strictly separating DNS specification boundaries so that old and new infrastructures do not encroach on each other's domains.


6. Continuous Codebase Hygiene Management with Dependabot and Knip: CI/CD Integration for Dependency Patch Automation and Dead Code Pruning

Software begins to obsolesce the moment it is completed. Neglected external libraries become breeding grounds for security vulnerabilities, and dead code (unused files, exports, type definitions) left behind during repeated feature modifications and refactoring degrades codebase visibility and inflates build times and bundle sizes.

This article discusses a mechanism for continuously and automatically performing "codebase hygiene management" via CI/CD pipelines, rather than relying on developers' goodwill or meticulousness.

Specifically, the following two tools are integrated into GitHub Actions.

  • Dependabot's weekly grouped updates:

When multiple PRs for dependency package updates arrive daily, they waste CI execution minutes and cause review fatigue. By defining dependabot.yml in the configuration file (groups), development tools (TypeScript, ESLint, Vite, etc.) and minor/patch updates are consolidated into a single PR once a week (e.g., early Monday morning).

  • Mechanical detection of dead code with Knip:

In TypeScript projects, Knip performs static analysis to find files that are not imported anywhere, unnecessary module exports, unreferenced type definitions, and package.json unnecessary dependencies that remain in the package.json file. By integrating this into the PR validation CI gate and detecting these as errors rather than warnings, we prevent the accumulation of unnecessary code at the source.

Instead of "publicizing hygiene management as a rule," we "deterministically embed it as a gate in the CI pipeline." This is practical knowledge for structurally preventing technical debt.


Summary: Eliminate reliance on inference, clarify boundaries, and mechanize deterministically

What the six technical documents published this week have in common is the stance of "how to draw clear boundaries and control elements with uncertainty (LLM inference, malicious external communication, infrastructure attribution, DNS conflicts, code degradation over time) with deterministic rules."

  1. Precisely because we leverage AI's intelligence, we constrain it with harnesses (stop boundaries, goal contracts).
  2. Precisely because we publish to the web, we block malicious traffic at the edge (WAF/CDN).
  3. Precisely because we allow agents to operate autonomously, we entrust exploration to deterministic CLI tools.
  4. Precisely because we accelerate implementation, we fix prior infrastructure ownership boundaries as contracts.
  5. Precisely because we coexist new and old infrastructure, we strictly separate DNS record boundaries.
  6. Precisely because we maintain codebase quality, we irreversibly embed hygiene management into the CI pipeline.

In an era where new tools like AI and serverless are becoming widespread and development speed is accelerating, the value of "classic and honest engineering principles" such as foundational system design and boundary definition is increasing.

Each document details specific configuration code, architectural diagrams, and checklists to prevent failures. Please refer to the explanations in each article for daily design decisions and system operations.