Skip to content

feat(sdd): add JD agent definitions and model assignment foundation#475

Open
danielgap wants to merge 7 commits into
Gentleman-Programming:mainfrom
danielgap:feat/jd-1-foundation
Open

feat(sdd): add JD agent definitions and model assignment foundation#475
danielgap wants to merge 7 commits into
Gentleman-Programming:mainfrom
danielgap:feat/jd-1-foundation

Conversation

@danielgap
Copy link
Copy Markdown

@danielgap danielgap commented May 8, 2026

🔗 Linked Issue

Closes #208


🏷️ PR Type

  • type:feature — New feature (non-breaking change that adds functionality)

📝 Summary

Adds the foundational layer for configurable judgment-day agents: 3 JD agent definitions in the OpenCode overlay, phase discovery functions, model assignment table entries, and root model exclusion.

This is PR 1 of 3 in a chained approach to keep each PR under 400 lines.


Cross-Agent Contract

Agent JD agents in overlay Model assignments Prompt files TUI picker
OpenCode This PR This PR N/A (uses overlay) #477
Claude Code #476 #477
Kiro #476 #477

This PR enables the OpenCode foundation. Claude Code and Kiro counterparts come in #476 (agent prompt files). End-to-end validation for all agents is in #477.


📂 Changes

File / Area What Changed
internal/assets/opencode/sdd-overlay-multi.json 3 JD agent definitions (jd-judge-a, jd-judge-b, jd-fix-agent) + orchestrator delegation permissions
internal/opencode/models.go JDPhases() and ConfigurableAgentPhases() for dynamic phase discovery
internal/components/sdd/inject.go Model assignment rows for JD agents, reason strings, isJDAgent() helper
internal/model/claude_model.go JD entries in Balanced/Performance/Economy presets + ClaudeModelPresetDiversity()

🧪 Test Plan

  • Unit tests pass (go test ./...)
  • Manually verified: sync produces 14 agents in opencode.json (11 SDD + 3 JD)
  • Root model exclusion: JD agents do NOT inherit root model

✅ Contributor Checklist

  • PR is linked to an issue with status:approved
  • I have added the appropriate type:* label to this PR
  • Unit tests pass (go test ./...)
  • My commits follow Conventional Commits format
  • My commits do not include Co-Authored-By trailers

Chain Context

