How to Connect Google Drive as a Knowledge Base in OpenClaw Using GoG CLI
Blog Image



Google Drive can serve as a centralized knowledge base for your OpenClaw agent. By integrating OpenClaw with GoG CLI and Google Workspace, your agent can access documents, SOPs, project files, onboarding guides, and other knowledge stored in Google Drive.
This guide walks through creating an OpenClaw agent, enabling the GoG skill, installing GoG CLI, authenticating with Google Workspace, and making Drive content available to your AI assistant.

Step 1: Create a New Agent

Create a new OpenClaw agent:
openclaw agents add PersonalAssistant

Verify that the agent was created successfully:
openclaw agents list

You should see:
PersonalAssistant


Step 2: Verify the GoG Skill

Check whether the GoG skill is installed:
openclaw skills info gog

You may initially see:
๐ŸŽฎ gog ๐Ÿšซ Excluded by agent allowlist

This means the skill is installed but not yet available to the agent.

Step 3: Install Homebrew

Install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Add Homebrew to your shell:
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)"' >> ~/.bashrc

Load the environment:
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)"

Verify installation:
brew --version


Step 4: Install GoG CLI

Install GoG CLI:
brew install openclaw/tap/gogcli

Verify installation:
gog --version


Step 5: Create Google OAuth Credentials

  1. Open Google Cloud Console.
  2. Create a new project or select an existing project.
  3. Enable the following APIs:
    • Google Drive API
    • Google Docs API
  4. Navigate to:
APIs & Services โ†’ Credentials

  1. Click:
Create Credentials โ†’ OAuth Client ID

  1. Choose:
Desktop Application

  1. Download the OAuth credentials JSON file.

Step 6: Configure GoG Credentials

Create the GoG configuration directory:
mkdir -p ~/.local/share/gogcli

Create the credential file:
nano ~/.local/share/gogcli/credentials.json

Paste the OAuth credentials JSON downloaded from Google Cloud Console.
Verify:
ls -l ~/.local/share/gogcli/credentials.json


Step 7: Authenticate with Google Workspace

Authenticate with Google:
gog auth credentials ~/.local/share/gogcli/credentials.json

During authentication:
  1. A browser URL is displayed.
  2. Open the URL.
  3. Sign in with the Google account that owns the Drive documents.
  4. Grant the requested permissions.
  5. Copy the returned authorization URL back into the terminal.
Verify authentication:
gog auth list

Example:
user@example.com
default
gmail,calendar,drive,docs,sheets,slides
oauth


Step 8: Verify GoG CLI Access

Test Google Drive access:
gog drive ls --max 10

Example output:
๐Ÿ“„ Employee Handbook.pdf
๐Ÿ“„ SOP - Customer Support.docx
๐Ÿ“„ Product Roadmap.xlsx
๐Ÿ“„ Onboarding Guide.pdf

If files are displayed, GoG CLI can access your Google Drive successfully.

Step 9: Enable the GoG Skill for the Agent

Update the agent configuration to allow the GoG skill.
Check status again:
openclaw skills info gog

Expected output:
๐ŸŽฎ gog โœ“ Ready

Example:
Google Workspace CLI for Gmail, Calendar, Drive, Contacts, Sheets, Docs, and more.


Step 10: Make Credentials Available to OpenClaw Runtime

OpenClaw agents run inside isolated workspaces and require access to the GoG credentials.
Create the destination directory:
mkdir -p ~/.openclaw/agents/main/agent/codex-home/home/.local/share/gogcli

Copy the credentials:
cp ~/.local/share/gogcli/credentials.json \
~/.openclaw/agents/main/agent/codex-home/home/.local/share/gogcli/

Verify:
find ~/.openclaw/agents -name credentials.json

Expected output:
/home/USER/.openclaw/agents/main/agent/codex-home/home/.local/share/gogcli/credentials.json


Step 11: Restart OpenClaw

Restart the gateway:
openclaw gateway restart

Expected output:
Restarted systemd service: openclaw-gateway.service


Step 12: Test Google Drive from the Agent

Once OpenClaw restarts, test Drive access through the agent.
Example prompts:
drive what files exist

list my drive files

find onboarding document

show documents in knowledge base

Example:
Use the gog skill for this request.

User input:
list my drive files

The agent should invoke GoG and retrieve documents directly from Google Drive.

Troubleshooting

GoG Excluded by Agent Allowlist

If you see:
๐ŸŽฎ gog ๐Ÿšซ Excluded by agent allowlist

Add gog to the agent's allowed skills configuration and restart OpenClaw.

GoG Needs Setup

If you see:
๐ŸŽฎ gog โ–ณ Needs setup

Run:
gog auth credentials ~/.local/share/gogcli/credentials.json

Complete the OAuth authentication flow.

Authentication Works in Terminal but Not in OpenClaw

Verify credentials exist in both locations:
ls ~/.local/share/gogcli/

ls ~/.openclaw/agents/main/agent/codex-home/home/.local/share/gogcli/

If the file is missing inside the OpenClaw runtime directory, copy it again and restart the gateway.

Reauthenticate GoG

Remove existing authentication:
rm -rf ~/.local/share/gogcli

Authenticate again:
gog auth credentials ~/.local/share/gogcli/credentials.json

Then restart OpenClaw.

Conclusion

By integrating Google Drive with OpenClaw through GoG CLI, you can transform Google Drive into a searchable knowledge base for AI-powered assistance. Your agent can access SOPs, onboarding documents, project files, internal documentation, and organizational knowledge directly from Google Workspace, enabling a powerful and scalable AI assistant environment.