-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: Programmatic implementation of /gsd:set-profile command
#1007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alythobani
wants to merge
7
commits into
gsd-build:main
Choose a base branch
from
alythobani:1/set-model-profile-programmatic-impl
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+205
−146
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b9c583a
perf: make `/gsd:set-profile`'s implementation more programmatic
alythobani 451d06d
perf: run the set-profile script without Claude needing to invoke it
alythobani f8767df
feat: improve output message for case where model profile wasn't changed
alythobani 10904b7
feat: specify haiku model for set-profile command since it's so simple
alythobani 82fa548
fix: remove ' (default)' from previousProfile to avoid false negative…
alythobani fab3d6f
chore: add docstring to MODEL_PROFILES with note about the analogous …
alythobani e8b1401
chore: delete set-profile workflow file that's no longer needed
alythobani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,12 @@ | ||
| --- | ||
| name: gsd:set-profile | ||
| description: Switch model profile for GSD agents (quality/balanced/budget) | ||
| argument-hint: <profile> | ||
| argument-hint: <profile (quality|balanced|budget)> | ||
| model: haiku | ||
| allowed-tools: | ||
| - Read | ||
| - Write | ||
| - Bash | ||
| --- | ||
|
|
||
| <objective> | ||
| Switch the model profile used by GSD agents. Controls which Claude model each agent uses, balancing quality vs token spend. | ||
| Show the following output to the user verbatim, with no extra commentary: | ||
|
|
||
| Routes to the set-profile workflow which handles: | ||
| - Argument validation (quality/balanced/budget) | ||
| - Config file creation if missing | ||
| - Profile update in config.json | ||
| - Confirmation with model table display | ||
| </objective> | ||
|
|
||
| <execution_context> | ||
| @~/.claude/get-shit-done/workflows/set-profile.md | ||
| </execution_context> | ||
|
|
||
| <process> | ||
| **Follow the set-profile workflow** from `@~/.claude/get-shit-done/workflows/set-profile.md`. | ||
|
|
||
| The workflow handles all logic including: | ||
| 1. Profile argument validation | ||
| 2. Config file ensuring | ||
| 3. Config reading and updating | ||
| 4. Model table generation from MODEL_PROFILES | ||
| 5. Confirmation display | ||
| </process> | ||
| !`node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set-model-profile $ARGUMENTS --raw` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /** | ||
| * Mapping of GSD agent to model for each profile. | ||
| * | ||
| * Should be in sync with the profiles table in `get-shit-done/references/model-profiles.md`. But | ||
| * possibly worth making this the single source of truth at some point, and removing the markdown | ||
| * reference table in favor of programmatically determining the model to use for an agent (which | ||
| * would be faster, use fewer tokens, and be less error-prone). | ||
| */ | ||
| const MODEL_PROFILES = { | ||
| 'gsd-planner': { quality: 'opus', balanced: 'opus', budget: 'sonnet' }, | ||
| 'gsd-roadmapper': { quality: 'opus', balanced: 'sonnet', budget: 'sonnet' }, | ||
| 'gsd-executor': { quality: 'opus', balanced: 'sonnet', budget: 'sonnet' }, | ||
| 'gsd-phase-researcher': { quality: 'opus', balanced: 'sonnet', budget: 'haiku' }, | ||
| 'gsd-project-researcher': { quality: 'opus', balanced: 'sonnet', budget: 'haiku' }, | ||
| 'gsd-research-synthesizer': { quality: 'sonnet', balanced: 'sonnet', budget: 'haiku' }, | ||
| 'gsd-debugger': { quality: 'opus', balanced: 'sonnet', budget: 'sonnet' }, | ||
| 'gsd-codebase-mapper': { quality: 'sonnet', balanced: 'haiku', budget: 'haiku' }, | ||
| 'gsd-verifier': { quality: 'sonnet', balanced: 'sonnet', budget: 'haiku' }, | ||
| 'gsd-plan-checker': { quality: 'sonnet', balanced: 'sonnet', budget: 'haiku' }, | ||
| 'gsd-integration-checker': { quality: 'sonnet', balanced: 'sonnet', budget: 'haiku' }, | ||
| 'gsd-nyquist-auditor': { quality: 'sonnet', balanced: 'sonnet', budget: 'haiku' }, | ||
| }; | ||
| const VALID_PROFILES = Object.keys(MODEL_PROFILES['gsd-planner']); | ||
|
|
||
| /** | ||
| * Formats the agent-to-model mapping as a human-readable table (in string format). | ||
| * | ||
| * @param {Object<string, string>} agentToModelMap - A mapping from agent to model | ||
| * @returns {string} A formatted table string | ||
| */ | ||
| function formatAgentToModelMapAsTable(agentToModelMap) { | ||
| const agentWidth = Math.max('Agent'.length, ...Object.keys(agentToModelMap).map((a) => a.length)); | ||
| const modelWidth = Math.max( | ||
| 'Model'.length, | ||
| ...Object.values(agentToModelMap).map((m) => m.length) | ||
| ); | ||
| const sep = '─'.repeat(agentWidth + 2) + '┼' + '─'.repeat(modelWidth + 2); | ||
| const header = ' ' + 'Agent'.padEnd(agentWidth) + ' │ ' + 'Model'.padEnd(modelWidth); | ||
| let agentToModelTable = header + '\n' + sep + '\n'; | ||
| for (const [agent, model] of Object.entries(agentToModelMap)) { | ||
| agentToModelTable += ' ' + agent.padEnd(agentWidth) + ' │ ' + model.padEnd(modelWidth) + '\n'; | ||
| } | ||
| return agentToModelTable; | ||
| } | ||
|
|
||
| /** | ||
| * Returns a mapping from agent to model for the given model profile. | ||
| * | ||
| * @param {string} normalizedProfile - The normalized (lowercase and trimmed) profile name | ||
| * @returns {Object<string, string>} A mapping from agent to model for the given profile | ||
| */ | ||
| function getAgentToModelMapForProfile(normalizedProfile) { | ||
| const agentToModelMap = {}; | ||
| for (const [agent, profileToModelMap] of Object.entries(MODEL_PROFILES)) { | ||
| agentToModelMap[agent] = profileToModelMap[normalizedProfile]; | ||
| } | ||
| return agentToModelMap; | ||
| } | ||
|
|
||
| module.exports = { | ||
| MODEL_PROFILES, | ||
| VALID_PROFILES, | ||
| formatAgentToModelMapAsTable, | ||
| getAgentToModelMapForProfile, | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The instructions for Claude are now simple enough (just printing the injected output to the user) that I think it's safe to just always use
haikufor this command, making it even faster + fewer tokens