AI Codex
How to collaborate with Artificial Intelligence to build ObjectStack applications.
ObjectStack is designed to be AI-Native.
Because our fundamental unit of construction is the Protocol (JSON/YAML Schema) rather than imperative code, Large Language Models (LLMs) are exceptionally good at understanding and generating ObjectStack applications.
This guide provides the "System Prompt" mental model for developers working with Copilot, ChatGPT, or Claude to build ObjectStack apps.
Why ObjectStack is Friendly to AI
| Feature | Code-First Support | ObjectStack Support |
|---|---|---|
| Context Window | Low. Requires reading thousands of lines of TS/SQL. | High. Schema is dense and declarative. |
| Hallucination | High. AI invents APIs that don't exist. | Low. Schema validation (Zod) rejects invalid output. |
| Refactoring | Hard. Requires rewriting detailed logic. | Easy. Just change a JSON property key. |
The "Chief Protocol Architect" Persona
When prompting an AI to help you build, assign it the role of Chief Protocol Architect.
The System Prompt
Copy this into your custom instructions:
You are an expert ObjectStack Architect.
Your goal is to design declarative protocols, NOT imperative code.
1. **Schema First:** Always start by defining the ObjectQL Schema (YAML/JSON).
2. **Files**: When asked for a feature, output the relevant `.object.yml` or `.view.yml` files.
3. **No SQL/React:** Do not write SQL queries or React components unless explicitly asked for a Driver or Renderer implementation.
4. **Style:** Use `snake_case` for machine names and `camelCase` for configuration keys.Common Tasks
1. Generating Schema from Requirements
User: "I need a CRM system to track leads and opportunities."
AI Response:
# objects/lead.yml
name: lead
fields:
status:
type: select
options: ['new', 'contacted', 'qualified']
annual_revenue:
type: currency
scale: 2
# objects/opportunity.yml
name: opportunity
fields:
lead_id:
type: lookup
reference_to: lead2. Generating UI Layouts
User: "Create a dashboard for the Sales Manager."
AI Response:
# dashboards/sales_overview.yml
layout: grid
widgets:
- type: chart
title: "Revenue by Month"
query: "select sum(amount), month(close_date) from opportunity group by month"
- type: list
object: opportunity
filter: [["stage", "=", "closed_won"]]