A full architectural blueprint for turning Viewport Corporation into a GitHub-grounded, agent-powered operating company that survives model cutoffs, restart events, and infrastructure churn — with no knowledge loss and no manual coordination.
Viewport Corporation is not managed through email, spreadsheets, or Notion. It is managed through code — specifically, a GitHub-grounded stack where every decision, task, agent, and infrastructure component has a canonical address. This section maps the full architecture.
viewport-os in under 20 minutes.
┌─────────────────────────────────────────────────────────────────────────┐
│ COMMAND LAYER (Human Interface & Intent) │
├────────────────────┬──────────────────────┬────────────────────────────┤
│ SLACK │ Discord │ Telegram / WhatsApp │
│ Primary control │ 2nd power surface │ Department channels │
│ #ops-control-room │ Community / alerts │ Field teams / clients │
│ /cmd slash cmds │ Bot integrations │ Lightweight approvals │
└────────────┬───────┴──────────────────────┴────────────────────────────┘
│ intent + context
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ HERMES (Operator / Router — Per Tenant) │
│ Routes Slack/webhook events → packets → agent seat assignments │
│ Maintains per-tenant context, approval gates, loop state │
│ Runtime: OpenAI Codex ($100–200) · deployed on VPS · GitHub-backed │
└───────────────────────────────┬─────────────────────────────────────────┘
│ structured task packets
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ GITHUB (Truth + Brain + Actions Loop) │
│ viewport-os monorepo · issues = ledger · PRs = evidence │
│ Actions: claude-code-action · codex-action · cron loops │
│ Secrets vault · AGENTS.md per repo · brain markdown writeback │
└───────────────────────────────┬─────────────────────────────────────────┘
│ agent tasks + verified outputs
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ OPENCLAW (47-Seat Agent Fleet) │
│ Seats: research / code / review / write / qa / ops / legal / finance │
│ Auth: API keys only (no subscription OAuth — see §4) │
│ Loops: cron-babysit-prs · nightly-deep-work · verify-and-merge │
└───────────────────────────────┬─────────────────────────────────────────┘
│ deploy commands
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ VPS (Disposable Runtime — 194.163.153.171) │
│ Coolify · Traefik · Docker · Tailscale · Cloudflare │
│ Every service rebuildable from GitHub source in <20 min │
│ Deploy via Coolify API only — never Docker daemon / iptables │
└───────────────────────────────┬─────────────────────────────────────────┘
│ live evidence
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ /migration COMMAND CENTER (viewport.llc/migration) │
│ Live pages: Overview · Forensics · Transcript · Brain │
│ Rebuild Plan · Idea Bank · sourced from GitHub via Action deploy │
└─────────────────────────────────────────────────────────────────────────┘
Parent holding entity. Four groups (Viewport Group, Capital ABC, Think That Group, Veavor Group) + Modern Lao (49% partner). Governed via GitHub issues — not email.
The operating system of the company. viewport-os monorepo is the single source of truth: products, agents, skills, MCPs, tenants, infra config, and corp docs.
The product layer. AI agent infrastructure, harness engineering, tenant deployments. Lives under viewport-os/products/platformx/ with its own AGENTS.md and skill library.
The workforce. 47 named agent seats, each with a soul file, AGENTS.md, and assigned GitHub labels. Powered by Codex API + Claude Code CLI. No subscription auth.
Disposable compute. All state lives in GitHub and the brain markdown store. The VPS can be wiped and rebuilt from viewport-os/infra/ without any information loss.
The canonical namespace for Viewport Corporation on GitHub. Every repo has a purpose, an AGENTS.md, and a protection rule on main.
products/ — PlatformX, Veavor tools, tenant apps |
services/ — Hermes, gateway, n8n automations |
agents/ — 47 soul files + AGENTS.md per seat |
skills/ — Claude Code skill library |
mcps/ — MCP server configs |
corp/ — articles, cap table, contracts |
infra/ — VPS rebuild scripts
Every unit of work in Viewport follows a closed loop: captured in Slack, routed through Hermes, executed by OpenClaw, verified, published as evidence, and written back to the brain. No loop exits without a proof artifact. No task ends in ambiguity.
| # | Stage | Input | Who / What | Output | Failure mode |
|---|---|---|---|---|---|
| 1 | CAPTURE | Slack message, webhook, cron, human intent | Hermes operator bot | GitHub issue with structured frontmatter | Slack message lost, no issue created |
| 2 | AUTOMATE | GitHub issue event | n8n workflow + label router | Labelled task packet assigned to seat | n8n disconnected from GitHub webhook |
| 3 | EXECUTE | Task packet + AGENTS.md context | OpenClaw seat (Codex/Claude Code) | Code diff, content draft, research artifact | Agent dies mid-task, no handoff recorded |
| 4 | VERIFY | Agent output + CI logs | Reviewer seat + Verifier seat + Auditor | LGTM comment or change request on PR | Verification skipped, hallucinated output merged |
| 5 | PUBLISH | Merged PR + proof artifact | GitHub Actions → Cloudflare deploy | Live page, Slack notification, approval record | Deploy silently fails, no health check run |
| 6 | REMEMBER | Issue + PR metadata + proof | Brain writeback agent (nightly) | Updated brain markdown + MEMORY.md entry | No writeback = next session has amnesia |
#ops-control-room. Hermes listens, parses intent, and creates a structured GitHub issue within 30 seconds. No email, no Notion, no sticky notes.type:code, type:research, type:content, etc.) and assigns it to the appropriate OpenClaw seat queue.curl /health, and posts a Slack + Telegram heartbeat with the live URL and HTTP status code.brain/ directory. No amnesia.Slack is not a chat app for Viewport — it is the command plane. Every integration, automation, approval, and department communication routes through Slack. Discord is the second power surface for community and alerts. Telegram and WhatsApp handle department channels and field teams.
| Channel | Purpose | Who posts | Key integrations |
|---|---|---|---|
#ops-control-room |
Master command channel — all Hermes commands, approvals, heartbeats | Sam + Hermes bot | GitHub, n8n, Coolify deploy hooks |
#agents-status |
Real-time OpenClaw seat status — running / idle / failed | OpenClaw monitor agent | GitHub Actions webhook, Coolify health checks |
#deploy-log |
Every deployment event with HTTP status, commit SHA, rollback link | GitHub Actions bot | Coolify API, curl health probe |
#approvals |
High-risk change requests requiring Sam's explicit yes/no | Hermes approval flow | Interactive buttons → GitHub PR merge / close |
#brain-updates |
Daily brain writeback digest — what was learned, what changed | Brain agent (nightly cron) | GitHub brain/ directory, MEMORY.md |
#infra-alerts |
VPS health, cron failures, dead agents, secret expiry warnings | Monitor agent + Coolify webhooks | state.db audit, uptime checks |
#tenant-modernlao |
Modern Lao tenant operations — MLH portal, investor pages, client activity | Tenant Hermes instance | Supabase webhooks, Resend email events |
#finance-ops |
Billing events, Stripe webhooks, invoice approvals, API cost alerts | Finance agent | Stripe, Coolify billing, OpenAI/Anthropic usage API |
| Command | Action | Approval required? | Output |
|---|---|---|---|
/task [description] | Creates GitHub issue, routes to seat | No | Issue URL + seat assignment |
/deploy [service] [env] | Triggers Coolify API deploy | Yes — prod only | Deploy status + health check result |
/rotate-secret [name] | Opens secret rotation runbook issue | Yes — always | Rotation checklist issue + Telegram alert |
/brain-query [question] | Queries brain markdown store | No | Inline Slack response with source citations |
/status | Snapshot of all agent seats + VPS health | No | Rich Slack block with live data |
/approve [issue#] | Merges a pending PR after approval gate | Sam-only | Merge + deploy + heartbeat |
/cancel [seat] [job] | Kills a running agent job | No | Job cancelled + issue comment |
/forensics [incident] | Opens forensics page for an incident | No | Link to /migration/restart/forensics |
Anthropic's April 2026 policy change cut off subscription-based OAuth authentication for all third-party agents including OpenClaw. This section documents the post-cutoff model strategy and the two durable authentication paths.
| Runtime | Model | Auth method | Cost | Use case |
|---|---|---|---|---|
| Hermes + OpenClaw runtimes | OpenAI Codex (GPT-5.3-Codex / codex-mini) | API key — OPENAI_API_KEY |
$1.50/1M in · $6/1M out (codex-mini) [S6] | Agent loops, routing, task execution |
| Claude Code CLI on VPS | Claude Max ($200/mo) | Claude Code CLI — local session, not OAuth | Subscription — interactive only | Sam's direct CLI work; VPS terminal sessions |
| GitHub Actions (PR review / issues) | Anthropic API (claude-sonnet-4-5+) | API key in GitHub Secrets — ANTHROPIC_API_KEY |
Pay-as-you-go API rates | claude-code-action — PR review, issue triage [S5] |
| GitHub Actions (code execution) | Codex via openai/codex-action | API key in GitHub Secrets — OPENAI_API_KEY |
API rates + Pro plan tasks | Automated CI fixes, refactors, docs sync [S6] |
| Fallback / cost control | LiteLLM proxy → px-* prefix | Internal gateway — no external subscription | Routed to cheapest capable model | High-volume research, summarisation, low-stakes tasks |
The official anthropics/claude-code-action (7.9k stars, used by 16.8k projects as of June 2026) provides the durable GitHub Actions loop for Claude-powered automation. Key integration points:
claude-code-action only needs: contents:write, pull-requests:write, issues:write. No admin scope needed for agent loops.
Six phases from stop-the-bleeding to a fully closed, daily-heartbeat loop. Phases are sequential — do not start Phase N+1 until Phase N has a passing health check. Each phase ends with a Slack heartbeat post.
crontab -l | grep -i kill. Comment out the offending line. This is the #1 blocker for any recovery attempt.pat_revoked=true in state.db. Store new token in /home/openclaw/.openclaw/.env on VPS only — never in code.openclaw.json fallback chains: remove any subscription OAuth paths. Primary: codex-mini-latest (API key). Secondary: claude-sonnet-4-6 (API key, not OAuth). Tertiary: LiteLLM px-* proxy. Validate with a test run.ops/openclaw-github-flow-44 to viewport-corp/viewport-ops. Confirm Actions trigger. Confirm no secret leaks in diff. This branch is the recovery ledger.viewport-os/infra/crons/. Audit crontab -l on VPS against the repo. Missing crons get filed as GitHub issues with type:infra label and re-deployed via Coolify API. Never hand-edit crontab.curl https://hermes-[tenant].veavor.com/health. Any failing instance gets redeployed from its GitHub-backed Dockerfile.viewport-corp/viewport-os/brain/ directory. Structure: brain/global/MEMORY.md, brain/tenant-[name]/MEMORY.md, brain/agents/[seat-name].md. Each file follows the handoff template from §7.brain/global/MEMORY.md, and opens a PR. On auto-merge, posts a Slack digest to #brain-updates.~/.claude/claude-memory/MEMORY.md entries (21 entries as of June 2026) into brain/global/MEMORY.md. Each entry gets a GitHub issue backlink. This seeds the brain so the first writeback has continuity.viewport-corp/viewport-os. Push initial directory skeleton (products/ services/ agents/ skills/ mcps/ corp/ infra/ brain/). Add AGENTS.md at root. Enable branch protection on main: require PRs, require CI, no force-push./home/openclaw/.openclaw/.env as GitHub org secrets (not repo secrets — org-level for cross-repo access). Naming convention: PROVIDER_PURPOSE_ENV e.g. ANTHROPIC_API_KEY_PROD.public/ directory: builds static HTML, deploys to Cloudflare Pages via CLOUDFLARE_API_TOKEN secret, runs curl https://viewport.llc/migration/restart/plan and asserts HTTP 200. Posts result to #deploy-log./migration/ tree should be gated by Cloudflare Zero Trust. Only Sam's email gets access. Public paths (/migration/restart/plan) remain open. This prevents accidental indexing of internal forensics data./task Update brain with June 2026 recovery status in #ops-control-room. Confirm: issue created → seat assigned → agent opens PR → CI passes → Reviewer LGTM → Sam approves via Slack button → deploy fires → health check 200 → brain writeback commits. Full loop, documented.These are the first ten concrete GitHub issues to open, in order, after the Phase 0 stop-the-bleeding actions are complete. Each packet includes a label, assigned seat, definition of done, and proof artifact.
| # | Title | Label | Seat | DoD | Proof artifact |
|---|---|---|---|---|---|
| T-01 | Neutralize 6h kill-cron | type:infra p0 |
Sam-only | Crontab shows no kill lines; agent sessions survive 7h test | crontab -l output + 7h session log |
| T-02 | Rotate admin PAT, scope to minimum | type:security p0 |
Sam-only | New PAT active; old PAT revoked; state.db updated | GitHub token audit log screenshot |
| T-03 | Init viewport-os monorepo skeleton | type:infra p3 |
ops-seat | Repo exists, skeleton pushed, branch protection on main | gh repo view viewport-corp/viewport-os output |
| T-04 | Deploy brain writeback Action | type:brain p2 |
brain-seat | Nightly Action runs, MEMORY.md committed, Slack digest posted | First brain commit SHA + Slack screenshot |
| T-05 | Reconnect GitHub → n8n → gateway | type:integration p1 |
ops-seat | Synthetic issue → n8n event → gateway log within 30s | n8n execution log URL |
| T-06 | Write AGENTS.md for viewport-ops repo | type:harness p3 |
architect-seat | AGENTS.md committed, defines 3+ allowed tools, forbidden actions, verification gate | Committed AGENTS.md file link |
| T-07 | Restart 7 Hermes loops, health-check all | type:infra p1 |
devops-seat | All 7 /health endpoints return 200; Slack confirms |
curl output for all 7 endpoints |
| T-08 | Migrate MEMORY.md → brain/global | type:brain p2 |
brain-seat | 21 existing entries in brain/global/MEMORY.md with issue backlinks | Committed MEMORY.md diff showing 21 entries |
| T-09 | Install daily heartbeat cron Action | type:monitoring p5 |
ops-seat | 09:00 UTC Action fires; Slack + Telegram blocks posted; 3 consecutive days confirmed | 3 Slack screenshots of heartbeat blocks |
| T-10 | Run canonical smoke test — full closed loop | type:test p5 |
qa-seat + Sam approve | Full loop in ≤15 min: Slack command → issue → PR → CI → approve → deploy → brain | GitHub issue timeline screenshot showing all steps |
needs-dod and not picked up by any seat.
The single biggest failure mode in agent-powered companies is knowledge loss: agents restart without context, sessions die, handoffs fail, the same bug is solved twice. This section defines the four pillars of anti-amnesia architecture.
GitHub Issues is the single source of truth for all work. No Notion, no Slack threads, no sticky notes. Every task has an issue. Every issue has a status. Issues are never deleted — only closed with proof.
The brain markdown store (brain/ in viewport-os) accumulates every lesson. The nightly writeback Action reads the day's closed issues and distills entries. Agent restarts read the brain first — always.
Every task handoff — from one agent to another, or from one session to the next — follows the canonical 7-field format below. No free-form handoffs are accepted by any seat.
Before any agent starts work on a new task, Hermes checks the brain and the issue ledger for a matching entry within the last 30 days. Duplicate issues are automatically closed with a link to the original.
Every handoff must have all seven fields populated. Agents that receive a handoff with a missing field must file a needs-dod issue before proceeding.
| Label | Meaning | Who applies |
|---|---|---|
truth:confirmed | Fact verified by 2+ sources or live test | Reviewer seat or Sam |
truth:unverified | Claim from a single agent, not yet tested | Auto-applied by Hermes on creation |
truth:superseded | Previously confirmed fact now known to be outdated | Brain writeback agent |
needs-dod | Issue missing Definition of Done — blocked from pickup | Hermes validation hook |
needs-proof | DoD claimed complete but no proof artifact attached | Auditor seat |
duplicate | Duplicate of an existing open/closed issue | Dedup gate (automated) |
brain:written | Issue content written back to brain markdown store | Brain writeback Action |
The state.db audit found alarming numbers of raw credential strings across the OpenClaw workspace. These must be rotated, scoped, and routed through a redaction pipeline before any secret is written to GitHub, logs, or the brain store.
repo, workflow, write:packages, read:org. Store in VPS .env only. No PAT in any repo, script, or log..env. Test each service endpoint. The OpenRouter key leak from May 2026 was a previous example of this risk.ghp_-prefixed tokens. Many are likely expired — run a batch check. Revoke all active ones. Generate replacements with fine-grained scopes. Update state.db references to point to new tokens./revoke via BotFather for each bot. Generate new tokens. Update each Hermes Telegram adapter. Test incoming message routing. Note: Name.com API tokens also need rotation per the April 2026 exposure — partially safe due to IP lock to VPS but rotate within 30 days./sk-[a-zA-Z0-9]{20,}/, /ghp_[a-zA-Z0-9]+/, /CF_[A-Z_]+=[a-zA-Z0-9]+/. Replace with [REDACTED:TYPE]./home/openclaw/.openclaw/.env on VPS — never anywhere elsePROVIDER_PURPOSE_ENV — never in coderepo + workflow only for most agents/migration/ admin paths#infra-alertsThis architecture is grounded in three living practitioners whose work has been verified against live sources (June 2026). Their frameworks directly shaped the design decisions in this plan.
AI researcher, former OpenAI and Tesla. Coined context engineering (Dec 2025) and agentic engineering (Feb 2026). Presented Software 3.0 at the Sequoia Ascent Summit 2026. [S7, S8]
"Your programming now turns to prompting. And what's in the context window is over the interpreter, that is the LLM." — Andrej Karpathy, Sequoia Ascent 2026 (via philippdubach.com summary) [S8]
"You can outsource your thinking, but you can't outsource your understanding." — Andrej Karpathy, on human value in Software 3.0 [S8]
| Karpathy Principle | Applied in this plan |
|---|---|
| Software 3.0: context window = program; LLM = interpreter | AGENTS.md is the program. OpenClaw seats are the interpreter. GitHub provides the context. |
| Agentic engineering > vibe coding (quality preserved at scale) | Every seat has an AGENTS.md harness boundary. No unconstrained free-form execution. |
| Verifiable domains see exponential gains (code, math, tests) | All tasks require a proof artifact. DoD must be testable. Brain writeback verifies completion. |
| December 2024 inflection: agents trustworthy without constant oversight | The loop is designed for async execution — Sam approves only high-risk gates, not every step. |
Creator of Claude Code at Anthropic. Ships 50–150 PRs/day from his phone. Has not written a line of code by hand since October 2025. His core insight: the engineer's job is to build the harness — not to write the code. [S3, S4]
"The engineer's job is to build the harness, not to write the code. The harness is the AGENTS.md files, the linters, the architectural constraints, the verification scripts, the test infrastructure." — Boris Cherny (via Towards AI, June 2026) [S4]
"Simply giving Claude effective verification methods typically improves final output quality by 2–3x." — Boris Cherny [S4]
| Cherny Principle | Applied in this plan |
|---|---|
| Harness = AGENTS.md + linters + constraints + verification scripts | §3 of every repo is an AGENTS.md. Verification is a mandatory loop stage (§2 VERIFY node). |
| Verification improves quality 2–3x | Every OpenClaw seat has a paired Verifier seat. No PR merges without verification sign-off. |
| Measure output in PRs, not hours | Task packets are PR-shaped. DoD is a merged PR + proof artifact. |
| research → plan → execute → verify (separate sessions) | The loop stages (§2) map directly: CAPTURE=research, AUTOMATE=plan, EXECUTE, VERIFY. |
Co-founder of PSPDFKit (€100M exit 2021). Founded OpenClaw. Shipped 6,600 commits in January 2026 as a solo developer using AI agents. Featured on Pragmatic Engineer and Lex Fridman. [S9, S10]
"I am the architect." — Peter Steinberger, on his role in AI-native development (via sethserver.com) [S10]
"Most code is boring data transformation that AI can handle efficiently." — Peter Steinberger (paraphrased via sethserver.com analysis) [S10]
| Steinberger Principle | Applied in this plan |
|---|---|
| Architect role: system design, taste, direction — delegate execution to agents | Sam is the architect of viewport-os. OpenClaw executes. Sam approves only high-risk gates. |
| Architecture reviews > code reviews | The Reviewer seat reviews architecture alignment, not just syntax. AGENTS.md defines the architecture contract. |
| Local-first state: everything reconstructible from source | VPS is disposable. All state in GitHub. Rebuild from source in <20 min. |
| 6,600 commits/month proves solo-architect + agent-fleet model scales | 47-seat fleet under single architect (Sam) mirrors this pattern at company scale. |
All external claims in this document are grounded in live sources retrieved June 2026. No claim is made from training-data memory alone.
Rebuild plan · grounded in live docs (Context7 + official sources), 2026-06-09. Branch: ops/openclaw-github-flow-44 · viewport-corp/viewport-ops