# physique-coach - Work Plan

## TL;DR (For humans)
<!-- Fill this LAST, after the detailed plan below is written, so it summarizes the REAL plan. -->
<!-- Plain English for a non-engineer: NO file paths, NO todo numbers, NO wave/agent/tool names. -->

**What you'll get:** A separate Telegram-ready Hermes physique coach with its own personality, coaching knowledge, immutable check-in history, daily source watch, and safety rules.

**Why this approach:** The coach must be an isolated profile so the current trading Hermes and Telegram bot cannot leak prompts, sessions, data, or polling traffic into it. Check-ins use an event history so mistakes can be corrected without rewriting your past record.

**What it will NOT do:** It will not impersonate the real coach, prescribe drugs/hormones or extreme cuts, alter the trading Hermes, share its Telegram token, bypass Instagram access controls, or rewrite its personality every day.

**Effort:** Large
**Risk:** Medium - it creates a new local agent identity and scheduled messages, but public activation is gated on a new bot token and a dry-run.
**Decisions to sanity-check:** Fresh `physique-coach` profile, 08:11 KST check-in, and a unique Telegram bot rather than the current trading bot.

Your next move: Provide the new bot token and allowed Telegram chat/user after the dry-run checks pass. Full execution detail follows below.

---

> TL;DR (machine): Large / Medium — isolated profile, coach assets, append-only records, source collector, and gated Telegram activation.

## Scope
### Must have
- A fresh `physique-coach` Hermes profile at `/home/cube/.hermes/profiles/physique-coach`, never cloned from default.
- A profile-local minimal configuration that disables every messaging platform until an explicit activation step supplies the dedicated Telegram token and allowlists.
- Dedicated Korean SOUL, knowledge base, check-in template, data contract, and isolated storage.
- A typed local CLI that imports raw history immutably, appends/corrects check-in events, materializes state, and creates safety flags.
- A daily source collector for Naver RSS, YouTube Atom, and an Instagram blocked/pending gate.
- Hermes cron definitions for 08:11 KST check-in and hourly source-refresh wakeups, not publicly deliverable until profile Telegram setup succeeds.
### Must NOT have (guardrails, anti-slop, scope boundaries)
- Do not modify `/home/cube/.hermes/config.yaml`, `/home/cube/projects/richard/telegram-bridge`, existing bot tokens, trading prompts, or D1-D123 source files.
- Do not copy the default `.env`, do not add a token to any tracked file, and do not reuse a bot token.
- Do not create medical/drug/hormone optimization logic, Instagram credential automation, or unreviewed SOUL mutation.

## Verification strategy
> Zero human intervention - all verification is agent-executed.
- Test decision: TDD + pytest for local scripts; Hermes CLI profile/cron smoke commands for configuration.
- Evidence: `.omo/evidence/physique-coach/task-<N>.md`. Automated pre-activation verification has zero human intervention; real Telegram delivery is a separate user-gated activation acceptance.

## Execution strategy
### Parallel execution waves
> Target 5-8 todos per wave. Fewer than 3 (except the final) means you under-split.

Wave 1: 1, 2, 3 in parallel. Wave 2: 4 after 1–3. Wave 3: 5 after 1–4.

### Dependency matrix
| Todo | Depends on | Blocks | Can parallelize with |
| --- | --- | --- | --- |
| 1 | none | 4, 5 | 2, 3 |
| 2 | none | 4, 5 | 1, 3 |
| 3 | none | 4, 5 | 1, 2 |
| 4 | 1, 2, 3 | 5 | none |
| 5 | 1, 2, 3, 4 | final wave | none |

## Todos
> Implementation + Test = ONE todo. Never separate.
<!-- APPEND TASK BATCHES BELOW THIS LINE WITH edit/apply_patch - never rewrite the headers above. -->
- [x] 1. Create the isolated Hermes profile and guarded runtime configuration
  What to do / Must NOT do: Create a **fresh** `physique-coach` profile using the installed Hermes entry point; create an explicit profile-local minimal config setting timezone `Asia/Seoul`, terminal-home `profile`, and all messaging platforms disabled/unconfigured. Launch checks must use a sanitized environment (`env -i` with only path/runtime values) so shell-exported default Telegram credentials cannot leak in. Do not clone config/secrets, start a gateway, install a service, or modify default Hermes.
  Parallelization: Wave 1 | Blocked by: none | Blocks: 4, 5
  References (executor has NO interview context - be exhaustive): `/home/cube/projects/richard/hermes-agent/hermes_cli/profiles.py:55-68,331-336,904-970`; `/home/cube/projects/richard/hermes-agent/hermes_constants.py:54-109`; `/home/cube/.hermes/config.yaml:443-470`.
  Acceptance criteria (agent-executable): profile directory exists; its `.env` contains no token; default config checksum is unchanged; profile config reports `Asia/Seoul`; all new directories are owner-only; no s6/system service is enabled; sanitized profile config/status confirms Telegram is unavailable.
  QA scenarios (name the exact tool + invocation): happy: run profile config/status with `env -i PATH="$PATH" HERMES_HOME=/home/cube/.hermes/profiles/physique-coach ...` and capture output; failure: set a sentinel Telegram token only in a child shell, rerun sanitized status/setup probe, and assert it does not enable/connect Telegram; compare default `.env` and profile `.env` hashes and inspect service list. Evidence `.omo/evidence/physique-coach/task-1.md`.
  Commit: N | local Hermes state only

