TAUI-0001 Standard

Abstract

This document specifies the first version of the Terminal Agent UI (TAUI) standard. It defines a declarative, serializable, and stateless JSON schema for describing terminal interfaces that can be generated by AI agents and rendered by standard terminal runtimes.

Introduction

TAUI Version 1 focuses on creating a secure and portable bridge between autonomous agents (which generate intent and structure) and terminal runtimes (which handle layout and rendering). The goal is to move away from imperative command-line outputs towards structured, interactive dashboards and tools.

Architecture

The TAUI workflow follows a strict three-tier architecture:

  1. Agent: Generates a TAUIDocument (JSON) reflecting the current world state.
  2. Runtime: Validates the JSON, computes the layout, and renders to the terminal.
  3. User: Interacts with the TUI. Actions are captured by the Runtime and sent back to the Agent as Events.
graph LR
    Agent[Agent] -- "TAUIDocument (JSON)" --> Runtime[Runtime]
    Runtime -- "ANSI/Drawing" --> Terminal[Terminal]
    Terminal -- "Input" --> Runtime
    Runtime -- "Event (JSON)" --> Agent

The TAUIDocument

A TAUIDocument is a JSON object that describes the entire screen state.

Root Schema

{
  "version": "1.0",
  "metadata": {
    "title": "My Dashboard"
  },
  "screen": {
    "type": "Grid",
    "rows": ["auto", "1fr"],
    "columns": ["1fr"],
    "children": []
  }
}

Primitives

Layout Nodes

Layout nodes define how their children are positioned.

UI Nodes

UI nodes display content.

Interaction Nodes

Interaction nodes capture user intent.

Interaction Model

The interaction model is event-driven. The Agent MUST NOT handle raw terminal escape codes or individual keystrokes unless specified via KeyBinding.

Event Object

When a user interacts, the Runtime sends an Event to the Agent:

{
  "type": "action",
  "targetId": "submit_btn",
  "payload": {
    "value": "Hello World"
  },
  "timestamp": "2026-01-23T..."
}

Security Requirements

To ensure the safety of the host environment, Runtimes MUST adhere to the following:

1. Node Validation

Runtimes MUST reject any JSON tree that contains unknown node types or invalid properties.

2. ANSI Sanitization

All string content in Text, Panel, and Log nodes MUST be stripped of non-printable or control escape sequences to prevent terminal injection attacks.

3. Execution Isolation

The spec defines no primitive for direct shell execution. Any "Terminal" or "Shell" like behavior MUST be implemented by the Agent as a series of Log updates and Input events.

Design Goals Compliance

Goal Implementation in v1
Declarative Entire UI is defined as a static JSON tree.
Stateless The Runtime can re-render the entire UI from a single JSON blob.
Serializable Standard JSON format ensures portability across languages.
Diffable Clean structure allows for efficient JSON Patch updates.
Model-agnostic LLMs can easily generate this structure via JSON modes.
Language-agnostic Any language with a JSON parser can implement an agent or runtime.

References

JSON Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "TAUI Document Schema by Tariq Shams",
  "description": "Definition for Terminal Agent UI documents version 1.0",
  "type": "object",
  "required": [
    "version",
    "screen"
  ],
  "properties": {
    "version": {
      "type": "string",
      "enum": [
        "1.0"
      ]
    },
    "metadata": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        }
      }
    },
    "screen": {
      "$ref": "#/definitions/node"
    }
  },
  "definitions": {
    "node": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "Box",
            "Grid",
            "Row",
            "Column",
            "Text",
            "Panel",
            "List",
            "Table",
            "Progress",
            "Input",
            "Log",
            "Button",
            "Select",
            "KeyBinding"
          ]
        },
        "style": {
          "$ref": "#/definitions/style"
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "type": {
                "enum": [
                  "Grid",
                  "Row",
                  "Column",
                  "Box",
                  "Panel"
                ]
              }
            }
          },
          "then": {
            "properties": {
              "children": {
                "type": "array",
                "items": {
                  "$ref": "#/definitions/node"
                }
              },
              "rows": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "columns": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "gap": {
                "type": "number"
              },
              "padding": {
                "oneOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "number"
                    },
                    "minItems": 1,
                    "maxItems": 4
                  }
                ]
              },
              "align": {
                "type": "string",
                "enum": [
                  "start",
                  "center",
                  "end",
                  "stretch"
                ]
              },
              "justify": {
                "type": "string",
                "enum": [
                  "start",
                  "center",
                  "end",
                  "between",
                  "around"
                ]
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "Text"
              }
            }
          },
          "then": {
            "required": [
              "content"
            ],
            "properties": {
              "content": {
                "type": "string"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "Panel"
              }
            }
          },
          "then": {
            "properties": {
              "title": {
                "type": "string"
              },
              "borderStyle": {
                "type": "string",
                "enum": [
                  "single",
                  "double",
                  "rounded",
                  "bold",
                  "none"
                ]
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "Progress"
              }
            }
          },
          "then": {
            "required": [
              "value"
            ],
            "properties": {
              "value": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "label": {
                "type": "string"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "Table"
              }
            }
          },
          "then": {
            "required": [
              "headers",
              "rows"
            ],
            "properties": {
              "headers": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "rows": {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "Log"
              }
            }
          },
          "then": {
            "required": [
              "lines"
            ],
            "properties": {
              "lines": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "maxLines": {
                "type": "number"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "Button"
              }
            }
          },
          "then": {
            "required": [
              "id",
              "label"
            ],
            "properties": {
              "label": {
                "type": "string"
              },
              "action": {
                "type": "string"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "Input"
              }
            }
          },
          "then": {
            "required": [
              "id"
            ],
            "properties": {
              "placeholder": {
                "type": "string"
              },
              "value": {
                "type": "string"
              },
              "mask": {
                "type": "boolean"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "Select"
              }
            }
          },
          "then": {
            "required": [
              "id",
              "options"
            ],
            "properties": {
              "options": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "label",
                    "value"
                  ],
                  "properties": {
                    "label": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  }
                }
              },
              "value": {
                "type": "string"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "type": {
                "const": "KeyBinding"
              }
            }
          },
          "then": {
            "required": [
              "key",
              "action"
            ],
            "properties": {
              "key": {
                "type": "string"
              },
              "action": {
                "type": "string"
              },
              "ctrl": {
                "type": "boolean"
              },
              "meta": {
                "type": "boolean"
              },
              "shift": {
                "type": "boolean"
              }
            }
          }
        }
      ]
    },
    "style": {
      "type": "object",
      "properties": {
        "color": {
          "type": "string"
        },
        "backgroundColor": {
          "type": "string"
        },
        "bold": {
          "type": "boolean"
        },
        "dim": {
          "type": "boolean"
        },
        "italic": {
          "type": "boolean"
        },
        "underline": {
          "type": "boolean"
        },
        "hidden": {
          "type": "boolean"
        },
        "strikethrough": {
          "type": "boolean"
        }
      }
    },
    "event": {
      "type": "object",
      "required": [
        "type",
        "targetId",
        "timestamp"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "action",
            "change",
            "key"
          ]
        },
        "targetId": {
          "type": "string"
        },
        "payload": {
          "type": "object"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  }
}