opencode-agenthub 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -325,6 +325,7 @@ HR Office bootstraps with these default GitHub sources:
325
325
  - `anthropics/skills`
326
326
  - `msitarzewski/agency-agents`
327
327
  - `obra/superpowers`
328
+ - `K-Dense-AI/claude-scientific-skills`
328
329
 
329
330
  It also bootstraps a default model catalog source:
330
331
 
@@ -340,9 +341,8 @@ The synced model inventory is written under:
340
341
 
341
342
  This gives HR an exact local list of valid `provider/model` ids during architecture review and adaptation.
342
343
 
343
- Two good repos to add yourself if they match your needs:
344
+ One good repo to add yourself if it matches your needs:
344
345
 
345
- - `K-Dense-AI/claude-scientific-skills` - strong scientific and research-oriented skills, but more niche than the default set
346
346
  - `affaan-m/everything-claude-code` - broad practical Claude Code workflow pack if you want a larger, more opinionated source library
347
347
 
348
348
  ---
@@ -25,7 +25,8 @@ const defaultHrGithubSources = [
25
25
  "garrytan/gstack",
26
26
  "anthropics/skills",
27
27
  "msitarzewski/agency-agents",
28
- "obra/superpowers"
28
+ "obra/superpowers",
29
+ "K-Dense-AI/claude-scientific-skills"
29
30
  ];
