Skip to content

fix(karpathy-self-improve): CLI subcommands resolve profile from global --profile (#180) - #181

Merged
Interstellar-code merged 1 commit into
mainfrom
fix/180-karpathy-cli-profile
Jul 20, 2026
Merged

fix(karpathy-self-improve): CLI subcommands resolve profile from global --profile (#180)#181
Interstellar-code merged 1 commit into
mainfrom
fix/180-karpathy-cli-profile

Conversation

@Interstellar-code

Copy link
Copy Markdown
Owner

Closes #180.

hermes karpathy bootstrap|pause|resume|propose failed with a misleading error: the following arguments are required: --profile even when --profile <name> was supplied.

Root cause (verified, not the one in the issue body)

The issue speculated the handlers/set_defaults were dropped at merge. They weren't — _cmd_bootstrap/_cmd_pause/_cmd_resume/_cmd_propose all exist and the CLI dispatches via a cmd == ... ladder (this parser never used set_defaults(func=...), so grep set_defaults → 0 is expected, not a defect).

The real cause: the top-level hermes CLI consumes --profile/-p before argparsemain._apply_profile_override() (hermes_cli/main.py:339) scans argv broadly (even after the subcommand), sets HERMES_HOME, and strips --profile from sys.argv. So a subcommand-local --profile required=True can never receive a value; argparse then reports it missing. This pre-strip predates the #176 work (from PR NousResearch#34097); the #176 subcommands simply declared their own --profile in violation of the CLI's convention (profile is always global — same as hermes --profile <name> gateway run). init/status/collect/daemon were unaffected because none require --profile. The HTTP pause/resume endpoints take profile as a path param → db.set_paused directly (no argparse), so they were never affected.

Fix

  • Dropped the --profile flag from the propose/bootstrap/pause/resume subparsers.
  • Added _resolve_cli_profile(cmd) — resolves the target from the global active profile via hermes_cli.profiles.get_active_profile_name() (HERMES_HOME, the per-process runtime profile), and exits 2 with an actionable message when no named profile is selected.
  • Dispatch now passes the resolved profile to each handler.
  • Corrected the now-wrong hint strings in daemon.py and the _wiring.py fail-fast to the real syntax: hermes --profile <name> karpathy <cmd>.

Usage (unchanged convention, corrected form)

hermes --profile hermes-switch karpathy bootstrap
hermes --profile hermes-switch karpathy resume
hermes --profile hermes-switch karpathy propose

Tests (187 passed, +2)

  • test_resolve_cli_profile_reads_global_active_profile — resolves from get_active_profile_name().
  • test_resolve_cli_profile_errors_without_named_profiledefault/empty → SystemExit(2) with the actionable message.

Verified live

hermes --profile hermes-switch karpathy bootstrap now succeeds — wrote plugins.karpathy_self_improve.profiles.hermes-switch (target_relpath: SOUL.md, profile_root, live_sessions_target: 10, paused: true) to config.yaml and set controls.hermes-switch = paused. hermes karpathy status reflects it.

…l --profile, not a stripped subcommand flag (#180)

hermes karpathy bootstrap|pause|resume|propose declared their own
--profile required=True, but main._apply_profile_override strips
--profile from argv before argparse. Read the active profile via
get_active_profile_name() instead; usage is 'hermes --profile <name>
karpathy <cmd>'. Fixes misleading 'required: --profile' error.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Interstellar-code
Interstellar-code merged commit 9bb7add into main Jul 20, 2026
2 checks passed
@Interstellar-code
Interstellar-code deleted the fix/180-karpathy-cli-profile branch July 20, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant