Class NucleoSchemaKeywords

java.lang.Object
ai.redouble.nucleo.harness.schema.NucleoSchemaKeywords

public final class NucleoSchemaKeywords extends Object
The x-nucleo-* JSON Schema vocabulary: keywords that carry a field's Nucleo annotations to a consumer that cannot read the annotations themselves.

A schema has two audiences. The standard keywords - type, description, required, enum, examples - are what a model reads in a tool definition. These keywords are what a consuming HARNESS reads: whether a field can be summarized and how, whether it belongs in a model's context at all, what an artifact-typed field points at. In process a harness reads the annotations off the class; across an MCP boundary, where the concrete class may not resolve, the schema is the only source. JSON Schema ignores unknown keywords, so they are inert for anyone else.

stripFrom(String) removes them again on the path to a model, which is why the prefix has to be stable: it is what the strip keys on.

Since:
0.1 (2026-09-04)
Author:
Andrey Santrosyan
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    @LLMContextIgnore: present in the payload, kept out of a model's context.
    static final String
    The prefix every harness-facing keyword carries, and what stripFrom(String) keys on.
    static final String
    @LLMSummarizable, as declared: hint, size, threshold, llmSafe, preSummarized, staticSummary.
    static final String
    The @TypeAlias of an artifact-typed field, which is also what its refs carry.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    forModel(String schemaJson)
    Returns the schema as a model is offered it: every artifact-typed field reduced to its reference, then every x-nucleo-* keyword removed.
    static String
    stripFrom(String schemaJson)
    Returns the schema with every x-nucleo-* keyword removed, at every depth.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PREFIX

      public static final String PREFIX
      The prefix every harness-facing keyword carries, and what stripFrom(String) keys on.
      See Also:
    • SUMMARIZABLE

      public static final String SUMMARIZABLE
      @LLMSummarizable, as declared: hint, size, threshold, llmSafe, preSummarized, staticSummary.
      See Also:
    • CONTEXT_IGNORE

      public static final String CONTEXT_IGNORE
      @LLMContextIgnore: present in the payload, kept out of a model's context.
      See Also:
    • TYPE_ALIAS

      public static final String TYPE_ALIAS
      The @TypeAlias of an artifact-typed field, which is also what its refs carry.
      See Also:
  • Method Details

    • stripFrom

      public static String stripFrom(String schemaJson) throws IOException
      Returns the schema with every x-nucleo-* keyword removed, at every depth.
      Parameters:
      schemaJson - a JSON Schema document, or null or empty
      Returns:
      the stripped schema; null for a null input and empty for an empty one
      Throws:
      IOException - if the input is not JSON
    • forModel

      public static String forModel(String schemaJson) throws IOException
      Returns the schema as a model is offered it: every artifact-typed field reduced to its reference, then every x-nucleo-* keyword removed. A model never authors an artifact, so it is never asked for one's content: where an input takes an artifact, the model writes the reference of one the registry lists.
      Parameters:
      schemaJson - a JSON Schema document, or null or empty
      Returns:
      the model-facing schema; null for a null input and empty for an empty one
      Throws:
      IOException - if the input is not JSON