Skip to content

feat: one-time GitHub star prompt at Stand Down#117

Merged
harrymunro merged 2 commits into
mainfrom
feat/stand-down-star-prompt
May 8, 2026
Merged

feat: one-time GitHub star prompt at Stand Down#117
harrymunro merged 2 commits into
mainfrom
feat/stand-down-star-prompt

Conversation

@harrymunro
Copy link
Copy Markdown
Collaborator

Summary

  • Adds a single, one-time GitHub star prompt to Step 8 (Stand Down) that fires only on a successful mission, after the Mission Complete Gate.
  • Pattern mirrors Q00/ouroboros: a pure markdown directive in SKILL.md — no new Python module, subcommand, event type, or test surface.
  • Persists {"star_asked": true} in ~/.nelson/prefs.json so the prompt is one-shot per user across all Nelson projects on the same machine.

Behaviour

The directive tells Claude to:

  1. Skip silently if gh auth status fails or ~/.nelson/prefs.json["star_asked"] is already true.
  2. Otherwise invoke AskUserQuestion with two options: Star Nelson / Maybe later.
  3. On Star Nelson: run gh api -X PUT /user/starred/harrymunro/nelson (idempotent — no pre-check needed). On API failure, print a friendly note and continue; never block Stand Down.
  4. On any answer (including a custom "Other" response): merge star_asked: true into prefs via inline python3 -<<'PY' heredoc, preserving any existing keys.

Out of scope (deferred per issue notes)

  • Re-asking after N missions on "Maybe later".
  • Configurable NELSON_NO_STAR_PROMPT env var (manual workaround documented in README).
  • /nelson-star slash command.
  • Mission-log telemetry beyond the local prefs flag.

Test plan

  • scripts/check-references.sh passes (no broken cross-references).
  • pytest skills/nelson/scripts/ — 278 tests pass.
  • pytest hooks/ — 52 tests pass.
  • Heredoc smoke-tested against a tmp HOME: fresh-create, key-preservation merge, read-back idempotency, missing-file branch all behave correctly.
  • Manual QA on a real mission: gh authed + first success → prompt fires, Star Nelson → repo starred, prefs file written.
  • Manual QA: second mission Stand Down → prompt does not re-fire.
  • Manual QA: gh auth logout → prompt skipped, Stand Down completes.
  • Manual QA: outcome_achieved=false → prompt skipped.

Closes nelson-4yt.

@harrymunro
Copy link
Copy Markdown
Collaborator Author

Reviewed and addressed in bf20cbc.

Changes

  1. Defensive prefs reader — The read-side heredoc now mirrors the writer's shape: missing file, malformed JSON, and non-dict top-level all fall through to PREFS_OK instead of raising. A corrupted ~/.nelson/prefs.json will now skip the prompt silently rather than surface a Python traceback in chat.
  2. Disk-based outcome gate — Added a third preflight heredoc that reads {mission-dir}/stand-down.json and emits OUTCOME_OK / SKIP_OUTCOME_NOT_ACHIEVED / SKIP_NO_STAND_DOWN. The prompt no longer depends on the model remembering whether --outcome-achieved was passed minutes earlier — it's an observable signal on disk. Driven by MISSION_DIR env var with a {mission-dir} placeholder fallback.
  3. Canonical slug — Directive now names harrymunro/nelson once up front as the canonical slug. The two gh api references remain because they're command lines the model runs verbatim.
  4. README placement — Explainer paragraph moved below the star-history image under a new ### How the star prompt works subhead so the section still leads with the chart.

Verification

  • All 8 reader/outcome branches smoke-tested against tmp dirs (missing/malformed/non-dict/already-asked × outcome=true/false/missing/malformed) — every signal lands as documented.
  • pytest skills/nelson/scripts/ → 278 passed.
  • pytest hooks/ → 52 passed.
  • scripts/check-references.sh → OK.

harrymunro added 2 commits May 8, 2026 15:03
Asks users once whether they would like to star the repo on a successful
Stand Down. Pattern follows Q00/ouroboros: pure markdown directive in
SKILL.md, gh CLI for auth + idempotent PUT, ~/.nelson/prefs.json with a
single star_asked flag merged via inline python3 heredoc.

Skips silently when gh is unavailable, when the user is unauthenticated,
when the mission outcome was not achieved, or when star_asked is already
set. Either answer (Star Nelson / Maybe later, plus any custom Other
response) locks the prompt forever, across all Nelson projects on the
same machine user.

Closes nelson-4yt.
Address PR 117 review feedback:

- Reader heredoc for ~/.nelson/prefs.json now matches the writer's
  defensive shape (handles missing file, malformed JSON, non-dict
  top-level) so a corrupted prefs file skips silently rather than
  surfacing a Python traceback in chat.
- Gate the prompt on stand-down.json's outcome_achieved on disk via
  MISSION_DIR (with {mission-dir} fallback) instead of relying on the
  model remembering whether --outcome-achieved was passed minutes
  earlier. SKIP_NO_STAND_DOWN / SKIP_OUTCOME_NOT_ACHIEVED give the
  model an explicit, observable signal.
- Document the gh api PUT as idempotent and call out the canonical
  slug (harrymunro/nelson) once at the top of the directive.
- Move the README explainer below the star-history image and under a
  dedicated "How the star prompt works" subhead so the section still
  leads with the chart.
@harrymunro harrymunro force-pushed the feat/stand-down-star-prompt branch from bf20cbc to b68cdd4 Compare May 8, 2026 18:04
@harrymunro harrymunro merged commit 5eed168 into main May 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant