Claude Code SEO Workflow: Terminal Agents With Ranked Orders
Claude Code operators want the same thing Cursor operators want: ranked growth work inside the terminal, not another prose tab inventing priorities. This playbook wires Learn Domains into Claude Code through bearer tokens, the REST API, and @learndomains/cli with --json output. Pull the Mission Brief first. Route refresh orders to Content Operations as drafts only. Check Mission Fuel before costly runs. No auto-publish. No mystery spend. A credit-aware loop for agents that ship orders.
Why Claude Code needs connected orders
Claude Code excels at repo edits, test runs, and multi-file refactors. SEO work still defaults to side chats with pasted CSV exports. The agent guesses priorities from training data. Monday repeats. The Claude Code SEO workflow replaces guesswork with structured JSON from your asset: Mission Brief orders, opportunity backlog, credit balance.
Operator rule
If your Claude Code session cannot cite this week's top Mission Brief order with Search Console evidence, you are generating text, not operating.
Cursor SEO workflow covers the same architecture for Cursor users. This article targets Claude Code terminal patterns and project instruction files.
Architecture: REST API, CLI, human publish
Claude Code growth stack
- REST API
- CLI
- Mission Brief
- Content Operations
- Credits
Bearer tokens from app settings. Mission Briefs, opportunities, credits, content drafts. Same auth as the web app.
@learndomains/cli wraps REST endpoints. --json on every command for agent parsing.
Default input contract: ranked ICEE orders with URL and query evidence.
Draft output with QA and internal links. Human review required. No CMS auto-publish.
Reserve Mission Fuel before costly endpoints. CLI returns explicit insufficient balance errors.
Setup: token, CLI, first brief pull
- •Create API token in app settings. Export LEARN_DOMAINS_TOKEN in shell profile.
- •Install @learndomains/cli. Verify with learn-domains me --json.
- •Add CLAUDE.md or project instructions: always pull Mission Brief before SEO tasks.
- •Run learn-domains mission-brief latest --website yourdomain.com --json.
- •Optional: learn-domains opportunities list --json for full backlog context.
- •Check learn-domains credits balance --json before batch content jobs.
Activation path still applies: website added, Search Console connected, GA4 connected, Knowledge Base populated. Agents cannot raise Confidence without syncs.
Weekly agent loop
Monday: ingest Mission Brief JSON into Claude Code context. Assign order one with URL, query cluster, ICEE rationale. Tuesday to Thursday: technical fixes in repo, Content Operations draft for refresh orders, AI Analyst in app when Confidence is medium.
Content create via CLI or REST returns draft IDs. Agent prepares CMS-ready markdown. Human publishes manually. Mark published in app after live. Auto-publish would break Execution discipline and brand QA.
- Never invent keyword priorities not in brief JSON.
- Never skip credit check before content create or analyst-equivalent batch jobs.
- Never bypass human review on money pages.
- Re-pull brief after major sync, not hourly without shipping.
Example agent prompts that work
Good prompt: Given this Mission Brief JSON, implement order one technical acceptance criteria in /docs, then request a Content Operations draft for the refresh URL with diagnosis notes from the brief. Bad prompt: Improve our SEO this week. The first binds evidence. The second hallucinates a backlog.
For striking-distance orders, agent expands outline sections named in brief evidence. For cannibalization orders, agent drafts redirect map and internal link diff before copy changes. Codex terminal SEO workflow shares JSON patterns for OpenAI Codex users.
Knowledge Base and URL Library grounding
Agents without memory produce interchangeable SaaS slop. Populate Knowledge Base with ICP, pricing boundaries, and voice rules. Paste relevant vault excerpts into Claude Code context or maintain repo copies synced with your vault.
Internal link orders must use URL Library targets, not improvised exact-match anchors. Knowledge base advantage article explains why memory beats longer prompts.
Asset Yield and growth orders in agent context
When revenue connects, CLI asset-yield commands return summary JSON for commercial triage. Growth orders materialize from Mission Brief top actions. Agents can prioritize money URLs when brief includes revenue-weighted Impact.
Revenue attribution for SEO work explains investor-grade framing. Agents should cite orders, not invent ROI guarantees.
Stakeholder communication without dashboard theater
Leadership asks why traffic dropped. Dashboards invite a sixty-minute chart walk. Intelligence answers with three diagnosed URLs, root cause tags, and the order shipping this week. AI Analyst in Learn Domains cites connected queries when you need a memo with evidence. Keep memos short: drop type, top losers, action taken, next measurement date.
Investors and clients respect closure language. Orders shipped beats impressions explained. Organic traffic dropping playbook pairs with revenue attribution for SEO work when money pages are in the loser list.
Multi-repo and monorepo patterns
Marketing sites in monorepos can wire Claude Code to pull brief JSON then open PRs on content paths directly. Separate marketing repos should store .growth logs beside MDX or CMS export folders. Keep website id or domain consistent in CLI flags across repos to avoid wrong-asset orders.
Technical SEO orders often touch app router config, redirects, or sitemap generators in code. Content orders stay in Content Operations. Mixed orders should split into two agent tasks with explicit boundaries so code agents do not rewrite blog prose in middleware files.
Security and token hygiene for agents
API tokens belong in environment variables, never in committed repos. Rotate tokens when contractors roll off. Scope tokens to the minimum website access required. Agents should read tokens from shell env, not from markdown files checked into git.
Rate limits apply to REST API the same as the app. Batch jobs should backoff on 429 responses. Log token id prefix in execution JSON for audit, never the secret itself.
Troubleshooting agent sessions
When agents ignore brief JSON, tighten project instructions: mandatory file read of .growth/brief-latest.json before edits, cite order id in PR title, refuse tasks without evidence block. When credits fail unexpectedly, verify token org matches website org. When drafts sound generic, paste Knowledge Base excerpts into the session and regenerate.
Autonomous website AI agents article sets category expectations. This workflow stays human-in-the-loop by design.
Limits and operator contract
Claude Code plus Learn Domains is not autonomous SEO. No silent cron publishes. No third-party keyword database in product today. You own keeper URL decisions and credit budget.
Start with one agent task per week tied to order one. Expand automation only after execution logs show consistent publish and measurement discipline. Agents amplify good ops. They multiply chaos when the queue is unranked.
Full REST API and CLI reference lives at /docs/api and /docs/cli. Mission Brief Method defines ICEE vocabulary agents should echo back in commit messages and PR descriptions.
Frequently asked questions
- Does Learn Domains auto-publish from Claude Code?
- No. Content Operations creates drafts only. Humans publish on CMS and record live URLs in the app.
- Which CLI command should Claude Code run first?
- learn-domains mission-brief latest --website yourdomain.com --json. It returns ranked weekly orders with evidence.
- Can I use REST API without CLI?
- Yes. Bearer tokens hit the same endpoints. CLI is convenience for --json terminal output.
- How do credits work for agents?
- Costly endpoints reserve Mission Fuel first. Check balance JSON before batch jobs. Insufficient balance returns explicit errors.
- What data is required?
- Website, Search Console, GA4, Knowledge Base for useful Confidence. Follow getting started activation path.
- How is this different from generic Claude SEO chats?
- Generic chats invent priorities. Learn Domains supplies ranked orders from connected analytics and opportunity detections.
- Where is API documentation?
- Public docs at /docs/api and /docs/cli cover tokens, endpoints, and agent examples.