FakeOpenClaw is a command-based AI agent that can receive prompts from the terminal or Google Sheets, ask an OpenRouter model what to do next, execute one command at a time, and write AI replies back to a Google Sheets reply log.
- Project Files
- Setup
- Google Sheets Setup
- Run The Agent
- How It Functions
- Skills Available
- Google Sheets Rules
- Flowchart
- Troubleshooting
main.py: Main agent loop.Agent.md: System rules for how the AI must respond.Skill.md: List of available tool skills and command examples.google_sheet.py: Google Sheets input, output, and sheet operation helpers.google.py: Original Google Sheets prompt helper.sele.py: Selenium browser control implementation.google.json: Google service account credentials file.downloads/: Local download and screenshot folder.
- Install Python dependencies used by the project:
pip install openrouter gspread google-auth selenium yt-dlp python-dotenv- Put your Google service account JSON credentials in:
google.json
- Set your OpenRouter API key:
$env:OPENROUTER_API_KEY="your_openrouter_api_key"- Optional: choose a model. If omitted,
main.pyusesopenai/gpt-5.4.
$env:OPENROUTER_MODEL="openai/gpt-5.4"- Create or open a Google Sheet.
- Share the sheet with the service account email inside
google.json. - Set the spreadsheet id:
$env:GOOGLE_SHEET_ID="your_google_sheet_id"- Create these worksheets:
Cy: prompt input queue.reply: AI reply log.Schedule: allowed AI sheet workspace.Financial: allowed AI sheet workspace.Sheet1: allowed AI sheet workspace.
Default cells and sheets:
- Prompt sheet:
Cy - Prompt cell:
I2 - Reply sheet:
reply - Poll interval: 5 seconds
- Sheet download folder:
C:\Users\<user>\Downloads
Useful optional environment variables:
$env:GOOGLE_SHEET_NAME="Cy"
$env:GOOGLE_PROMPT_CELL="I2"
$env:GOOGLE_REPLY_SHEET_NAME="reply"
$env:GOOGLE_POLL_SECONDS="5"
$env:GOOGLE_DOWNLOAD_DIR="C:\Users\User\Downloads"Run with terminal input:
python main.pyRun with Google Sheets input:
$env:GOOGLE_SHEET_ID="your_google_sheet_id"
$env:OPENROUTER_API_KEY="your_openrouter_api_key"
python main.pyWhen Google Sheets input is enabled, put the user prompt in Cy!I2. The program waits until that cell has text.
main.pybuilds a system prompt by combiningAgent.mdandSkill.md.- It reads user input from Google Sheets if
GOOGLE_SHEET_IDis set. - Otherwise, it reads user input from the terminal.
- It sends the conversation to OpenRouter.
- The AI must reply with either:
COMMAND: {...}
or:
DONE: final answer
- If the reply is a command,
main.pyexecutes it and sends the result back to the AI. - Every raw AI reply is appended to the
replyworksheet. - When the AI returns
DONE,main.pyremoves everything below the header row inCy. - The program then waits for the next prompt.
- Reads prompts from
Cy!I2whenGOOGLE_SHEET_IDis set. - Appends AI replies to the
replyworksheet. - Clears all rows below the
Cyheader after one prompt finishes.
Allowed worksheets for AI sheet commands:
ScheduleFinancialSheet1
Supported sheet commands:
{"type": "sheet", "action": "read", "range": "A1:D10"}
{"type": "sheet", "action": "read"}
{"type": "sheet", "action": "update_cell", "cell": "A2", "value": "new value"}
{"type": "sheet", "action": "update_range", "range": "A2:B3", "values": [["A2", "B2"], ["A3", "B3"]]}
{"type": "sheet", "action": "append_row", "values": ["col 1", "col 2", "col 3"]}
{"type": "sheet", "action": "clear", "range": "A2:D20"}
{"type": "sheet", "action": "download", "format": "csv"}
{"type": "sheet", "action": "download", "format": "json"}If worksheet_name is omitted, the command uses Schedule.
Supported browser commands include:
{"type": "browser", "action": "open_google"}
{"type": "browser", "action": "search", "query": "search words"}
{"type": "browser", "action": "open_youtube"}
{"type": "browser", "action": "open_youtube_video", "url": "https://www.youtube.com/watch?v=VIDEO_ID"}
{"type": "browser", "action": "read_page"}
{"type": "browser", "action": "screenshot", "path": "downloads/page.png"}The AI can run shell commands for local files and command-line tools:
{"type": "shell", "command": "yt-dlp -F \"YOUTUBE_URL\""}Cyis only for prompt input.- AI sheet commands must not modify
Cy. - AI sheet commands are restricted in code to
Schedule,Financial, andSheet1. - AI replies are stored in the
replyworksheet. - Downloads from sheet commands go to the Windows Downloads folder by default.
flowchart TD
A[Start main.py] --> B[Load Agent.md and Skill.md]
B --> C{GOOGLE_SHEET_ID set?}
C -- No --> D[Read prompt from terminal]
C -- Yes --> E[Wait for prompt in Cy!I2]
E --> F[Send prompt to OpenRouter]
D --> F
F --> G[Receive AI reply]
G --> H[Append AI reply to reply sheet]
H --> I{Reply type}
I -- COMMAND --> J[Parse command JSON]
J --> K{Command type}
K -- shell --> L[Run shell command]
K -- browser --> M[Run Selenium browser action]
K -- sheet --> N[Validate worksheet is Schedule, Financial, or Sheet1]
N --> O[Run Google Sheets action]
L --> P[Send command result back to AI]
M --> P
O --> P
P --> F
I -- DONE --> Q[Remove all rows below header in Cy]
Q --> R[Wait for next prompt]
R --> C
- If the terminal says it is waiting for
Cy!I2, add a prompt to that cell. - If Google Sheets access fails, make sure the sheet is shared with the service account email from
google.json. - If the AI tries to modify
Cy,main.pyrejects the command. - If Google returns a read quota error, the program waits before retrying.
- If
.envparsing warns, use normal dotenv format instead of PowerShell syntax inside.env:
GOOGLE_SHEET_ID=your_google_sheet_id
OPENROUTER_API_KEY=your_openrouter_api_key