Field Value
Chain JD Configurable Models (#208)
Tracker PR Not needed (stacked to main)
Position 1 of 3
Base main
Depends on None
Follow-up #476 (agent assets)
Review budget 109 / 400
Starts at Current main
Ends with JD agents in OpenCode overlay + model assignment tables ready

Chain Overview

main
 └── 📍 #475 This PR (foundation — OpenCode overlay + model tables)
      └── #476 PR 2 (agent assets — Claude Code + Kiro prompt files)
           └── #477 PR 3 (TUI integration — validates all agents end-to-end)

Scope

Autonomy

  • This PR has one deliverable scope
  • This PR can be rolled back without unrelated changes

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR lays the groundwork for adding configurable “judgment-day” (JD) sub-agents alongside the existing SDD orchestration stack in OpenCode, including new agent definitions and initial model-assignment plumbing.

Changes:

  • Added JD agent name discovery helpers (JDPhases, ConfigurableAgentPhases) in the OpenCode models package.
  • Extended Claude model presets to include JD agents and introduced a diversity-oriented preset.
  • Updated SDD injection logic and OpenCode multi overlay to define JD agents, add delegation permissions, and adjust model-injection behavior for JD agents.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
internal/opencode/models.go Adds JD agent name lists and a combined “configurable agents” list helper.
internal/model/claude_model.go Adds JD keys to existing presets and introduces a diversity preset for JD reviews.
internal/components/sdd/inject.go Adds JD rows/reasons to the model assignment section and excludes JD agents from root-model propagation in multi-mode injection.
internal/assets/opencode/sdd-overlay-multi.json Defines JD sub-agents and allows the orchestrator to delegate to them.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 19 to +23
"sdd-archive": "allow",
"sdd-onboard": "allow"
"sdd-onboard": "allow",
"jd-judge-a": "allow",
"jd-judge-b": "allow",
"jd-fix-agent": "allow"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in PR #477 — tests updated for the expanded agent count and permission map.

Comment on lines +1611 to +1616
// 3. Fresh install or new agent: use root model as default to break inheritance.
// Exception: JD agents are excluded from root model propagation to support
// independent model configuration and diversity of perspective between judges.
if !isJDAgent(phase) {
agentMap["model"] = rootModelID
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By design — JD agents are excluded from root model propagation to support independent model configuration and diversity. Test added in PR #477.

Comment on lines +221 to +227
// ConfigurableAgentPhases returns all agent names that support per-agent
// model configuration. This includes SDD phases + JD agents.
// Used by the TUI model picker and ReadCurrentModelAssignments.
func ConfigurableAgentPhases() []string {
phases := SDDPhases()
phases = append(phases, JDPhases()...)
return phases
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring updated — callers use SDDPhases() and JDPhases() separately based on context.

Copy link
Copy Markdown
Contributor

@Alan-TheGentleman Alan-TheGentleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This slice only shows the OpenCode foundation, while the chain needs to land with both OpenCode and Claude Code support clearly covered.

Before this can move forward, please add the missing type:feature label and update the chain notes to make the cross-agent contract explicit: what this PR enables for OpenCode, what the Claude Code counterpart is, and which PR in the chain completes it.

@danielgap
Copy link
Copy Markdown
Author

@Alan-TheGentleman Could you add the type:feature label to this PR? I don't have permissions to add labels. Thanks!

@Alan-TheGentleman Alan-TheGentleman added the type:feature New feature label May 10, 2026
@Alan-TheGentleman
Copy link
Copy Markdown
Contributor

Alan-TheGentleman commented May 10, 2026

Added the type:feature label. Thanks for flagging the permission issue.

Copilot AI review requested due to automatic review settings May 11, 2026 08:55
@danielgap danielgap force-pushed the feat/jd-1-foundation branch from 671b24c to fbff04d Compare May 11, 2026 08:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment on lines +313 to +316
// model configuration. This includes SDD phases + JD agents.
// Used by the inject model assignment table builder and the configurable agent set
// in ReadCurrentModelAssignments. The TUI model picker uses SDDPhases() and
// JDPhases() separately for row layout control.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring already updated in prior commit. ConfigurableAgentPhases returns the combined list for the configurable agent set.

Comment on lines +1611 to +1616
// 3. Fresh install or new agent: use root model as default to break inheritance.
// Exception: JD agents are excluded from root model propagation to support
// independent model configuration and diversity of perspective between judges.
if !isJDAgent(phase) {
agentMap["model"] = rootModelID
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By design — JD agents excluded from root model propagation. Test added in PR #477 verifying this behavior.

Comment on lines 89 to +94
"sdd-apply": ClaudeModelSonnet,
"sdd-verify": ClaudeModelSonnet,
"sdd-archive": ClaudeModelHaiku,
"jd-judge-a": ClaudeModelHaiku,
"jd-judge-b": ClaudeModelHaiku,
"jd-fix-agent": ClaudeModelHaiku,
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — docstring updated to reflect JD agent assignments in Economy preset.

Copilot AI review requested due to automatic review settings May 11, 2026 12:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

Comment on lines +314 to +316
// Used by the inject model assignment table builder and the configurable agent set
// in ReadCurrentModelAssignments. The TUI model picker uses SDDPhases() and
// JDPhases() separately for row layout control.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring updated in fbff04d and 48998df. ConfigurableAgentPhases returns the combined list — callers use SDDPhases() and JDPhases() separately based on context.

Comment on lines +162 to +169
"tools": { "read": true, "glob": true, "grep": true, "bash": true }
},
"jd-judge-b": {
"mode": "subagent",
"hidden": true,
"description": "Adversarial code reviewer — blind judge B for judgment-day protocol",
"prompt": "You are a judgment-day adversarial reviewer. Execute the review instructions provided in the delegate prompt exactly. Do NOT delegate further. Do NOT modify any code — your job is ONLY to find problems.",
"tools": { "read": true, "glob": true, "grep": true, "bash": true }
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 70f167e. Replaced glob/grep with the standard {read, bash} tool set used by all other OpenCode overlay agents.

Comment on lines +162 to +169
"tools": { "read": true, "glob": true, "grep": true, "bash": true }
},
"jd-judge-b": {
"mode": "subagent",
"hidden": true,
"description": "Adversarial code reviewer — blind judge B for judgment-day protocol",
"prompt": "You are a judgment-day adversarial reviewer. Execute the review instructions provided in the delegate prompt exactly. Do NOT delegate further. Do NOT modify any code — your job is ONLY to find problems.",
"tools": { "read": true, "glob": true, "grep": true, "bash": true }
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 70f167e — same as jd-judge-a above.

Comment on lines +1619 to +1624
// 3. Fresh install or new agent: use root model as default to break inheritance.
// Exception: JD agents are excluded from root model propagation to support
// independent model configuration and diversity of perspective between judges.
if !isJDAgent(phase) {
agentMap["model"] = rootModelID
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point — test added in PR #477 (294d4a8): TestInjectOpenCodeMultiModeJDAgentsExcludedFromRootModel asserts JD agents do NOT get a model field when only root model is set, while SDD agents still do.

@Alan-TheGentleman
Copy link
Copy Markdown
Contributor

Thanks, this slice has the right issue link, one type label, and a clear chain role.

The blocker now is mergeability: GitHub reports this PR as conflicting with main, and checks are not reported on the branch. Please resolve the conflicts and rerun checks so we can re-review this as PR 1 of the chain.

danielgap added 7 commits May 15, 2026 00:03
Add jd-judge-a, jd-judge-b, and jd-fix-agent as hidden sub-agents
in the multi-mode overlay. Update orchestrator permissions to allow
delegation to these agents.

Refs: Gentleman-Programming#208
JDPhases returns the judgment-day sub-agent names (jd-judge-a,
jd-judge-b, jd-fix-agent). ConfigurableAgentPhases combines SDD
phases and JD agents for the TUI model picker.

Refs: Gentleman-Programming#208
Add jd-judge-a, jd-judge-b, jd-fix-agent to claudeModelAssignmentRowOrder
and claudeModelAssignmentReasons in inject.go. Add JD entries to all three
existing presets (balanced, performance, economy) in claude_model.go.
Add new ClaudeModelPresetDiversity() preset for perspective diversity
between judges (opus/haiku/sonnet split).

Refs: Gentleman-Programming#208
Add isJDAgent helper and modify injectModelAssignments case 3 to skip
root model fallback for judgment-day agents. This preserves independent
model configuration for diversity of perspective between judges.

Refs: Gentleman-Programming#208
- ClaudeModelPresetDiversity now clones the base map before mutating,
  preventing corruption if ClaudeModelPresetBalanced is ever cached.
- isJDAgent uses a package-level set instead of linear scan, consistent
  with sddPhaseSet pattern in read_assignments.go.
OpenCode overlays only use {read, write, edit, bash} as tool keys.
glob and grep are not referenced anywhere in the codebase and may cause
config rejection. Judges only need read and bash for code review.
Copilot AI review requested due to automatic review settings May 14, 2026 22:08
@danielgap danielgap force-pushed the feat/jd-1-foundation branch from 70f167e to 6dd2553 Compare May 14, 2026 22:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment on lines +20 to +23
"sdd-onboard": "allow",
"jd-judge-a": "allow",
"jd-judge-b": "allow",
"jd-fix-agent": "allow"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already addressed — the test is updated in PR #477 (part of this chain). expectedTaskPermissions() in profiles_test.go iterates opencode.JDPhases() to include JD agent permissions, and TestDefaultOverlayTaskPermissions_ExplicitAllowlist uses includeJD bool to handle multi vs single overlay correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Configurable models for judgment-day in the TUI

3 participants