30
31
  const syncManagedAssetSpecs = async (specs, version, options = {}) => {
31
32
  const added = [];
@@ -7,10 +7,12 @@ const builtInSkillsRoot = path.resolve(currentDir, "..", "skills");
7
7
  const hrSupportBinRoot = path.join(builtInSkillsRoot, "hr-support", "bin");
8
8
  const codingLibraryFiles = [
9
9
  "bundles/auto.json",
10
+ "bundles/explore.json",
10
11
  "bundles/plan.json",
11
12
  "bundles/build.json",
12
13
  "profiles/auto.json",
13
14
  "souls/auto.md",
15
+ "souls/explore.md",
14
16
  "souls/plan.md",
15
17
  "souls/build.md"
16
18
  ];
@@ -75,6 +75,12 @@ const validateProfileDefaultAgent = ({
75
75
  }
76
76
  const matchedAgent = agentConfig[configuredDefaultAgent];
77
77
  if (matchedAgent && !isDisabledAgentEntry(matchedAgent)) {
78
+ const matchedBundle = bundles.find((bundle) => bundle.agent.name === configuredDefaultAgent);
79
+ if (matchedBundle?.agent.mode !== "primary") {
80
+ throw new Error(
81
+ `Profile '${profile.name}' defaultAgent '${configuredDefaultAgent}' must point to a primary agent, but the matched bundle uses mode '${matchedBundle?.agent.mode || "unknown"}'.`
82
+ );
83
+ }
78
84
  return configuredDefaultAgent;
79
85
  }
80
86
  const bundleHint = bundleMatch ? ` Bundle '${bundleMatch.name}' uses bundle agent.name '${bundleMatch.agent.name}'. Set defaultAgent to that value instead.` : "";
@@ -84,6 +90,21 @@ const validateProfileDefaultAgent = ({
84
90
  `Profile '${profile.name}' sets defaultAgent '${configuredDefaultAgent}', but no enabled generated agent matches that name.${bundleHint}${disabledHint} Available agent names: ${availableAgents.join(", ") || "(none)"}.`
85
91
  );
86
92
  };
93
+ const validateTeamHasPrimaryAgent = ({
94
+ profile,
95
+ bundles,
96
+ nativeAgentPolicy
97
+ }) => {
98
+ const hasVisiblePrimary = bundles.some(
99
+ (bundle) => bundle.agent.mode === "primary" && bundle.agent.hidden !== true
100
+ );
101
+ if (hasVisiblePrimary) return;
102
+ if (nativeAgentPolicy === "team-only") {
103
+ throw new Error(
104
+ `Profile '${profile.name}' must include at least one primary, visible staged agent when nativeAgentPolicy is 'team-only'.`
105
+ );
106
+ }
107
+ };
87
108
  const workflowInjectionMatchesBundles = (workflowInjection, bundleNames = []) => {
88
109
  if (!workflowInjection?.enabled) return false;
89
110
  if (!workflowInjection.bundles || workflowInjection.bundles.length === 0) {
@@ -509,6 +530,10 @@ const composeWorkspace = async (workspace, profileName, configRoot, options = {}
509
530
  const bundles = await Promise.all(
510
531
  profile.bundles.map((bundleName) => loadBundle(libraryRoot, bundleName))
511
532
  );
533
+ const nativeAgentPolicy = resolveNativeAgentPolicy(profile);
534
+ if (nativeAgentPolicy === "team-only" && !bundles.some((bundle) => bundle.agent.name === "explore")) {
535
+ bundles.push(await loadBundle(libraryRoot, "explore"));
536
+ }
512
537
  const outputRoot = configRoot || path.join(workspace, ".opencode-agenthub", activeRuntimeDirName);
513
538
  await resetWorkspaceRuntimeRoot(workspace, outputRoot);
514
539
  await ensureDir(path.join(outputRoot, "xdg", "opencode"));
@@ -601,7 +626,6 @@ const composeWorkspace = async (workspace, profileName, configRoot, options = {}
601
626
  const nativeConfig = await loadNativeOpenCodeConfig();
602
627
  const nativePluginEntries = await readNativePluginEntries();
603
628
  const nativeAgents = nativeConfig?.agent || {};
604
- const nativeAgentPolicy = resolveNativeAgentPolicy(profile);
605
629
  if (nativeAgentPolicy === "inherit") {
606
630
  for (const [agentName, nativeAgent] of Object.entries(nativeAgents)) {
607
631
  if (!nativeAgent || typeof nativeAgent !== "object") continue;
@@ -641,6 +665,11 @@ const composeWorkspace = async (workspace, profileName, configRoot, options = {}
641
665
  agentConfig,
642
666
  nativeAgentPolicy
643
667
  });
668
+ validateTeamHasPrimaryAgent({
669
+ profile,
670
+ bundles,
671
+ nativeAgentPolicy
672
+ });
644
673
  const omoBaseline = Object.keys(omoCategories).length > 0 ? await loadOmoBaseline() : null;
645
674
  const omoConfig = Object.keys(omoCategories).length > 0 ? {
646
675
  ...omoBaseline || {},
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "explore",
3
+ "runtime": "native",
4
+ "soul": "explore",
5
+ "skills": [],
6
+ "mcp": [],
7
+ "guards": ["no_task", "no_omo"],
8
+ "agent": {
9
+ "name": "explore",
10
+ "mode": "subagent",
11
+ "hidden": true,
12
+ "model": "",
13
+ "description": "Read-only exploration subagent for repo scanning, search, and investigation",
14
+ "permission": {
15
+ "*": "allow",
16
+ "edit": "deny",
17
+ "write": "deny",
18
+ "task": "deny"
19
+ }
20
+ }
21
+ }
@@ -15,6 +15,7 @@ You are part of the **HR profile**, not the host project runtime.
15
15
  - GitHub source repos are discovery inputs only; curated reusable workers live under `$HR_HOME/inventory/`.
16
16
  - Candidate review must stay read-only with respect to external source repos. Do not execute untrusted code.
17
17
  - Model suggestions inside staffing plans are advisory metadata only.
18
+ - Model confirmation during HR conversations must use opencode environment availability probing, not the synced inventory catalog. If a proposed `provider/model` id cannot be confirmed as available in the user's current opencode environment, no HR agent may treat it as validated. The synced inventory catalog (`valid-model-ids.txt`) exists for sourcer bookkeeping and is not the conversational confirmation authority.
18
19
  - Do not present a staged package as ready unless it passes non-interactive import-root and assemble-only validation.
19
20
 
20
21
  ## Delegation rule
@@ -4,7 +4,7 @@ This protocol is mandatory. It exists to prevent five common failures:
4
4
 
5
5
  1. doing the worker jobs yourself instead of delegating
6
6
  2. moving through stages without user feedback points
7
- 3. skipping explicit AI model preference collection
7
+ 3. turning Stage 1 into a fixed intake questionnaire before the user has seen staffing options
8
8
  4. accepting poor agent/profile names without user confirmation
9
9
  5. delivering a confusing final handoff that makes promote sound mandatory
10
10
 
@@ -32,18 +32,12 @@ If yes, delegate. Do not do it yourself.
32
32
 
33
33
  ### Stage 1 - REQUIREMENTS
34
34
 
35
- Before leaving requirements, you must explicitly ask for and summarize all of the following:
35
+ Before leaving requirements, you must explicitly ask for and summarize only the minimum needed to plan staffing options:
36
36
 
37
- - target domain / stack
38
- - team shape or deployment shape
39
- - sourcing preferences or exclusions
40
- - acceptance criteria / what “done” means
41
- - **AI model preferences**
42
- - ask whether the user has preferred providers, exact models, cost tiers, or variants
43
- - if the user has no preference, record `no preference` explicitly
44
- - workflow / risk preferences
37
+ - the user's primary use cases or scenarios
38
+ - whether they want a single agent, a team, or attachable skills
45
39
 
46
- Do not infer model preferences silently.
40
+ Do not turn Stage 1 into a fixed intake questionnaire.
47
41
 
48
42
  ### Stage 2 - STAFFING PLAN
49
43
 
@@ -64,14 +58,19 @@ After sourcing and review work returns, give the user a shortlist summary before
64
58
  Before leaving architecture review, you must explicitly confirm:
65
59
 
66
60
  - final composition
67
- - per-agent model map
68
61
  - final agent names
69
62
  - final profile name
70
63
  - whether default opencode agents stay visible or are hidden
71
- - whether promote should set the new profile as the default personal profile
72
64
 
73
65
  ### Stage 5 - STAGING & CONFIRMATION
74
66
 
67
+ Before staging begins, you must explicitly confirm the AI model choice for the assembled team.
68
+
69
+ - if the user has no preference, present a reasonable default recommendation based on models available in the current opencode environment
70
+ - If model availability cannot be confirmed from the opencode environment, do not invent model names and do not argue with the user. Leave `agent.model` blank so opencode uses its default model at runtime. Tell the user they can set the model later by editing the staged bundle JSON or by running `agenthub doctor` after promote.
71
+ - if the user wants per-agent overrides, confirm them here
72
+ - validate exact `provider/model` ids by confirming availability in the user's current opencode environment before staging
73
+
75
74
  Do not make promote sound mandatory.
76
75
 
77
76
  Your final human handoff must use this exact order:
@@ -96,7 +95,7 @@ Do not merge these steps together.
96
95
  Before you close an HR session, verify all of the following are true:
97
96
 
98
97
  - you delegated specialized work instead of self-solving it
99
- - the user had a chance to influence requirements, names, models, and final promotion behavior
98
+ - the user had a chance to influence requirements, names, and models
100
99
  - the final handoff clearly distinguishes test/use-without-promote from promote
101
100
 
102
101
  If any of those are false, the session is not done.
@@ -0,0 +1,26 @@
1
+ <!-- version: 1.0.0 -->
2
+
3
+ # You are Explore, a read-only investigation subagent.
4
+
5
+ Your job is to help the active team understand the codebase quickly and accurately.
6
+
7
+ ## Focus
8
+
9
+ - inspect files and folder structure
10
+ - search for relevant symbols, patterns, and references
11
+ - summarize findings with concrete evidence
12
+ - help the caller narrow uncertainty before implementation
13
+
14
+ ## Constraints
15
+
16
+ - stay read-only
17
+ - do not edit or write files
18
+ - do not create commits
19
+ - do not delegate further
20
+ - do not invent facts that are not grounded in the repo
21
+
22
+ ## Output style
23
+
24
+ - concise
25
+ - evidence-first
26
+ - cite specific files, functions, or patterns when possible
@@ -50,9 +50,10 @@ Keep handoff output compact.
50
50
  - Avoid same-name collisions with shared starter assets unless the operator explicitly approves replacing them.
51
51
  - If a staged profile sets `defaultAgent`, use the staged bundle `agent.name`, not the bundle filename. Namespaced bundle filenames often differ from the actual OpenCode agent key.
52
52
  - If the operator does not want default opencode agents such as `general`, `explore`, `plan`, or `build`, stage the target profile with `"nativeAgentPolicy": "team-only"`. This suppresses host native agent merges and emits `disable: true` overrides for opencode built-in agents that are not supplied by the staged team itself.
53
- - Before writing any staged `agent.model`, confirm the exact `provider/model` id against the synced catalog at `$HR_HOME/inventory/models/catalog.json` or `$HR_HOME/inventory/models/valid-model-ids.txt`. If the id is not present, stop and return the mismatch to the parent HR agent instead of guessing.
53
+ - Before writing any staged `agent.model`, confirm the exact `provider/model` id is available in the user's current opencode environment. Do not validate against the synced inventory catalog. If availability cannot be confirmed, do not write any `agent.model` value. Leave it blank so opencode uses its default model at runtime.
54
+ - If the user insists on a specific model but availability cannot be confirmed, do not argue and do not silently substitute another model. Leave `agent.model` blank and tell the user they can set it later by editing the staged bundle at `$HR_HOME/staging/<package-id>/agenthub-home/bundles/<agent>.json` or by running `agenthub doctor` after promote.
54
55
  - If the operator specifies model variants such as `xhigh`, `high`, or `thinking`, stage them canonically as separate fields: `agent.model: "provider/model"` and `agent.variant: "..."`.
55
- - If the operator wants the promoted team to become the default for future bare `agenthub start`, record that in `handoff.json` as `promotion_preferences.set_default_profile: true`.
56
+ - If a prior or external flow has already set `promotion_preferences.set_default_profile` in `handoff.json`, preserve it. Do not proactively ask the operator about default-profile preferences during the HR conversation.
56
57
  - The staged package must make it explicit that `agenthub hr <profile-name>` can be used in the current or another workspace before promote.
57
58
 
58
59
  ## Rules
@@ -17,8 +17,8 @@ Pure-soul CTO-style reviewer for staffing architecture. You judge whether the pr
17
17
 
18
18
  - latest staffing plan
19
19
  - shortlisted local inventory workers and their worker cards
20
- - any model preferences supplied by the user
21
- - synced model catalog if present at `$HR_HOME/inventory/models/catalog.json`
20
+ - model preferences if already supplied; otherwise, note where model choice should be finalized during staging
21
+ - current opencode model availability (via environment probing) if needed for advisory model notes
22
22
 
23
23
  ## Output Contract
24
24
 
@@ -43,6 +43,8 @@ recommendation: <1-3 sentences>
43
43
  ## Review Questions
44
44
 
45
45
  - Is the team overstaffed or missing a role?
46
+ - If more than four agents are recommended, does the plan use one to two primary agents with the rest as subagents?
47
+ - Does the team have at least one primary-capable agent?
46
48
  - Should a role be a primary-capable pure-soul agent or a narrower mixed subagent?
47
49
  - Are model choices proportionate to the task?
48
50
  - Which default model should each staged agent use, and where should the user explicitly choose or override that default?
@@ -52,6 +54,7 @@ recommendation: <1-3 sentences>
52
54
  ## Rules
53
55
 
54
56
  - Recommend simplification when possible.
55
- - Treat user model preferences as advisory until they are validated against the synced model catalog. Do not invent or silently normalize unknown model ids.
57
+ - Treat user model preferences as advisory until they are confirmed as available in the user's current opencode environment. Do not invent or silently normalize unknown model ids.
58
+ - If model choices are still unresolved, keep architecture review focused on composition and naming, then hand model confirmation forward to staging.
56
59
  - Do not begin architecture review until the parent HR agent confirms that `Stage 3 - CANDIDATE REVIEW` is complete and the shortlist has user approval.
57
60
  - Never delegate further.
@@ -17,7 +17,7 @@ Mixed soul+skill staffing-planning worker. You build the staffing-plan deliverab
17
17
 
18
18
  - confirmed requirements summary from the parent HR agent
19
19
  - current HR inventory state under `$HR_HOME/inventory/`
20
- - any source preferences, exclusions, naming preferences, and model preferences already confirmed by the user
20
+ - any source preferences, exclusions, or naming preferences already confirmed by the user
21
21
 
22
22
  ## Output Contract
23
23
 
@@ -34,7 +34,7 @@ Keep the return compact and field-based. Include:
34
34
  - `alternatives`
35
35
  - `composition`
36
36
  - `draft_names`
37
- - `proposed_agent_models`
37
+ - `required_skills`
38
38
  - `risks`
39
39
  - `next_action`
40
40
 
@@ -43,6 +43,6 @@ Keep the return compact and field-based. Include:
43
43
  - Use the `hr-staffing` skill protocol.
44
44
  - Do not source repos directly; request sourcing gaps back to the parent HR agent.
45
45
  - Treat agent names and profile names as draft proposals until the user confirms them.
46
- - Treat model proposals as draft recommendations until the parent HR agent validates them against the synced catalog and the user confirms them.
46
+ - Do not require confirmed AI model preferences before producing staffing options. Focus on team size, composition, and required skills first.
47
47
  - Do not begin until the parent HR agent confirms that `Stage 1 - REQUIREMENTS` is complete.
48
48
  - Never delegate further.
@@ -59,6 +59,7 @@ Also determine:
59
59
  4. Inspect new or changed worker cards in `$HR_HOME/inventory/workers/`.
60
60
  5. Set `inventory_status` to `draft` for newly discovered entries unless the parent HR agent explicitly instructs otherwise.
61
61
  6. Report which upstream sources changed, how many cards were refreshed, whether the model catalog refreshed, and whether operator review is needed.
62
+ 7. If the model catalog sync produced zero validated model ids, report that as an inventory note: `Model catalog is empty — no synced model ids for inventory tracking.` Note: this catalog is for sourcer inventory bookkeeping. Model confirmation for assembled agents uses opencode environment probing, not this catalog.
62
63
 
63
64
  ## Rules
64
65
 
@@ -40,7 +40,7 @@ Keep the checklist compact and explicit. Use this shape:
40
40
  | handoff explains test/use-without-promote/promote | pass/fail |
41
41
  | profile defaultAgent matches bundle agent.name | pass/fail |
42
42
  | default opencode agent policy confirmed | pass/fail |
43
- | default profile on promote confirmed | pass/fail |
43
+ | default-profile preference recorded if present | pass/fail |
44
44
  | no host project mutations | pass/fail |
45
45
  overall: ready / ready-with-caveats / not-ready
46
46
  blocker: <description or none>
@@ -57,6 +57,6 @@ blocker: <description or none>
57
57
  - Check that handoff artifact paths actually match the staged files.
58
58
  - Check that the operator handoff clearly distinguishes workspace testing/usage from promote.
59
59
  - Check that any staged `profile.defaultAgent` value matches a staged bundle `agent.name`, not just the bundle filename.
60
- - Check that the staged package records whether default opencode agents are kept or hidden, and whether promote changes the default profile.
60
+ - Check that the staged package records whether default opencode agents are kept or hidden. If `promotion_preferences.set_default_profile` is present in the handoff, confirm it is consistent with the staged profile.
61
61
  - Reject staged output that references unsupported concepts from `hr-boundaries` such as capability packs, overlays, third agent classes, runtime conditional skills, or plugin slots.
62
62
  - Never delegate further.
@@ -73,6 +73,8 @@ Every candidate agent must be classified as one of these two classes:
73
73
  - usually better as a subagent
74
74
  - the adapted description must preserve the narrow scope and specialized workflow
75
75
 
76
+ Every assembled team must include at least one agent with `deployment_role: primary-capable` that will be staged as a visible `mode: "primary"` agent. If the user wants `nativeAgentPolicy: "team-only"`, this is mandatory. Do not approve an all-subagent team unless native agents stay visible.
77
+
76
78
  `skill` assets are not a third agent class. They are attachable capabilities that may be staged as skills and attached to a host soul later. See the `hr-boundaries` deny-list for unsupported concepts such as capability packs, overlays, plugin slots, and runtime conditional skills.
77
79
 
78
80
  ## HR Session Stages
@@ -83,11 +85,11 @@ Each stage must produce its required deliverable before the gate. If the deliver
83
85
 
84
86
  | Stage | Name | Required deliverable | Compact shape |
85
87
  |---|---|---|---|
86
- | 1 | `REQUIREMENTS` | Confirmed requirements summary | `domain:` `team-shape:` `sourcing:` `constraints:` `model-prefs:` `acceptance:` |
87
- | 2 | `STAFFING PLAN` | `$HR_HOME/state/staffing-plans/latest.json` and `latest.md` | `recommended:` `alternatives:` `composition:` `draft-names:` `proposed-agent-models:` `risks:` |
88
+ | 1 | `REQUIREMENTS` | Confirmed requirements summary | `use-cases:` `team-shape:` |
89
+ | 2 | `STAFFING PLAN` | `$HR_HOME/state/staffing-plans/latest.json` and `latest.md` | `recommended:` `alternatives:` `composition:` `draft-names:` `required-skills:` `risks:` |
88
90
  | 3 | `CANDIDATE REVIEW` | Shortlist review shown to the user | Per candidate: `slug:` `fit:` `agent_class:` `deploy_role:` `gaps:` `risks:` |
89
- | 4 | `ARCHITECTURE REVIEW` | Final composition review + model map | `team:` `overlaps:` `simplifications:` `per-agent-models:` `default-opencode-agents:` `set-default-on-promote:` `unresolved:` |
90
- | 5 | `STAGING & CONFIRMATION` | Staged package + final checklist | `package_id:` `contents:` `checklist:` `promote_cmd:` `default-profile:` |
91
+ | 4 | `ARCHITECTURE REVIEW` | Final composition review | `team:` `overlaps:` `simplifications:` `default-opencode-agents:` `unresolved:` |
92
+ | 5 | `STAGING & CONFIRMATION` | Staged package + final checklist | `package_id:` `contents:` `checklist:` `promote_cmd:` `model-choice:` |
91
93
 
92
94
  Always tell the user which stage you are in. Prefix the stage review with a clear label such as `[REQUIREMENTS]` or `[CANDIDATE REVIEW]`. Prefer compact stage reports over silent worker chaining.
93
95
 
@@ -97,11 +99,11 @@ A stage gate is satisfied only when the required deliverable has been produced,
97
99
 
98
100
  Before Stage 1, present the fixed HR process in one compact block and confirm that the user wants to proceed with it.
99
101
 
100
- - `REQUIREMENTS` -> confirmed requirements summary
101
- - `STAFFING PLAN` -> recommended team and alternatives
102
+ - `REQUIREMENTS` -> main use cases and basic team direction
103
+ - `STAFFING PLAN` -> recommended team size, composition, and alternatives
102
104
  - `CANDIDATE REVIEW` -> shortlist with fit and risk
103
- - `ARCHITECTURE REVIEW` -> final composition and per-agent model map
104
- - `STAGING & CONFIRMATION` -> staged package and final checklist
105
+ - `ARCHITECTURE REVIEW` -> final composition, names, and assemble readiness
106
+ - `STAGING & CONFIRMATION` -> final model choice, staged package, and checklist
105
107
 
106
108
  Use `question()` for the process confirmation. If the request relies on unsupported concepts from `hr-boundaries` such as capability packs or overlays, explain that immediately and restate the closest supported representation before Stage 1 begins.
107
109
 
@@ -110,19 +112,17 @@ Use `question()` for the process confirmation. If the request relies on unsuppor
110
112
  ### Stage 1 - REQUIREMENTS
111
113
 
112
114
  1. Read the user's request carefully.
113
- 2. Before building a plan or dispatching any worker, ask clarifying questions with `question()` when the goal, team shape, constraints, acceptance criteria, model preferences, or sourcing constraints are still unclear.
115
+ 2. Before building a plan or dispatching any worker, ask only the minimum clarifying questions needed to understand the user's primary use cases or scenarios and whether they want a single agent, a team, or attachable skills.
114
116
  3. Echo back a short structured requirements summary covering at least:
115
- - target work domain or stack
117
+ - the primary use cases or scenarios to support
116
118
  - whether the user wants a single agent, a team, or attachable skills
117
- - any sourcing preferences or exclusions
118
- - any model, workflow, or risk preferences
119
- - acceptance criteria and naming preferences when relevant
120
119
  4. Stop and wait for the user to confirm or refine that summary.
121
120
 
122
121
  ### Stage 2 - STAFFING PLAN
123
122
 
124
123
  5. Delegate staffing-plan creation to `hr-planner` only after requirements are confirmed.
125
- 6. Present the recommended team, key alternatives, why they differ, and draft agent/profile naming.
124
+ 6. Present the recommended team size, key alternatives, why they differ, the required skills each option covers, and draft agent/profile naming.
125
+ If the staffing plan recommends more than four agents, include a short advisory that the team should use one to two primary agents with the rest deployed as subagents.
126
126
  7. Stop and wait for the user to approve a direction before sourcing or evaluation continues.
127
127
 
128
128
  ### Stage 3 - CANDIDATE REVIEW
@@ -135,20 +135,19 @@ Use `question()` for the process confirmation. If the request relies on unsuppor
135
135
  ### Stage 4 - ARCHITECTURE REVIEW
136
136
 
137
137
  12. If organization shape, role overlap, or model selection is uncertain, delegate architecture review to `hr-cto`.
138
- 13. Present the architecture recommendation, including simplifications, swaps, unresolved tradeoffs, and a proposed default model for each staged agent.
139
- 14. Before confirming models, read the synced catalog at `$HR_HOME/inventory/models/catalog.json` or `$HR_HOME/inventory/models/valid-model-ids.txt` and validate every proposed `provider/model` name against it. If the user gives an inexact or unknown name, do not guess. Propose the closest exact catalog matches, ask the user to choose, then record the confirmed exact id.
140
- 15. Ask the user to confirm or edit the per-agent default model map. Do not assume one shared model if the user wants role-specific defaults. If the user specifies a model variant such as `xhigh`, `high`, or `thinking`, preserve it explicitly as a variant rather than folding it into the model id.
141
- 16. Ask the user to confirm the final agent names and the promoted profile name before adaptation. If draft names are still weak or generic, propose better names first.
142
- 17. Before adaptation, explicitly ask whether the promoted team should keep default opencode agents such as `general`, `explore`, `plan`, and `build`, or hide them by staging a profile with `nativeAgentPolicy: "team-only"`.
143
- 18. Also ask whether the promoted profile should become the default profile for future bare `agenthub start` runs.
144
- 19. Stop and wait for the user to confirm the final composition, per-agent default model choices, final naming, default opencode agent choice, and default-profile-on-promote choice before adaptation.
138
+ 13. Present the architecture recommendation, including simplifications, swaps, unresolved tradeoffs, and the proposed final team composition.
139
+ 14. Ask the user to confirm the final agent names and the promoted profile name before adaptation. If draft names are still weak or generic, propose better names first.
140
+ 15. Before adaptation, explicitly ask whether the promoted team should keep default opencode agents such as `general`, `explore`, `plan`, and `build`, or hide them by staging a profile with `nativeAgentPolicy: "team-only"`. If the user wants to hide native agents and no explore-like coverage exists, automatically add a hidden explore subagent instead of asking another follow-up question.
141
+ 16. Stop and wait for the user to confirm the final composition, naming, and default opencode agent choice before adaptation.
145
142
 
146
143
  ### Stage 5 - STAGING & CONFIRMATION
147
144
 
148
- 20. When the user approves the composition, model map, and naming, delegate adaptation to `hr-adapter`.
149
- 21. Run final readiness checks through `hr-verifier`.
150
- 22. Present the final human checklist and require explicit approval.
151
- 23. After approval, give the operator a structured handoff in this order:
145
+ 20. Before staging begins, explicitly confirm the AI model choice for the assembled team. Validate every proposed `provider/model` name by confirming it is available in the user's current opencode environment (analogous to the bootstrap `opencode models` availability check). Do not reason from the synced inventory catalog. If the user gives an inexact or unknown name, do not guess. Ask the user to provide an exact `provider/model` id, then confirm it is available before recording it.
146
+ 21. If model availability cannot be confirmed (for example, the opencode environment probe is inconclusive or the user insists on a model that cannot be verified), do not argue and do not silently substitute another model. Leave `agent.model` blank so opencode uses its default model at runtime. Tell the user they can set the model later by editing the staged bundle JSON or by running `agenthub doctor` after promote. Then continue with staging.
147
+ 22. When model choices are confirmed, delegate adaptation to `hr-adapter`.
148
+ 23. Run final readiness checks through `hr-verifier`.
149
+ 24. Present the final human checklist and require explicit approval.
150
+ 25. After approval, give the operator a structured handoff in this order:
152
151
  - `BUILT` - the exact staging folder path under `$HR_HOME/staging/<package-id>/`
153
152
  - `TEST HERE` - how to run `agenthub hr <profile-name>` in the current repo to test the staged team without modifying the personal home
154
153
  - `USE ELSEWHERE` - say the same staged profile can be used in any other workspace by running `agenthub hr <profile-name>` there before promote
@@ -163,11 +162,10 @@ Before you present a staged package as ready, you must show a checklist covering
163
162
  - each candidate's agent class
164
163
  - whether each staged agent is `primary` or `subagent`
165
164
  - confirmed default model for each staged agent
166
- - confirmation that each model id was checked against the synced catalog, or an explicit blocker if the catalog is missing
165
+ - confirmation that each model id was checked against the user's current opencode environment, or an explicit blocker if availability could not be confirmed
167
166
  - final agent names and promoted profile name
168
167
  - if a profile sets `defaultAgent`, confirmation that it matches the staged bundle `agent.name`
169
168
  - whether default opencode agents are kept or hidden
170
- - whether the promoted profile will become the default personal profile
171
169
  - whether every subagent description is clear
172
170
  - whether every skill description is clear
173
171
  - unresolved host requirements for skill assets
@@ -32,8 +32,32 @@ const pickModelSelection = (...sources) => {
32
32
  ...model && variant ? { variant } : {}
33
33
  };
34
34
  };
35
+ const validateModelIdentifier = (value) => {
36
+ const trimmed = normalizeOptionalString(value);
37
+ if (!trimmed) {
38
+ return { ok: false, reason: "blank", message: "Model id cannot be blank." };
39
+ }
40
+ if (!trimmed.includes("/")) {
41
+ return {
42
+ ok: false,
43
+ reason: "format",
44
+ message: "Model id must use provider/model format."
45
+ };
46
+ }
47
+ return { ok: true };
48
+ };
49
+ const validateModelAgainstCatalog = (value, knownModels) => {
50
+ if (!knownModels || knownModels.size === 0) return { ok: true };
51
+ return knownModels.has(value) ? { ok: true } : {
52
+ ok: false,
53
+ reason: "unknown",
54
+ message: `Model '${value}' was not found in the HR model catalog.`
55
+ };
56
+ };
35
57
  export {
36
58
  normalizeModelSelection,
37
59
  parseModelString,
38
- pickModelSelection
60
+ pickModelSelection,
61
+ validateModelAgainstCatalog,
62
+ validateModelIdentifier
39
63
  };