- [x] 2. Install coach doctrine, check-in contract, and dedicated Hermes skill
  What to do / Must NOT do: Create the profile-local SOUL, knowledge copy, check-in template, event schema, and `physique-coach` skill. It must disclose AI identity, model the documented public coaching style without impersonation, force a factual/safety-first response order, and require event recording before coaching. Do not copy trading prompts, default memories, original check-ins, or long copyrighted source text.
  Parallelization: Wave 1 | Blocked by: none | Blocks: 4, 5
  References (executor has NO interview context - be exhaustive): `/home/cube/projects/richard/traning coach/choi_coach_knowledge_base.md`; supplied D1-D123 Markdown attachments; `/home/cube/.hermes/SOUL.md:96-120`; profile standard dirs `/home/cube/projects/richard/hermes-agent/hermes_cli/profiles.py:38-53`.
  Acceptance criteria (agent-executable): skill and SOUL explicitly include safe escalation, event-first behavior, no direct identity claim, and sources/provenance; raw-import manifest has SHA-256 without copying original text; no token/trading keyword in new assets.
  QA scenarios (name the exact tool + invocation): happy: `rg` assertions for mandatory coach/safety sections and an LLM-less template validation; failure: adversarial phrases requesting GH dosage and chest-pain training must map to stop/escalate examples. Evidence `.omo/evidence/physique-coach/task-2.md`.
  Commit: N | local Hermes state only

- [x] 3. Implement and test the append-only check-in event CLI
  What to do / Must NOT do: Under the profile-local workspace, implement a small Python CLI plus pytest tests. It reads these immutable source files: `/home/cube/.codex/attachments/6f30b58c-f695-4a47-a27f-f964394a371e/physique_coaching_chat_only_D1-D44.md` (D1–D44), `/home/cube/.codex/attachments/6f30b58c-f695-4a47-a27f-f964394a371e/chat_only_physique_coaching_master_record_D38-D85.md` (D38–D85), and `/home/cube/.codex/attachments/6f30b58c-f695-4a47-a27f-f964394a371e/chat_only_physique_coaching_master_record_D86-D123.md` (D86–D123). It writes a manifest with source hash/range, then structured imported events with source file + stable section anchor provenance; archives raw Telegram-like payloads, validates check-ins into typed events, appends corrections via `supersedes`, generates rebuildable current/weekly views, and records safety flags. Do not edit historical sources, use a database, treat missing as zero, or recommend medication/training based on urgent flags.
  Parallelization: Wave 1 | Blocked by: none | Blocks: 4, 5
  References (executor has NO interview context - be exhaustive): check-in design findings in `.omo/drafts/physique-coach.md`; `/home/cube/projects/richard/traning coach/choi_coach_knowledge_base.md:78-84,107-112`; Python rules at `/home/cube/.codex/plugins/cache/sisyphuslabs/omo/4.17.0/skills/programming/references/python/README.md`.
  Acceptance criteria (agent-executable): tests cover valid/incomplete/correction/unsafe/duplicate flows; events append once; invalid values produce `needs_clarification`; current state excludes ineligible values; raw payloads use owner-only permissions.
  QA scenarios (name the exact tool + invocation): happy: invoke CLI with a valid fixture then inspect event and current-state artifacts; failure: invoke with `체중 7O`, negative calories, a duplicate message, and chest-pain words, then assert no trend mutation and correct safety/clarification outputs. Evidence `.omo/evidence/physique-coach/task-3.md`.
  Commit: N | local Hermes state only

