⏳ This skill is pending AI review.

Scores will appear once the review pipeline completes.

version unknown

language-coach

nova-novanest@nova-novanest⭐ 0 stars· last commit 7mo ago· 0 open issues

>-

Choose how to use this skill

You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.

1. Native installer

This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.

Do not guess an installer command or replace an existing version without reviewing the diff.

2. Complete package recommended

Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.

No complete ProSkills package is published for this listing yet.

3. Prompt-only

Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.

Need only the instruction file?

Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.

No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.

—/10

// RATINGS

⭐GitHub Stars
⭐ 0 on GitHubGitHub ↗

New / niche

🟢ProSkills Score
—
📍

Not yet listed on ClawHub or SkillsMP

// README

openclaw-language-coach

An OpenClaw skill that coaches non-native speakers by analyzing their actual messages — voice transcripts and typed text. It tracks recurring mistakes, sends weekly AI-generated lessons, and delivers daily reminders about patterns you keep getting wrong.

Built this because I wanted to actually improve my English at a professional level, not just "learn English." The difference: this watches what you actually say and catches the patterns you don't notice yourself.

What it does

  1. Logs your messages — every voice transcript and typed message gets appended to a JSONL file
  2. Tracks error patterns — when an AI or human spots a recurring mistake, it gets added to a tracked list with wrong/correct examples
  3. Weekly lessons — every Sunday, Claude reads your week's transcripts + tracked errors and generates a personalized lesson
  4. Daily nudges — picks your most frequent mistake and sends a quick reminder via Telegram

Install

Copy this repo into your OpenClaw skills directory:

cd ~/.openclaw/workspace/skills/
git clone https://github.com/nova-novanest/openclaw-language-coach.git language-coach

OpenClaw will auto-detect it from the SKILL.md frontmatter.

Setup

  1. Edit config.json:

    • target_lang — the language you're practicing (default: English)
    • target_context — what level you're targeting (e.g., "investor/pitch level", "casual conversation")
    • chat_id — your Telegram chat ID for receiving lessons/nudges
  2. Set your bot token in the scripts (search for YOUR_BOT_TOKEN in weekly_lesson.py and daily_nudge.py)

  3. Set ANTHROPIC_API_KEY in your environment (needed for weekly lessons)

  4. Set up cron jobs:

    # Weekly lesson — Sundays at 7pm UTC
    openclaw cron add --name english-coach-weekly --schedule "0 19 * * 0" --task "Run the weekly language lesson: python3 skills/language-coach/scripts/weekly_lesson.py"
    
    # Daily nudge — every day at 7pm UTC  
    openclaw cron add --name english-coach-daily --schedule "0 19 * * *" --task "Run the daily language nudge: python3 skills/language-coach/scripts/daily_nudge.py"
    

Usage

The skill integrates with your OpenClaw agent. When voice messages come in, the agent logs them automatically. You can also:

# Log a transcript manually
python3 scripts/log_transcript.py --source voice --text "transcript here"

# Add a tracked error pattern
python3 scripts/manage_errors.py add --pattern "Present tense overuse" --wrong "from that time you are not normal" --correct "since then you haven't been acting normally"

# List active errors
python3 scripts/manage_errors.py list

# Mark one as resolved
python3 scripts/manage_errors.py resolve --id present_tense_overuse

How it actually works

The weekly lesson sends your real transcripts to Claude with your tracked error list. Claude spots new mistakes, checks if old patterns are still showing up, and notes any progress. It's not a generic grammar lesson — it's built from what you actually said that week.

The daily nudge just picks your most frequent active error and sends a quick wrong/right example. Takes 2 seconds to read. That's the point.

Requirements

  • Python 3.10+
  • requests library
  • Anthropic API key (for weekly lessons)
  • Telegram bot token (for sending messages)
  • OpenClaw (for skill integration)

License

MIT

// HOW IT'S BUILT

// FILES

