Viewport Rebuild Plan
Company-as-Code · Slack-Controlled · Never-Amnesia

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.

Version: 1.0 — June 2026 Branch: ops/openclaw-github-flow-44 Status: ACTIVE RECOVERY Owner: Sam · Viewport / PlatformX

Contents

  1. Master Model — Company-as-Code
  2. The Loop — Capture to Remember
  3. Slack as Top Layer
  4. Models & Auth
  5. Recovery Sequence — Phase 0–5
  6. First 10 Task Packets
  7. Anti-Amnesia Protocol
  8. Security & Secret Rotation
  9. Intellectual Grounding
  10. Sources

1 Master Model — Company-as-Code

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.

Core Axiom
If it isn't in GitHub, it doesn't exist. Slack triggers work, GitHub holds truth. The VPS executes — and is disposable. Any runtime that dies can be rebuilt from viewport-os in under 20 minutes.

Full Architecture Stack

┌─────────────────────────────────────────────────────────────────────────┐
│              COMMAND LAYER  (Human Interface & Intent)                  │
├────────────────────┬──────────────────────┬────────────────────────────┤
│  SLACKDiscordTelegram / 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       │
└─────────────────────────────────────────────────────────────────────────┘

The Five-Layer Model

Layer 1

Viewport Corporation

Parent holding entity. Four groups (Viewport Group, Capital ABC, Think That Group, Veavor Group) + Modern Lao (49% partner). Governed via GitHub issues — not email.

Layer 2

Viewport OS

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.

Layer 3

PlatformX

The product layer. AI agent infrastructure, harness engineering, tenant deployments. Lives under viewport-os/products/platformx/ with its own AGENTS.md and skill library.

Layer 4

OpenClaw

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.

Layer 5

VPS Runtime

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.

Target GitHub Namespace

The canonical namespace for Viewport Corporation on GitHub. Every repo has a purpose, an AGENTS.md, and a protection rule on main.

viewport-corp/viewport-os
Monorepo — products/ services/ agents/ skills/ mcps/ tenants/ corp/ infra/
viewport-corp/handbook
Company handbook — culture, process, onboarding, locked decisions, soul files
viewport-corp/meta
Architecture decisions, ADRs, cross-repo issues, company-level tracking
viewport-corp/tenant-*
Per-tenant repos (e.g. tenant-modernlao, tenant-mlh) — isolated, own secrets
viewport-corp/fork-*
Maintained forks of upstream tools (OpenClaw, n8n, LiteLLM patches)
viewport-corp/infra-*
Infrastructure-as-code — Coolify configs, Traefik rules, Docker compose manifests
viewport-corp/internal-*
Private internal tools — state.db pipelines, secret rotation scripts, finance automation
viewport-corp/public-*
Public-facing content — migration pages, open docs, community resources
Monorepo Directory Layout (viewport-os)
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

2 The Loop — Capture to Remember

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.

CAPTURESlack/Hermes → issue
AUTOMATEroute + packet
EXECUTEOpenClaw seats
VERIFYreviewer+auditor
PUBLISHevidence + PR + page
REMEMBERbrain writeback
REPEAT

Loop Stage Breakdown

# 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

