opensddrag 0.1.1 → 0.2.0

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.
@@ -1,192 +1,72 @@
1
+ /**
2
+ * OpenSddRag skill templates — aggregator.
3
+ *
4
+ * Each of the 13 SDD skills lives in its own module exporting
5
+ * { name, description, body(slug, note) }. This file wraps every body with the
6
+ * Claude Code or OpenCode header (`note`) plus YAML frontmatter, so the workflow
7
+ * is authored once per skill and the CC/OC pair is always in sync
8
+ * (command-skill-separation-contract REQ-001). The public API —
9
+ * getSkills(slug, serverUrl) and getOpenCodeSkills(slug, serverUrl) — is
10
+ * unchanged, so client/src/commands/init.js needs no edits.
11
+ */
12
+
13
+ import { proposeSkill } from "./propose.js";
14
+ import { specSkill } from "./spec.js";
15
+ import { designSkill } from "./design.js";
16
+ import { tasksSkill } from "./tasks.js";
17
+ import { applySkill } from "./apply.js";
18
+ import { verifySkill } from "./verify.js";
19
+ import { syncSkill } from "./sync.js";
20
+ import { archiveSkill } from "./archive.js";
21
+ import { exploreSkill } from "./explore.js";
22
+ import { continueSkill } from "./continue.js";
23
+ import { statusSkill } from "./status.js";
24
+ import { flowSkill } from "./flow.js";
25
+ import { searchSkill } from "./search.js";
26
+
27
+ const SKILLS = [
28
+ proposeSkill,
29
+ specSkill,
30
+ designSkill,
31
+ tasksSkill,
32
+ applySkill,
33
+ verifySkill,
34
+ syncSkill,
35
+ archiveSkill,
36
+ exploreSkill,
37
+ continueSkill,
38
+ statusSkill,
39
+ flowSkill,
40
+ searchSkill,
41
+ ];
42
+
43
+ const frontmatter = (name, description) =>
44
+ `---\nname: ${name}\ndescription: ${description}\n---\n\n`;
45
+
46
+ /**
47
+ * Claude Code skills — installed to .claude/skills/ and .agents/skills/.
48
+ * Header advertises the MCP server + tool list and the STOP-if-not-connected rule.
49
+ */
1
50
  export function getSkills(slug, serverUrl) {
2
51
  const note = `> **MCP server:** \`opensddrag\` (${serverUrl}) | **project_slug:** \`${slug}\`
3
- > **Available tools:** \`create_artifact\`, \`read_artifact\`, \`list_artifacts\`, \`update_artifact\`, \`validate_artifact\`, \`link_artifacts\`, \`get_relationships\`, \`search_semantic\`, \`recall_episodes\`, \`get_working_context\`, \`update_working_context\`, \`record_trace\`
52
+ > **Available tools:** \`create_artifact\`, \`read_artifact\`, \`list_artifacts\`, \`update_artifact\`, \`validate_artifact\`, \`link_artifacts\`, \`get_relationships\`, \`search_semantic\`, \`recall_episodes\`, \`get_working_context\`, \`update_working_context\`, \`record_trace\`, \`get_harness_checklist\`
4
53
  > If these tools are not in your active tool list, the \`opensddrag\` MCP server is not connected — STOP and inform the user.\n\n`;
5
54
 
6
- return [
7
- {
8
- name: "opensddrag-propose",
9
- content: `# OpenSddRag — Propose
10
- ${note}Creates a named **change** with a proposal artifact: Why, What Changes, Capabilities, Impact.
11
- Entry point for every new feature or bugfix. No code is written here.
12
- After this, /opsr:spec and /opsr:design become available.
13
-
14
- **Run:** \`/opsr:propose <change-name or description>\`
15
-
16
- **Creates:** \`<change-name>-proposal\` artifact in database.
17
- **Unlocks:** /opsr:spec, /opsr:design
18
- `,
19
- },
20
- {
21
- name: "opensddrag-spec",
22
- content: `# OpenSddRag — Spec
23
- ${note}Creates spec artifacts for each capability listed in the proposal.
24
- Uses SHALL/MUST language. Each requirement MUST have Scenarios with WHEN/THEN format.
25
-
26
- **New capability** → full spec (Purpose + Requirements + Scenarios)
27
- **Modified capability** → delta spec (ADDED / MODIFIED / REMOVED / RENAMED sections)
28
-
29
- **Run:** \`/opsr:spec <change-name>\`
30
-
31
- **Requires:** proposal artifact in database.
32
- **Creates:** \`<change-name>-<capability>-spec\` artifact(s) in database.
33
- **Unlocks:** /opsr:design (when all capabilities have specs)
34
- `,
35
- },
36
- {
37
- name: "opensddrag-design",
38
- content: `# OpenSddRag — Design
39
- ${note}Creates a design document: Context, Goals, Decisions (with alternatives), Architecture, Risks, Migration.
40
- Must read proposal and all specs from the database as context.
41
-
42
- **Run:** \`/opsr:design <change-name>\`
43
-
44
- **Requires:** proposal + specs in database.
45
- **Creates:** \`<change-name>-design\` artifact in database.
46
- **Unlocks:** /opsr:tasks
47
- `,
48
- },
49
- {
50
- name: "opensddrag-tasks",
51
- content: `# OpenSddRag — Tasks
52
- ${note}Decomposes specs + design into atomic task artifacts, each < 4 hours.
53
- Each task has: Goal, Acceptance criteria (referencing REQ-NNN), Dependencies.
54
- Tasks are individual database artifacts — NOT a single markdown file.
55
-
56
- **Run:** \`/opsr:tasks <change-name>\`
57
-
58
- **Requires:** proposal + specs + design in database.
59
- **Creates:** \`<change-name>-task-<N>\` artifacts in database.
60
- **Unlocks:** /opsr:apply
61
- `,
62
- },
63
- {
64
- name: "opensddrag-apply",
65
- content: `# OpenSddRag — Apply
66
- ${note}Implements tasks one at a time, reading ALL planning artifacts (proposal + specs + design) as context.
67
- Marks tasks active → archived in the database after implementation.
68
- Must validate each task against spec acceptance criteria before marking done.
69
-
70
- **Run:** \`/opsr:apply <change-name>\`
71
-
72
- **Requires:** all planning artifacts + pending tasks in database.
73
- **Updates:** task status in database (draft → active → archived).
74
- **After all tasks:** run /opsr:verify then /opsr:archive.
75
- `,
76
- },
77
- {
78
- name: "opensddrag-verify",
79
- content: `# OpenSddRag — Verify
80
- ${note}Read-only validation of the implementation against spec requirements and design decisions.
81
- Produces a report with CRITICAL / WARNING / SUGGESTION severity levels.
82
-
83
- Checks:
84
- - **Completeness**: all tasks done, all REQ-NNN implemented
85
- - **Correctness**: all spec scenarios covered
86
- - **Coherence**: implementation follows design decisions
87
-
88
- **Run:** \`/opsr:verify <change-name>\`
89
-
90
- **Requires:** all artifacts in database + implementation in codebase.
91
- **Output:** verification report (no artifacts modified).
92
- `,
93
- },
94
- {
95
- name: "opensddrag-sync",
96
- content: `# OpenSddRag — Sync
97
- ${note}Merges delta specs (ADDED/MODIFIED/REMOVED/RENAMED) into main specs stored in the database.
98
- Called automatically during /opsr:archive when delta specs exist.
99
-
100
- Delta operations:
101
- - **ADDED** → append new requirement to main spec
102
- - **MODIFIED** → apply partial updates (not wholesale replace)
103
- - **REMOVED** → delete requirement + add Reason/Migration note
104
- - **RENAMED** → rename requirement heading
105
-
106
- **Run:** \`/opsr:sync <change-name>\`
107
-
108
- **Requires:** delta specs + main specs in database.
109
- **Updates:** main spec artifacts in database.
110
- `,
111
- },
112
- {
113
- name: "opensddrag-archive",
114
- content: `# OpenSddRag — Archive
115
- ${note}Finalizes a completed change: validates, syncs delta specs, archives all artifacts.
116
-
117
- Steps:
118
- 1. Validate artifact and task completion (warns if incomplete)
119
- 2. Sync delta specs to main specs (if any)
120
- 3. Mark all change artifacts as archived in database
121
-
122
- **Run:** \`/opsr:archive <change-name>\`
123
-
124
- **Requires:** all tasks completed (or user confirmation to archive anyway).
125
- **Updates:** all change artifacts to status=archived in database.
126
- `,
127
- },
128
- {
129
- name: "opensddrag-explore",
130
- content: `# OpenSddRag — Explore
131
- ${note}Thinking mode — investigates ideas WITHOUT implementing any code.
132
- Reads existing specs and codebase for context. Can create artifacts to capture insights.
133
-
134
- Rules:
135
- - NEVER write application code
136
- - NEVER create implementation files
137
- - MAY create/update OpenSddRag artifacts to capture decisions
138
-
139
- Use when: thinking through options, investigating feasibility, comparing approaches.
140
- Transition: when ready → /opsr:propose <name>
141
-
142
- **Run:** \`/opsr:explore <topic or question>\`
143
- `,
144
- },
145
- {
146
- name: "opensddrag-continue",
147
- content: `# OpenSddRag — Continue
148
- ${note}Creates the NEXT SINGLE artifact in the dependency chain and stops.
149
- Unlike /opsr:flow, creates one artifact per invocation.
150
-
151
- Dependency order: proposal → specs → design → tasks
152
-
153
- Use when: stepping through the SDD flow one artifact at a time.
154
-
155
- **Run:** \`/opsr:continue <change-name>\`
156
- `,
157
- },
158
- {
159
- name: "opensddrag-status",
160
- content: `# OpenSddRag — Status
161
- ${note}Shows current state of all in-progress changes: artifact completion, task progress, recent activity.
162
-
163
- Reads from MCP server — no local files.
164
-
165
- **Run:** \`/opsr:status\` or \`/opsr:status <change-name>\`
166
- `,
167
- },
168
- {
169
- name: "opensddrag-flow",
170
- content: `# OpenSddRag — Flow
171
- ${note}Runs the complete SDD flow end-to-end: propose → spec → design → tasks → apply → archive.
172
- ALL artifacts saved to database via MCP — no local files created.
173
-
174
- Use when: implementing a feature from scratch in a single session.
175
-
176
- **Run:** \`/opsr:flow <feature description>\`
177
- `,
178
- },
179
- {
180
- name: "opensddrag-search",
181
- content: `# OpenSddRag — Search
182
- ${note}Semantic search over the SDD knowledge base using pgvector similarity.
183
- Always run this BEFORE starting new work to find existing specs and decisions.
184
-
185
- Searches: this project first, then all projects if no results.
186
- Also recalls past agent actions (episodic memory).
55
+ return SKILLS.map((skill) => ({
56
+ name: skill.name,
57
+ content: `${frontmatter(skill.name, skill.description)}${skill.body(slug, note)}`,
58
+ }));
59
+ }
187
60
 
188
- **Run:** \`/opsr:search <natural language query>\`
189
- `,
190
- },
191
- ];
61
+ /**
62
+ * OpenCode skills — installed to .opencode/skills/.
63
+ * Compact header (project_slug only); MCP tools are auto-available in OpenCode.
64
+ */
65
+ export function getOpenCodeSkills(slug, _serverUrl) {
66
+ const note = `> **project_slug for every call:** \`${slug}\`\n\n`;
67
+
68
+ return SKILLS.map((skill) => ({
69
+ name: skill.name,
70
+ content: `${frontmatter(skill.name, skill.description)}${skill.body(slug, note)}`,
71
+ }));
192
72
  }
@@ -0,0 +1,74 @@
1
+ export const proposeSkill = {
2
+ name: "opensddrag-propose",
3
+ description:
4
+ "Create a named change proposal — entry point for every feature or bugfix",
5
+ body: (slug, note) => `# OpenSddRag — Propose
6
+ ${note}## When to use
7
+ Run this as the entry point for every new feature or bugfix, before any code is written.
8
+ It creates a named **change** with a proposal artifact defining WHY, WHAT changes, WHICH
9
+ capabilities are affected, and the IMPACT. After it, /opsr:spec and /opsr:design unlock.
10
+
11
+ ## Inputs
12
+ $ARGUMENTS = change name (kebab-case) or a plain description. If a plain description, derive a kebab-case name.
13
+
14
+ ## Workflow
15
+
16
+ ### Step 1 — Derive the change name
17
+ If $ARGUMENTS is a plain description (contains spaces), convert it to kebab-case.
18
+ Example: "add user authentication" → "add-user-authentication".
19
+
20
+ ### Step 2 — Search for existing work (avoid duplication)
21
+ \`search_semantic(query="$ARGUMENTS", project_slug="${slug}", limit=5)\`
22
+ If relevant artifacts are found, show them and ask the user to confirm this is genuinely new work.
23
+
24
+ ### Step 3 — Write the proposal content
25
+ Compose this structure — do NOT skip any section:
26
+
27
+ \`\`\`markdown
28
+ # <change-name>
29
+
30
+ ## Why
31
+ [1-2 sentences on the problem or opportunity being addressed]
32
+
33
+ ## What Changes
34
+ - [Specific change 1]
35
+ - [Specific change 2]
36
+ - **BREAKING** [Breaking change if any]
37
+
38
+ ## Capabilities
39
+ ### New Capabilities
40
+ - [capability-name] — brief description
41
+
42
+ ### Modified Capabilities
43
+ - [existing-capability] — what changes
44
+
45
+ ## Impact
46
+ [Affected code, APIs, dependencies, systems]
47
+ \`\`\`
48
+
49
+ ### Step 4 — Save the proposal
50
+ \`create_artifact(name="<change-name>-proposal", type="proposal", content="<full proposal markdown>", metadata={"change_name": "<change-name>", "status_phase": "planning"}, project_slug="${slug}")\`
51
+ Note the returned artifact ID.
52
+
53
+ ### Step 5 — Create spec drafts for each capability
54
+ Parse "## Capabilities". For each capability in "New Capabilities" or "Modified Capabilities":
55
+ 1. Check if a spec already exists: \`read_artifact(name="<change-name>-<capability>-spec", project_slug="${slug}")\`. If it exists and is non-empty, skip.
56
+ 2. Otherwise create a draft spec scaffold:
57
+ \`create_artifact(name="<change-name>-<capability>-spec", type="spec", status="draft", content="# <capability> Specification\\n\\n## Purpose\\n[TODO]\\n\\n## Requirements\\n\\n### Requirement: REQ-001\\n[TODO SHALL/MUST]\\n\\n#### Scenario: <Name>\\n- **WHEN** [condition]\\n- **THEN** [outcome]", metadata={"change_name": "<change-name>", "capability": "<capability>", "is_delta": true}, project_slug="${slug}")\`
58
+
59
+ ### Step 6 — Create a design skeleton
60
+ \`create_artifact(name="<change-name>-design", type="design", status="draft", content="# Design: <change-name>\\n\\n## Context\\n[TODO]\\n\\n## Goals / Non-Goals\\n\\n## Decisions\\n\\n## Architecture\\n\\n## Risks / Trade-offs\\n\\n## Open Questions", metadata={"change_name": "<change-name>"}, project_slug="${slug}")\`
61
+
62
+ ### Step 7 — Record the action
63
+ \`record_trace(action="propose", result_summary="Created proposal: <change-name>-proposal", project_slug="${slug}")\`
64
+
65
+ ## Output
66
+ - A \`<change-name>-proposal\` artifact (plus draft spec/design scaffolds) in the database.
67
+ - **Unlocks:** /opsr:spec, /opsr:design, or /opsr:flow to continue automatically.
68
+
69
+ ## Important rules
70
+ - NEVER write application code in this phase.
71
+ - DO NOT create local markdown files — all artifacts live in the database.
72
+ - If $ARGUMENTS is empty, ask the user for a change name or description before proceeding.
73
+ `,
74
+ };
@@ -0,0 +1,60 @@
1
+ export const searchSkill = {
2
+ name: "opensddrag-search",
3
+ description: "Semantic search over specs, tasks, and past agent actions",
4
+ body: (slug, note) => `# OpenSddRag — Search
5
+ ${note}## When to use
6
+ To search the SDD knowledge base by semantic similarity (pgvector). Run this BEFORE starting any
7
+ new work to find existing specs, decisions, and past implementations.
8
+
9
+ ## Inputs
10
+ $ARGUMENTS = natural language search query.
11
+
12
+ ## Workflow
13
+
14
+ ### Step 1 — Search this project
15
+ \`search_semantic(query="$ARGUMENTS", project_slug="${slug}", limit=5)\`
16
+
17
+ ### Step 2 — If no relevant results, search all projects
18
+ \`search_semantic(query="$ARGUMENTS", project_slug="*", limit=5)\`
19
+
20
+ ### Step 3 — Recall past actions related to the query
21
+ \`recall_episodes(query="$ARGUMENTS", project_slug="${slug}", limit=3)\`
22
+
23
+ ### Step 4 — Present the results clearly
24
+ For each result: name, type, status, and a content excerpt (first ~200 chars).
25
+ Group by: this project / other projects / past actions.
26
+
27
+ ### Step 5 — Offer to read a full artifact
28
+ \`read_artifact(name="<artifact-name>", project_slug="${slug}")\`
29
+
30
+ ### Step 6 — Optionally filter by artifact type
31
+ When the user is only interested in one kind of artifact, narrow the search:
32
+ \`search_semantic(query="$ARGUMENTS", project_slug="${slug}", type="spec", limit=5)\`
33
+ Valid \`type\` values: \`proposal\`, \`spec\`, \`design\`, \`task\`.
34
+
35
+ ## Examples
36
+ - "How do we handle delta specs?" → finds the spec/sync capability artifacts.
37
+ - "auth token refresh" → finds proposals/specs/designs touching authentication.
38
+ - "what did we decide about embeddings" → combine with \`recall_episodes\` for past decisions.
39
+
40
+ A good presentation block looks like:
41
+ \`\`\`
42
+ ### This project
43
+ - [spec] opensddrag-sync-spec (active) — "Merges delta specs (ADDED/MODIFIED/REMOVED…)"
44
+ ### Other projects
45
+ - (none)
46
+ ### Past actions
47
+ - design (2026-06-22) — "Created design: refactor-commands-skills-separation-design"
48
+ \`\`\`
49
+
50
+ ## Output
51
+ - A grouped list of semantically relevant artifacts and past actions, with an offer to open any.
52
+
53
+ ## Important rules
54
+ - Read-only — search never creates or modifies artifacts.
55
+ - Fall back to cross-project search (project_slug="*") only when the local search is empty.
56
+ - Surface episodic recall alongside artifacts so prior decisions are not missed.
57
+ - Prefer specific, noun-rich queries; vague one-word queries return weak matches.
58
+ - Always run search BEFORE /opsr:propose to avoid creating duplicate changes.
59
+ `,
60
+ };
@@ -0,0 +1,94 @@
1
+ import { harnessChecklistBlock } from "./_shared.js";
2
+
3
+ export const specSkill = {
4
+ name: "opensddrag-spec",
5
+ description:
6
+ "Write capability specs with SHALL/MUST requirements and WHEN/THEN scenarios",
7
+ body: (slug, note) => `# OpenSddRag — Spec
8
+ ${note}## When to use
9
+ After a proposal exists, to formalize each capability into a spec artifact with SHALL/MUST
10
+ requirements and WHEN/THEN scenarios. Each capability in the proposal gets its own spec.
11
+
12
+ ## Inputs
13
+ $ARGUMENTS = change name. If not provided, list proposals and ask which one.
14
+
15
+ ## Workflow
16
+
17
+ ### Step 1 — Read the proposal
18
+ \`list_artifacts(type="proposal", project_slug="${slug}")\`
19
+ \`read_artifact(name="<change-name>-proposal", project_slug="${slug}")\`
20
+
21
+ ### Step 2 — Identify capabilities
22
+ Parse "## Capabilities". Every capability in "New Capabilities" and "Modified Capabilities" needs a spec.
23
+ - **New capability** → full spec (Purpose + Requirements + Scenarios).
24
+ - **Modified capability** → check for an existing main spec: \`search_semantic(query="<capability> spec", project_slug="${slug}", limit=3)\`.
25
+ - If a main spec exists → create a DELTA spec (ADDED/MODIFIED/REMOVED/RENAMED).
26
+ - If no main spec → create BOTH the main spec (is_delta=false) and the delta spec (is_delta=true).
27
+
28
+ ### Step 3 — Write spec content for each capability
29
+
30
+ Full spec structure (new capabilities):
31
+ \`\`\`markdown
32
+ # <capability> Specification
33
+
34
+ ## Purpose
35
+ [High-level description]
36
+
37
+ ## Requirements
38
+
39
+ ### Requirement: REQ-001 <Name>
40
+ [Description using SHALL/MUST language]
41
+
42
+ #### Scenario: <Happy path>
43
+ - **WHEN** [condition]
44
+ - **THEN** [expected outcome]
45
+
46
+ #### Scenario: <Edge case>
47
+ - **WHEN** [edge condition]
48
+ - **THEN** [expected outcome]
49
+ \`\`\`
50
+
51
+ Delta spec structure (modified capabilities):
52
+ \`\`\`markdown
53
+ # <capability> Specification — Delta
54
+
55
+ ## ADDED Requirements
56
+ ### Requirement: <New name>
57
+ [Full requirement with scenarios]
58
+
59
+ ## MODIFIED Requirements
60
+ ### Requirement: <Existing name>
61
+ [Full updated text with all scenarios]
62
+
63
+ ## REMOVED Requirements
64
+ ### Requirement: <Removed name>
65
+ **Reason:** [why] · **Migration:** [how consumers migrate]
66
+
67
+ ## RENAMED Requirements
68
+ - FROM: \`### Requirement: Old Name\`
69
+ - TO: \`### Requirement: New Name\`
70
+ \`\`\`
71
+
72
+ ### Step 4 — Save each spec
73
+ \`create_artifact(name="<change-name>-<capability>-spec", type="spec", content="<full spec markdown>", metadata={"change_name": "<change-name>", "capability": "<capability>", "is_delta": true|false}, project_slug="${slug}")\`
74
+
75
+ ### Step 5 — Link each spec to the proposal
76
+ \`link_artifacts(source_name="<spec>", target_name="<change-name>-proposal", relationship_type="implements", project_slug="${slug}")\`
77
+
78
+ ### Step 6 — Validate each spec
79
+ \`validate_artifact(name="<spec>", project_slug="${slug}")\` — fix any validation errors before continuing.
80
+
81
+ ${harnessChecklistBlock(slug, "on_spec", "Saving specs to the database")}
82
+ ### Step 7 — Record the action
83
+ \`record_trace(action="spec", result_summary="Created specs for: <capability-list>", project_slug="${slug}")\`
84
+
85
+ ## Output
86
+ - One spec artifact per capability (full and/or delta) linked to the proposal.
87
+ - **Unlocks:** /opsr:design once all capabilities have specs.
88
+
89
+ ## Important rules
90
+ - Every requirement MUST have at least one WHEN/THEN scenario.
91
+ - Delta specs MUST carry metadata.is_delta=true so /opsr:sync can merge them later.
92
+ - Run the harness checklist (on_spec) before declaring specs done.
93
+ `,
94
+ };
@@ -0,0 +1,66 @@
1
+ export const statusSkill = {
2
+ name: "opensddrag-status",
3
+ description: "Show current state of all in-progress changes",
4
+ body: (slug, note) => `# OpenSddRag — Status
5
+ ${note}## When to use
6
+ To show the current state of all in-progress changes for this project: artifact completion,
7
+ task progress, and recent activity. Reads from the MCP server — no local files involved.
8
+
9
+ ## Inputs
10
+ $ARGUMENTS = optional change name to show details for a single change. If absent, show all.
11
+
12
+ ## Workflow
13
+
14
+ ### Step 1 — Load working context
15
+ \`get_working_context(project_slug="${slug}")\`
16
+ This also surfaces any \`trigger="always"\` harness rules — read them first.
17
+
18
+ ### Step 2 — List artifacts by type and status
19
+ \`list_artifacts(type="proposal", status="active", project_slug="${slug}")\`
20
+ \`list_artifacts(type="proposal", status="draft", project_slug="${slug}")\`
21
+ \`list_artifacts(type="spec", status="active", project_slug="${slug}")\`
22
+ \`list_artifacts(type="design", status="active", project_slug="${slug}")\`
23
+ \`list_artifacts(type="task", status="active", project_slug="${slug}")\`
24
+ \`list_artifacts(type="task", status="draft", project_slug="${slug}")\`
25
+
26
+ ### Step 3 — Recall recent activity
27
+ \`recall_episodes(query="recent actions in this project", project_slug="${slug}", limit=5)\`
28
+
29
+ ### Step 4 — Present a structured status
30
+ For each active change, show:
31
+ \`\`\`
32
+ ## Change: <change-name>
33
+ | Artifact | Status |
34
+ |----------|--------|
35
+ | Proposal | ✓ done |
36
+ | Specs | ✓ 2/2 |
37
+ | Design | ✓ done |
38
+ | Tasks | 3/5 done |
39
+
40
+ Current task: <task-name>
41
+ Next step: /opsr:apply <change-name>
42
+ \`\`\`
43
+ Then show recent activity (last 5 episodes) and a suggested next command based on the state.
44
+
45
+ ### Step 5 — Suggest the next command
46
+ Map the change's state to the next action:
47
+ - proposal only → /opsr:spec
48
+ - specs but no design → /opsr:design
49
+ - design but no tasks → /opsr:tasks
50
+ - tasks with drafts remaining → /opsr:apply
51
+ - all tasks archived → /opsr:verify then /opsr:archive
52
+
53
+ ## Reading the working context
54
+ \`get_working_context\` returns \`current_task\` and the ordered \`tasks\` list — use them to compute
55
+ "N/M done" and to name the in-flight task. It also returns always-trigger harness rules; show
56
+ those at the top so the user starts every session aware of the project's constraints.
57
+
58
+ ## Output
59
+ - A per-change status table, recent activity, and the recommended next command.
60
+
61
+ ## Important rules
62
+ - Read-only — never modify artifacts from status.
63
+ - If a specific change is requested, scope all lists to that change via metadata.change_name.
64
+ - Always surface always-trigger harness rules from the working context.
65
+ `,
66
+ };
@@ -0,0 +1,65 @@
1
+ export const syncSkill = {
2
+ name: "opensddrag-sync",
3
+ description: "Merge delta specs back into main capability specs",
4
+ body: (slug, note) => `# OpenSddRag — Sync
5
+ ${note}## When to use
6
+ To merge delta specs (ADDED/MODIFIED/REMOVED/RENAMED) into the main specs stored in the database.
7
+ Delta specs are created by /opsr:spec for MODIFIED capabilities. Runs automatically during /opsr:archive.
8
+
9
+ ## Inputs
10
+ $ARGUMENTS = change name.
11
+
12
+ ## Workflow
13
+
14
+ ### Step 1 — Find delta specs for this change
15
+ \`list_artifacts(type="spec", project_slug="${slug}")\`
16
+ Filter where metadata.change_name = "<change-name>" AND metadata.is_delta = true.
17
+
18
+ ### Step 2 — For each delta, find the main spec
19
+ \`search_semantic(query="<capability> spec", project_slug="${slug}", limit=5)\`
20
+ Find the spec for the same capability where metadata.is_delta = false (or unset).
21
+
22
+ ### Step 3 — Apply delta operations to the main spec
23
+ \`read_artifact(name="<delta-spec>", project_slug="${slug}")\`
24
+ \`read_artifact(name="<main-spec>", project_slug="${slug}")\`
25
+ Apply each delta section:
26
+ - **## ADDED Requirements** → confirm the requirement does NOT exist, then append it (with scenarios).
27
+ - **## MODIFIED Requirements** → find by name and apply ONLY the changed parts (partial update, not wholesale replace).
28
+ - **## REMOVED Requirements** → remove the requirement block; note the Reason/Migration in a comment.
29
+ - **## RENAMED Requirements** → change the heading FROM the old name TO the new name.
30
+
31
+ ### Step 4 — Save the updated main spec
32
+ \`update_artifact(name="<main-spec>", content="<merged spec content>", project_slug="${slug}")\`
33
+
34
+ ### Step 5 — Archive the delta spec
35
+ \`update_artifact(name="<delta-spec>", status="archived", metadata={"synced_at": "<ISO timestamp>", "merged_into": "<main-spec>"}, project_slug="${slug}")\`
36
+
37
+ ### Step 6 — Record the sync
38
+ \`record_trace(action="sync", result_summary="Synced delta for capability: <capability> into main spec", project_slug="${slug}")\`
39
+ Tell the user which capabilities were updated.
40
+
41
+ ## Worked example — a MODIFIED merge
42
+ Delta says:
43
+ \`\`\`markdown
44
+ ## MODIFIED Requirements
45
+ ### Requirement: REQ-002 Token issuance
46
+ [adds a new scenario for refresh tokens]
47
+ \`\`\`
48
+ Main spec already has REQ-002 with two scenarios. Correct merge = keep the existing two scenarios
49
+ and APPEND the new refresh-token scenario under the same requirement heading. Do NOT replace the
50
+ whole REQ-002 block — that would silently drop the original scenarios.
51
+
52
+ ## When NOT to sync
53
+ - The delta is still being edited (run /opsr:spec to completion first).
54
+ - No main spec exists yet for the capability — then there is nothing to merge into; the delta
55
+ IS the spec until a main is created.
56
+
57
+ ## Output
58
+ - Main spec artifacts updated to reflect all deltas; delta specs archived with a merge pointer.
59
+
60
+ ## Important rules
61
+ - MODIFIED requirements get partial, intelligent merges — never blind whole-section replacement.
62
+ - Always archive the delta after merging so it is not re-applied.
63
+ - Preserve REMOVED requirements' Reason/Migration as a note for future readers.
64
+ `,
65
+ };