- [x] 4. Implement and test source-provenance collector and approval queue
  What to do / Must NOT do: Implement a profile-local Python collector and tests. Use canonical constants for Naver `https://rss.blog.naver.com/seongdo1994.xml`, YouTube `https://www.youtube.com/feeds/videos.xml?channel_id=UCZnMj8WWVg5hGn8FdJNvMug`, and Instagram `https://www.instagram.com/fitness_choi/`. Persist per-source state `{source, attempted_at_kst, status, item_ids, digest, last_good_at_kst, candidate_ids, parser_version}` atomically; create concise attributed review candidates only. For Instagram, detect challenge/login/captcha and mark blocked/pending without scraping/login. Do not edit SOUL or knowledge automatically, print raw feed bodies, use credentials, or bypass access controls.
  Parallelization: Wave 2 | Blocked by: 1, 2, 3 | Blocks: 5
  References (executor has NO interview context - be exhaustive): `/home/cube/projects/richard/traning coach/choi_coach_knowledge_base.md:86-105`; `/home/cube/.codex/plugins/cache/sisyphuslabs/omo/4.17.0/skills/ultimate-browsing/SKILL.md`; `/home/cube/projects/richard/hermes-agent/cron/scheduler.py:922-1079,1129-1148`.
  Acceptance criteria (agent-executable): new Naver/YouTube item becomes one concise attributed candidate; repeats are unchanged; fetch failure retains last-good; Instagram challenge is blocked; doctrine/SOUL checksums never change; tests do not access real credentials.
  QA scenarios (name the exact tool + invocation): happy: run against fixture XML/HTML and inspect source-state/review queue; failure: run malformed XML, 500 response, duplicate ID, and CAPTCHA HTML fixtures. Evidence `.omo/evidence/physique-coach/task-4.md`.
  Commit: N | local Hermes state only

- [x] 5. Provision Telegram/cron activation templates and execute the isolated dry-run
  What to do / Must NOT do: Create a profile-local activation guide and configuration template referring only to `TELEGRAM_BOT_TOKEN`, `telegram.allow_from`, `telegram.group_allow_from`, `telegram.group_allowed_chats`, target `telegram:<chat_id>`, and optional `TELEGRAM_CRON_THREAD_ID`. Provision paused/gated jobs only if the profile runtime supports them: check-in `11 8 * * *` Asia/Seoul, no delivery while unconfigured; source wakeup `0 * * * *` Asia/Seoul with a persistent per-source KST-date claim. Each job uses restricted script toolsets and records its idempotency key before attempting output. Verify `HERMES_HOME` is profile-local. Do not start polling, send public messages, run two consumers for a token, or change the default gateway.
  Parallelization: Wave 3 | Blocked by: 1, 2, 3, 4 | Blocks: final wave
  References (executor has NO interview context - be exhaustive): `/home/cube/projects/richard/hermes-agent/gateway/platforms/telegram.py:2005-2011,2188-2216,5296-5309`; `/home/cube/projects/richard/telegram-bridge/telegram_bridge.py:119-176`; `/home/cube/projects/richard/hermes-agent/cron/jobs.py:424-453,1197-1255`; `.omo/drafts/physique-coach.md`.
  Acceptance criteria (agent-executable): no gateway process starts; no token appears in artifacts; paused 08:11 KST and hourly wake-up definitions are documented with restricted toolsets/idempotency keys; dry-run reports profile-local state and source/check-in commands work; unauthorized chat/user routing fixtures are rejected; no message is delivered while paused/unconfigured.
  QA scenarios (name the exact tool + invocation): happy: run isolated local dry-run commands with an unset token and assert fail-closed/no network polling; failure: simulate duplicate delivery key, gateway restart, and unauthorized DM/group/topic fixtures, then assert exactly one check-in shell and zero outbound delivery. Evidence `.omo/evidence/physique-coach/task-5.md`.
  Commit: N | local Hermes state only

## Final verification wave
> Runs in parallel after ALL todos. All automated pre-activation checks must approve. Public Telegram activation remains user-gated and is not a completion prerequisite.
- [x] F1. Plan compliance audit
- [x] F2. Code quality review
- [x] F3. Real manual QA
- [x] F4. Scope fidelity

## Commit strategy

No git commit by default. The deliverable is profile-local configuration and user-owned coach data; preserve the existing dirty worktree.

## Success criteria

- The default Hermes/trading Telegram setup remains byte-for-byte unchanged.
- A fresh `physique-coach` profile exists with isolated state and no copied secrets.
- A valid check-in creates immutable, auditable records; invalid/unsafe inputs cannot silently alter plans or trends.
- Source updates preserve provenance and cannot mutate coach doctrine automatically.
- The coach is prepared for Telegram but cannot poll/send publicly until a unique token and allowlist are provided.
