molecule-ai-org-template-mo.../_generate.py
claude-ceo-assistant ba34788878 feat: initial mock-bigorg template (200 workspaces, CEO/VPs/Managers/ICs)
Generated via _generate.py — every workspace declares runtime: mock so the
platform's A2A proxy short-circuits with hardcoded 'On it!' canned replies.
Built for funding-demo visual scale.

See workspace-server/internal/handlers/mock_runtime.go in molecule-core for
the proxy short-circuit + reply variant pool.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 08:38:58 -07:00

169 lines
5.9 KiB
Python

#!/usr/bin/env python3
"""Generate org.yaml for mock-bigorg.
Outputs a CEO/VPs/Managers/ICs hierarchy:
- 1 CEO
- 5 VPs (Engineering, Product, Sales, Marketing, Operations)
- 25 Managers (5 per VP)
- 169 ICs distributed across managers (~7 per manager)
Total: 200 workspaces
Every workspace is `runtime: mock` so no container/EC2 is provisioned.
The proxy short-circuits with a canned "On it!" variant on every A2A.
Why a generator and not hand-written YAML: 200 workspaces with the
nested children + name templating is mechanical work that a small
script does without typos. The generator is committed alongside the
output so a future bump (300 workspaces, different department names)
is one config edit + re-run.
Run:
python3 _generate.py > org.yaml
"""
import textwrap
# IC distribution per VP — must sum to 169 so the total tree hits
# exactly 200: 1 CEO + 5 VPs + 25 Managers + 169 ICs = 200.
# Engineering is the largest team (matches a real-world tech-org
# fingerprint); Operations is the smallest. Demo-friendly — the
# uneven split makes the canvas tree look like a real company,
# not a contrived perfectly-balanced lattice.
VPS = [
("Engineering", 65),
("Product", 28),
("Sales", 32),
("Marketing", 24),
("Operations", 20),
]
# Each VP has exactly 5 managers; the IC count for each VP is split
# across those 5 managers as evenly as possible.
MANAGERS_PER_VP = 5
def emit_header() -> str:
return textwrap.dedent("""\
# mock-bigorg — 200-workspace mock organization for funding demos.
#
# Every workspace uses runtime: mock — no container, no EC2, no
# LLM. The platform's A2A proxy short-circuits on mock-runtime
# targets and returns a canned "On it!" variant. Built so a demo
# can render an enterprise-scale org chart on the canvas without
# spinning 200 EC2 instances or burning 200 Anthropic keys.
#
# Hierarchy:
# 1 CEO
# 5 VPs (Engineering / Product / Sales / Marketing / Operations)
# 25 Managers (5 per VP)
# 169 ICs (distributed across managers)
# Total: 200 workspaces.
#
# See workspace-server/internal/handlers/mock_runtime.go for the
# short-circuit + reply variants.
#
# Generated by _generate.py — re-run after editing the constants
# at the top of that script. Do not hand-edit this file beyond
# commit-time tweaks; the generator is the source of truth.
name: Mock BigOrg (200 nodes)
description: Demo-only mock organization. CEO + VPs + Managers + ICs across 200 workspaces. Every reply is a hardcoded "On it!" — no real agent backing.
defaults:
runtime: mock
tier: 1
workspaces:
""").rstrip("\n") + "\n"
def emit_ic(ic_idx: int, dept: str, indent: str) -> str:
"""A leaf IC node — the smallest unit."""
name = f"IC {dept} {ic_idx}"
role = f"{dept} individual contributor"
return f"{indent}- name: {name!s}\n{indent} role: {role!s}\n"
def emit_manager(mgr_idx: int, dept: str, ic_count: int, ic_start: int, indent: str) -> list[str]:
"""A manager with `ic_count` ICs underneath."""
name = f"Manager {dept} {mgr_idx}"
role = f"{dept} manager — leads team {mgr_idx}"
out = [
f"{indent}- name: {name!s}\n",
f"{indent} role: {role!s}\n",
]
if ic_count > 0:
out.append(f"{indent} children:\n")
child_indent = indent + " "
for i in range(ic_count):
ic_idx = ic_start + i
out.append(emit_ic(ic_idx, dept, child_indent))
return out
def split_evenly(total: int, parts: int) -> list[int]:
"""Distribute `total` units across `parts` buckets as evenly as
possible. e.g. split_evenly(17, 5) → [4, 4, 3, 3, 3]."""
base = total // parts
extra = total % parts
return [base + 1 if i < extra else base for i in range(parts)]
def emit_vp(vp_name: str, ic_total: int, indent: str) -> list[str]:
"""A VP with MANAGERS_PER_VP managers underneath; the VP's ICs
are split across those managers."""
name = f"VP {vp_name}"
role = f"VP of {vp_name}"
out = [
f"{indent}- name: {name!s}\n",
f"{indent} role: {role!s}\n",
f"{indent} children:\n",
]
child_indent = indent + " "
ic_split = split_evenly(ic_total, MANAGERS_PER_VP)
ic_running = 1
for mgr_idx, ic_count in enumerate(ic_split, start=1):
out.extend(emit_manager(mgr_idx, vp_name, ic_count, ic_running, child_indent))
ic_running += ic_count
return out
def emit_ceo() -> list[str]:
"""The single root CEO node, containing all VPs."""
out = [
" - name: CEO\n",
" role: Chief Executive Officer\n",
# Canvas root coords — the canvas's nested-grid layout
# positions all descendants relative to this anchor, so a
# single root with subtree-aware sizing puts the whole org
# in one neat tree instead of a fan that overflows the
# viewport.
" canvas: { x: 200, y: 100 }\n",
" children:\n",
]
for vp_name, ic_count in VPS:
out.extend(emit_vp(vp_name, ic_count, " "))
return out
def total_workspaces() -> int:
# 1 CEO + len(VPS) VPs + len(VPS)*MANAGERS_PER_VP managers + sum(ICs)
return 1 + len(VPS) + len(VPS) * MANAGERS_PER_VP + sum(ic for _, ic in VPS)
def main() -> None:
expected = total_workspaces()
if expected != 200:
# Generator self-check. Keep at exactly 200 so the demo's
# "200 workspaces" claim stays honest. If you intentionally
# change the totals, update this check + the README.
raise SystemExit(f"workspace count = {expected}, expected 200 — adjust VPS or MANAGERS_PER_VP")
print(emit_header(), end="")
for line in emit_ceo():
print(line, end="")
print()
print("template_schema_version: 1")
if __name__ == "__main__":
main()