Skip to main content

Chapter 58: Building TutorClaw

You built one MCP tool in Chapter 57. Now you build a real product: TutorClaw, an AI tutor with 9 tools that teaches the rest of this book.

TutorClaw is the case study that ties Part 5 together. You design 9 tools, describe each one to Claude Code using the mcp-builder skill, steer the implementation, and verify the result. The same describe-steer-verify cycle from Chapter 57, scaled to a real product.

Everything runs locally. JSON files store learner state. Markdown files hold course content. Stripe is the one external service because monetization IS the product. No database servers, no cloud storage, no deployment infrastructure. You spend your time on product design, tool quality, context engineering, and agent identity, not SSL certificates and boto3 scripts.

📚 Teaching Aid

What You'll Learn

By the end of this chapter, you will have built a complete 9-tool MCP server, connected it to OpenClaw, tested it end-to-end from WhatsApp, added Stripe monetization, written a full pytest suite, and given your agent a distinct identity as a tutor.

What This Chapter IS

  • Building a real OpenClaw product end-to-end (9 tools, monetization, identity)
  • The describe-steer-verify workflow from Chapter 57, scaled to a full application
  • Product thinking: tool design, context engineering, tier gating, agent personality
  • Stripe integration as the one external service (test mode throughout)

What This Chapter Is NOT

  • Not MCP basics (covered in Chapter 57)
  • Not hand-written Python (Claude Code writes the code; you steer)
  • Not infrastructure setup (no databases, cloud storage, or VPS deployment)
  • Not the economics analysis (Chapter 59 covers unit economics in depth)
  • Not the architecture decision history (Chapter 60 covers pivots and meta-lessons)

Teaching Aid

#LessonWhat You Build
1The Application BlueprintProduct mental model via a designed tutoring session transcript
2Designing the Tool Surface9-tool specification with input/output contracts and tier access rules
3Build the State Toolsregister_learner, get_learner_state, update_progress with JSON persistence
4Build the Content Toolsget_chapter_content, get_exercises with local markdown files
5Build the Pedagogy Toolsgenerate_guidance, assess_response with PRIMM-Lite teaching methodology
6Build the Code and Upgrade Toolssubmit_code (mock sandbox) and get_upgrade_url (mock Stripe)
7The Full Cycle TestAll 9 tools in one server, 5-tool chain verified from WhatsApp
8Expected vs ActualWrite acceptance criteria, test a PRIMM session, grade the gaps
9The Agent's Instruction ManualAGENTS.md that orchestrates 9 tools without code
10Context Engineer Your ToolsTwo-layer descriptions, NEVER statements, cross-tool references
11The Test Suitepytest suite for all 9 tools: valid, invalid, tier gating, state persistence
12All Tests GreenDebug failures, add edge cases, achieve full green suite
13Tier Gatingcheck_tier() enforcement, exchange counting, free vs paid access
14Stripe Checkoutget_upgrade_url with real Stripe, webhook handler, test card payment
15Test the Payment FlowEnd-to-end free-to-paid upgrade via WhatsApp with Stripe test mode
16The Shim SkillPRIMM-Lite offline fallback when the MCP server is unreachable
17The Dedicated AgentSOUL.md and IDENTITY.md giving TutorClaw a distinct tutor personality
18Route and BindBind TutorClaw to a WhatsApp group; peer-based routing, not keywords
19Harden and PolishInput validation, error messages, structured JSON logging
20Publish to ClawHubClawHub package manifest and publishing workflow
21The Full EngineSpec-vs-implementation audit, scaling roadmap preview
22Chapter Quiz50 scenario-based questions across all 6 phases

Six Phases

Phase 1: Blueprint (L1-L2) establishes the mental model: 9 tools, tier access, platform inversion. Design every tool on paper before writing a single line of code.

Phase 2: Local Build (L3-L8) builds all 9 tools using Claude Code and the mcp-builder skill. JSON for state, local files for content, mock auth. Each tool gets careful design time via describe-steer-verify.

Phase 3: The Harness (L9-L12) adds the context that makes 9 tools work together: AGENTS.md for orchestration, refined tool descriptions for accurate selection, and a pytest suite that proves everything works.

Phase 4: Monetize (L13-L15) adds the business layer: tier gating, Stripe checkout, and a complete free-to-paid upgrade flow. Stripe is the one external integration because monetization IS the product.

Phase 5: Identity and Polish (L16-L19) gives TutorClaw a personality: shim skill for offline resilience, SOUL.md and IDENTITY.md for agent identity, channel routing for scope, and hardening for production readiness.

Phase 6: Reflect and Ship (L20-L21) publishes to ClawHub and audits the complete system against the original design. Everything you built locally is the product. Database servers, cloud storage, and deployment are scaling challenges for later, not product challenges for now.

Prerequisites

  • Chapter 57: Extend Your Claw with MCP (you have a working tutorclaw-mcp project with the mcp-builder skill)
  • Part 4: Python proficiency (you drove the TDG cycle with Claude Code)
  • Chapter 56: Meet Your Personal AI Employee (OpenClaw platform understanding)