How to Use Gemini Gems to Create Persistent English Coaching Sessions
Create a custom English Coach Gem that stores lesson state as JSON, invoke it before each Gemini Live session, and persist the session data locally to maintain continuous learning across multiple days.
The byoungd/English-level-up-tips repository documents an advanced workflow for serious language learners using Google's Gemini ecosystem. By configuring Gemini Gems—custom AI assistants that retain system prompts and limited session state—you can build a persistent English coaching system that tracks vocabulary acquisition, grammar errors, and conversation history across disconnected practice sessions.
What Are Gemini Gems?
Gemini Gems are custom-assistant features within the Gemini Apps platform. Unlike standard Gemini chats, a Gem stores a fixed system prompt (your "coach rules") and maintains a small session-state blob (≤10 KB JSON) that persists across interactions. This architecture allows you to reuse the same teaching persona and learning history every time you open the app, creating continuity that mimics a human tutor who remembers your previous mistakes and mastered words.
Why the Pre-Built Learning Coach Falls Short
According to the repository's AI guide at docs/threads/part-1/7-ai.md (lines 36-38), the pre-built "Learning coach" Gem does not support language learning and suffers from a critical architectural limitation: Gems cannot be used together with Gemini Live. This means you cannot simply select a Gem while already inside a Live audio session. Instead, the repository recommends a hybrid workflow documented in lines 56-62: create your own "English Coach Gem," use it to set up the session context, then switch to Gemini Live for spoken practice, and finally return to the Gem (or Canvas) to log progress.
The Architecture of Persistent Coaching
The persistent coaching workflow relies on four integrated components:
- Gem Definition: Stores a system prompt that dictates coaching style—for example, "always correct grammar, ask follow-up questions, and maintain a vocabulary list."
- Session State: A short JSON blob (≤10 KB) that the Gem reads and updates each turn, enabling persistence of lesson progress, error logs, and personal word banks.
- Gemini Live: Real-time audio/video conversation interface. You invoke the Gem before starting Live, then hand over the conversation for speaking practice.
- Canvas / Guided Learning: Post-session tools where you feed the Live transcript back to the Gem to auto-generate quizzes or flashcards, closing the learning loop.
Creating Your English Coach Gem
To establish persistence, first define a Gem with explicit instructions for state management. The following Python snippet demonstrates creating a Gem via the Gemini REST API that embeds a JSON-based lesson log:
import requests, json
API_URL = "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro-001:generateContent"
API_KEY = "YOUR_API_KEY"
# System prompt defines the coach and persistence format
system_prompt = """
You are an English coaching assistant.
- Always correct the learner's grammar and suggest alternatives.
- After each turn, update a JSON object called `lesson_state` with:
{
"vocab_learned": [],
"errors_made": [],
"last_topic": "<topic>"
}
- Return the updated `lesson_state` in a code block labelled `json`.
"""
payload = {
"contents": [{"role": "model", "parts": [{"text": system_prompt}]}],
"generationConfig": {"responseMimeType": "application/json"},
"safetySettings": []
}
resp = requests.post(f"{API_URL}?key={API_KEY}", json=payload)
print(resp.json())
This registers your custom assistant and returns a sessionId for subsequent calls.
Managing Session State for Persistence
True persistence requires manually embedding and extracting the state JSON with each API call. The repository suggests tracking three core data points: vocabulary learned, errors corrected, and the last topic discussed.
Use this pattern to inject saved state into new conversations:
def chat(session_id, user_msg, state):
# Embed the persisted state in the user message context
prompt = f"""Current lesson_state:
```json
{json.dumps(state, indent=2)}
User: {user_msg} Assistant:"""
payload = {
"contents": [{"role": "user", "parts": [{"text": prompt}]}],
"systemInstruction": {"parts": [{"text": system_prompt}]},
"session": {"name": session_id}
}
r = requests.post(f"{API_URL}?key={API_KEY}", json=payload)
reply = r.json()
# Extract the updated state from the JSON code block in response
updated_state = json.loads(reply["candidates"][0]["content"]["parts"][0]["text"])
return reply, updated_state
To maintain continuity across days, store the state locally between sessions:
```python
import pathlib, json
STATE_PATH = pathlib.Path("lesson_state.json")
def save_state(state):
STATE_PATH.write_text(json.dumps(state, ensure_ascii=False, indent=2))
def load_state():
if STATE_PATH.exists():
return json.loads(STATE_PATH.read_text())
return {"vocab_learned": [], "errors_made": [], "last_topic": ""}
Integrating with Gemini Live
As noted in docs/threads/part-1/7-ai.md (lines 31-33), Gems cannot be used inside Gemini Live, but you can use the Gem to prepare the Live session. The workflow is:
- Start your custom English Coach Gem in the Gemini Apps interface.
- Review your current
lesson_stateand confirm the day's learning objectives with the Gem. - Launch Gemini Live from the same interface—this carries your coaching context forward.
- Conduct the speaking practice; the Live session inherits the persona defined in your Gem.
- End the Live session and return to the Gem to log new errors and vocabulary discovered during conversation.
Closing the Learning Loop with Canvas
After completing a Live session, feed the transcript or summary back to your English Coach Gem (or into Canvas) to generate structured follow-up materials. As documented in docs/threads/part-1/7-ai.md (lines 24-28), this step allows you to auto-generate quizzes or flashcards based on the actual errors and new vocabulary encountered during live speaking practice, creating a closed feedback loop between conversation and study.
Summary
- Gemini Gems provide the system-prompt persistence needed for consistent coaching personalities, but require custom setup because pre-built learning coaches lack language support.
- Session state (limited to ~10 KB JSON) must be explicitly managed via the API or UI to track vocabulary and errors across interactions.
- Gemini Live integration works only when you invoke the Gem before starting the Live session, not during.
- Local storage of the JSON state file (
lesson_state.json) ensures your learning history survives between app restarts and device switches. - The
byoungd/English-level-up-tipsrepository recommends combining Gems + Live + Canvas for a complete persistent learning stack.
Frequently Asked Questions
Can I use the pre-built "Learning coach" Gem for English practice?
No. According to the source documentation in docs/threads/part-1/7-ai.md (lines 36-38), the pre-built "Learning coach" Gem does not support language learning. You must create a custom Gem specifically designed for English coaching with your own system prompt and state management rules.
Why can't I access my Gem while using Gemini Live?
This is a current platform limitation explicitly noted in the repository. Gems cannot be used together with Gemini Live because Live sessions run in a separate interface context. The recommended workaround is to start your Gem session first to review your learning state, then launch Live from the same interface, which carries the coaching context forward without allowing mid-session Gem switching.
How much lesson history can I store in a Gem session?
Gem session states are limited to approximately 10 KB of JSON data. This is sufficient for storing lists of recent vocabulary words, corrected grammar errors, and current topic metadata, but insufficient for full conversation transcripts. For comprehensive history, export the state to a local file (like lesson_state.json) after each session and reload it at the start of the next.
What is the optimal workflow for daily practice using this system?
The repository outlines a three-phase daily workflow: (1) Load your saved lesson_state into your custom English Coach Gem to review previous errors; (2) Launch Gemini Live (invoked from the Gem interface) for 15-20 minutes of spoken conversation practice; (3) Return to the Gem or switch to Canvas to log new vocabulary and generate flashcards based on the Live session transcript, then save the updated state locally.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →