Coach: a way in, and instructions for getting there

Two gaps found by deploying the thing and then trying to use it.

The Coach had no entry point. Its three routes have existed since the UI
landed and nothing in the app linked to them — not the nav, not Home, not
Plan, not Settings. The hub's back button already pointed at /plan, so that is
where the link was always meant to be. On a configured instance the feature was
enabled, credentialed, running, and reachable only by typing the URL.

It sits behind the same coachAvailable() predicate every other Coach surface
uses, so an instance without the feature sees exactly the Plan screen it saw
before.

And there were no setup instructions anywhere. This document said the Coach is
"off until an admin turns it on" and then never said how to turn it on: ten
sections on what it does and why it is safe, nothing on the four steps that get
you from a running instance to a working Coach. .env.example has no Coach knobs
and SELF_HOSTING mentions it only in the backup caveat, so there was nowhere
else to look either.

The new section covers building the target that has a runtime in it, minting a
token with `claude setup-token`, connecting and testing it on the admin card,
and where a user starts. It also warns up front about the thing a multi-profile
instance discovers the hard way: in instance mode the credential binds to the
first profile that spends it and every other profile is refused by design, so
one person gets the Coach and the rest get a refusal.

api 72/72, frontend 404/404, build clean, 11 locales in sync.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
AlexandClaude Opus 5 committed 2026-08-07 11:45:45 +01:00
1 parent ab1adcdd4f
commit 4ee9a2abbf
2 files changed
+66 -4

No files matched your search

+19 -1
View File
@@ -4,13 +4,24 @@ import { DAYN, uid, exCount } from '../lib/format.js'
import { t } from '../lib/i18n.js'
import { dayAssignSheet, loadStarterPlan, planToolsSheet } from '../sheets.jsx'
import Icon from '../components/Icon.jsx'
import { Button } from '../components/ui.jsx'
import { Button, Row } from '../components/ui.jsx'
import { glyphOf, DEFAULT_GLYPH } from '../lib/glyphs.js'
import { DEMO } from '../lib/demo.js'
import { MOBILE } from '../lib/mobile.js'
import { coachAvailable } from '../lib/coach.js'
export default function Plan() {
const nav = useNavigate()
const S = useStore(s => s.S)
const update = useStore(s => s.update)
const config = useStore(s => s.config)
const user = useStore(s => s.user)
/* The Coach's only entry point in the app. Its screens have existed since the UI landed and
nothing linked to them, so the feature was reachable only by typing the URL — enabled,
configured, and invisible. The same predicate every other Coach surface uses gates it, so
an instance without the feature sees exactly the Plan screen it saw before. */
const showCoach = coachAvailable(config, user, { demo: DEMO, mobile: MOBILE })
const addRoutine = () => {
const r = { id: uid(), name: t('New routine'), emoji: DEFAULT_GLYPH, ex: [] }
@@ -23,6 +34,13 @@ export default function Plan() {
<div><h1>{t('Plan')}</h1><div className="sub">{t('Your weekly routine')}</div></div>
<button className="iconbtn" onClick={planToolsSheet} aria-label={t('Share your plan')} title={t('Share your plan')}><Icon name="upload" /></button>
</div>
{showCoach && <div className="list" style={{ marginBottom: 10 }}>
<Row icon="sparkles" iconTint="var(--acc)" accessory="chevron"
title={t('AI Coach')}
subtitle={t('Build a plan, or have it reviewed against what you actually logged.')}
onClick={() => nav('/coach')} />
</div>}
<div className="cols"><div>
<h4 className="sec">{t('Week schedule')}</h4>
<div className="list" style={{ display: 'flex', flexDirection: 'column' }}>