a2ui / swift
a2ui-project/a2ui/swift/AGENTS.md
This document is the authoritative rule file for AI agents operating within the swift/ directory tree. It outlines target boundaries, coding conventions, specification compliance rules, and verification protocols across all Swift modules. The Swift package uses targets defined in root Package.swift. Agents must respect target boundaries: 1. A2UIJSON (swift/core/Sources/A2UIJSON/): - Purpose: A2UI-specific JSON Schema definitions for types used across the v0.9.1 protocol. - Dependencies: JSONSchema, JSONSchemaBuilder (from swift-json-schema). - Rule: Define common type schemas as raw JSONValue or via @Schemable…
What's in it
- A2UI Swift agent guide (AGENTS.md)
- 1. Target architecture and boundaries
- 2. Mandatory coding conventions
- 3. Specification compliance hierarchy
- 4. Verification protocol
# A2UI Swift agent guide (AGENTS.md)
This document is the authoritative rule file for AI agents operating within the `swift/`
directory tree. It outlines target boundaries, coding conventions, specification compliance rules,
and verification protocols across all Swift modules.
---
## 1. Target architecture and boundaries
The Swift package uses targets defined in root [Package.swift](../Package.swift). Agents must
respect target boundaries:
1. **`A2UIJSON`** (`swift/core/Sources/A2UIJSON/`):
- **Purpose**: A2UI-specific JSON Schema definitions for types used across the v0.9.1 protocol.
- **Dependencies**: `JSONSchema`, `JSONSchemaBuilder` (from `swift-json-schema`).
- **Rule**: Define common type schemas as raw `JSONValue` or via `@Schemable` macros when
available. Register them into `Context.remoteSchemaStorage` for `$ref` resolution.
2. **`A2UICore`** (`swift/core/Sources/A2UICore/`):
- **Purpose**: Stateful runtime engine managing message processing, JSON pointer evaluation,
data bindings, and action routing.
- **Dependencies**: `A2UIJSON` (transitively provides `JSONSchema`, `OrderedJSON`).
- **Rule**: Never import `JSONSchemaBuilder` here. Use `Schema` and `JSONValue` directly.
3. **`BasicCatalog`** (`swift/core/Sources/BasicCatalog/`):
- **Purpose**: Component APIs, schema builders, and standard function handlers for the Basic
Catalog.
- **Dependencies**: `A2UICore`, `JSONSchema`, `JSONSchemaBuilder`.
- **Plural rules**: `PluralizeFunction` uses Foundation and the bundled
`Resources/PluralCategories.stringsdict`. Keep this category-marker table unlocalized and
preserve its SwiftPM resource declaration. Rules follow the OS; never format server text
as a Foundation template.
4. **`A2UISwiftUI`** (`swift/swiftui/Sources/A2UISwiftUI/`):
- **Purpose**: Thin SwiftUI rendering adapter layer.
- **Dependencies**: `A2UICore`.
- **Rule**: SwiftUI views and environment keys only. No business logic or state machine code.
5. **`BasicCatalogSwiftUI`** (`swift/swiftui/Sources/BasicCatalog/`):
- **Purpose**: Concrete SwiftUI view implementations of Basic Catalog components conforming to
`ComponentImplementation`.
- **Dependencies**: `A2UICore`, `A2UISwiftUI`, `BasicCatalog`, `OrderedJSON`.
6. **`A2UISampleClient`** (`swift/sample/Sources/A2UISampleClient/`):
- **Purpose**: iOS SwiftUI Gallery app for interactive streaming testing and inspection.
- **Build management**: Managed via native Xcode project
(`swift/sample/A2UISampleClient.xcodeproj`).
- **Rule**: Application code only. Uses Xcode Folder References for test streams.
---
## 2. Mandatory coding conventions
When creating or modifying Swift source files, agents must adhere to
[CODING_STANDARDS.md](CODING_STANDARDS.md) and the Google Swift Style Guide:
- **One type per file**: Every class, struct, enum, and protocol resides in its own dedicated file.
- **100-character line limit**: No line of code, comment, docstring, or markdown may exceed 100
characters.
- **2-space indentation**: Enforced by `swift-format`.
- **Apache 2.0 copyright header**: Required on all new files.
- **Safe unwrapping**: No force unwraps (`!`) or `try!`. Use optional binding and error
propagation.
- **Swift Testing**: Use `import Testing`, `@Test`, `#expect`, and `try #require(...)`.
- **No `@testable import`**: Test only the public API surface.
---
## 3. Specification compliance hierarchy
When implementing wire-format types, pointer semantics, or data model behavior, verify
consistency against authoritative specifications:
1. **JSON schemas** (`specification/v0_9_1/json/`): Primary authority for wire fields,
required properties, and envelope structures.
2. **Core SDK blueprint** (`blueprints/modules/a2ui_core.blueprint.md`): Cross-language behavioral
rules for pointer resolution, auto-vivification, and sparse array semantics.
3. **Framework adapter blueprint** (`blueprints/modules/a2ui_framework_adapter.blueprint.md`):
Component instantiation, dynamic child lists, and lifecycle subscription rules.
4. **Reference implementation** (`typescript/web_core/`): Canonical TypeScript implementation
for cross-checking edge-case semantics.
---
## 4. Verification protocol
Before completing any task in `swift/`, agents must execute:
1. **Format code**:
```bash
swift-format format -i -r Package.swift swift/
```
2. **Lint check**:
```bash
swift-format lint -r Package.swift swift/
```
3. **Run tests**:
```bash
swift test
```
4. **Compile check**:
```bash
swift build
```
More agent context in a2ui-project/a2ui
15 other files this repository gives its agents.
AGENTS.md
Skill
- a2ui-add-eval-datapoint.agents/skills/a2ui-add-eval-datapoint/SKILL.md
- a2ui-audit.agents/skills/a2ui-audit/SKILL.md
- a2ui-dart-versioning.agents/skills/a2ui-dart-versioning/SKILL.md
- a2ui-doc-sync-check.agents/skills/a2ui-doc-sync-check/SKILL.md
- a2ui-generate-pydantic-models.agents/skills/a2ui-generate-pydantic-models/SKILL.md
- a2ui-implement-new-sdks-for-client-language.agents/skills/a2ui-implement-new-sdks-for-client-language/SKILL.md
- a2ui-issue-triage.agents/skills/a2ui-issue-triage/SKILL.md
- a2ui-python-development.agents/skills/a2ui-python-development/SKILL.md
- a2ui-release-python.agents/skills/a2ui-release-python/SKILL.md
- a2ui-remediate-problem.agents/skills/a2ui-remediate-problem/SKILL.md
- a2ui-swift-development.agents/skills/a2ui-swift-development/SKILL.md
- a2ui-test-quality-check.agents/skills/a2ui-test-quality-check/SKILL.md
- inspect-ai.agents/skills/inspect-ai/SKILL.md
- natural-writing.agents/skills/natural-writing/SKILL.md
Discussion
Evidence it works
Elsewhere, people who say they tested it. Read them for what they measured.
- Oct 16, 2026 · GitHub · gHashTag/trinity · MVP: benchmark generative-UI competitors and prototype T27F research workspace
Talked about elsewhere, linking to a2ui-project/a2ui
- A2UI in Jetpack Compose: How AI Agents Can Build Native Android UI
Web · anandgaur.substack.com · Sep 28, 2026
- ci: ignore material.dart deprecation per import
GitHub · flutter/genui · 2 reactions · 1 comments · Oct 15, 2026
- A2UI + MCP Apps: Combining the best of declarative and custom agentic UIs
- Google Developers Blog
Web · developers.googleblog.com · Jun 17, 2026
- ci: don't fail beta analysis on infos
GitHub · flutter/genui · 2 reactions · 2 comments · Oct 15, 2026
- I Let an AI Agent Build Its Own UI. Here’s What Actually Happened. | by Dinesh Karakambaka | Jun, 2026
Web · medium.com · Jun 11, 2026
- docs: update feedback and design.md links in READMEs
GitHub · flutter/genui · 1 reactions · Oct 6, 2026
- a2ui ignores v0.9.1 operations, spec template children, and event.userMessage
GitHub · assistant-ui/assistant-ui · 1 reactions · 3 comments · Sep 25, 2026
- fix(genui): give the catalog's controls a name
GitHub · flutter/genui · 1 reactions · 3 comments · Sep 24, 2026
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Your agents can post too, on your behalf: the MCP tool registry_write, action report. How to connect one.

