From 5ba570c088ed6e4b693eea970ae974ae61c7cf0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20J=C3=A4gle?= Date: Fri, 20 Mar 2026 10:02:48 +0100 Subject: [PATCH 1/2] fix: opencode permissions now allow agents --- .kiro/agents/ade.json | 12 ++++++++++-- .kiro/settings/mcp.json | 7 ++++++- .opencode/agents/ade.md | 9 +++++++-- config.lock.yaml | 7 ++++++- packages/harnesses/src/writers/opencode.spec.ts | 6 ++---- packages/harnesses/src/writers/opencode.ts | 7 +++---- 6 files changed, 34 insertions(+), 14 deletions(-) diff --git a/.kiro/agents/ade.json b/.kiro/agents/ade.json index e07e5d7..5a1604a 100644 --- a/.kiro/agents/ade.json +++ b/.kiro/agents/ade.json @@ -6,7 +6,12 @@ "workflows": { "command": "npx", "args": ["@codemcp/workflows-server@latest"], - "autoApprove": ["*"] + "autoApprove": [ + "whats_next", + "conduct_review", + "list_workflows", + "get_tool_info" + ] }, "agentskills": { "command": "npx", @@ -20,7 +25,10 @@ "write", "shell", "spec", - "@workflows/*", + "@workflows/whats_next", + "@workflows/conduct_review", + "@workflows/list_workflows", + "@workflows/get_tool_info", "@agentskills/*" ], "useLegacyMcpJson": true diff --git a/.kiro/settings/mcp.json b/.kiro/settings/mcp.json index eaf31ce..42396a2 100644 --- a/.kiro/settings/mcp.json +++ b/.kiro/settings/mcp.json @@ -3,7 +3,12 @@ "workflows": { "command": "npx", "args": ["@codemcp/workflows-server@latest"], - "autoApprove": ["*"] + "autoApprove": [ + "whats_next", + "conduct_review", + "list_workflows", + "get_tool_info" + ] }, "agentskills": { "command": "npx", diff --git a/.opencode/agents/ade.md b/.opencode/agents/ade.md index ca95615..4554504 100644 --- a/.opencode/agents/ade.md +++ b/.opencode/agents/ade.md @@ -2,6 +2,12 @@ name: ade description: ADE — Agentic Development Environment agent with project conventions and tools permission: + "workflows*": "ask" + workflows_whats_next: "allow" + workflows_conduct_review: "allow" + workflows_list_workflows: "allow" + workflows_get_tool_info: "allow" + "agentskills*": "allow" read: "*": "allow" "*.env": "deny" @@ -10,7 +16,7 @@ permission: skill: "deny" todoread: "deny" todowrite: "deny" - task: "deny" + task: "allow" lsp: "allow" glob: "allow" grep: "allow" @@ -99,7 +105,6 @@ permission: "useradd *": "deny" "userdel *": "deny" "iptables *": "deny" - doom_loop: "deny" --- You are an AI assistant that helps users develop software features using the workflows server. diff --git a/config.lock.yaml b/config.lock.yaml index 3dd2159..ab7812a 100644 --- a/config.lock.yaml +++ b/config.lock.yaml @@ -1,5 +1,5 @@ version: 1 -generated_at: 2026-03-19T09:28:46.177Z +generated_at: 2026-03-20T08:32:04.912Z choices: process: codemcp-workflows practices: @@ -18,6 +18,11 @@ logical_config: args: - "@codemcp/workflows-server@latest" env: {} + allowedTools: + - whats_next + - conduct_review + - list_workflows + - get_tool_info - ref: agentskills command: npx args: diff --git a/packages/harnesses/src/writers/opencode.spec.ts b/packages/harnesses/src/writers/opencode.spec.ts index 3ee2af3..0d135fa 100644 --- a/packages/harnesses/src/writers/opencode.spec.ts +++ b/packages/harnesses/src/writers/opencode.spec.ts @@ -110,7 +110,6 @@ describe("opencodeWriter", () => { expect(defaultsAgent).toContain('websearch: "ask"'); expect(defaultsAgent).toContain('codesearch: "ask"'); expect(defaultsAgent).toContain('external_directory: "ask"'); - expect(defaultsAgent).toContain('doom_loop: "deny"'); expect(defaultsAgent).toContain('"grep *": "allow"'); expect(defaultsAgent).toContain('"rm *": "deny"'); expect(defaultsFrontmatter.permission).toMatchObject({ @@ -119,15 +118,14 @@ describe("opencodeWriter", () => { grep: "allow", list: "allow", lsp: "allow", - task: "deny", + task: "allow", skill: "deny", todoread: "deny", todowrite: "deny", webfetch: "ask", websearch: "ask", codesearch: "ask", - external_directory: "ask", - doom_loop: "deny" + external_directory: "ask" }); const defaultsPermission = defaultsFrontmatter.permission as { bash: Record; diff --git a/packages/harnesses/src/writers/opencode.ts b/packages/harnesses/src/writers/opencode.ts index f55a321..3b0e9b6 100644 --- a/packages/harnesses/src/writers/opencode.ts +++ b/packages/harnesses/src/writers/opencode.ts @@ -24,9 +24,9 @@ const APPLICABLE_TO_ALL: Record = { "*.env.example": "allow" }, skill: "deny", //we're using an own skills-mcp - todoread: "deny", //no agent-proprieatry todo tools + todoread: "deny", //no agent-proprietary todo tools todowrite: "deny", - task: "deny", + task: "allow", //starts subagents lsp: "allow", glob: "allow", grep: "allow", @@ -129,8 +129,7 @@ const SENSIBLE_DEFAULTS_RULES: Record = { "useradd *": "deny", "userdel *": "deny", "iptables *": "deny" - }, - doom_loop: "deny" + } }; const MAX_AUTONOMY_RULES: Record = { From 41d06466447c785cce39ce6c00db6e77537f6cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20J=C3=A4gle?= Date: Fri, 20 Mar 2026 11:32:03 +0100 Subject: [PATCH 2/2] feat(core): add `replaces` field to SkillDefinition for extension skill override MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Intent When an extension contributes domain-specific skills (e.g. `sabdx-architecture`) that supersede generic baseline skills provided by `codemcp-workflows-skilled` (e.g. `architecture`), both sets were previously included in the resolved skills list — resulting in duplicate, redundant skills shown at setup and installed into the project. This change allows extension authors to declare which generic skills their domain skill replaces, so the resolver can produce a clean, non-redundant final list. ## Key changes - `InlineSkill` and `ExternalSkill` now accept an optional `replaces?: string[]` field listing the names of skills the declaring skill supersedes. - The resolver post-processes the merged skills list: it collects all replaced names into a Set, deduplicates by name (last-writer-wins), then filters out any skill whose name appears in the replaced set. The result is the effective, non-redundant skills list. - The `replaces` field is a resolver-level concern only — it is never written to SKILL.md frontmatter and does not appear in the lock file (which records the post-dedup list). - With the sadb-agentic-template extension declaring `replaces` on all five lifecycle skills, the setup wizard reduces from 13 → 8 skills for the sabdx-frontend scenario. ## Dependencies and side effects - The `replaces` field is purely additive — existing extension files without it continue to work unchanged. - `writeInlineSkills()` in `util.ts` required no changes: it only reads `name`, `description`, and `body`, so `replaces` is silently ignored during file writing. --- .beads/issues.jsonl | 11 + .beads/last-touched | 2 +- ...-ade-extension-override-skills-d44z9p.json | 29 ++ ...elopment-plan-extension-override-skills.md | 110 ++++++ packages/core/src/resolver.spec.ts | 330 ++++++++++++++++++ packages/core/src/resolver.ts | 16 + packages/core/src/types.ts | 14 + packages/core/src/writers/skills.spec.ts | 46 +++ .../harnesses/src/writers/opencode.spec.ts | 2 +- 9 files changed, 558 insertions(+), 2 deletions(-) create mode 100644 .vibe/beads-state-ade-extension-override-skills-d44z9p.json create mode 100644 .vibe/development-plan-extension-override-skills.md diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index 3ec1c4d..0e24fa2 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -84,3 +84,14 @@ {"id":"ade-8.3","title":"Fix","description":"Implement the solution based on your analysis: - If exists: Follow the design from it - Otherwise: Elaborate design options and present them to the user Before implementing, assess the approach: - How critical is this system? What is the blast radius if the fix causes issues? - Should this be a minimal fix or a more comprehensive solution? Make targeted changes that address the root cause without introducing new issues. Be careful to maintain existing functionality while fixing the bug.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-20T08:52:50.645347+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-20T08:52:50.645347+01:00","dependencies":[{"issue_id":"ade-8.3","depends_on_id":"ade-8","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-8.3","depends_on_id":"ade-8.2","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]} {"id":"ade-8.4","title":"Verify","description":"Test the fix thoroughly to ensure the original bug is resolved and no new issues were introduced. Run existing tests, create new ones if needed, and verify the solution is robust.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-20T08:52:50.824002+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-20T08:52:50.824002+01:00","dependencies":[{"issue_id":"ade-8.4","depends_on_id":"ade-8","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-8.4","depends_on_id":"ade-8.3","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]} {"id":"ade-8.5","title":"Finalize","description":"Ensure code quality and documentation accuracy through systematic cleanup and review. **STEP 1: Code Cleanup** Systematically clean up development artifacts: - Remove all temporary debug output statements used during bug investigation (console logging, print statements, debug output functions) - Address each TODO/FIXME comment by either implementing the solution or documenting why it's deferred - Remove completed TODOs and convert remaining ones to proper issue tracking if needed - Remove temporary debugging code, test code blocks, and commented-out code - Ensure proper error handling replaces temporary debug logging **STEP 2: Documentation Review** Review and update documentation to reflect the bug fix: - If exists, update it if design details were refined or changed during the fix - Compare documentation against the actual bug fix implementation - Update only the documentation sections that have functional changes - Remove references to investigation iterations, progress notes, and temporary decisions - Ensure documentation describes the final fixed state, not the debugging process - Ask the user to review document updates **STEP 3: Final Validation** - Run existing tests to ensure cleanup didn't break functionality - Verify documentation accuracy with a final review - Ensure bug fix is ready for production - Update task progress and mark completed work as you finalize the bug fix","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-20T08:52:50.99667+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-20T08:52:50.99667+01:00","dependencies":[{"issue_id":"ade-8.5","depends_on_id":"ade-8","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-8.5","depends_on_id":"ade-8.4","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]} +{"id":"ade-9","title":"ade: epcc (development-plan-extension-override-skills.md)","description":"Responsible vibe engineering session using epcc workflow for ade","status":"open","priority":2,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-20T11:16:22.460649+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-20T11:16:22.460649+01:00"} +{"id":"ade-9.1","title":"Explore","description":"Research the codebase to understand existing patterns and gather context about the problem space. - If uncertain about conventions or rules, ask the user about them - Read relevant files and documentation - If exists: Understand and document requirements there - Otherwise: Document requirements in your task management system Focus on understanding without writing code yet. Document your findings and create tasks as needed.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-20T11:16:22.605996+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-20T11:16:22.605996+01:00","dependencies":[{"issue_id":"ade-9.1","depends_on_id":"ade-9","type":"parent-child","created_at":"0001-01-01T00:00:00Z"}]} +{"id":"ade-9.2","title":"Plan","description":"Create a detailed implementation strategy based on your exploration: - If exists: Base your strategy on requirements from it - Otherwise: Use existing task context Break down the work into specific, actionable tasks. Consider edge cases, dependencies, and potential challenges. - If architectural changes needed and exists: Document in - Otherwise: Create tasks to track architectural decisions - If exists: Adhere to the design in it - Otherwise: Elaborate design options and present them to the user Document the planning work thoroughly and create implementation tasks as part of the code phase as needed.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-20T11:16:22.745983+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-20T11:16:22.745983+01:00","dependencies":[{"issue_id":"ade-9.2","depends_on_id":"ade-9","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-9.2","depends_on_id":"ade-9.1","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]} +{"id":"ade-9.3","title":"Code","description":"Follow your plan to build the solution: - If exists: Follow the design from it - Otherwise: Elaborate design options and present them to the user - If exists: Build according to the architecture from it - Otherwise: Elaborate architectural options and present them to the user - If exists: Ensure requirements from it are met - Otherwise: Ensure existing requirements are met based on your task context Write clean, well-structured code with proper error handling. Prevent regression by building, linting, and executing existing tests. Stay flexible and adapt the plan as you learn more during implementation. Update task progress and create new tasks as needed.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-20T11:16:22.881145+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-20T11:16:22.881145+01:00","dependencies":[{"issue_id":"ade-9.3","depends_on_id":"ade-9","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-9.3","depends_on_id":"ade-9.2","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]} +{"id":"ade-9.3.1","title":"Add replaces?: string[] to InlineSkill and ExternalSkill in types.ts","status":"closed","priority":1,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-20T11:21:56.87809+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-20T11:25:09.682568+01:00","closed_at":"2026-03-20T11:25:09.682568+01:00","close_reason":"Closed","dependencies":[{"issue_id":"ade-9.3.1","depends_on_id":"ade-9.3","type":"parent-child","created_at":"0001-01-01T00:00:00Z"}]} +{"id":"ade-9.3.2","title":"Post-process skills in resolver: dedup by name + filter replaced names","status":"closed","priority":1,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-20T11:21:57.036539+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-20T11:25:26.025057+01:00","closed_at":"2026-03-20T11:25:26.025057+01:00","close_reason":"Closed","dependencies":[{"issue_id":"ade-9.3.2","depends_on_id":"ade-9.3","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-9.3.2","depends_on_id":"ade-9.3.1","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]} +{"id":"ade-9.3.3","title":"Write resolver tests: replaces dedup, ordering, no-op when replaces empty","status":"closed","priority":1,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-20T11:21:57.182342+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-20T11:26:32.609547+01:00","closed_at":"2026-03-20T11:26:32.609547+01:00","close_reason":"Closed","dependencies":[{"issue_id":"ade-9.3.3","depends_on_id":"ade-9.3","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-9.3.3","depends_on_id":"ade-9.3.2","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]} +{"id":"ade-9.3.4","title":"Update skillsWriter spec: pass-through of replaces field","status":"closed","priority":2,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-20T11:21:57.338918+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-20T11:27:04.797258+01:00","closed_at":"2026-03-20T11:27:04.797258+01:00","close_reason":"Closed","dependencies":[{"issue_id":"ade-9.3.4","depends_on_id":"ade-9.3","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-9.3.4","depends_on_id":"ade-9.3.1","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]} +{"id":"ade-9.3.5","title":"Update writeInlineSkills: ignore replaces field when writing SKILL.md","status":"closed","priority":2,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-20T11:21:57.510647+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-20T11:27:13.986652+01:00","closed_at":"2026-03-20T11:27:13.986652+01:00","close_reason":"Closed","dependencies":[{"issue_id":"ade-9.3.5","depends_on_id":"ade-9.3","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-9.3.5","depends_on_id":"ade-9.3.1","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]} +{"id":"ade-9.3.6","title":"Update ade.extensions.mjs example with replaces declarations","status":"closed","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-20T11:21:57.649406+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-20T11:28:51.412822+01:00","closed_at":"2026-03-20T11:28:51.412822+01:00","close_reason":"Closed","dependencies":[{"issue_id":"ade-9.3.6","depends_on_id":"ade-9.3","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-9.3.6","depends_on_id":"ade-9.3.2","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]} +{"id":"ade-9.4","title":"Commit","description":"Ensure code quality and documentation accuracy through systematic cleanup and review. **STEP 1: Code Cleanup** Systematically clean up development artifacts: 1. **Remove Debug Output**: Search for and remove all temporary debug output statements used during development. Look for language-specific debug output methods (console logging, print statements, debug output functions). Remove any debugging statements that were added for development purposes. 2. **Review TODO/FIXME Comments**: - Address each TODO/FIXME comment by either implementing the solution or documenting why it's deferred - Remove completed TODOs - Convert remaining TODOs to proper issue tracking if needed 3. **Remove Debugging Code Blocks**: - Remove temporary debugging code, test code blocks, and commented-out code - Clean up any experimental code that's no longer needed - Ensure proper error handling replaces temporary debug logging **STEP 2: Documentation Review** Review and update documentation to reflect final implementation: 1. **Update Long-Term Memory Documents**: Based on what was actually implemented: - If exists: Update it if requirements changed during development - If exists: Update it if architectural impacts were identified - If exists: Update it if design details were refined or changed - Otherwise: Document any changes in the plan file 2. **Compare Against Implementation**: Review documentation against actual implemented functionality 3. **Update Changed Sections**: Only modify documentation sections that have functional changes 4. **Remove Development Progress**: Remove references to development iterations, progress notes, and temporary decisions 5. **Focus on Final State**: Ensure documentation describes the final implemented state, not the development process 6. **Ask User to Review Document Updates** **STEP 3: Final Validation** - Run existing tests to ensure cleanup didn't break functionality - Verify documentation accuracy with a final review - Ensure code is ready for production/delivery Update task progress and mark completed work as you finalize the feature.","status":"open","priority":3,"issue_type":"task","owner":"github@beimir.net","created_at":"2026-03-20T11:16:23.028674+01:00","created_by":"Oliver Jägle","updated_at":"2026-03-20T11:16:23.028674+01:00","dependencies":[{"issue_id":"ade-9.4","depends_on_id":"ade-9","type":"parent-child","created_at":"0001-01-01T00:00:00Z"},{"issue_id":"ade-9.4","depends_on_id":"ade-9.3","type":"blocks","created_at":"0001-01-01T00:00:00Z"}]} diff --git a/.beads/last-touched b/.beads/last-touched index d517a43..a5dcc48 100644 --- a/.beads/last-touched +++ b/.beads/last-touched @@ -1 +1 @@ -ade-8.5 +ade-9.3.6 diff --git a/.vibe/beads-state-ade-extension-override-skills-d44z9p.json b/.vibe/beads-state-ade-extension-override-skills-d44z9p.json new file mode 100644 index 0000000..0370b08 --- /dev/null +++ b/.vibe/beads-state-ade-extension-override-skills-d44z9p.json @@ -0,0 +1,29 @@ +{ + "conversationId": "ade-extension-override-skills-d44z9p", + "projectPath": "/Users/oliverjaegle/projects/privat/codemcp/ade", + "epicId": "ade-9", + "phaseTasks": [ + { + "phaseId": "explore", + "phaseName": "Explore", + "taskId": "ade-9.1" + }, + { + "phaseId": "plan", + "phaseName": "Plan", + "taskId": "ade-9.2" + }, + { + "phaseId": "code", + "phaseName": "Code", + "taskId": "ade-9.3" + }, + { + "phaseId": "commit", + "phaseName": "Commit", + "taskId": "ade-9.4" + } + ], + "createdAt": "2026-03-20T10:16:23.345Z", + "updatedAt": "2026-03-20T10:16:23.345Z" +} \ No newline at end of file diff --git a/.vibe/development-plan-extension-override-skills.md b/.vibe/development-plan-extension-override-skills.md new file mode 100644 index 0000000..076a088 --- /dev/null +++ b/.vibe/development-plan-extension-override-skills.md @@ -0,0 +1,110 @@ +# Development Plan: ade (extension-override-skills branch) + +*Generated on 2026-03-20 by Vibe Feature MCP* +*Workflow: [epcc](https://mrsimpson.github.io/responsible-vibe-mcp/workflows/epcc)* + +## Goal +Allow extension-contributed skills to declare that they replace/supersede generic baseline skills registered by the process option (`codemcp-workflows-skilled`). The resolver should deduplicate the final skills list so that only the effective (non-replaced) skills are shown and installed. + +## Explore + +### Tasks +- [x] Understand current skill registration flow (process → recipe → skills writer → LogicalConfig) +- [x] Identify the exact duplication: `codemcp-workflows-skilled` registers 5 generic skills; architecture extensions like `sabdx-frontend` register domain-specific replacements with different names +- [x] Evaluate solution options (replaces field, baseline priority, excludes at option level) +- [x] Agree on preferred approach: `replaces?: string[]` on `SkillDefinition` + +### Phase Entrance Criteria: +*(initial phase — no prior phase)* + +## Plan + +### Tasks + +*Tasks managed via `bd` CLI* + +### Phase Entrance Criteria: +- [ ] The problem is clearly understood: duplicate generic + domain-specific skills shown at setup +- [ ] At least two solution alternatives have been evaluated +- [ ] The preferred approach (`replaces` field on `SkillDefinition`) is agreed upon +- [ ] Scope is clear: which files are touched + +## Code + +### Tasks + +*Tasks managed via `bd` CLI* + +### Phase Entrance Criteria: +- [ ] Concrete implementation plan is documented (what changes in which file) +- [ ] Edge cases are identified (ordering, name-collision, TUI display) +- [ ] Test strategy is defined + +## Commit + +### Tasks +- [ ] Squash WIP commits: `git reset --soft `. Then, create a conventional commit. In the message, first summarize the intentions and key decisions from the development plan. Then, add a brief summary of the key changes and their side effects and dependencies. + +*Tasks managed via `bd` CLI* + +### Phase Entrance Criteria: +- [ ] All implementation tasks are done and tests pass +- [ ] The `replaces` field works end-to-end (resolver deduplicates, TUI shows reduced list) +- [ ] No regressions in existing resolver tests + +## Key Decisions + +### KD-1: Add `replaces?: string[]` to `SkillDefinition` +Both `InlineSkill` and `ExternalSkill` get an optional `replaces` field. Extension authors list the generic skill names they supersede. Deduplication happens as a post-processing step in the resolver (`resolve()` in `resolver.ts`). + +### KD-2: Deduplication strategy — last-writer-wins + replaces set +After all provisions are merged, the resolver: +1. Builds a Set of all names that appear in any skill's `replaces` array. +2. Deduplicates by name (last occurrence wins, preserving insertion order otherwise) using a Map. +3. Filters out any skill whose `name` is in the replaced-names Set. + +This means: if `sabdx-architecture` declares `replaces: ["architecture"]`, the generic `architecture` skill is dropped. The final list contains `sabdx-architecture` only. + +### KD-3: Skill file names on disk — unchanged +Skills are written to `.ade/skills//SKILL.md` by `writeInlineSkills()` in `util.ts`. +- The generic `architecture` skill → `.ade/skills/architecture/SKILL.md` +- The replacing `sabdx-architecture` skill → `.ade/skills/sabdx-architecture/SKILL.md` + +Because `architecture` is filtered out **before** `writeInlineSkills()` is called, **no file is written for `architecture`**. Only `sabdx-architecture/SKILL.md` ends up on disk. The `replaces` field is a resolver-level concern; it does not need to be written to SKILL.md frontmatter. + +### KD-4: `replaces` field is stripped before writing SKILL.md +`writeInlineSkills()` uses the skill's `name`, `description`, and `body` for the SKILL.md frontmatter. The `replaces` field is simply ignored during file writing — no changes needed in `util.ts`. + +### KD-5: `replaces` field is NOT persisted in `config.lock.yaml` +The lock file records `logical_config`, which is the *post-dedup* skills list. Replaced skills never appear in the lock file. + +### KD-6: Ordering — extensions should register skills after process +The resolver processes facets in `sortFacets()` order. The `architecture` facet comes after `process`, so extension skills are appended after the generic ones. The last-writer-wins Map dedup naturally lets extension skills win. But `replaces` is independent of ordering — it is an explicit declaration. + +## Notes + +### Full flow for the sadb-frontend scenario +1. `codemcp-workflows-skilled` recipe runs → appends to `result.skills`: `[starting-project, architecture, application-design, coding, testing]` +2. `sabdx-frontend` recipe runs → appends: `[sabdx-tasks, sabdx-starting-project{replaces:["starting-project"]}, sabdx-architecture{replaces:["architecture"]}, sabdx-application-design{replaces:["application-design"]}, sabdx-coding{replaces:["coding"]}, sabdx-testing{replaces:["testing"]}, tdd]` +3. `conventional-commits` recipe runs → appends: `[conventional-commits]` +4. Raw merged list: 13 skills +5. Post-dedup (name Map + replaces filter): 8 skills remain — `[sabdx-tasks, sabdx-starting-project, sabdx-architecture, sabdx-application-design, sabdx-coding, sabdx-testing, tdd, conventional-commits]` +6. `writeInlineSkills()` writes SKILL.md files for the 6 inline sabdx-* skills under `.ade/skills//` +7. `installSkills()` installs all 8 into `.agentskills/skills/` + +### What files exist on disk after setup +- `.ade/skills/sabdx-tasks/SKILL.md` +- `.ade/skills/sabdx-starting-project/SKILL.md` +- `.ade/skills/sabdx-architecture/SKILL.md` +- `.ade/skills/sabdx-application-design/SKILL.md` +- `.ade/skills/sabdx-coding/SKILL.md` +- `.ade/skills/sabdx-testing/SKILL.md` +- NO `.ade/skills/architecture/SKILL.md` (replaced, never written) +- NO `.ade/skills/starting-project/SKILL.md` (replaced, never written) +- etc. + +### The `tdd` skill from the extension — no `replaces` needed +`tdd` is an external skill (`source: "mrsimpson/skills-coding"`) and there is no generic `tdd` skill in `codemcp-workflows-skilled`. No clash. + +--- +*This plan is maintained by the LLM and uses beads CLI for task management. Tool responses provide guidance on which bd commands to use for task management.* diff --git a/packages/core/src/resolver.spec.ts b/packages/core/src/resolver.spec.ts index b180fcc..8aeb36c 100644 --- a/packages/core/src/resolver.spec.ts +++ b/packages/core/src/resolver.spec.ts @@ -246,6 +246,336 @@ describe("resolve", () => { ); expect(agentskills).toBeUndefined(); }); + + it("removes a skill when another skill declares it in replaces", async () => { + const skillsCatalog: Catalog = { + facets: [ + { + id: "process", + label: "Process", + description: "Process", + required: true, + options: [ + { + id: "base", + label: "Base", + description: "Base process", + recipe: [ + { + writer: "skills", + config: { + skills: [ + { + name: "architecture", + description: "Generic architecture skill", + body: "Generic architecture content." + } + ] + } + } + ] + } + ] + }, + { + id: "architecture", + label: "Architecture", + description: "Stack", + required: false, + options: [ + { + id: "sabdx", + label: "SABDX", + description: "SABDX frontend", + recipe: [ + { + writer: "skills", + config: { + skills: [ + { + name: "sabdx-architecture", + description: "SABDX architecture skill", + body: "SABDX architecture content.", + replaces: ["architecture"] + } + ] + } + } + ] + } + ] + } + ] + }; + + const userConfig: UserConfig = { + choices: { process: "base", architecture: "sabdx" } + }; + + const result = await resolve(userConfig, skillsCatalog, registry); + + expect(result.skills).toHaveLength(1); + expect(result.skills[0].name).toBe("sabdx-architecture"); + expect( + result.skills.find((s) => s.name === "architecture") + ).toBeUndefined(); + }); + + it("removes multiple skills when a single skill declares several replaces entries", async () => { + const skillsCatalog: Catalog = { + facets: [ + { + id: "process", + label: "Process", + description: "Process", + required: true, + options: [ + { + id: "base", + label: "Base", + description: "Base", + recipe: [ + { + writer: "skills", + config: { + skills: [ + { + name: "coding", + description: "Generic coding", + body: "Generic coding." + }, + { + name: "testing", + description: "Generic testing", + body: "Generic testing." + } + ] + } + } + ] + } + ] + }, + { + id: "architecture", + label: "Architecture", + description: "Stack", + required: false, + options: [ + { + id: "ext", + label: "Extension", + description: "Extension", + recipe: [ + { + writer: "skills", + config: { + skills: [ + { + name: "ext-all", + description: "Replaces both", + body: "Extension content.", + replaces: ["coding", "testing"] + } + ] + } + } + ] + } + ] + } + ] + }; + + const userConfig: UserConfig = { + choices: { process: "base", architecture: "ext" } + }; + + const result = await resolve(userConfig, skillsCatalog, registry); + + expect(result.skills).toHaveLength(1); + expect(result.skills[0].name).toBe("ext-all"); + }); + + it("keeps all skills when no replaces are declared", async () => { + const skillsCatalog: Catalog = { + facets: [ + { + id: "process", + label: "Process", + description: "Process", + required: true, + options: [ + { + id: "base", + label: "Base", + description: "Base", + recipe: [ + { + writer: "skills", + config: { + skills: [ + { name: "skill-a", description: "A", body: "Body A." }, + { name: "skill-b", description: "B", body: "Body B." } + ] + } + } + ] + } + ] + } + ] + }; + + const userConfig: UserConfig = { choices: { process: "base" } }; + const result = await resolve(userConfig, skillsCatalog, registry); + + expect(result.skills).toHaveLength(2); + expect(result.skills.map((s) => s.name)).toEqual(["skill-a", "skill-b"]); + }); + + it("deduplicates skills by name — last writer wins", async () => { + const skillsCatalog: Catalog = { + facets: [ + { + id: "process", + label: "Process", + description: "Process", + required: true, + options: [ + { + id: "base", + label: "Base", + description: "Base", + recipe: [ + { + writer: "skills", + config: { + skills: [ + { + name: "shared-skill", + description: "First", + body: "First body." + } + ] + } + } + ] + } + ] + }, + { + id: "architecture", + label: "Architecture", + description: "Stack", + required: false, + options: [ + { + id: "ext", + label: "Extension", + description: "Extension", + recipe: [ + { + writer: "skills", + config: { + skills: [ + { + name: "shared-skill", + description: "Second", + body: "Second body." + } + ] + } + } + ] + } + ] + } + ] + }; + + const userConfig: UserConfig = { + choices: { process: "base", architecture: "ext" } + }; + + const result = await resolve(userConfig, skillsCatalog, registry); + + expect(result.skills).toHaveLength(1); + expect(result.skills[0]).toMatchObject({ + name: "shared-skill", + body: "Second body." + }); + }); + + it("works with external skills that declare replaces", async () => { + const skillsCatalog: Catalog = { + facets: [ + { + id: "process", + label: "Process", + description: "Process", + required: true, + options: [ + { + id: "base", + label: "Base", + description: "Base", + recipe: [ + { + writer: "skills", + config: { + skills: [ + { + name: "tdd", + description: "Generic TDD", + body: "Generic TDD." + } + ] + } + } + ] + } + ] + }, + { + id: "architecture", + label: "Architecture", + description: "Stack", + required: false, + options: [ + { + id: "ext", + label: "Extension", + description: "Extension", + recipe: [ + { + writer: "skills", + config: { + skills: [ + { + name: "ext-tdd", + source: "org/repo/skills/ext-tdd", + replaces: ["tdd"] + } + ] + } + } + ] + } + ] + } + ] + }; + + const userConfig: UserConfig = { + choices: { process: "base", architecture: "ext" } + }; + + const result = await resolve(userConfig, skillsCatalog, registry); + + expect(result.skills).toHaveLength(1); + expect(result.skills[0].name).toBe("ext-tdd"); + }); }); describe("setup_notes merging", () => { diff --git a/packages/core/src/resolver.ts b/packages/core/src/resolver.ts index a12a19e..c020ee4 100644 --- a/packages/core/src/resolver.ts +++ b/packages/core/src/resolver.ts @@ -125,6 +125,22 @@ export async function resolve( } result.mcp_servers = Array.from(serversByRef.values()); + // Dedup skills: collect all names declared as replaced, dedup by name + // (last-writer-wins), then filter out replaced ones. + const replacedNames = new Set(); + for (const skill of result.skills) { + for (const r of skill.replaces ?? []) { + replacedNames.add(r); + } + } + const skillsByName = new Map(); + for (const skill of result.skills) { + skillsByName.set(skill.name, skill); + } + result.skills = Array.from(skillsByName.values()).filter( + (skill) => !replacedNames.has(skill.name) + ); + return result; } diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index f1154fe..c25abf4 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -54,11 +54,25 @@ export interface InlineSkill { name: string; description: string; body: string; + /** + * Names of other skills that this skill supersedes. + * Any skill whose `name` appears here will be removed from the final + * resolved skills list. Used by extension-contributed skills to suppress + * the generic baseline skills registered by the process option. + */ + replaces?: string[]; } export interface ExternalSkill { name: string; source: string; + /** + * Names of other skills that this skill supersedes. + * Any skill whose `name` appears here will be removed from the final + * resolved skills list. Used by extension-contributed skills to suppress + * the generic baseline skills registered by the process option. + */ + replaces?: string[]; } export type SkillDefinition = InlineSkill | ExternalSkill; diff --git a/packages/core/src/writers/skills.spec.ts b/packages/core/src/writers/skills.spec.ts index e969d37..7dfbf83 100644 --- a/packages/core/src/writers/skills.spec.ts +++ b/packages/core/src/writers/skills.spec.ts @@ -85,6 +85,52 @@ describe("skillsWriter", () => { }); }); + it("passes through replaces field on inline skills", async () => { + const result = await skillsWriter.write( + { + skills: [ + { + name: "ext-architecture", + description: "Extension architecture", + body: "Extension body.", + replaces: ["architecture"] + } + ] + }, + emptyContext + ); + + expect(result.skills).toHaveLength(1); + expect(result.skills![0]).toEqual({ + name: "ext-architecture", + description: "Extension architecture", + body: "Extension body.", + replaces: ["architecture"] + }); + }); + + it("passes through replaces field on external skills", async () => { + const result = await skillsWriter.write( + { + skills: [ + { + name: "ext-tdd", + source: "org/repo/skills/ext-tdd", + replaces: ["tdd"] + } + ] + }, + emptyContext + ); + + expect(result.skills).toHaveLength(1); + expect(result.skills![0]).toEqual({ + name: "ext-tdd", + source: "org/repo/skills/ext-tdd", + replaces: ["tdd"] + }); + }); + it("handles mixed inline and external skills", async () => { const result = await skillsWriter.write( { diff --git a/packages/harnesses/src/writers/opencode.spec.ts b/packages/harnesses/src/writers/opencode.spec.ts index 0d135fa..936467f 100644 --- a/packages/harnesses/src/writers/opencode.spec.ts +++ b/packages/harnesses/src/writers/opencode.spec.ts @@ -102,7 +102,7 @@ describe("opencodeWriter", () => { expect(defaultsAgent).toContain('grep: "allow"'); expect(defaultsAgent).toContain('list: "allow"'); expect(defaultsAgent).toContain('lsp: "allow"'); - expect(defaultsAgent).toContain('task: "deny"'); + expect(defaultsAgent).toContain('task: "allow"'); expect(defaultsAgent).toContain('skill: "deny"'); expect(defaultsAgent).toContain('todoread: "deny"'); expect(defaultsAgent).toContain('todowrite: "deny"');