Data structure / v1.0

A data structure
for AI agents.

Define agent personality as numbers, rules as objects, boundaries as constraints. Validate at build time, generate prompts at runtime, swap frameworks without rewriting.

npm install @reallyartificial/grain pip install grain-sdk

The Structure

6 lines min / 4 required fields

Input: .grain.yaml

specVersion: "1.0"
id: my-bot
version: 1.0.0
meta:
  name: My Bot
  description: Does helpful things

Output: system prompt

You are My Bot, a AI Assistant.
Your primary purpose: Does helpful things

## Communication Style
- Use a balanced tone - professional
  but approachable.
- Be friendly. Show basic courtesy and
  acknowledge the human behind the request.
...

Live Playground

Grain (YAML)

Valid

Generated System Prompt

default

      

Personality Vector

8 dimensions / 5 graduated levels each

Integration

Grain.load → .toPrompt → call any LLM

  

Why Grain

Tiered Complexity

Start with 6 lines. Add personality, rules, and boundaries as needed. Only 4 fields required.

Channel-Aware

One spec, multiple outputs. Override tone per channel. Same agent, context-appropriate behavior.

5-Level Personality

0-1 values map to behavioral directives via graduated semantic anchoring. Real granularity, not coarse buckets.

Framework Portable

Define once, run on any LLM framework or raw API. Grain is the data. Frameworks are the runtime.

Schema Validated

JSON Schema 2020-12. Catch errors at build time. Editor autocomplete via $schema.

Real Operations

addRule, setPersonality, merge, diff, toPrompt. Primitive operations like a real data structure.


Agent Builder

Real SDK / Live validation
Meta
Identity
Personality
Language Style
Channel Overrides
Behavior Rules
Boundaries
Cognition