Grok CLI Template
The community Grok CLI (superagent-ai/grok-cli) readsAGENTS.md from your repo root and auto-discovers Skills under .agents/skills/ — same shape as Codex, wired to the Grok models.
⚡ Just get me started
Smallest possible Learner Brain in Grok CLI. Skip the deep-dive on first pass.
- 1Install Grok CLI — curl -fsSL https://raw.githubusercontent.com/superagent-ai/grok-cli/main/install.sh | bash
- 2Drop AGENTS.md at your repo root — Grok auto-loads it on every session — no flags needed.
- 3Run grok and ask a real task — When friction appears, the meta-learning Skill will propose a brain upgrade.
# AGENTS.md
You operate under The Learner Brain methodology.
## Working agreements
- Run lint + tests before claiming a task is done.
- Ask before adding production dependencies.
- Never commit secrets or .env* files.
- Prefer sub-agents for research-heavy work.
## Meta-learning protocol
When you detect: (1) the same correction twice, (2) a workaround I'd repeat, or (3) a stated preference — propose ONE upgrade in this format:
🧠 BRAIN UPGRADE PROPOSAL
Trigger: <what caused this>
Surface: <AGENTS.md | Skill | knowledge/<category>>
Location: <path>
Proposed change: <exact addition>
Rationale: <why it prevents future friction>
Wait for my approval before editing anything.That's it — you have a working brain. The rest of this page is for when you want to go deeper.
AGENTS.md
Auto-loaded from repo root every session.
Skills
.agents/skills/<name>/SKILL.md — list with /skills in TUI.
Sub-agents
task / delegate for parallel research without polluting main context.
grok-code-fast-1
Default model tuned for agentic coding. Run grok models for the full menu.
File Structure
Grok scans .agents/skills/ in your project; user-scope skills live at ~/.agents/skills/. The .grok/ folder holds session state and computer-use screenshots — don't put rules there.
Template Files
AGENTS.md
Always-on instructions + Learner Brain protocol
# AGENTS.md — Project Instructions
Grok CLI auto-loads this file from the project root before any work. Keep it small and durable — push deep workflows into Skills under `.agents/skills/`.
## Meta-Learning Protocol
You operate under The Learner Brain methodology. Improve the *system*, not just the output.
### Upgrade Triggers
1. **Repetition** — same correction twice
2. **Friction** — workaround the user shouldn't repeat
3. **Manual labor** — multi-step task that should become a Skill
4. **Preference** — codify expressed style/approach
### Upgrade Format
```
🧠 BRAIN UPGRADE PROPOSAL
Trigger: [what caused this]
Surface: [AGENTS.md | Skill | knowledge/<category>]
Location: [path]
Proposed change: [exact addition]
Rationale: [why it prevents future friction]
```
### Hygiene
- Keep AGENTS.md under ~200 lines
- Never edit AGENTS.md without approval — propose ONE upgrade at a time
- Prefer Skills over inline procedures for anything > 10 lines
## Project Context
### Tech Stack
- Language: [Your language]
- Framework: [Your framework]
- Test command: [bun test | pnpm test | etc.]
### Working Agreements
- Run lint + tests before claiming a task is done
- Ask before adding production dependencies
- Never commit `.env*` or anything under `secrets/`
- Use sub-agents (`task`/`delegate`) for research-heavy work to keep main context clean
## Patterns Learned
<!-- Append discovered patterns. Promote to Skills when they grow. -->
- [Pattern]: [solution]
## Anti-Patterns
- Do not regenerate boilerplate when an existing Skill covers it
- Do not run `computer_*` tools without explicit approval.agents/skills/meta-learning/SKILL.md
Auto-discovered when description matches; explicit via /skills
---
name: meta-learning
description: Detect repetition, friction, manual labor, and unwritten preferences. Propose ONE Brain Upgrade at a time using the Learner Brain format.
---
# Meta-Learning Skill
Triggers (any of):
1. The user corrects the same thing twice in this session
2. The user describes a workaround they shouldn't have to repeat
3. A task takes more than 3 manual steps that could be codified
4. The user states a preference that isn't written down anywhere
When a trigger fires, STOP and emit:
```
🧠 BRAIN UPGRADE PROPOSAL
Trigger: <what caused this>
Surface: <AGENTS.md | Skill | knowledge/<category>>
Location: <path>
Proposed change: <exact text to add>
Rationale: <why it prevents future friction>
```
Wait for explicit approval ("add it", "do it") before editing any file.
## Outputs
- One proposal per turn, max
- Reference existing entries when relevant — don't duplicate
## Version
- 1.0.0 — Initial~/.grok/user-settings.json
Default model, sub-agents, MCP servers
// ~/.grok/user-settings.json — Grok CLI user settings
// Configure default model, sub-agents, and MCP servers
{
"defaultModel": "grok-code-fast-1",
"subAgents": {
"explore": {
"description": "Read-only repo exploration; returns a concise summary",
"model": "grok-4-1-fast-reasoning"
}
},
"mcpServers": {
// Add MCP server configs here, e.g.:
// "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp"] }
}
}Known limits & gotchas — Grok CLI
Real-world quirks that bite if you don't know about them. Not deal-breakers — just things to design around.
- Community CLI, not official — superagent-ai/grok-cli is community-maintained. Behavior can change between releases — pin a version in CI.
- API key required — You need a Grok API key from x.ai. Pricing follows xAI's per-token rates; grok-code-fast-1 is the cheapest agentic option.
- Computer use is macOS-only — The built-in computer sub-agent uses agent-desktop, which currently targets macOS and needs Accessibility permission.
- OpenTUI requires a modern terminal — Use WezTerm, Alacritty, Ghostty, or Kitty for the interactive UI. Headless --prompt mode works anywhere.
- No global instruction discovery hierarchy — Unlike Codex, Grok CLI doesn't walk parent directories layering AGENTS.md files. Keep one AGENTS.md at the repo root.
🧠 Brain Prompts
Copy-paste these prompts into Grok CLI to bootstrap your Learner Brain setup or harvest knowledge from productive sessions.
Bootstrap Prompt
Paste this into Grok CLI to generate the complete Learner Brain folder structure and starter files for your project.
🚀 Learner Brain Bootstrap — Grok CLI
Create the full Learner Brain folder structure for this project. Grok CLI (superagent-ai) auto-loads `AGENTS.md` from the project root and discovers Agent Skills under `.agents/skills/<name>/SKILL.md` (project) or `~/.agents/skills/` (user).
Generate the following files:
```
AGENTS.md # Project constitution (always loaded)
.agents/
└── skills/
├── meta-learning/
│ └── SKILL.md # Upgrade triggers + format
└── run-audit/
└── SKILL.md # Security/quality audit procedure
knowledge/
├── rules/ # Hard preferences
├── stack-conventions/ # Architecture decisions
├── error-solutions/ # Bugs fixed + root causes
├── skills/ # Reusable procedures
├── anti-patterns/ # Things to avoid
└── calculations/ # Domain logic / formulas
```
For each file:
- Use markdown
- Keep `AGENTS.md` under ~200 lines — push deep workflows into Skills
- Skills must include the YAML frontmatter Grok expects (`name`, `description`)
- Include the Meta-Learning Protocol with the 🧠 BRAIN UPGRADE PROPOSAL format
- Tailor tech stack and conventions to THIS project (scan the repo first)
After generation, tell me which Skills will auto-trigger vs which need explicit `/skills` invocation.When to use this
🧠 Brain Harvest Prompt
Paste this into Grok CLI at the end of a productive session to extract reusable patterns in the platform's native format.
🧠 Brain Harvest — Grok CLI
Review our recent session and harvest patterns into the right surface:
- **AGENTS.md** for short, always-true rules
- **.agents/skills/<name>/SKILL.md** for richer procedures with triggers
- **knowledge/<category>/** for reference material that doesn't need to be in-context every turn
Scan for these 6 categories:
1. **Rules** — Preferences or constraints stated (e.g., "never use any types", "always use shadcn components")
2. **Skills** — Reusable procedures or multi-step workflows (e.g., "how to add a new page with SEO")
3. **Error Solutions** — Bugs fixed and their root causes (e.g., "infinite re-render caused by object in useEffect deps")
4. **Stack Conventions** — Architecture or tooling decisions (e.g., "use React Query for all server state")
5. **Anti-Patterns** — Things to avoid learned the hard way (e.g., "don't use localStorage for auth tokens")
6. **Calculations / Logic** — Formulas, business rules, or domain logic worth preserving
For each finding, output:
---
**Category:** [one of the 6]
**Surface:** AGENTS.md | Skill | knowledge/<category>
**Path:** [exact file path]
**Status:** 🆕 New | ✏️ Update existing
**Content:**
```markdown
[Ready-to-paste content with YAML frontmatter if it's a SKILL]
```
---
If nothing worth capturing was found, say so — don't force it.
At the end, summarize:
- Total findings by category
- Which existing entries should be updated vs. new ones to createWhen to use this
Universal Learner Brain Guides
These guides apply to all platforms — use your AGENTS.md + .agents/skills/ path wherever they reference rule/skill locations.
This template was last reviewed in April 2026 against the official Grok CLI repo (superagent-ai). Spot something out of date? Let us know.