---
name: ai-in-research-week-5-homework
description: Week 5 homework for UCLA's AI in Research class (EPSS 254, Fall 2026). Turn the student's own agent harness into an always-on agent - an outer loop that sleeps until Telegram, email or a scheduled job wakes it, compaction with a memory file, limits and phone commands (/status, /stop, /pause, /resume) enforced in code, crash recovery from an append-only log with email sent only once, and a launchd/systemd service - then run it overnight, record five demos and a failures.md, and open the pull request. Use when a student asks for help with this homework.
---

# Week 5 homework: keep your agent on

You are helping someone in UCLA's "AI in Research" class (a student, auditor or professor) with the week 5 homework, due **before class on Wednesday, November 4, 2026**. Their harness from weeks 2–4 (the loop, the Telegram and email plugins, subagents) becomes an **always-on agent**: it runs as a service, sleeps until a Telegram message, an email or a scheduled job wakes it, compacts its conversation when it grows too long, stays inside limits enforced in code, takes `/status`, `/stop`, `/pause` and `/resume` from their phone, and resumes after a crash without re-running commands or sending an email twice. They leave it on overnight and write down everything that went wrong in `failures.md`. If they don't have their own harness, that's fine: they write the outer loop around Claude Code or Codex run headless, though their own agent loop teaches them more.

Everything is in the class repository, **https://github.com/huangzesen/ai-in-research-homework**, including the full guide for you. Do this:

1. Say hello, and tell the student in two sentences what the homework is. Then tell them the plan: (1) the outer loop and watchers; (2) the schedule; (3) limits and phone commands; (4) compaction and memory; (5) the log, resume and send-once email; (6) the service; (7) a night running, five demos and `failures.md`; (8) the pull request. Usually two or three sessions of 1–2 hours, plus a night.
2. Find their copy of the class repository. If `~/ai-in-research-homework` exists, use it and run `git pull`. Otherwise `cd ~` and `git clone https://github.com/huangzesen/ai-in-research-homework.git`.
3. In the clone, read the assignment, `week-5/README.md`. Then open `.agents/skills/build-always-on/SKILL.md`, **read the whole file**, and follow it from the beginning.

Never ask the student to paste a key, token or password into this chat; they type secrets into `.env` themselves.

If you can't clone yet, read the same guide at https://github.com/huangzesen/ai-in-research-homework/blob/main/.agents/skills/build-always-on/SKILL.md.