Mapping to Sam's 10-Step Workflow

  1. Capture intent in Slack
    Type a command or free-form request in #ops-control-room. Hermes listens, parses intent, and creates a structured GitHub issue within 30 seconds. No email, no Notion, no sticky notes.
  2. Issue auto-labelled and routed
    n8n workflow reads the new issue event, applies a label from the taxonomy (type:code, type:research, type:content, etc.) and assigns it to the appropriate OpenClaw seat queue.
  3. Task packet assembled
    Hermes injects context: AGENTS.md for the target repo, last-5-PRs from the relevant seat, the brain markdown for this domain, and any blocking dependencies. Agent receives a complete packet, not a bare prompt.
  4. Seat picks up work
    The assigned OpenClaw seat (running Codex API or Claude Code CLI) begins execution. It runs in an isolated GitHub Actions runner, with tool access scoped to what AGENTS.md permits.
  5. Agent opens a draft PR with live progress
    Rather than a single commit at the end, the agent pushes incremental progress to a branch and updates checkboxes in the PR description. Sam sees real-time state without polling.
  6. CI + verification gates run
    Automated linting, tests, security scan, and the Verifier seat review the diff. Boris Cherny's finding: giving agents effective verification methods improves output quality 2–3x. [S4]
  7. Reviewer seat LGTM or requests changes
    A second OpenClaw seat (Reviewer) independently reads the diff and leaves structured inline comments. If it finds issues, the Executor seat re-runs with the feedback appended to its context.
  8. Sam approves (or auto-merges on low-risk paths)
    High-risk changes (prod deploy, secret rotation, billing changes) require a Slack approval from Sam. Low-risk paths (docs, minor refactors, brain writeback) auto-merge after CI passes.
  9. Publish + deploy + heartbeat
    Merged PR triggers a GitHub Action that deploys via Coolify API, runs curl /health, and posts a Slack + Telegram heartbeat with the live URL and HTTP status code.
  10. Brain writeback closes the loop
    The nightly brain agent reads all closed issues and merged PRs from the past 24 hours, distills them into a markdown entry, appends to MEMORY.md, and commits to the brain/ directory. No amnesia.

3 Slack as Top Layer

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.

1
Primary control surface — Slack
1
Secondary surface — Discord
2+
Department channels — Telegram / WhatsApp
Integrations via n8n + Hermes

Slack Control-Room Channels

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

Slash Commands & Approval Flows

