refactor(materialize/renderers): introduce {SHARED_DIR} placeholder + move _shared/ for primary-agent installs - #71
Merged
Conversation
…lot installs
OpenCode and Copilot have a primary `sdd-orchestrator` agent the user
explicitly selects (a custom agent in opencode.json / a `.agent.md` in
.github/agents/). The orchestrator playbook lives in that agent's prompt
— rendered from ORCHESTRATOR.{opencode,copilot}.md alone.
Until now, the renderer was also:
- prepending REGISTRY.{opencode,copilot}.md to the orchestrator prompt
- capturing the same registry content into r.registryContents for later
injection into AGENTS.md / copilot-instructions.md
Both paths leaked workflow-specific rules into non-workflow sessions
(ambient catalog) and duplicated / contradicted the orchestrator agent's
own playbook (prompt prepend). They were a Claude/Factory pattern
applied where it does not fit.
This change removes both consumers for OpenCode and Copilot:
- opencode.go: skip captureRegistryContent + pass registryPath="" to
synthesizeAgents.
- copilot.go: skip captureRegistryContent + pass registryPath="" to
installOrchestratorAgent.
buildOrchestratorEntry / installOrchestratorAgent still accept a
registryPath argument for backward compatibility — non-empty paths are
still read and prepended — but the canonical caller now passes "".
Tests updated to assert the new contract (RegistryContents must NOT
contain the workflow name for OpenCode/Copilot installs). Renames the
two test functions accordingly.
Pairs with devrune-starter-catalog change that deletes REGISTRY.opencode.md
/ REGISTRY.copilot.md (now dead code from the catalog's perspective) and
slims ORCHESTRATOR.{opencode,copilot}.md to remove duplication with the
deleted REGISTRY blocks.
… move _shared/ for primary-agent installs
Adds a {SHARED_DIR} placeholder that the catalog uses to reference
workflow-shared assets (launch-templates, advisor-templates, envelope-
contract, persistence-contract, recovery). Each renderer resolves it to
its idiomatic path so the same template body works for all agents.
Path resolution per agent:
- claude/factory/codex: workflowDir/_shared/ (legacy — _shared/ stays
inside the orchestrator skill dir, which is a real skill on disk).
- opencode/copilot: workspaceRoot/<workflow-name>/_shared/ — a
workflow-namespaced top-level directory. The legacy
.opencode/sdd-orchestrator/ and .github/skills/sdd-orchestrator/
directories were fantasma containers (no SKILL.md, the orchestrator
is a primary agent in opencode.json / a flat .agent.md). Installing
_shared/ at the top level removes that fantasma directory entirely.
Code changes:
- helpers.go: add {SHARED_DIR} to both buildWorkflowPlaceholderReplacements
(used by opencode/copilot/claude/factory) and buildWorkflowPathReplacements
(used by codex/factory). Each picks the right resolution based on
agentName and workflow.Name.
- opencode.go: change _shared/ copy destination to
workspaceRoot/<workflow-name>/_shared/. Add resolvePlaceholders pass
for the new shared root. Keep legacy workflowDir resolve as a no-op
fallback for backward compat.
- copilot.go: same pattern, destination .github/<workflow-name>/_shared/.
Tests:
- TestOpenCodeRenderer_InstallWorkflow_SkillsUnderSkillsDir / Copilot
equivalent: assert _shared/ at the new path AND assert legacy fantasma
paths are NOT created.
- TestOpenCodeRenderer_InstallWorkflow_SharedVariantSuffixStripping /
Copilot equivalent: same path update.
- TestBuildWorkflowPathReplacements_OnlyPathKeys: now expects 3 keys
({SKILLS_PATH}, {WORKFLOW_DIR}, {SHARED_DIR}) instead of 2.
- TestBuildWorkflowPathReplacements_NoModelKeysEvenWithRoles: allowed key
set extended to include {SHARED_DIR}.
Pairs with devrune-starter-catalog refactor that updates all templates
to use {SHARED_DIR} instead of {WORKFLOW_DIR}/_shared/.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Pairs with the catalog refactor that replaces `{WORKFLOW_DIR}/_shared/` with `{SHARED_DIR}/` in all SDD templates.
Adds a new `{SHARED_DIR}` placeholder. Each renderer resolves it to the path where it actually installs the workflow's `_shared/` assets:
For OpenCode/Copilot the orchestrator is a primary agent (in `opencode.json` / a flat `.agent.md`), so the per-orchestrator skill directory was empty (fantasma container). Installing `_shared/` at a workflow-namespaced top-level path removes that fantasma directory and makes the layout reflect reality.
Changes
`helpers.go`
`opencode.go`
`copilot.go`
Tests
Compatibility
Branched from
This PR is branched from `fix/sdd-opencode-copilot-slim-orchestrator` (PR #70) which is still open. Will need to be rebased onto main after PR #70 merges. The two PRs touch overlapping code in opencode.go / copilot.go but the changes are sequential (PR #70 removes REGISTRY consumption, this PR moves _shared/ install path) — rebase should be clean.
Pairing PR
Catalog: https://github.com/davidarce/devrune-starter-catalog/pull/new/refactor/sdd-shared-dir-placeholder
Recommended merge order: PR #70 → catalog #60 (already merged) → this DevRune PR → catalog `refactor/sdd-shared-dir-placeholder`.
Test plan