newsence
來源篩選

Show HN: JsonUI – Constrain AI Agents Through Code Structure, Not Prompts

Hacker News

JsonUI is a new approach to AI coding assistants that uses code structure and JSON as a single source of truth to enforce consistency and prevent AI agents from breaking rules, generating cross-platform code and tests from a single definition.

newsence

Show HN:JsonUI – 透過程式碼結構而非提示來約束 AI 代理

Hacker News
大約 1 個月前

AI 生成摘要

JsonUI 提出一種新的 AI 程式碼助手方法,利用程式碼結構和 JSON 作為單一真相來源,以強制執行一致性並防止 AI 代理違反規則,從單一定義生成跨平台程式碼和測試。

Show HN: JsonUI – Constrain AI agents through code structure, not prompts | Hacker News

Image

The problem: AI coding assistants produce inconsistent code. Every session yields different implementations, and AI "forgets" rules mid-conversation. Prompt engineering helps, but quality still depends on how well you explain things each time.

The insight: Don't ask AI to follow rules—make it impossible to break them.

The approach:

  1. Specialized agents with strict boundaries - Instead of one AI doing everything, split responsibilities. Layout agent creates JSON UI structure (never touches data types). Data agent defines bindings (never writes business logic). ViewModel agent implements logic (never edits JSON).

  2. JSON as single source of truth - One JSON definition generates iOS native (SwiftUI/UIKit), Android native (Compose/XML), Web (React/Tailwind), tests, and docs. All in sync. Always.

  3. Cross-platform test runner - Same test JSON runs on XCUITest, UIAutomator, and Playwright.

Result: Spec, implementation, and docs stay in sync because they're generated from the same source. AI agents are productive because they have clear, narrow scopes.

Still in development. Repos:

  • Core: SwiftJsonUI, KotlinJsonUI, ReactJsonUI
  • Test runner: jsonui-test-runner (CLI + platform drivers)
  • Agents: JsonUI-Agents-for-claude

GitHub: https://github.com/Tai-Kimura

Would love feedback on the agent design approach.

Image