Command Action Approval required? Output
/task [description]Creates GitHub issue, routes to seatNoIssue URL + seat assignment
/deploy [service] [env]Triggers Coolify API deployYes — prod onlyDeploy status + health check result
/rotate-secret [name]Opens secret rotation runbook issueYes — alwaysRotation checklist issue + Telegram alert
/brain-query [question]Queries brain markdown storeNoInline Slack response with source citations
/statusSnapshot of all agent seats + VPS healthNoRich Slack block with live data
/approve [issue#]Merges a pending PR after approval gateSam-onlyMerge + deploy + heartbeat
/cancel [seat] [job]Kills a running agent jobNoJob cancelled + issue comment
/forensics [incident]Opens forensics page for an incidentNoLink to /migration/restart/forensics
Discord = Second Power Surface
Discord runs parallel to Slack for community-facing automation, bot interactions, and public alerts. The same Hermes routing layer connects Discord events to GitHub issues — with a separate webhook namespace and bot identity to avoid cross-contamination.
Telegram + WhatsApp = Department Channels
Field teams, Modern Lao operations, and lightweight client updates flow through Telegram and WhatsApp. Hermes has a Telegram adapter (MCP plugin active) and a WhatsApp Business API integration. All messages are archived to GitHub issues within 5 minutes via n8n.

4 Models & Auth

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.

Breaking Change — April 4, 2026
Anthropic blocked subscription OAuth tokens from working with third-party tools including OpenClaw, effective April 4 2026. A $200/month Claude Max subscription was being used to run $1,000–$5,000 worth of agent compute. Boris Cherny (Claude Code creator) announced the change explicitly. A temporary reinstatement followed weeks later — but with a catch: starting June 15, 2026, agent workloads consume a separate monthly credit pool (not the interactive subscription limit). [S1, S2]

Post-Cutoff Authentication Architecture

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
GitHub Actions = The Durable Loop
Agent sessions die. VPS reboots happen. But GitHub Actions triggers off issues and PRs — it always runs, it always has context, and it always writes back to GitHub. This makes Actions the recovery plane: when OpenClaw loses state, the Action can reconstruct context from the issue thread and resume. This is why the GitHub-as-truth model eliminates amnesia even when agent processes crash. [S5]

claude-code-action Integration

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:

# .github/workflows/claude-review.yml on: pull_request: types: [opened, synchronize] issues: types: [labeled] jobs: claude: runs-on: ubuntu-latest steps: - uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} # Intelligent mode: auto-detects PR review vs issue execution # Supports Bedrock, Vertex AI, Microsoft Foundry as drop-in alternatives
PAT Scoping — Critical
The current admin:enterprise PAT must be scoped down immediately. See §8 (Security). The claude-code-action only needs: contents:write, pull-requests:write, issues:write. No admin scope needed for agent loops.

5 Recovery Sequence — Phase 0 through 5

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.

P0
Stop the Bleeding
Neutralize active threats before attempting any rebuild. Sam-only actions.
  1. Neutralize the 6-hour kill-cron
    The cron job that kills agent sessions after 6h must be identified and stopped or reconfigured. SSH to VPS: crontab -l | grep -i kill. Comment out the offending line. This is the #1 blocker for any recovery attempt.
  2. Rotate and scope the PAT
    Generate a new GitHub PAT with minimum required scopes only. Revoke the old token immediately. Set pat_revoked=true in state.db. Store new token in /home/openclaw/.openclaw/.env on VPS only — never in code.
  3. Flip model fallbacks off subscription
    Update 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.
  4. Push a clean branch and verify CI green
    Push 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.
P1
Restore Core Infrastructure
50 crons + 7 Hermes loops + GitHub → n8n → gateway reconnection
  1. Restore 50 cron jobs from GitHub source
    All cron definitions must live in 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.
  2. Restart the 7 Hermes loops
    Each Hermes instance (one per major tenant/domain) runs as a named Coolify service. Verify each with curl https://hermes-[tenant].veavor.com/health. Any failing instance gets redeployed from its GitHub-backed Dockerfile.
  3. Reconnect GitHub → n8n → gateway
    Verify n8n webhooks are registered in GitHub org settings. Test with a synthetic issue creation. Confirm the event flows through: GitHub webhook → n8n trigger → route → gateway → OpenClaw seat. Log the round-trip time as a baseline metric.
P2
Install the Brain
Per-brain architecture + nightly memory writeback pipeline
  1. Deploy brain markdown store
    Create 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.
  2. Install nightly writeback GitHub Action
    Schedule a nightly Action at 02:00 UTC. It reads all closed issues + merged PRs from the last 24h, distills insights, appends to brain/global/MEMORY.md, and opens a PR. On auto-merge, posts a Slack digest to #brain-updates.
  3. Migrate existing MEMORY.md entries
    Copy the existing ~/.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.
P3
GitHub-ify the Company
viewport-os monorepo, main branch protection, secrets vault
  1. Initialise viewport-os monorepo
    Create the repo under 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.
  2. Populate GitHub Secrets vault
    Add all service keys from VPS /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.
  3. Write AGENTS.md for each major repo
    Every repo in the viewport-corp org needs an AGENTS.md that defines: allowed tools, forbidden actions, verification requirements, handoff format, and which OpenClaw seats are authorised. This is the harness boundary.
P4
Command Center
GitHub Action → Cloudflare Pages deploy pipeline for /migration
  1. Wire the publish Action
    GitHub Action on push to 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.
  2. Set up Cloudflare Access for admin paths
    The /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.
P5
Prove One Closed Loop
End-to-end smoke test + daily Slack/Telegram heartbeat established
  1. Run the canonical smoke test
    Type /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.
  2. Establish daily heartbeat
    Install a daily 09:00 UTC cron Action that posts a Slack + Telegram status block: active agent seats, VPS health, last brain writeback time, next scheduled tasks. If the heartbeat goes silent, that IS the alert.

6 First 10 Task Packets

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
Packet Format (all future tasks inherit this schema)
Every GitHub issue in Viewport must include: Phase · Task ID · Assigned seat · Definition of Done · Proof artifact required · Blocker (if any) · Status URL. Issues without DoD are auto-labelled needs-dod and not picked up by any seat.

7 Anti-Amnesia Protocol

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.

Pillar 1

One Ledger

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.

Pillar 2

One Brain

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.

Pillar 3

One Handoff Format

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.

Pillar 4

Dedup Gate

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.

Canonical Handoff Template

--- Phase: P2 / T-04 Task: Deploy brain writeback Action Done: Nightly Action runs; MEMORY.md committed; Slack digest posted Proof: https://github.com/viewport-corp/viewport-os/commit/[SHA] Blocker: None Next: Migrate existing MEMORY.md entries (T-08) Status-URL: https://viewport.llc/migration/restart#task-packets ---

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.

Truth Labels — GitHub Issue Taxonomy

Label Meaning Who applies
truth:confirmedFact verified by 2+ sources or live testReviewer seat or Sam
truth:unverifiedClaim from a single agent, not yet testedAuto-applied by Hermes on creation
truth:supersededPreviously confirmed fact now known to be outdatedBrain writeback agent
needs-dodIssue missing Definition of Done — blocked from pickupHermes validation hook
needs-proofDoD claimed complete but no proof artifact attachedAuditor seat
duplicateDuplicate of an existing open/closed issueDedup gate (automated)
brain:writtenIssue content written back to brain markdown storeBrain writeback Action
The No-Amnesia Test
After every restart event (VPS reboot, session kill, model cutoff), run this test: open a fresh OpenClaw session with zero priming, and ask it "What is the current status of the Modern Lao portal?" If it can answer from the brain store without any additional context — the anti-amnesia protocol is working.

8 Security & Secret Rotation

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.

970
sk-* API key strings in state.db
276
Telegram bot token strings
138
ghp_* GitHub PAT strings
61
CF_API_KEY Cloudflare strings
Critical — Never Publish Raw state.db
state.db is an internal operational database. It must NEVER be committed to any GitHub repo, included in any Docker image, or exposed via any public endpoint. A redaction pipeline must run before any state.db content is written anywhere outside the VPS.

Secret Rotation Priority Queue

  1. Admin:enterprise PAT → scope down immediately
    The current PAT has admin:enterprise scope. Revoke it. Generate a new PAT with only: repo, workflow, write:packages, read:org. Store in VPS .env only. No PAT in any repo, script, or log.
  2. Rotate all 970 sk-* keys
    Audit which service each key belongs to (OpenAI, Anthropic, OpenRouter, etc.). Revoke all. Generate fresh keys. Update VPS .env. Test each service endpoint. The OpenRouter key leak from May 2026 was a previous example of this risk.
  3. Rotate 138 ghp_* GitHub PATs
    All 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.
  4. Rotate 61 CF_API_KEY tokens
    Cloudflare API keys. Rotate in Cloudflare dashboard. Use scoped API tokens (not global API key) going forward. Scope per-service: DNS-only, Workers-deploy-only, Pages-deploy-only.
  5. Rotate 276 Telegram bot tokens
    Use /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.
  6. Install redaction pipeline for brain writeback
    Before any content from state.db, logs, or agent output is written to GitHub issues, PRs, or brain markdown — it must pass through a regex redaction filter. Patterns: /sk-[a-zA-Z0-9]{20,}/, /ghp_[a-zA-Z0-9]+/, /CF_[A-Z_]+=[a-zA-Z0-9]+/. Replace with [REDACTED:TYPE].

Permanent Security Posture

9 Intellectual Grounding

This 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.

Andrej Karpathy — Software 3.0 & Agentic Engineering

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 PrincipleApplied in this plan
Software 3.0: context window = program; LLM = interpreterAGENTS.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 oversightThe loop is designed for async execution — Sam approves only high-risk gates, not every step.

Boris Cherny — Harness Engineering & Verification-First

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 PrincipleApplied 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–3xEvery OpenClaw seat has a paired Verifier seat. No PR merges without verification sign-off.
Measure output in PRs, not hoursTask 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.

Peter Steinberger — Architecture-First, Pragmatic Delegation

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 PrincipleApplied in this plan
Architect role: system design, taste, direction — delegate execution to agentsSam is the architect of viewport-os. OpenClaw executes. Sam approves only high-risk gates.
Architecture reviews > code reviewsThe Reviewer seat reviews architecture alignment, not just syntax. AGENTS.md defines the architecture contract.
Local-first state: everything reconstructible from sourceVPS is disposable. All state in GitHub. Rebuild from source in <20 min.
6,600 commits/month proves solo-architect + agent-fleet model scales47-seat fleet under single architect (Sam) mirrors this pattern at company scale.

10 Sources

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