fix(office-hours): pick the closing tier from the profile read before this session is logged (#2801)

Phase 4.5 appended this session to the builder profile and Phase 6 then read
the profile to choose its closing, so every run saw itself as history: a
first-time user got welcome_back and was asked how the assignment issued
minutes earlier went. Phase 4.5 now reads the profile before --log-session and
records the prior tier, count and last-session fields in the transcript;
Phase 6 uses those values (this session is prior + 1) and re-reads only the
running totals. A failed read proceeds as a first session and says so. Tier
headers now name the session numbers each tier actually covers.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
garrytanandcapy-ai[bot] committed 2026-10-08 06:20:39 +00:00
1 parent 65fef05a92
commit 66b87ba66f
2 files changed
+37 -15

No files matched your search

+17 -1
View File
@@ -291,9 +291,25 @@ Track which of these signals appeared during the session:
Count the signals. You'll use this count in Phase 6 to determine which tier of closing message to use.
### Builder Profile Read (before this session is logged)
Read the profile before the append below: a read after it counts this session as history, so a
first-timer gets the welcome-back closing about an assignment they haven't been given yet.
```bash
~/.claude/skills/gstack/bin/gstack-builder-profile 2>/dev/null || echo "PROFILE_READ: failed"
```
Write this line in your reply (it must survive context compaction until Phase 6):
`Builder profile before this session: PROFILE_READ=ok SESSION_TIER=<TIER> PRIOR_SESSION_COUNT=<SESSION_COUNT> LAST_PROJECT=<LAST_PROJECT> LAST_ASSIGNMENT=<LAST_ASSIGNMENT> CROSS_PROJECT=<true|false>`
CROSS_PROJECT is true only when LAST_PROJECT is non-empty and differs from this session's SLUG
(the output's own CROSS_PROJECT compares the two previous sessions). If the output says
`PROFILE_READ: failed` or has no `TIER:` line, write `PROFILE_READ=failed SESSION_TIER=introduction
PRIOR_SESSION_COUNT=0` with the rest empty or false.
### Builder Profile Append
After counting signals, append a session entry to the builder profile. This is the single
After the read above, append a session entry to the builder profile. This is the single
source of truth for all closing state (tier, resource dedup, journey tracking). The
`gstack-developer-profile --log-session` binary handles its own directory creation
and writes via atomic mktemp+mv to `$GSTACK_STATE_ROOT/developer-profile.json`.
@@ -186,16 +186,22 @@ Once the design doc is APPROVED, deliver the closing sequence. The closing adapt
on how many times this user has done office hours, creating a relationship that deepens
over time.
### Step 1: Read Builder Profile
### Step 1: Builder Profile
Use SESSION_TIER, PRIOR_SESSION_COUNT, LAST_PROJECT, LAST_ASSIGNMENT and CROSS_PROJECT from the
`Builder profile before this session:` line you wrote in Phase 4.5. This is session
PRIOR_SESSION_COUNT + 1. If that line says `PROFILE_READ=failed` or is gone, use the introduction
tier and tell the user: "I couldn't read your builder profile, so I'm treating this as your first
office hours session."
Then read the running totals, which now include this session:
```bash
PROFILE=$(~/.claude/skills/gstack/bin/gstack-builder-profile 2>/dev/null) || PROFILE="SESSION_COUNT: 0
TIER: introduction"
SESSION_TIER=$(echo "$PROFILE" | grep "^TIER:" | awk '{print $2}')
SESSION_COUNT=$(echo "$PROFILE" | grep "^SESSION_COUNT:" | awk '{print $2}')
~/.claude/skills/gstack/bin/gstack-builder-profile 2>/dev/null || echo "PROFILE_READ: failed"
```
Read the full profile output. You will use these values throughout the closing.
Use only its DESIGN_COUNT, DESIGN_TITLES, ACCUMULATED_SIGNALS, TOTAL_SIGNAL_COUNT, NUDGE_ELIGIBLE
and RESOURCES_SHOWN(_COUNT); never its TIER, SESSION_COUNT, LAST_* or CROSS_PROJECT.
### Step 2: Follow the Tier Path
@@ -261,17 +267,17 @@ Then proceed to Founder Resources below.
---
### If TIER = welcome_back (sessions 2-3)
### If TIER = welcome_back (sessions 2-4)
Lead with recognition. The magical moment is immediate.
Read LAST_ASSIGNMENT and CROSS_PROJECT from the profile output.
Use LAST_ASSIGNMENT, LAST_PROJECT and CROSS_PROJECT from Step 1 (the Phase 4.5 values).
If CROSS_PROJECT is false (same project as last time):
"Welcome back. Last time you were working on [LAST_ASSIGNMENT from profile]. How's it going?"
"Welcome back. Last time you were working on [LAST_ASSIGNMENT]. How's it going?"
If CROSS_PROJECT is true (different project):
"Welcome back. Last time we talked about [LAST_PROJECT from profile]. Still on that, or onto something new?"
"Welcome back. Last time we talked about [LAST_PROJECT]. Still on that, or onto something new?"
Then: "No pitch this time. You already know about YC. Let's talk about your work."
@@ -290,11 +296,11 @@ Then proceed to Founder Resources below.
---
### If TIER = regular (sessions 4-7)
### If TIER = regular (sessions 5-8)
Lead with recognition and session count.
"Welcome back. This is session [SESSION_COUNT]. Last time: [LAST_ASSIGNMENT]. How'd it go?"
"Welcome back. This is session [PRIOR_SESSION_COUNT + 1]. Last time: [LAST_ASSIGNMENT]. How'd it go?"
**Tone examples:**
- GOOD: "You've been at this for 5 sessions now. Your designs keep getting sharper. Let me show you what I've noticed."
@@ -326,9 +332,9 @@ Then proceed to Founder Resources below.
---
### If TIER = inner_circle (sessions 8+)
### If TIER = inner_circle (sessions 9+)
"You've done [SESSION_COUNT] sessions. You've iterated [DESIGN_COUNT] designs. Most people who show this pattern end up shipping."
"You've done [PRIOR_SESSION_COUNT + 1] sessions. You've iterated [DESIGN_COUNT] designs. Most people who show this pattern end up shipping."
The data speaks. No pitch needed.