8 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.

  • SKILL.md4.6 KBb507ce0ffb9aupstream ↗
    ---
    name: language-coach
    description: >-
      Personal language coaching skill for non-native speakers. Analyzes voice
      transcripts and typed messages to identify recurring grammar and language
      mistakes. Sends personalized weekly lessons and daily nudges based on real
      mistakes the user made. Supports any target language via config.json. Use
      when logging a voice transcript for language analysis, running a weekly
      lesson, sending a daily language nudge, tracking or resolving error patterns,
      or when the user asks for language training exercises.
    ---
    
    # Language Coach
    
    A personal language improvement system for the user — tracks real mistakes from voice and typed messages, generates weekly AI-powered lessons, and sends daily reminders about active patterns.
    
    Target language and context are configured in `config.json` (default: English at investor/pitch level).
    
    ---
    
    ## Configuration
    
    Edit `skills/language-coach/config.json` to change the target language:
    
    ```json
    {
      "target_lang": "English",
      "target_context": "investor/pitch level — clear, professional, persuasive",
      "chat_id": YOUR_CHAT_ID
    }
    ```
    
    ---
    
    ## Logging Transcripts
    
    Every voice message and typed message should be logged for analysis:
    
    ```bash
    # After a voice transcription:
    python3 skills/language-coach/scripts/log_transcript.py --source voice --text "transcript here"
    
    # After a typed message:
    python3 skills/language-coach/scripts/log_transcript.py --source typed --text "message here"
    ```
    
    Logs are stored in: `memory/english-transcripts.jsonl`
    
    Each entry:
    ```json
    {"timestamp": "2026-04-01T12:30:00Z", "source": "voice", "text": "..."}
    ```
    
    ---
    
    ## Managing Error Patterns
    
    Nova (or Hovo) tracks recurring mistakes in `memory/english-errors.json`.
    
    ```bash
    # Add a new tracked error:
    python3 skills/language-coach/scripts/manage_errors.py add \
      --pattern "Present tense overuse" \
      --wrong "from that time you are not normal" \
      --correct "since then you haven't been acting normally"
    
    # List all active errors:
    python3 skills/language-coach/scripts/manage_errors.py list
    
    # Increment occurrences when a pattern reappears:
    python3 skills/language-coach/scripts/manage_errors.py bump --id present_tense_overuse
    
    # Mark a pattern as resolved when the user stops making the mistake:
    python3 skills/language-coach/scripts/manage_errors.py resolve --id present_tense_overuse
    
    # Count active errors (for cron/automation):
    python3 skills/language-coach/scripts/manage_errors.py active-count
    ```
    
    ---
    
    ## Weekly Lesson (Automated — Sundays 20:00 Barcelona)
    
    The weekly lesson script reads the last 7 days of transcripts + active errors, sends them to Claude, and delivers a formatted lesson to the user's Telegram.
    
    ```bash
    python3 skills/language-coach/scripts/weekly_lesson.py
    ```
    
    Requires: `ANTHROPIC_API_KEY` environment variable.
    
    The lesson format:
    - 📌 New mistakes spotted this week
    - 🔁 Recurring patterns still showing up
    - ✅ Progress vs. tracked patterns
    - 💡 One focused thing to practice
    
    ---
    
    ## Daily Nudge (Automated — Every Day 20:00 Barcelona)
    
    Picks the most-occurring active error pattern and sends a short reminder. Always sends even if no messages were received that day:
    
    ```bash
    python3 skills/language-coach/scripts/daily_nudge.py
    ```
    
    Example output:
    > 🧠 **Today's English focus:** Present tense overuse
    > ❌ "from that time you are not normal"
    > ✅ "since then you haven't been acting normally"
    
    ---
    
    ## On-Demand Training Mode
    
    When Hovo says **"make me training"** or **"give me exercises"**, Nova should:
    
    1. Load config: `cat skills/language-coach/config.json`
    2. Run: `python3 skills/language-coach/scripts/manage_errors.py list`
    3. Pick 3–5 active error patterns from the output
    4. Call Claude with this prompt:
    
    ```
    The user is practicing {target_lang}. His goal is {target_context}.
    
    Here are his active error patterns:
    {errors}
    
    Generate 3-5 short practice exercises targeting these patterns. Each exercise:
    - One sentence to rewrite (wrong version)
    - A hint (one word about what's wrong)
    - The correct version (hidden below — "Answer: ...")
    
    Keep it practical and brief. Use realistic business/startup contexts.
    ```
    
    No scripts needed — just generate and send right in the chat.
    
    ---
    
    ## Data Files
    
    | File | Purpose |
    |------|---------|
    | `memory/english-transcripts.jsonl` | Running log of all voice/typed messages |
    | `memory/english-errors.json` | Tracked error patterns with status |
    
    ---
    
    ## Notes
    
    - `ANTHROPIC_API_KEY` must be set in environment for weekly lessons to work
    - Telegram Bot Token is hardcoded in the scripts (bot: `8120149172:AAE0Mj...`)
    - Cron jobs: `english-coach-weekly` (Sun 19:00 UTC) + `english-coach-daily` (daily 19:00 UTC)
    
  • README.md3.4 KBcff01c59ec2fupstream ↗
    # openclaw-language-coach
    
    An [OpenClaw](https://openclaw.com) skill that coaches non-native speakers by analyzing their actual messages — voice transcripts and typed text. It tracks recurring mistakes, sends weekly AI-generated lessons, and delivers daily reminders about patterns you keep getting wrong.
    
    Built this because I wanted to actually improve my English at a professional level, not just "learn English." The difference: this watches what you *actually say* and catches the patterns you don't notice yourself.
    
    ## What it does
    
    1. **Logs your messages** — every voice transcript and typed message gets appended to a JSONL file
    2. **Tracks error patterns** — when an AI or human spots a recurring mistake, it gets added to a tracked list with wrong/correct examples
    3. **Weekly lessons** — every Sunday, Claude reads your week's transcripts + tracked errors and generates a personalized lesson
    4. **Daily nudges** — picks your most frequent mistake and sends a quick reminder via Telegram
    
    ## Install
    
    Copy this repo into your OpenClaw skills directory:
    
    ```bash
    cd ~/.openclaw/workspace/skills/
    git clone https://github.com/nova-novanest/openclaw-language-coach.git language-coach
    ```
    
    OpenClaw will auto-detect it from the SKILL.md frontmatter.
    
    ## Setup
    
    1. Edit `config.json`:
       - `target_lang` — the language you're practicing (default: English)
       - `target_context` — what level you're targeting (e.g., "investor/pitch level", "casual conversation")
       - `chat_id` — your Telegram chat ID for receiving lessons/nudges
    
    2. Set your bot token in the scripts (search for `YOUR_BOT_TOKEN` in `weekly_lesson.py` and `daily_nudge.py`)
    
    3. Set `ANTHROPIC_API_KEY` in your environment (needed for weekly lessons)
    
    4. Set up cron jobs:
       ```bash
       # Weekly lesson — Sundays at 7pm UTC
       openclaw cron add --name english-coach-weekly --schedule "0 19 * * 0" --task "Run the weekly language lesson: python3 skills/language-coach/scripts/weekly_lesson.py"
    
       # Daily nudge — every day at 7pm UTC  
       openclaw cron add --name english-coach-daily --schedule "0 19 * * *" --task "Run the daily language nudge: python3 skills/language-coach/scripts/daily_nudge.py"
       ```
    
    ## Usage
    
    The skill integrates with your OpenClaw agent. When voice messages come in, the agent logs them automatically. You can also:
    
    ```bash
    # Log a transcript manually
    python3 scripts/log_transcript.py --source voice --text "transcript here"
    
    # Add a tracked error pattern
    python3 scripts/manage_errors.py add --pattern "Present tense overuse" --wrong "from that time you are not normal" --correct "since then you haven't been acting normally"
    
    # List active errors
    python3 scripts/manage_errors.py list
    
    # Mark one as resolved
    python3 scripts/manage_errors.py resolve --id present_tense_overuse
    ```
    
    ## How it actually works
    
    The weekly lesson sends your real transcripts to Claude with your tracked error list. Claude spots new mistakes, checks if old patterns are still showing up, and notes any progress. It's not a generic grammar lesson — it's built from what you actually said that week.
    
    The daily nudge just picks your most frequent active error and sends a quick wrong/right example. Takes 2 seconds to read. That's the point.
    
    ## Requirements
    
    - Python 3.10+
    - `requests` library
    - Anthropic API key (for weekly lessons)
    - Telegram bot token (for sending messages)
    - OpenClaw (for skill integration)
    
    ## License
    
    MIT
    
  • scripts/daily_nudge.py3.0 KB8cda3b3e8767upstream ↗
    #!/usr/bin/env python3
    """
    daily_nudge.py — Send a daily language coaching nudge via Telegram.
    
    Picks the most frequent active error pattern that hasn't been seen in
    the last 24 hours (based on last_seen date) and sends a short reminder.
    Always sends, even if no messages were received that day.
    """
    
    import json
    import os
    import sys
    from datetime import date, timedelta
    
    import requests
    
    # ── Config ──────────────────────────────────────────────────────────────────
    BOT_TOKEN = "YOUR_BOT_TOKEN"
    ERRORS_FILE = "memory/english-errors.json"
    CONFIG_FILE = "skills/language-coach/config.json"
    
    
    def load_config() -> dict:
        with open(CONFIG_FILE, "r", encoding="utf-8") as f:
            return json.load(f)
    
    
    def send_telegram(text: str, chat_id: int) -> dict:
        r = requests.post(
            f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage",
            json={"chat_id": chat_id, "text": text, "parse_mode": "HTML"},
            timeout=30,
        )
        return r.json()
    
    
    def load_active_errors() -> list[dict]:
        if not os.path.exists(ERRORS_FILE):
            return []
        with open(ERRORS_FILE, "r", encoding="utf-8") as f:
            errors = json.load(f)
        return [e for e in errors if e.get("status") == "active"]
    
    
    def pick_error(errors: list[dict]):
        """Pick active error not seen in last 24h, sorted by occurrences descending."""
        today = date.today()
    
        eligible = []
        for e in errors:
            try:
                last_seen = date.fromisoformat(e.get("last_seen", "2000-01-01"))
            except ValueError:
                last_seen = date(2000, 1, 1)
            # "not seen in last 24h" = last_seen is before today
            if last_seen < today:
                eligible.append(e)
    
        if not eligible:
            # All were seen today — fall back to highest occurrences overall
            eligible = errors
    
        if not eligible:
            return None
    
        return max(eligible, key=lambda e: e.get("occurrences", 0))
    
    
    def main():
        config = load_config()
        target_lang = config.get("target_lang", "English")
        chat_id = config.get("chat_id", YOUR_CHAT_ID)
    
        print(f"🧠 Running daily {target_lang} nudge...")
    
        errors = load_active_errors()
    
        if not errors:
            message = f"🧠 Language coach: No active patterns tracked yet — keep talking!"
        else:
            error = pick_error(errors)
            if error:
                message = (
                    f"🧠 <b>Today's {target_lang} focus:</b> {error['pattern']}\n\n"
                    f"❌ <i>\"{error['example_wrong']}\"</i>\n"
                    f"✅ \"{error['example_correct']}\""
                )
            else:
                message = f"🧠 Language coach: No active patterns tracked yet — keep talking!"
    
        result = send_telegram(message, chat_id)
    
        if result.get("ok"):
            print("✅ Daily nudge sent to Telegram!")
        else:
            print(f"❌ Telegram send failed: {result}", file=sys.stderr)
            sys.exit(1)
    
    
    if __name__ == "__main__":
        main()
    
  • scripts/log_transcript.py1.4 KB8dd83f860c3cupstream ↗
    #!/usr/bin/env python3
    """
    log_transcript.py — Append a voice or typed transcript to english-transcripts.jsonl.
    
    Usage:
        python3 log_transcript.py --source voice --text "transcript here"
        python3 log_transcript.py --source typed --text "message here"
    """
    
    import argparse
    import json
    import os
    import sys
    from datetime import datetime, timezone
    
    TRANSCRIPTS_FILE = "memory/english-transcripts.jsonl"
    
    
    def main():
        parser = argparse.ArgumentParser(description="Log a transcript for English coaching.")
        parser.add_argument("--source", required=True, choices=["voice", "typed"],
                            help="Source of the transcript: 'voice' or 'typed'")
        parser.add_argument("--text", required=True, help="The transcript or message text")
        args = parser.parse_args()
    
        if not args.text.strip():
            print("Error: --text cannot be empty.", file=sys.stderr)
            sys.exit(1)
    
        entry = {
            "timestamp": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
            "source": args.source,
            "text": args.text.strip(),
        }
    
        os.makedirs(os.path.dirname(TRANSCRIPTS_FILE), exist_ok=True)
        with open(TRANSCRIPTS_FILE, "a", encoding="utf-8") as f:
            f.write(json.dumps(entry, ensure_ascii=False) + "\n")
    
        print(f"✅ Logged ({args.source}): {args.text[:80]}{'...' if len(args.text) > 80 else ''}")
    
    
    if __name__ == "__main__":
        main()
    
  • scripts/manage_errors.py4.6 KBc01f6fecc7fbupstream ↗
    #!/usr/bin/env python3
    """
    manage_errors.py — Manage tracked English error patterns.
    
    Usage:
        python3 manage_errors.py add --pattern "..." --wrong "..." --correct "..."
        python3 manage_errors.py list
        python3 manage_errors.py bump --id error_id
        python3 manage_errors.py resolve --id error_id
        python3 manage_errors.py active-count
    """
    
    import argparse
    import json
    import os
    import re
    import sys
    from datetime import date
    
    ERRORS_FILE = "memory/english-errors.json"
    
    
    def load_errors():
        if not os.path.exists(ERRORS_FILE):
            return []
        with open(ERRORS_FILE, "r", encoding="utf-8") as f:
            return json.load(f)
    
    
    def save_errors(errors):
        os.makedirs(os.path.dirname(ERRORS_FILE), exist_ok=True)
        with open(ERRORS_FILE, "w", encoding="utf-8") as f:
            json.dump(errors, f, indent=2, ensure_ascii=False)
    
    
    def make_id(pattern: str) -> str:
        """Generate a slug-style ID from a pattern string."""
        slug = re.sub(r"[^a-z0-9]+", "_", pattern.lower()).strip("_")
        return slug[:50]
    
    
    def ensure_unique_id(base_id: str, errors: list) -> str:
        existing = {e["id"] for e in errors}
        if base_id not in existing:
            return base_id
        i = 2
        while f"{base_id}_{i}" in existing:
            i += 1
        return f"{base_id}_{i}"
    
    
    def cmd_add(args):
        errors = load_errors()
        base_id = make_id(args.pattern)
        error_id = ensure_unique_id(base_id, errors)
        today = date.today().isoformat()
    
        new_error = {
            "id": error_id,
            "pattern": args.pattern,
            "example_wrong": args.wrong,
            "example_correct": args.correct,
            "first_seen": today,
            "last_seen": today,
            "occurrences": 1,
            "status": "active",
            "resolved_date": None,
        }
        errors.append(new_error)
        save_errors(errors)
        print(f"✅ Added error pattern: [{error_id}] {args.pattern}")
    
    
    def cmd_list(args):
        errors = load_errors()
        active = [e for e in errors if e["status"] == "active"]
        if not active:
            print("No active error patterns tracked.")
            return
        print(f"📋 Active error patterns ({len(active)}):\n")
        for e in active:
            print(f"  [{e['id']}] {e['pattern']}")
            print(f"     ❌ \"{e['example_wrong']}\"")
            print(f"     ✅ \"{e['example_correct']}\"")
            print(f"     Occurrences: {e['occurrences']} | Last seen: {e['last_seen']}")
            print()
    
    
    def cmd_bump(args):
        errors = load_errors()
        today = date.today().isoformat()
        for e in errors:
            if e["id"] == args.id:
                e["occurrences"] += 1
                e["last_seen"] = today
                save_errors(errors)
                print(f"✅ Bumped [{args.id}] — occurrences: {e['occurrences']}, last_seen: {today}")
                return
        print(f"❌ Error ID not found: {args.id}", file=sys.stderr)
        sys.exit(1)
    
    
    def cmd_resolve(args):
        errors = load_errors()
        today = date.today().isoformat()
        for e in errors:
            if e["id"] == args.id:
                e["status"] = "resolved"
                e["resolved_date"] = today
                save_errors(errors)
                print(f"✅ Resolved [{args.id}]")
                return
        print(f"❌ Error ID not found: {args.id}", file=sys.stderr)
        sys.exit(1)
    
    
    def cmd_active_count(args):
        errors = load_errors()
        count = sum(1 for e in errors if e["status"] == "active")
        print(count)
    
    
    def main():
        parser = argparse.ArgumentParser(description="Manage English error patterns.")
        subparsers = parser.add_subparsers(dest="command", required=True)
    
        # add
        p_add = subparsers.add_parser("add", help="Add a new error pattern")
        p_add.add_argument("--pattern", required=True, help="Description of the pattern")
        p_add.add_argument("--wrong", required=True, help="Example of the wrong usage")
        p_add.add_argument("--correct", required=True, help="Corrected version")
    
        # list
        subparsers.add_parser("list", help="List active error patterns")
    
        # bump
        p_bump = subparsers.add_parser("bump", help="Increment occurrences for an error")
        p_bump.add_argument("--id", required=True, help="Error ID to bump")
    
        # resolve
        p_resolve = subparsers.add_parser("resolve", help="Mark an error as resolved")
        p_resolve.add_argument("--id", required=True, help="Error ID to resolve")
    
        # active-count
        subparsers.add_parser("active-count", help="Print count of active errors")
    
        args = parser.parse_args()
    
        dispatch = {
            "add": cmd_add,
            "list": cmd_list,
            "bump": cmd_bump,
            "resolve": cmd_resolve,
            "active-count": cmd_active_count,
        }
        dispatch[args.command](args)
    
    
    if __name__ == "__main__":
        main()
    
  • scripts/weekly_lesson.py5.6 KB54619ab7e976upstream ↗
    #!/usr/bin/env python3
    """
    weekly_lesson.py — Generate and send a weekly language lesson.
    
    Reads the last 7 days of transcripts + active error patterns, sends them
    to Claude for analysis, then delivers the lesson via Telegram Bot API.
    """
    
    import json
    import os
    import sys
    from datetime import datetime, timezone, timedelta
    
    import requests
    
    # ── Config ──────────────────────────────────────────────────────────────────
    BOT_TOKEN = "YOUR_BOT_TOKEN"
    
    CONFIG_FILE = "skills/language-coach/config.json"
    
    def load_config() -> dict:
        with open(CONFIG_FILE, "r", encoding="utf-8") as f:
            return json.load(f)
    
    def _load_anthropic_key() -> str:
        # Try env first, then .env file fallback
        key = os.environ.get("ANTHROPIC_API_KEY", "")
        if not key:
            env_path = "/path/to/.env"
            try:
                with open(env_path) as f:
                    for line in f:
                        line = line.strip()
                        if line.startswith("ANTHROPIC_API_KEY="):
                            key = line.split("=", 1)[1].strip()
                            break
            except FileNotFoundError:
                pass
        return key
    
    ANTHROPIC_API_KEY = _load_anthropic_key()
    TRANSCRIPTS_FILE = "memory/english-transcripts.jsonl"
    ERRORS_FILE = "memory/english-errors.json"
    MODEL = "claude-sonnet-4-6"
    
    
    def send_telegram(text: str, chat_id: int) -> dict:
        # Telegram max message length is 4096; split if needed
        max_len = 4000
        chunks = [text[i:i+max_len] for i in range(0, len(text), max_len)]
        results = []
        for chunk in chunks:
            r = requests.post(
                f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage",
                json={"chat_id": chat_id, "text": chunk, "parse_mode": "HTML"},
                timeout=30,
            )
            results.append(r.json())
        return results[-1] if results else {}
    
    
    def load_recent_transcripts(days: int = 7) -> list[dict]:
        if not os.path.exists(TRANSCRIPTS_FILE):
            return []
        cutoff = datetime.now(timezone.utc) - timedelta(days=days)
        entries = []
        with open(TRANSCRIPTS_FILE, "r", encoding="utf-8") as f:
            for line in f:
                line = line.strip()
                if not line:
                    continue
                try:
                    entry = json.loads(line)
                    ts = datetime.strptime(entry["timestamp"], "%Y-%m-%dT%H:%M:%SZ").replace(
                        tzinfo=timezone.utc
                    )
                    if ts >= cutoff:
                        entries.append(entry)
                except (json.JSONDecodeError, KeyError, ValueError):
                    continue
        return entries
    
    
    def load_active_errors() -> list[dict]:
        if not os.path.exists(ERRORS_FILE):
            return []
        with open(ERRORS_FILE, "r", encoding="utf-8") as f:
            errors = json.load(f)
        return [e for e in errors if e.get("status") == "active"]
    
    
    def call_claude(transcripts: list[dict], errors: list[dict], config: dict) -> str:
        if not ANTHROPIC_API_KEY:
            return "⚠️ ANTHROPIC_API_KEY not set — weekly lesson could not be generated."
    
        target_lang = config.get("target_lang", "English")
        target_context = config.get("target_context", "clear, professional communication")
    
        transcript_text = "\n".join(
            f"[{e['timestamp']} | {e['source']}] {e['text']}" for e in transcripts
        ) or "(No transcripts recorded this week)"
    
        error_text = "\n".join(
            f"- {e['pattern']}: \"{e['example_wrong']}\" → \"{e['example_correct']}\" (seen {e['occurrences']}x)"
            for e in errors
        ) or "(No tracked error patterns yet)"
    
        prompt = f"""You are a language coach analyzing transcripts of a non-native {target_lang} speaker named the user.
    His goal is {target_context}.
    
    Here are his recent messages (voice + typed):
    {transcript_text}
    
    Here are his currently tracked error patterns:
    {error_text}
    
    Produce a weekly {target_lang} lesson in this exact format:
    
    🗓 WEEKLY {target_lang.upper()} LESSON
    
    📌 NEW MISTAKES THIS WEEK
    [List each new pattern with: what he said → better version → why in plain language]
    
    🔁 RECURRING PATTERNS (still showing up)
    [List errors that appeared again from the tracked list]
    
    ✅ PROGRESS
    [Any improvements noticed compared to tracked patterns]
    
    💡 THIS WEEK'S FOCUS
    [One specific thing to practice]
    
    Keep it practical. Use his actual sentences. No grammar jargon — plain language explanations."""
    
        headers = {
            "x-api-key": ANTHROPIC_API_KEY,
            "anthropic-version": "2023-06-01",
            "content-type": "application/json",
        }
        payload = {
            "model": MODEL,
            "max_tokens": 1500,
            "messages": [{"role": "user", "content": prompt}],
        }
        r = requests.post(
            "https://api.anthropic.com/v1/messages",
            headers=headers,
            json=payload,
            timeout=60,
        )
        r.raise_for_status()
        data = r.json()
        return data["content"][0]["text"]
    
    
    def main():
        config = load_config()
        target_lang = config.get("target_lang", "English")
        chat_id = config.get("chat_id", YOUR_CHAT_ID)
    
        print(f"📚 Running weekly {target_lang} lesson...")
    
        transcripts = load_recent_transcripts(days=7)
        errors = load_active_errors()
        print(f"  Transcripts this week: {len(transcripts)}")
        print(f"  Active error patterns: {len(errors)}")
    
        lesson = call_claude(transcripts, errors, config)
        result = send_telegram(lesson, chat_id)
    
        if result.get("ok"):
            print("✅ Weekly lesson sent to Telegram!")
        else:
            print(f"❌ Telegram send failed: {result}", file=sys.stderr)
            sys.exit(1)
    
    
    if __name__ == "__main__":
        main()
    
  • config.json116 B81d32591d5e8upstream ↗
    {
      "target_lang": "English",
      "target_context": "clear, professional communication",
      "chat_id": "YOUR_CHAT_ID"
    }
  • LICENSE1.1 KB2948783b10bdupstream ↗
    MIT License
    
    Copyright (c) 2026 Hovhannes Hovhannisyan
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.
    

Plain-text copy, no login: /skill-bundles/nova-novanest-openclaw-language-coach.md

// REPO STATS

0 stars
0 open issues
Last commit: 7mo ago