๐Ÿ”ง Coding Rules

Rules every agent must follow when working on code โ€” routing, verification, deployment, and publishing.

๐Ÿงญ Task Routing

When an agent receives a task, it must route automatically based on type. Agents do not ask which agent to use.

Task TypeRoute ToHow
Code / logic / files Cursor Agent sessions_spawn(runtime="subagent", agentId="cursor", task="...")
Vision / screenshots / UI Codex sessions_spawn(runtime="acp", agentId="codex", task="...")
Planning / coordination Self Handle directly
Rule: Analyze the task and route automatically. Never ask the user which agent to use.

โœ… Post-Coding Verification

MUST After every coding task, agents must complete all three steps:

1. Run locally
โ†’
2. Screenshot
โ†’
3. Verify

1. Run the Project Locally

2. Take Screenshots

3. Verify Functionality

# Example: Run, wait, screenshot
npm run dev -- --port 3456
# Wait for "ready" signal, then:
npx playwright-core screenshot --browser=chromium \
  --viewport-size=1400,900 --wait-for-timeout=3000 \
  "http://localhost:3456" ./screenshot.png

# Post to chat
# MEDIA:./screenshot.png

๐Ÿš€ Deployment

When Asked to "Check In" or "Deploy"

Always include Vercel links in the response:

Response Format

๐Ÿ“ฆ Deployment: <VERCEL_DEPLOYMENT_URL>
๐ŸŒ Live site: <VERCEL_HOSTED_URL>
๐Ÿ”— Pages to test:
- <VERCEL_HOSTED_URL>/page1
- <VERCEL_HOSTED_URL>/page2

Vercel Authentication

All agents share a single Vercel token:

# Load credentials
source ~/.openclaw/workspace/.env.vercel

# Deploy
vercel --token $VERCEL_TOKEN --yes
Token location: ~/.openclaw/workspace/.env.vercel
Generate new tokens: vercel.com/account/tokens

Environment Variables (per agent)

Each agent should have these in their workspace .env file:

VariablePurpose
VERCEL_DEPLOYMENT_URLLink to Vercel deployments dashboard
VERCEL_HOSTED_URLLink to the live deployed site

The orchestrator provides these values per-project.

๐Ÿ“ Publishing Markdown Outputs

REQUIRED Any task that produces a .md file as output MUST publish it to GitHub.

Path Structure

microspaces/<discord-server-name>/<channel>/<bot>/<task>/<task>_<date>.md

Example

microspaces/superstarsale/marketing/clio/campaign-analysis/campaign-analysis_2026-06-12.md

How to Publish

# Load credentials
source ~/.openclaw/workspace/.env.github

# Publish
~/.openclaw/workspace/scripts/github-publish-md.sh \
  <server> <channel> <bot> <task> <markdown-file>

The script auto-creates the repo microspaces/<server> if it doesn't exist, commits to main, and returns the GitHub URL.

Always include in response: ๐Ÿ“„ Output: https://github.com/microspaces/<server>/blob/main/...

๐Ÿ–ฅ๏ธ Shell & Environment

Windows (Current)

ItemValue
HostDesktopWestport (Windows 11)
Default shellPowerShell (pwsh)
Shell scriptsGit Bash (C:\Program Files\Git\bin\bash.exe)
WSLNot installed โ€” do not use
Node.jsv24.18.0
PythonNot installed โ€” use node for scripting
WorkspaceC:\Users\AI\.openclaw\workspace
ReposC:/Users/AI/Repos/
โš ๏ธ All .sh scripts must run via Git Bash. Do not use WSL โ€” no distros are installed.

Path Conventions

๐Ÿ” Safety Rules

Safe to Do Freely

Ask First

Destructive Commands

Never run destructive commands without asking. trash > rm โ€” recoverable beats gone forever.

Private Data

๐Ÿ”€ Development Workflow

Universal rules for all coding agents across all repos. Full Workflow Rules โ†’

1. Branch from main
โ†’
2. Develop locally
โ†’
3. Run & screenshot
โ†’
4. Push branch
โ†’
5. Vercel preview
โ†’
6. Open PR
โ†’
7. Post to Discord
โ†’
8. Merge & deploy

Branching

Pull Requests

Convex Auto-Deploy

Safety net: test-screenshots/ is in .gitignore on main. All GitHub repos have AGENTS.md with workflow section + .github/PULL_REQUEST_TEMPLATE.md.

๐Ÿ“Š Status Updates

Agents must update their status at key moments:

WhenStatus
Starting workIn Progress
Finished workDone
BlockedBlocked + specify blocker
When askedRespond with current status
# Update both board and HTML page
source ~/.openclaw/workspace/.env.github

~/.openclaw/workspace/scripts/update-agent-status.sh \
  <agent> <status> <task> [server] [blocked-by] [discord] [priority] [type] [progress] [notes]

~/.openclaw/workspace/scripts/update-status-html.sh \
  <agent> <status> <task> [server] [blocked-by] [discord]