Skip to content

Pillar 1: The Zero-Agent Pattern

OSTwin’s first architectural pillar inverts the traditional approach to AI agents. Instead of coding each agent as a separate program, every role in the system is a configuration directory executed by a single, universal runner.

“Adding a new role requires zero lines of code.”

Universal Agent Runner

The entire system runs through one script: Invoke-Agent.ps1. This PowerShell function accepts a role name, a war-room path, and a task reference, then assembles everything the agent needs at invocation time.

Terminal window
Invoke-Agent -Role "engineer" -RoomDir ".agents/war-rooms/room-042" -Ref "TASK-003"

The runner handles:

  • Loading the role’s identity prompt from ROLE.md
  • Resolving skills, MCP servers, and model preferences
  • Injecting war-room context (brief, channel history, memory)
  • Launching the underlying LLM session with the assembled prompt

Because every role flows through the same runner, improvements to Invoke-Agent.ps1 benefit all roles simultaneously.

Role as a Config Directory

Each role is a directory under .agents/roles/ containing exactly two files:

.agents/roles/engineer/
role.json # Machine-readable config
ROLE.md # Identity prompt (personality + constraints)

No Python class. No TypeScript module. No compilation step. The role is its directory.

role.json Schema

The role.json file declares everything the runner needs to configure the agent session.

FieldTypeDescription
namestringRole identifier (e.g. "engineer")
display_namestringHuman-readable label
descriptionstringOne-line purpose statement
modelstringPreferred model ID (e.g. "claude-sonnet-4-20250514")
providerstringLLM provider ("anthropic", "openai", "vertex")
no_mcpboolIf true, launch without MCP servers (saves tokens)
skill_refsstring[]Skills this role should always have access to
temperaturefloatSampling temperature override
max_tokensintMax output tokens per turn

ROLE.md Identity Prompt

The ROLE.md file is a markdown document injected as the system prompt. It defines:

  • Who the agent is — its expertise, personality, communication style
  • What it must do — responsibilities, deliverables, quality standards
  • What it must not do — boundaries, anti-patterns, escalation triggers
# Engineer
You are a senior software engineer working inside a war-room.
Your job is to implement tasks assigned by the manager, write
production-quality code, and deliver structured done reports.
## Constraints
- Never modify files outside your war-room's scope
- Always run tests before reporting done
- Escalate architectural questions to the architect role

5-Tier Role Discovery

When Invoke-Agent.ps1 resolves a role, it searches five locations in priority order:

PriorityLocationScope
1.agents/war-rooms/{room}/roles/{role}/Room-local override
2.agents/roles/{role}/Project-level role
3~/.agents/roles/{role}/User-global role
4Built-in defaultsShipped with OSTwin
5Registry lookupDynamic resolution

This means you can override the engineer role for a single war-room without affecting any other room.

Role Registry

The file registry.json (~700 lines) catalogs every known role with metadata for discovery and assignment. The manager agent reads this registry when deciding which roles to assign to a war-room.

{
"engineer": {
"description": "Implements features, fixes bugs, writes tests",
"skills": ["implement-epic", "fix-from-qa", "write-tests"],
"model": "claude-sonnet-4-20250514"
},
"qa": {
"description": "Reviews deliverables, runs test suites, posts verdicts",
"skills": ["review-epic", "review-task", "build-verify"],
"model": "claude-sonnet-4-20250514"
}
}

Model Resolution Priority

The model used for a given agent invocation is resolved through four levels:

PrioritySourceExample
1War-room config.json overrideRoom needs GPT-4o for vision tasks
2role.json preferenceArchitect prefers Opus for deep reasoning
3Plan-level defaultPlan specifies Sonnet for cost control
4System defaultFalls back to claude-sonnet-4-20250514

Dynamic Role Creation

New roles can be created at runtime by the create-role skill:

  1. The manager identifies a capability gap (e.g., “we need a database specialist”)
  2. It invokes the create-role skill with a description
  3. The skill generates role.json + ROLE.md in the project’s .agents/roles/ directory
  4. The new role is registered in registry.json
  5. Future war-rooms can immediately assign the new role

No restart. No deployment. No code change.

Current Roles

OSTwin ships with 8 core roles and supports 50+ community-contributed roles:

Core roles: manager, engineer, qa, architect, game-engineer, game-designer, game-qa, reporter

Community roles include: narrative-designer, ux-researcher, macos-automation-engineer, game-ui-analyst, game-architect, audit, and many more domain-specific specialists.

Why This Matters

Key Source Files

FilePurpose
engine/Invoke-Agent.ps1Universal agent runner
.agents/roles/*/role.jsonRole configuration
.agents/roles/*/ROLE.mdIdentity prompt
.agents/registry.jsonRole catalog (~700 lines, 20+ roles)
engine/Resolve-Role.ps15-tier role discovery logic
engine/New-Role.ps1Dynamic role scaffolding