<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc [
  <!ENTITY RFC2119 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
  <!ENTITY RFC6241 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6241.xml">
  <!ENTITY RFC7950 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7950.xml">
  <!ENTITY RFC8040 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8040.xml">
  <!ENTITY RFC8174 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
  <!ENTITY RFC8342 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8342.xml">
  <!ENTITY RFC8792 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8792.xml">
  <!ENTITY RFC8808 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8808.xml">
]>
<?rfc strict="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude"
     category="std"
     docName="draft-feng-netconf-naim-op-00"
     ipr="trust200902"
     submissionType="IETF"
     consensus="true"
     version="3">

  <front>
    <title abbrev="NAIM Operation IR">
      Operation Intent Intermediate Representation for AI-Assisted Network Management
    </title>

    <seriesInfo name="Internet-Draft" value="draft-feng-netconf-naim-op-00"/>

    <author fullname="Chong Feng" initials="C." surname="Feng">
      <address>
        <email>fengchongllly@gmail.com</email>
      </address>
    </author>

    <date/>

    <area>Operations and Management</area>
    <workgroup>NETCONF Working Group</workgroup>

    <keyword>NAIM</keyword>
    <keyword>Operation IR</keyword>
    <keyword>AI-assisted network management</keyword>
    <keyword>intent-based networking</keyword>
    <keyword>NETCONF</keyword>
    <keyword>RESTCONF</keyword>

    <abstract>
      <t>
        This document defines Operation IR, a protocol-neutral intermediate
        representation for runtime network operations in the NAIM architecture.
        Operation IR serves as an AI-friendly operation layer between AI agents
        or LLM-based systems and the underlying network management protocols.
        It captures write operations, retrieval, RPC/action invocation,
        filtering, transaction metadata, precondition verification, compensation
        semantics, and optional expression-based values.
      </t>
      <t>
        Operation IR is designed to be consumed by any upstream mechanism
        capable of generating structured operation intent, including but not
        limited to MCP tool invocations, function calling interfaces, and
        agent-to-agent communication protocols. The translation of Operation IR
        into protocol-specific messages is performed deterministically by a
        Handler component, keeping the AI agent in the role of intent encoder
        rather than protocol executor.
      </t>
      <t>
        This document also defines context completeness classes for the
        Originator (AI agent) side, validation feedback requirements, and an
        execution preview mode intended to improve safety and operator trust.
        It standardizes semantic expectations and interoperability boundaries,
        but does not standardize proprietary dialogue policies,
        implementation-specific scheduling internals, automatic compensation
        derivation algorithms, or private execution-engine logic.
      </t>
    </abstract>
  </front>

  <middle>

    <section anchor="intro" numbered="true" toc="default">
      <name>Introduction</name>
      <t>
        The NAIM framework introduced a structured semantic representation for
        AI-assisted network modeling based on YANG <xref target="RFC7950"/>.
        The same semantic discipline is useful
        for runtime network operations, where users increasingly expect to
        express configuration, monitoring, and troubleshooting requests using
        high-level or natural-language intent.
      </t>
      <t>
        NAIM Operation IR defines the operation layer of the NAIM architecture.
        It sits between the AI agent (Originator) and the network management
        protocols, providing a structured, AI-friendly representation of
        operational intent that can be deterministically translated into
        protocol messages by a Handler component. This separation keeps
        protocol complexity out of the AI reasoning loop.
      </t>
      <t>
        The upstream interface of Operation IR is deliberately protocol-agnostic:
        Operation IR objects may be submitted by an LLM via MCP tool invocations,
        function calling, agent-to-agent communication protocols, or any other
        mechanism. The choice of upstream delivery mechanism does not affect the
        semantics of the Operation IR itself. Companion documents define specific
        upstream bindings (e.g., MCP integration).
      </t>
      <t>
        The downstream interface of Operation IR targets model-driven network
        management protocols, with NETCONF <xref target="RFC6241"/> and
        RESTCONF <xref target="RFC8040"/> as the primary examples. Handlers
        MAY support additional management protocol backends.
      </t>
      <t>
        Direct translation of runtime intent into protocol messages suffers from:
      </t>
      <ul spacing="normal">
        <li>ambiguity in user intent;</li>
        <li>missing required parameters;</li>
        <li>violation of model constraints;</li>
        <li>lack of explicit precondition handling;</li>
        <li>multi-step changes that require rollback or compensation; and</li>
        <li>protocol-specific behavior that obscures the original intent.</li>
      </ul>
      <t>
        NAIM-OP addresses these problems by introducing Operation IR, a
        protocol-neutral intermediate object designed to capture runtime
        semantics before protocol-specific requests are produced.
      </t>
    </section>

    <section anchor="requirements" numbered="true" toc="default">
      <name>Requirements Language</name>
      <t>
        The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
        "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
        "OPTIONAL" in this document are to be interpreted as described in
        BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and
        only when, they appear in all capitals, as shown here.
      </t>
      <t>
        Where examples of JSON or other structured content exceed the
        line-length limits of this document format, the single-backslash
        strategy ('\') defined in <xref target="RFC8792"/> is used to
        fold long lines.
      </t>
    </section>

    <section anchor="terminology" numbered="true" toc="default">
      <name>Terminology</name>
      <dl newline="false" spacing="normal">
        <dt>NAIM Document:</dt>
        <dd>A semantic model object as defined by the NAIM framework
          <xref target="I-D.feng-netmod-naim"/>.</dd>
        <dt>Operation IR:</dt>
        <dd>A structured JSON object representing a runtime operation intent.</dd>
        <dt>Originator:</dt>
        <dd>The AI agent or LLM-based system that generates Operation IR
          objects based on user intent and available semantic context.</dd>
        <dt>Handler:</dt>
        <dd>The deterministic software component that validates Operation IR
          objects against the NAIM Document, checks preconditions against the
          live device, and translates validated Operation IR into
          protocol-specific messages for execution.</dd>
        <dt>Target Path:</dt>
        <dd>An absolute schema path identifying the target of an operation.</dd>
        <dt>Hard Constraint:</dt>
        <dd>A model-derived constraint that MUST be satisfied.</dd>
        <dt>Soft Constraint:</dt>
        <dd>An operation-time condition or preference associated with a value.</dd>
        <dt>Dynamic Reference:</dt>
        <dd>A reference to current network state used during evaluation.</dd>
        <dt>Transaction:</dt>
        <dd>A group of operations intended to execute as one logical unit.</dd>
        <dt>Compensation Operation:</dt>
        <dd>An operation intended to reverse or mitigate the effect of a
          previously executed operation.</dd>
        <dt>Context Completeness:</dt>
        <dd>The degree to which the semantic context available to the
          Originator (AI agent) is complete, partial, or skeleton-only.
          This refers to the Originator-side NAIM LLM Context View, not
          to the Handler's internal NAIM Document, which SHOULD always
          be complete.</dd>
      </dl>
    </section>

    <section anchor="scope" numbered="true" toc="default">
      <name>Scope and Non-Goals</name>
      <section anchor="scope-in" numbered="true" toc="default">
        <name>Scope</name>
        <t>This document describes:</t>
        <ul spacing="normal">
          <li>the architectural position of Operation IR between AI agents and management protocols;</li>
          <li>the Originator workflow for intent recognition, parameter elicitation, precondition handling, and compensation planning;</li>
          <li>the structure of Operation IR;</li>
          <li>object semantics for core runtime operation fields;</li>
          <li>datastore selection semantics;</li>
          <li>representation of soft constraints and dynamic references;</li>
          <li>transaction grouping and compensation semantics;</li>
          <li>context completeness classes for the Originator side;</li>
          <li>dry-run execution preview semantics; and</li>
          <li>validation feedback expectations.</li>
        </ul>
      </section>
      <section anchor="scope-out" numbered="true" toc="default">
        <name>Non-Goals</name>
        <t>This document does not standardize:</t>
        <ul spacing="normal">
          <li>natural-language elicitation strategies;</li>
          <li>question ordering policies;</li>
          <li>automatic compensation derivation algorithms;</li>
          <li>execution-engine scheduling internals;</li>
          <li>expression-evaluation internals;</li>
          <li>vendor-specific workflow logic;</li>
          <li>upstream delivery mechanisms (MCP, function calling, A2A, etc.),
            which are defined in companion binding documents; or</li>
          <li>wire-level syntax beyond the governing protocol specifications.</li>
        </ul>
      </section>
    </section>

    <section anchor="principles" numbered="true" toc="default">
      <name>Design Principles</name>
      <t>NAIM-OP is guided by:</t>
      <ul spacing="normal">
        <li>protocol neutrality on the upstream (AI agent) side;</li>
        <li>open extensibility on the downstream (protocol execution) side;</li>
        <li>semantic grounding in NAIM Document context;</li>
        <li>progressive extensibility;</li>
        <li>explicit degradation behavior; and</li>
        <li>user-visible safety boundaries.</li>
      </ul>
    </section>

    <section anchor="architecture" numbered="true" toc="default">
      <name>Architectural Position</name>
      <section anchor="arch-layers" numbered="true" toc="default">
        <name>Layered Architecture</name>
        <t>
          Operation IR occupies the operation layer of the NAIM architecture,
          positioned between the semantic layer (NAIM Document and LLM Context
          View) and the protocol execution layer:
        </t>
        <artwork name="" type="ascii-art" align="left"><![CDATA[
AI Agent / LLM (Originator)
  |
  | [any upstream mechanism: MCP, function calling, A2A, ...]
  |
Operation IR                          <-- this document
  |
  | [deterministic Handler translation]
  |
NETCONF / RESTCONF / other management protocols
  |
Network Infrastructure
        ]]></artwork>
        <t>The Handler is responsible for:</t>
        <ul spacing="normal">
          <li>validating Operation IR against the NAIM Document;</li>
          <li>verifying preconditions against live device state;</li>
          <li>translating validated Operation IR into protocol-specific messages;</li>
          <li>executing protocol operations; and</li>
          <li>triggering compensation on failure.</li>
        </ul>
        <t>
          The Originator is responsible for generating semantically correct
          Operation IR objects based on user intent and the NAIM LLM Context
          View. The Originator does not construct protocol-specific messages
          directly.
        </t>
      </section>
      <section anchor="arch-flow" numbered="true" toc="default">
        <name>End-to-End Interaction Flow</name>
        <t>
          The complete flow from user intent to device execution is illustrated
          below. The Originator side (steps 1-6) covers how the AI agent
          retrieves semantic context, elicits missing parameters, resolves
          preconditions, and generates a complete Operation IR. The Handler
          side (steps A-E) covers deterministic validation, precondition
          verification against the live device, protocol translation,
          execution, and automatic compensation on failure. Detailed
          description of the Originator workflow is provided in
          <xref target="originator-workflow"/>. Handler behavior is described
          in Sections <xref target="operation-ir"/> through
          <xref target="protocol-mapping"/>.
        </t>
        <artwork name="" type="ascii-art" align="left"><![CDATA[
User
  |
  | natural language intent
  |
  v
Originator (AI Agent / LLM)
  |
  |--[1]--> Retrieve NAIM LLM Context View for target resource
  |           (fields, constraints, operation vocabulary,
  |            preconditions, side effects, examples)
  |
  |--[2]--> Identify target resource and operation
  |           from intent and Context View
  |
  |--[3]--> Check required fields against Context View
  |           Missing required fields --> elicit from user [LOOP]
  |           Hard Constraint violation --> re-elicit with guidance
  |           Soft Constraints --> confirm with user
  |
  |--[4]--> Resolve preconditions from Context View
  |           Structured preconditions --> populate precondition_state
  |           Natural language preconditions --> confirm with user
  |
  |--[5]--> Determine compensation need from Context View
  |           Write operations with declared side effects -->
  |           populate compensation
  |
  |--[6]--> Generate complete Operation IR
  |
  v
Handler (deterministic)
  |
  |--[A]--> Validate Operation IR against NAIM Canonical Document
  |--[B]--> Verify precondition_state against live device state
  |--[C]--> Translate to protocol-specific messages
  |--[D]--> Execute against network device
  |--[E]--> Trigger compensation on failure
  |
  v
Execution Report --> Originator --> natural language result --> User
        ]]></artwork>
      </section>
    </section>

    <section anchor="originator-workflow" numbered="true" toc="default">
      <name>Originator Workflow</name>
      <t>
        This section describes how an Originator (AI agent or LLM-based system)
        uses the NAIM LLM Context View to understand user intent and generate a
        semantically complete Operation IR. This workflow is the core value
        proposition of NAIM-OP: by grounding intent generation in explicit
        semantic context, the Originator produces Operation IR objects that are
        safe, complete, and deterministically executable by the Handler.
      </t>
      <t>
        The specific dialogue strategies and question ordering used by an
        Originator are implementation choices and are not standardized by this
        document. The following describes the expected logical stages.
      </t>
      <section anchor="context-retrieval" numbered="true" toc="default">
        <name>Context View Retrieval</name>
        <t>
          Before generating an Operation IR, the Originator SHOULD retrieve the
          NAIM LLM Context View for the target resource. The LLM Context View
          provides the semantic information the Originator needs to reason
          correctly about the operation, including:
        </t>
        <ul spacing="normal">
          <li>available operations and their target paths;</li>
          <li>field definitions with types, constraints, and examples;</li>
          <li>preconditions that must hold before each operation;</li>
          <li>side effects and state transitions associated with each operation;</li>
          <li>compensation vocabulary for reversible operations; and</li>
          <li>visibility conditions (if-feature, when) affecting field availability.</li>
        </ul>
        <t>
          The Originator MUST NOT generate an Operation IR by guessing field
          names, types, or constraints from training knowledge alone. Semantic
          grounding in the NAIM LLM Context View is the mechanism that
          distinguishes NAIM-OP from generic function calling.
        </t>
      </section>
      <section anchor="intent-mapping" numbered="true" toc="default">
        <name>Intent Recognition and Operation Mapping</name>
        <t>
          Once the Context View is available, the Originator maps the user's
          natural language intent to a specific operation defined in the Context
          View. This includes:
        </t>
        <ul spacing="normal">
          <li>identifying the target resource (e.g., an interface, a BGP neighbor, a routing policy);</li>
          <li>identifying the operation type (e.g., update, delete, get); and</li>
          <li>extracting any parameter values explicitly stated in the user intent.</li>
        </ul>
        <t>
          If the intent is ambiguous or maps to multiple possible operations,
          the Originator SHOULD seek clarification from the user before
          proceeding.
        </t>
      </section>
      <section anchor="elicitation" numbered="true" toc="default">
        <name>Parameter Elicitation and Constraint Validation</name>
        <t>
          After identifying the target operation, the Originator checks the
          required fields declared in the Context View against the parameters
          extracted from user intent. For any required field that is missing or
          invalid, the Originator MUST elicit the value from the user through
          targeted questions grounded in the Context View.
        </t>
        <t>
          Elicitation SHOULD be specific and informative. The Originator SHOULD
          use the field's description, type, constraints, and examples from the
          Context View to formulate questions. For example, instead of "Please
          provide the MTU value", the Originator SHOULD ask: "Please provide
          the MTU value for interface eth0. The allowed range is 68 to 65535
          bytes; common values are 1500 (standard) and 9000 (jumbo frames)."
        </t>
        <t>
          Hard Constraint validation MUST be applied to each value as it is
          received. If a provided value violates a Hard Constraint, the
          Originator MUST reject the value, explain the constraint to the user,
          and re-elicit. The Originator MUST NOT pass a value that violates a
          Hard Constraint to the Handler.
        </t>
        <t>
          Soft Constraints represent operation-time preferences that are not
          model-derived. The Originator SHOULD confirm Soft Constraints with
          the user before including them in the Operation IR.
        </t>
        <t>
          The elicitation loop continues until all required fields are populated
          with values that satisfy Hard Constraints. The Originator SHOULD
          present a summary of the planned operation to the user for
          confirmation before generating the final Operation IR.
        </t>
      </section>
      <section anchor="precondition-handling" numbered="true" toc="default">
        <name>Precondition Handling</name>
        <t>
          The Context View may declare preconditions for each operation.
          Preconditions come in two forms:
        </t>
        <t>
          Structured preconditions are machine-evaluable conditions expressed
          as field-path and expected-value pairs. The Originator SHOULD include
          these in the precondition_state field of the Operation IR, allowing
          the Handler to verify them automatically against live device state
          before execution.
        </t>
        <t>
          Natural language preconditions are human-readable descriptions that
          cannot be automatically verified. The Originator SHOULD present these
          to the user and request explicit confirmation that the precondition
          is satisfied before proceeding.
        </t>
      </section>
      <section anchor="compensation-planning" numbered="true" toc="default">
        <name>Compensation Planning</name>
        <t>
          For write operations (create, update, delete, replace), the Originator
          SHOULD examine the side effects and state transition information
          declared in the Context View to determine whether a compensation
          operation is warranted. If the operation has declared side effects
          that may need to be reversed on failure, the Originator SHOULD
          populate the compensation field of the Operation IR with an
          appropriate reversing operation.
        </t>
        <t>
          The Originator derives compensation operations from the Context View's
          operation vocabulary. For example, if the Context View declares that
          a create operation can be reversed by a delete operation targeting the
          same resource, the Originator SHOULD include that delete as the
          compensation for the create.
        </t>
      </section>
    </section>

    <section anchor="operation-ir" numbered="true" toc="default">
      <name>Operation Intermediate Representation</name>
      <section anchor="ir-general" numbered="true" toc="default">
        <name>General Form</name>
        <t>An Operation IR object typically contains:</t>
        <ul spacing="normal">
          <li>operation;</li>
          <li>target;</li>
          <li>values;</li>
          <li>filter;</li>
          <li>order;</li>
          <li>description;</li>
          <li>context;</li>
          <li>precondition_state;</li>
          <li>compensation; and</li>
          <li>constraints.</li>
        </ul>
      </section>
      <section anchor="ir-fields" numbered="true" toc="default">
        <name>Core Fields</name>
        <section anchor="field-operation" numbered="true" toc="default">
          <name>operation</name>
          <t>
            operation is required. Recognized values include: create, update,
            delete, replace, get, get-config, rpc, and action.
          </t>
        </section>
        <section anchor="field-target" numbered="true" toc="default">
          <name>target</name>
          <t>
            target is required and MUST be an absolute schema path. For list
            instances, key predicates SHOULD be included where necessary to
            identify a specific instance.
          </t>
        </section>
        <section anchor="field-values" numbered="true" toc="default">
          <name>values</name>
          <t>
            values carries configuration payload or input parameters. It SHOULD
            be omitted for retrieval-only or pure deletion cases when not needed.
          </t>
        </section>
        <section anchor="field-filter" numbered="true" toc="default">
          <name>filter</name>
          <t>
            filter is used for retrieval operations and SHOULD use one
            unambiguous filter form per operation.
          </t>
        </section>
        <section anchor="field-order" numbered="true" toc="default">
          <name>order</name>
          <t>
            order MAY express numeric sequencing or explicit dependency
            relationships among operations.
          </t>
        </section>
        <section anchor="field-description" numbered="true" toc="default">
          <name>description</name>
          <t>
            description MAY carry a human-readable summary suitable for audit,
            logging, preview, or operator review.
          </t>
        </section>
        <section anchor="field-context" numbered="true" toc="default">
          <name>context</name>
          <t>context MAY include: module, datastore, transaction_id, timeout,
            execution_mode, and context_completeness.</t>
          <t>
            context_completeness describes the completeness of the NAIM LLM
            Context View available to the Originator at the time the Operation
            IR was generated. It does not describe the Handler's internal NAIM
            Document, which SHOULD always be a complete canonical representation.
          </t>
        </section>
        <section anchor="field-precondition" numbered="true" toc="default">
          <name>precondition_state</name>
          <t>
            precondition_state MAY map one or more paths to expected values
            that MUST hold before execution.
          </t>
        </section>
        <section anchor="field-compensation" numbered="true" toc="default">
          <name>compensation</name>
          <t>
            compensation MAY contain one or more Operation IR objects intended
            to reverse or mitigate previously executed changes.
          </t>
        </section>
        <section anchor="field-constraints" numbered="true" toc="default">
          <name>constraints</name>
          <t>
            constraints MAY contain operation-time conditions such as soft
            constraints or structured expectations.
          </t>
        </section>
      </section>
    </section>

    <section anchor="datastore" numbered="true" toc="default">
      <name>Datastore Selection</name>
      <t>
        Datastore selection in Operation IR follows the Network Management
        Datastore Architecture (NMDA) defined in <xref target="RFC8342"/>
        and its updates. The datastore field in Operation IR context SHOULD
        reference a datastore by its NMDA-defined name or a vendor-defined
        name where applicable.
      </t>
      <section anchor="ds-conventional" numbered="true" toc="default">
        <name>Conventional Configuration Datastores</name>
        <t>
          <xref target="RFC8342"/> defines conventional configuration
          datastores as: running, startup, candidate, and intended.
          <xref target="I-D.ietf-netmod-system-config"/> updates this
          definition to also include system. These datastores share a common
          datastore schema, and protocol operations allow copying data between
          them.
        </t>
        <dl newline="false" spacing="normal">
          <dt>running:</dt>
          <dd>The current active configuration applied to the device.
            Suitable for simple standalone changes or environments in which
            no candidate datastore exists.</dd>
          <dt>candidate:</dt>
          <dd>A configuration datastore that can be manipulated without
            immediately affecting the running configuration. Suitable when
            operations are grouped transactionally, a preview-before-apply
            workflow is desired, or multiple related changes require
            coordinated validation.</dd>
          <dt>startup:</dt>
          <dd>The configuration loaded by the device at startup. MAY be used
            when persistence semantics require startup configuration
            handling.</dd>
          <dt>intended:</dt>
          <dd>The configuration that the device intends to apply after
            resolving all configuration sources. Read-only. Represents the
            effective configuration after all transformations have been
            applied to running.</dd>
          <dt>system:</dt>
          <dd>A read-only conventional datastore holding configuration
            provided by the device itself, as defined in
            <xref target="I-D.ietf-netmod-system-config"/>. System
            configuration may be referenced or overridden by client
            configuration in running.</dd>
        </dl>
      </section>
      <section anchor="ds-operational" numbered="true" toc="default">
        <name>Operational State Datastore</name>
        <dl newline="false" spacing="normal">
          <dt>operational:</dt>
          <dd>Defined separately in <xref target="RFC8342"/> as a distinct
            datastore category. It represents the current operational state
            of the device, including both applied configuration and derived
            state. Suitable for retrieval of live state data.</dd>
        </dl>
      </section>
      <section anchor="ds-dynamic" numbered="true" toc="default">
        <name>Dynamic Configuration Datastores</name>
        <t>
          <xref target="RFC8342"/> defines dynamic configuration datastores
          as an extensible category for configuration obtained dynamically
          during device operation through interaction with other systems.
          Vendor-defined dynamic datastores MAY be referenced by name in
          Operation IR.
        </t>
      </section>
      <section anchor="ds-other" numbered="true" toc="default">
        <name>Other Datastores</name>
        <t>
          Additional datastores defined outside the above categories MAY also
          be referenced by name in Operation IR. An example is:
        </t>
        <dl newline="false" spacing="normal">
          <dt>factory-default:</dt>
          <dd>An optional datastore defined in <xref target="RFC8808"/> that
            holds a preset initial configuration. It is neither a conventional
            nor a dynamic datastore but conforms to the NMDA datastore schema
            conventions.</dd>
        </dl>
        <t>
          Operation IR implementations SHOULD support selection of any
          NMDA-conformant datastore by name. If a requested datastore is not
          supported by the Handler or the target device, the Handler MUST
          return a validation error rather than silently falling back to an
          alternative datastore.
        </t>
      </section>
    </section>

    <section anchor="constraints" numbered="true" toc="default">
      <name>Soft Constraints and Dynamic Values</name>
      <section anchor="hard-vs-soft" numbered="true" toc="default">
        <name>Distinction from Hard Constraints</name>
        <t>
          Hard constraints are derived from semantic model context and MUST
          take precedence over operation-time preferences.
        </t>
      </section>
      <section anchor="expression-forms" numbered="true" toc="default">
        <name>Expression Forms</name>
        <t>
          Implementations MAY support expression objects including comparison
          operators, logical operators, arithmetic operators, and dynamic
          references.
        </t>
      </section>
      <section anchor="dynamic-refs" numbered="true" toc="default">
        <name>Dynamic References</name>
        <t>
          If a referenced value cannot be resolved, the implementation SHOULD
          fail the operation before generating a final protocol request.
        </t>
      </section>
    </section>

    <section anchor="context-completeness" numbered="true" toc="default">
      <name>Context Completeness and Best-Effort Operation</name>
      <section anchor="cc-motivation" numbered="true" toc="default">
        <name>Motivation</name>
        <t>
          Context completeness describes the quality of the NAIM LLM Context
          View available to the Originator (AI agent) when generating an
          Operation IR. In some environments the Originator has access to a
          full LLM Context View derived from a complete NAIM Document. In
          others, only a partial or skeleton-level view is available. This
          section defines completeness classes for the Originator side.
        </t>
        <t>
          Note: The Handler SHOULD always maintain a complete NAIM Canonical
          Document internally. Context completeness classes apply to the
          Originator's view, not to the Handler's internal representation.
        </t>
      </section>
      <section anchor="cc-classes" numbered="true" toc="default">
        <name>Completeness Classes</name>
        <dl newline="false" spacing="normal">
          <dt>full:</dt>
          <dd>Complete semantic context from a NAIM LLM Context View derived
            from a complete NAIM Document or semantically equivalent source.</dd>
          <dt>partial:</dt>
          <dd>Structural and some semantic context are available, but certain
            descriptions, side effects, or non-structural annotations may be
            absent.</dd>
          <dt>skeleton:</dt>
          <dd>Only a minimum context is available, typically including path,
            node type, type information, key structure, basic requiredness,
            and machine-recoverable constraints.</dd>
        </dl>
      </section>
      <section anchor="cc-skeleton" numbered="true" toc="default">
        <name>Skeleton Context Expectations</name>
        <t>A skeleton context SHOULD include, where available:</t>
        <ul spacing="normal">
          <li>path;</li>
          <li>node-type;</li>
          <li>type;</li>
          <li>key information;</li>
          <li>writable/config status;</li>
          <li>mandatory or requiredness indicators; and</li>
          <li>basic structural constraints recoverable from YANG.</li>
        </ul>
      </section>
      <section anchor="cc-best-effort" numbered="true" toc="default">
        <name>Best-Effort Mode</name>
        <t>
          An Originator MAY generate Operation IR in best-effort mode when
          only partial or skeleton context is available. If it does so, the
          context_completeness field MUST be set accordingly, and the
          Originator MUST disclose that semantic guidance is incomplete. The
          Handler MUST NOT relax validation requirements based on the
          Originator's declared context completeness.
        </t>
      </section>
    </section>

    <section anchor="transactions" numbered="true" toc="default">
      <name>Transactions and Compensation</name>
      <section anchor="tx-grouping" numbered="true" toc="default">
        <name>Transaction Grouping</name>
        <t>
          Multiple Operation IR objects MAY be associated by a shared
          transaction identifier.
        </t>
      </section>
      <section anchor="tx-precondition" numbered="true" toc="default">
        <name>Precondition Verification</name>
        <t>
          If a required precondition fails, the associated operation MUST NOT
          be executed.
        </t>
      </section>
      <section anchor="tx-compensation" numbered="true" toc="default">
        <name>Compensation Operations</name>
        <t>
          Compensation operations SHOULD be subject to the same authorization,
          validation, and logging expectations as normal operations.
        </t>
      </section>
      <section anchor="tx-errors" numbered="true" toc="default">
        <name>Error Handling Expectations</name>
        <t>
          Implementations supporting transactions SHOULD define behavior for:
          precondition failure, mid-transaction failure, compensation failure,
          timeout during grouped execution, and loss of connectivity during
          rollback.
        </t>
      </section>
    </section>

    <section anchor="dryrun" numbered="true" toc="default">
      <name>Dry-Run and Execution Preview</name>
      <section anchor="dr-overview" numbered="true" toc="default">
        <name>Overview</name>
        <t>
          An implementation SHOULD support an execution preview capability so
          that an operator can review planned actions before actual device
          change occurs.
        </t>
      </section>
      <section anchor="dr-mode" numbered="true" toc="default">
        <name>execution_mode</name>
        <t>
          The context member MAY contain execution_mode. Recognized values MAY
          include: apply, dry-run, plan-only, and validate-only. This document
          specifically defines dry-run semantics.
        </t>
      </section>
      <section anchor="dr-semantics" numbered="true" toc="default">
        <name>dry-run Semantics</name>
        <t>
          When execution_mode is dry-run, the Handler MUST NOT apply actual
          configuration changes to the target system. Instead, it SHOULD return
          an execution preview containing:
        </t>
        <ul spacing="normal">
          <li>resolved target objects;</li>
          <li>input values or evaluated expressions;</li>
          <li>selected datastore;</li>
          <li>precondition checks or planned checks;</li>
          <li>protocol message summary (NETCONF XML, RESTCONF, or equivalent);</li>
          <li>compensation plan summary;</li>
          <li>known side effects; and</li>
          <li>any limitations of the preview.</li>
        </ul>
      </section>
      <section anchor="dr-limitations" numbered="true" toc="default">
        <name>Preview Limitations</name>
        <t>
          A dry-run result MAY be incomplete if live-state dependencies,
          authorization results, or external conditions cannot be fully
          verified without execution. Such limitations SHOULD be disclosed.
        </t>
      </section>
    </section>

    <section anchor="protocol-mapping" numbered="true" toc="default">
      <name>Protocol Mapping</name>
      <section anchor="pm-protocols" numbered="true" toc="default">
        <name>Relationship to Management Protocols</name>
        <t>
          The Handler performs deterministic translation of validated Operation
          IR objects into protocol-specific messages appropriate to the target
          device or management system. This translation is a Handler concern
          and is not visible to the Originator.
        </t>
        <t>
          NETCONF <xref target="RFC6241"/> and RESTCONF <xref target="RFC8040"/>
          are the primary target protocols. A conforming Handler SHOULD be
          capable of translating Operation IR into one or more of:
        </t>
        <ul spacing="normal">
          <li>NETCONF &lt;edit-config&gt; operations;</li>
          <li>NETCONF &lt;get-config&gt; or &lt;get&gt; operations;</li>
          <li>NETCONF RPC or action invocations; or</li>
          <li>RESTCONF equivalent operations.</li>
        </ul>
        <t>
          Handlers MAY support additional management protocol backends. The
          choice of target protocol and the specific wire format produced are
          Handler implementation decisions. The Operation IR representation is
          identical regardless of which protocol the Handler uses for execution.
        </t>
      </section>
      <section anchor="pm-upstream" numbered="true" toc="default">
        <name>Upstream Protocol Independence</name>
        <t>
          Operation IR objects MAY be delivered to the Handler by any upstream
          mechanism. The semantic content of an Operation IR object is
          independent of the upstream delivery mechanism. Companion documents
          define specific upstream bindings, such as MCP tool integration.
        </t>
      </section>
    </section>

    <section anchor="validation" numbered="true" toc="default">
      <name>Validation Error Handling</name>
      <section anchor="val-envelope" numbered="true" toc="default">
        <name>Validation Error Envelope Reuse</name>
        <t>
          Implementations SHOULD use the Validation Error Envelope model
          defined by the NAIM framework for Operation IR validation failures.
        </t>
      </section>
      <section anchor="val-categories" numbered="true" toc="default">
        <name>Operational Error Categories</name>
        <t>Common categories MAY include:</t>
        <ul spacing="normal">
          <li>missing_required_field;</li>
          <li>invalid_target;</li>
          <li>constraint_violation;</li>
          <li>unresolved_dynamic_reference;</li>
          <li>precondition_failed;</li>
          <li>unsupported_extension; and</li>
          <li>dry_run_not_supported.</li>
        </ul>
      </section>
      <section anchor="val-example" numbered="true" toc="default">
        <name>Example</name>
        <sourcecode type="json"><![CDATA[
NOTE: '\' line wrapping per RFC 8792

{
  "error_type": "constraint_violation",
  "field_path": "/values/mtu",
  "user_message": "The MTU value 100000 \
is too large. The allowed range is 68 \
to 65535.",
  "suggested_fix": "1500",
  "retryable": true
}
        ]]></sourcecode>
      </section>
    </section>

    <section anchor="interop" numbered="true" toc="default">
      <name>Interoperability Expectations</name>
      <t>Independent implementations SHOULD be able to:</t>
      <ul spacing="normal">
        <li>exchange Operation IR objects;</li>
        <li>interpret required core members consistently;</li>
        <li>preserve target-path semantics;</li>
        <li>preserve datastore and transaction metadata where supported;</li>
        <li>preserve precondition and compensation semantics where supported;</li>
        <li>preserve execution_mode semantics where supported; and</li>
        <li>communicate degraded context and validation failures explicitly.</li>
      </ul>
    </section>

    <section anchor="security" numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>Implementations SHOULD address:</t>
      <ul spacing="normal">
        <li>authorization for dynamic references;</li>
        <li>authorization for compensation operations;</li>
        <li>integrity of semantic context used for validation;</li>
        <li>audit logging of execution and rollback;</li>
        <li>safe handling of transaction identifiers;</li>
        <li>protection against unauthorized modification of Operation IR objects; and</li>
        <li>prevention of deceptive or incomplete dry-run previews.</li>
      </ul>
      <t>
        Network device credentials MUST be managed by the Handler and MUST NOT
        be included in Operation IR objects or exposed to the Originator.
      </t>
    </section>

    <section anchor="iana" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>This document has no IANA actions.</t>
    </section>

  </middle>

  <back>

    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        &RFC2119;
        &RFC6241;
        &RFC7950;
        &RFC8040;
        &RFC8174;
        &RFC8342;
        &RFC8808;
        <reference anchor="I-D.ietf-netmod-system-config">
          <front>
            <title>System-defined Configuration</title>
            <author initials="Q." surname="Wu" fullname="Qin Wu"/>
            <author initials="B." surname="Lengyel" fullname="Balazs Lengyel"/>
            <author initials="Y." surname="Niu" fullname="Ye Niu"/>
            <date/>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-ietf-netmod-system-config"/>
        </reference>
      </references>
      <references>
        <name>Informative References</name>
        &RFC8792;
        <reference anchor="I-D.feng-netmod-naim">
          <front>
            <title>The NAIM Framework and Canonical Semantic Representation for AI-Assisted Network Modeling</title>
            <author initials="C." surname="Feng" fullname="Chong Feng"/>
            <date/>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-feng-netmod-naim-00"/>
        </reference>
      </references>
    </references>

    <section anchor="appendix-a" numbered="false" toc="default">
      <name>Example Operation IR</name>
      <sourcecode type="json"><![CDATA[
NOTE: '\' line wrapping per RFC 8792

{
  "operation": "update",
  "target": "/ietf-interfaces:interfaces/\
interface[name='eth0']",
  "values": {
    "enabled": false
  },
  "context": {
    "datastore": "candidate",
    "transaction_id": "123e4567-e89b-12d3-a456-426614174000",
    "timeout": 60,
    "execution_mode": "dry-run",
    "context_completeness": "full"
  },
  "precondition_state": {
    "/ietf-interfaces:interfaces/\
interface[name='eth0']/oper-status": "up"
  },
  "compensation": [
    {
      "operation": "update",
      "target": "/ietf-interfaces:interfaces/\
interface[name='eth0']",
      "values": {
        "enabled": true
      }
    }
  ]
}
      ]]></sourcecode>
    </section>

    <section anchor="appendix-b" numbered="false" toc="default">
      <name>Example Skeleton-Context Warning</name>
      <artwork name="" type="ascii-art" align="left"><![CDATA[
The NAIM LLM Context View available to the Originator is at skeleton
completeness level. The Originator is operating in best-effort mode
based on structural constraints and available YANG-derived type
information. Descriptive semantics and side-effect guidance may be
incomplete. The Handler will perform full validation against its
internal NAIM Document regardless of Originator context completeness.
      ]]></artwork>
    </section>

    <section anchor="appendix-c" numbered="false" toc="default">
      <name>Example Dry-Run Preview Summary</name>
      <artwork name="" type="ascii-art" align="left"><![CDATA[
Operation: update interface eth0
Target datastore: candidate
Preview mode: dry-run
Planned value change: enabled = false
Preconditions: oper-status must be up
Planned protocol operation: <edit-config> on candidate datastore
  followed by <commit> (NETCONF), or equivalent
Compensation plan: restore enabled = true if later step fails
      ]]></artwork>
    </section>

  </back>

</rfc>
