feat(kvb-coach): coach the operator's next step and remember what they enjoy
🧪 Test / 🧪 Lock + lint (push) Canceled after 0s

kvb-coach reads the situation (local time, hours at work today, the profile, open operator commands from kvb-org-operator, delegable kvb-org-rasci tasks) and suggests at most one next step per area: psyche, body, sleep, food, the operator's own tasks, and tasks to delegate to agents; short, friendly, with emojis, ordered by what the situation needs and biased to what the operator likes. It runs kvb-think-listen often to learn preferences. coach.py keeps the host-local profile in the gitignored .state/ of the skills repository: likes and dislikes per area (one replaces the other), a capped done-log, and the hours since the last activity per area; tests/test_coach.py covers it. General wellbeing only, no medical advice. Operator order 2026-11-03; two descriptions trimmed for the listing budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-03 13:57:14 +01:00
1 parent 5c30103b43
commit 57c3322076
7 files changed
+286 -9

No files matched your search

+73
View File
@@ -0,0 +1,73 @@
---
name: kvb-coach
description: >
Coach the operator's next step: psyche, body, sleep, food, own and
delegable tasks. Trigger on /kvb-coach or "was soll ich tun".
---
Be the operator's coach: short, warm, concrete, with emojis, in the
operator's language. Their health comes first; work is one area of six, not
the default. Suggestions, never pressure.
The profile keeps what the operator enjoys, dislikes and last did, host-local
in the gitignored `.state/` of the skills repository:
```bash
coach.py --profile <skills repo>/.state/coach.json like|dislike|forget <area> "<thing>"
coach.py --profile <same> done <area> "<thing>" [--at <iso>]
coach.py --profile <same> show [--json]
```
Areas: `psyche`, `body`, `sleep`, `food`, `tasks`, `delegate`.
## Step 1: read the situation
- **Time**: local time and weekday, and how long the operator has been at it
today (their first message of the day in the session transcripts).
- **Profile**: `coach.py show`: likes, dislikes, hours since the last sleep,
meal, workout or break.
- **Own tasks**: the open commands of the `kvb-org-operator` skill and the
decisions agents wait on.
- **Delegable**: what the operator did by hand that an agent could do, and
queued `kvb-org-rasci` register tasks without a worker.
## Step 2: suggest
At most one line per area, the most urgent first, the whole answer on one
screen:
- 🧠 **Psyche**: a short break, a walk outside, five minutes of meditation or
box breathing, a call with a friend, something just for fun.
- 💪 **Body**: a workout from the operator's likes (a 20-minute run, a
bodyweight circuit, cycling, yoga), stretching neck, hips and back after
long sitting, standing up every hour.
- 😴 **Sleep**: wind down, screens off, seven to nine hours; a 20-minute nap
in the early afternoon.
- 🥗 **Food**: water, a real meal with vegetables and protein, a healthy
snack instead of sugar, no caffeine late in the day.
- ✅ **Your tasks**: the one step only the operator can take that unblocks
the most.
- 🤖 **Delegate**: what an agent can take over, with the skill or command
that does it.
The situation sets the order: late evening puts sleep first, hours without
a break put moving first, a meal more than five hours ago puts food first.
Prefer what the operator likes, never offer a dislike, and do not repeat the
last tip of an area. Close with one encouraging line.
## Step 3: listen and remember
Often, not every time: when the profile is empty, after a declined
suggestion, and every few runs, run the `kvb-think-listen` skill with one
short `AskUserQuestion` (what they enjoy, what fits right now, what to
avoid). Record the answers with `like` and `dislike`, and what the operator
reports having done with `done`.
## Rules
- The operator decides: no guilt, no nagging, a declined tip stays off for
the day.
- General wellbeing, no medical advice: pain, illness or lasting exhaustion
get one kind pointer to a doctor.
- The profile never leaves the host: not into commits, memory files or peer
messages.
+135
View File
@@ -0,0 +1,135 @@
#!/usr/bin/env python3
"""Keep the operator's coaching profile: likes, dislikes and when what was done.
Args:
--profile: path of the profile JSON file.
like|dislike <area> <thing>: record a preference; one replaces the other.
forget <area> <thing>: drop a preference.
done <area> <thing> [--at <iso>]: log that the operator did it.
show [--now <iso>] [--json]: likes, dislikes and the last logged activity
per area with the hours since.
Exit codes:
0 done, 2 usage error.
"""
from __future__ import annotations
import argparse
import datetime
import json
import sys
from pathlib import Path
AREAS = ("psyche", "body", "sleep", "food", "tasks", "delegate")
LOG_LIMIT = 500
def fail(message: str) -> None:
print(f"coach: {message}", file=sys.stderr)
sys.exit(2)
def moment(value: str | None) -> datetime.datetime:
if value is None:
return datetime.datetime.now(datetime.UTC)
try:
parsed = datetime.datetime.fromisoformat(value)
except ValueError:
fail(f"{value} is not an ISO timestamp")
return parsed if parsed.tzinfo else parsed.replace(tzinfo=datetime.UTC)
def load(path: Path) -> dict:
try:
data = json.loads(path.read_text(encoding="utf-8"))
except FileNotFoundError:
return {"likes": {}, "dislikes": {}, "log": []}
except ValueError:
fail(f"{path} is not valid JSON")
return data
def save(path: Path, data: dict) -> None:
path.parent.mkdir(parents=True, exist_ok=True)
tmp = path.with_suffix(".tmp")
tmp.write_text(
json.dumps(data, indent=1, sort_keys=True, ensure_ascii=False), encoding="utf-8"
)
tmp.replace(path)
def prefer(data: dict, keep: str, area: str, thing: str) -> None:
for key in ("likes", "dislikes"):
items = data[key].setdefault(area, [])
if thing in items:
items.remove(thing)
if keep:
data[keep][area].append(thing)
def summary(data: dict, now: datetime.datetime) -> list[dict]:
rows = []
for area in AREAS:
last = next((e for e in reversed(data["log"]) if e["area"] == area), None)
hours = None
if last:
hours = round((now - moment(last["at"])).total_seconds() / 3600, 1)
rows.append(
{
"area": area,
"likes": data["likes"].get(area, []),
"dislikes": data["dislikes"].get(area, []),
"last": last["thing"] if last else None,
"hours_ago": hours,
}
)
return rows
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
parser.add_argument("--profile", required=True)
sub = parser.add_subparsers(dest="cmd", required=True)
for name in ("like", "dislike", "forget"):
p = sub.add_parser(name)
p.add_argument("area", choices=AREAS)
p.add_argument("thing")
p = sub.add_parser("done")
p.add_argument("area", choices=AREAS)
p.add_argument("thing")
p.add_argument("--at")
p = sub.add_parser("show")
p.add_argument("--now")
p.add_argument("--json", action="store_true")
args = parser.parse_args()
path = Path(args.profile)
data = load(path)
if args.cmd == "show":
rows = summary(data, moment(args.now))
if args.json:
print(json.dumps(rows, indent=1, ensure_ascii=False))
return 0
for row in rows:
last = f"{row['last']} {row['hours_ago']}h ago" if row["last"] else "-"
print(
f"{row['area']}\tlast: {last}\tlikes: {', '.join(row['likes']) or '-'}"
f"\tdislikes: {', '.join(row['dislikes']) or '-'}"
)
return 0
if args.cmd == "done":
data["log"].append(
{"area": args.area, "thing": args.thing, "at": moment(args.at).isoformat()}
)
data["log"] = data["log"][-LOG_LIMIT:]
else:
keep = {"like": "likes", "dislike": "dislikes"}.get(args.cmd, "")
prefer(data, keep, args.area, args.thing)
save(path, data)
print(f"{args.cmd} {args.area} {args.thing}")
return 0
if __name__ == "__main__":
sys.exit(main())
+3 -4
View File
@@ -1,10 +1,9 @@
---
name: kvb-git-branch-gc
description: >
Remove merged branches and worktrees with `pkgmgr branch gc`: dry run,
operator picks from the plan, then apply; unmerged items only one by one.
Trigger on /kvb-git-branch-gc, "branches aufräumen", "worktrees aufräumen",
"garbage collect".
Remove merged branches and worktrees with `pkgmgr branch gc` after a dry
run the operator picks from. Trigger on /kvb-git-branch-gc, "branches
aufräumen", "worktrees aufräumen".
---
`pkgmgr branch gc` decides what is merged and does the removing; this skill
+2 -3
View File
@@ -1,9 +1,8 @@
---
name: kvb-org-matrix
description: >
Print one matrix of everything in flight: tasks, workflows, background jobs,
with confidence and break risk per item. Trigger on /kvb-org-matrix,
"status", "übersicht", "wo stehen wir", or what is done, left or running.
One matrix of everything in flight with confidence and break risk per
item. Trigger on /kvb-org-matrix, "status", "übersicht", "wo stehen wir".
---
One-shot overview, no side effects: this skill reads state and reports it. It