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,3 +1,183 @@
1
+ export function getHarnessSkill({ slug, serverUrl }) {
2
+ // SKILL.md for the `opensddrag-harness` skill — installed into
3
+ // .claude/skills/opensddrag-harness/ and .agents/skills/opensddrag-harness/
4
+ // by `opensddrag init`. Drives the /opsr:harness slash command behaviorally
5
+ // for both Claude Code and OpenCode, using only the standard MCP tools
6
+ // (add_rule, list_rules, get_harness_checklist). No direct DB access, no
7
+ // local file writes for rule storage — rules are persisted via the MCP
8
+ // server's `project_rules` table.
9
+ return `---
10
+ name: opensddrag-harness
11
+ description: Manage persistent project rules — add, list, and disable behavioral constraints
12
+ ---
13
+
14
+ # OpenSddRag — Harness
15
+
16
+ This project is connected to the OpenSddRag Harness (${serverUrl}).
17
+ The Harness layer manages **project rules**: persistent, per-project behavioral
18
+ constraints that are automatically injected into every agent session.
19
+
20
+ ## Project slug: \`${slug}\`
21
+
22
+ Always pass \`project_slug: "${slug}"\` to scope rule operations to this project.
23
+
24
+ ## When to use
25
+
26
+ - Before starting any new feature, ask: "Are there harness rules I should be aware of?"
27
+ \`get_working_context(project_slug="${slug}")\` will return any \`trigger="always"\` rules
28
+ automatically — read them first.
29
+ - Use \`/opsr:harness\` (Claude Code) or invoke this skill (OpenCode) to:
30
+ - **add** a new rule (architecture, naming, forbidden, doc-sync, verification)
31
+ - **list** all rules for the project, grouped by trigger
32
+ - **disable** a rule (soft-delete — re-enable by re-adding with the same name)
33
+
34
+ ## Available operations
35
+
36
+ ### add — create or update a project rule
37
+
38
+ Call the \`add_rule\` MCP tool. Required arguments:
39
+
40
+ \`\`\`
41
+ add_rule(
42
+ name: "<kebab-case-name>",
43
+ trigger: "always" | "on_apply" | "on_verify" | "on_archive" | "on_spec",
44
+ category: "architecture" | "naming" | "forbidden" | "doc-sync" | "verification",
45
+ severity: "error" | "warning" | "info", // default: "warning"
46
+ instruction: "<free-text rule the agent must follow>",
47
+ project_slug:"${slug}",
48
+ enabled: true, // default: true (set false to soft-delete)
49
+ metadata: { ... } // optional, free-form JSON
50
+ )
51
+ \`\`\`
52
+
53
+ When the user provides a rule in natural language, infer the fields:
54
+ - "always update X when applying" → trigger=\`on_apply\`, category=\`doc-sync\`, severity=\`warning\`
55
+ - "never do Y" → trigger=\`always\`, category=\`forbidden\`, severity=\`error\`
56
+ - "use Z pattern in this project" → trigger=\`always\`, category=\`architecture\`, severity=\`warning\`
57
+
58
+ **Example 1 — architecture rule (always):**
59
+ \`\`\`
60
+ add_rule(
61
+ name: "repo-pattern-required",
62
+ trigger: "always",
63
+ category: "architecture",
64
+ severity: "error",
65
+ instruction: "All data access must go through a repository class. Do not call the ORM or DB driver directly from route handlers or service classes.",
66
+ project_slug:"${slug}"
67
+ )
68
+ \`\`\`
69
+
70
+ **Example 2 — doc-sync rule (on_apply):**
71
+ \`\`\`
72
+ add_rule(
73
+ name: "update-changelog-on-apply",
74
+ trigger: "on_apply",
75
+ category: "doc-sync",
76
+ severity: "warning",
77
+ instruction: "When applying a task that ships a user-visible change, add a one-line entry to CHANGELOG.md under the unreleased section before marking the task complete.",
78
+ project_slug:"${slug}"
79
+ )
80
+ \`\`\`
81
+
82
+ Confirm with the user after adding:
83
+ "Rule '<name>' added. It will be [injected at every session start | checked during /opsr:apply | ...]."
84
+
85
+ ### list — show all rules for this project
86
+
87
+ Call the \`list_rules\` MCP tool:
88
+
89
+ \`\`\`
90
+ list_rules(project_slug="${slug}", enabled_only=true)
91
+ \`\`\`
92
+
93
+ Group the results by \`trigger\` in the output:
94
+
95
+ \`\`\`
96
+ ### Always (loaded at session start)
97
+ - [architecture:error] repo-pattern-required — All data access must go through...
98
+
99
+ ### On Apply (checked during /opsr:apply)
100
+ - [doc-sync:warning] update-changelog-on-apply — When applying a task...
101
+
102
+ ### On Verify (checked during /opsr:verify)
103
+ - (none)
104
+
105
+ ### On Archive (checked during /opsr:archive)
106
+ - (none)
107
+
108
+ ### On Spec (checked during /opsr:spec)
109
+ - (none)
110
+ \`\`\`
111
+
112
+ If the result list is empty, respond:
113
+ "No harness rules defined for this project. Run \`/opsr:harness add\` to create the first rule."
114
+
115
+ ### disable — soft-delete a rule
116
+
117
+ Call the \`add_rule\` MCP tool with the same \`name\` and \`enabled=false\`:
118
+
119
+ \`\`\`
120
+ add_rule(name: "<rule-name>", enabled: false, project_slug: "${slug}")
121
+ \`\`\`
122
+
123
+ This is a soft-delete: the rule is preserved in the database with \`enabled=false\`
124
+ and will no longer appear in \`list_rules\` (default \`enabled_only=true\`) or in
125
+ \`get_working_context\` injection. To re-enable, call \`add_rule\` with the same
126
+ name and \`enabled=true\`.
127
+
128
+ Confirm with the user:
129
+ "Rule '<name>' disabled. It will no longer appear in checklists or session context."
130
+
131
+ ## Phase-gate checklist — get_harness_checklist
132
+
133
+ When the user runs \`/opsr:apply\`, \`/opsr:verify\`, \`/opsr:archive\`, or
134
+ \`/opsr:spec\`, the corresponding slash command will call:
135
+
136
+ \`\`\`
137
+ get_harness_checklist(trigger="on_apply"|"on_verify"|"on_archive"|"on_spec", project_slug="${slug}")
138
+ \`\`\`
139
+
140
+ …to fetch rules that must be satisfied at that phase gate. The response is an
141
+ array of {name, category, severity, instruction} objects ordered by severity
142
+ (error first) then name. Rules with \`severity="error"\` MUST be completed before
143
+ the phase is declared done; \`severity="warning"\` rules SHOULD be addressed.
144
+
145
+ You do not need to call this directly — the slash commands invoke it. But you
146
+ can use it from this skill if the user asks "what rules apply to apply?".
147
+
148
+ ## Memory of rule operations
149
+
150
+ Every add / disable operation should be recorded in episodic memory:
151
+
152
+ \`\`\`
153
+ record_trace(action="add_rule"|"disable_rule", result_summary="Added/disabled rule: <name>", project_slug="${slug}")
154
+ \`\`\`
155
+
156
+ ## MCP tools used
157
+
158
+ | Tool | Purpose |
159
+ |------|---------|
160
+ | \`add_rule\` | Upsert a rule (create, update, or soft-delete) |
161
+ | \`list_rules\` | List rules with optional filters |
162
+ | \`get_harness_checklist\` | Fetch phase-gate rules for apply/verify/archive/spec |
163
+ | \`get_working_context\` | Already returns trigger="always" rules automatically |
164
+ | \`record_trace\` | Log harness operations to episodic memory |
165
+
166
+ ## Important rules for this skill
167
+
168
+ - **Never write rule data to local files** — all rules live in the \`project_rules\` table.
169
+ - **Never translate or modify the user's rule instruction** — store it verbatim.
170
+ - **Always confirm with the user before calling \`add_rule\`** for new rules, especially when inferring fields from natural language.
171
+ - **Soft-delete is the only way to "remove" a rule** — re-adding with the same name restores it.
172
+ `;
173
+ }
174
+
175
+ export function getOpenCodeHarnessSkill({ slug, serverUrl }) {
176
+ const full = getHarnessSkill({ slug, serverUrl });
177
+ // OpenCode auto-discovers tools from opencode.json — the table is noise.
178
+ return full.replace(/\n## MCP tools used\n[\s\S]*?(?=\n## |\n$)/, '\n');
179
+ }
180
+
1
181
  export function renderSkillMd({ slug, serverUrl }) {
2
182
  return `# OpenSddRag — SDD + Harness
3
183
 
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Shared helpers for OpenSddRag skill templates.
3
+ *
4
+ * Each skill lives in its own module (propose.js, spec.js, …) and exports an
5
+ * object: { name, description, body(slug, note) }. The aggregator in index.js
6
+ * wraps `body` with the Claude Code or OpenCode header (`note`) and the YAML
7
+ * frontmatter, so the workflow is authored exactly once and the CC/OC pair is
8
+ * always in sync (command-skill-separation-contract REQ-001).
9
+ */
10
+
11
+ /**
12
+ * Renders the reusable harness phase-gate checklist block, inlined into the
13
+ * spec/apply/verify/archive skills at the point just before the phase gate.
14
+ * Mirrors the legacy harnessChecklistStep() that used to live in the command
15
+ * templates.
16
+ */
17
+ export function harnessChecklistBlock(slug, trigger, gateLabel) {
18
+ return `### Step — Harness checklist (${trigger})
19
+ Call the MCP tool to load all enabled harness rules for the \`${trigger}\` trigger:
20
+ \`get_harness_checklist(trigger="${trigger}", project_slug="${slug}")\`
21
+
22
+ Process the response:
23
+ - **If the result is an empty array \`[]\`** → output "No harness rules for this trigger." and continue.
24
+ - **If any rule has \`severity="error"\`** → present it as:
25
+ \`\`\`
26
+ MUST complete before proceeding (${gateLabel}):
27
+ - [<name>] <instruction>
28
+ \`\`\`
29
+ Then \`STOP\` and wait until each error-severity rule is confirmed satisfied before continuing.
30
+ - **If any rule has \`severity="warning"\`** → present it as "SHOULD complete: [<name>] <instruction>" (advisory; proceed if satisfied).
31
+ - **If any rule has \`severity="info"\`** → present inline as "Info: [<name>] <instruction>" and proceed.
32
+ - Rules are returned sorted error-first then by name; preserve that order when displaying.
33
+ - This step MUST run BEFORE ${gateLabel.toLowerCase()}.
34
+ `;
35
+ }
@@ -0,0 +1,64 @@
1
+ import { harnessChecklistBlock } from "./_shared.js";
2
+
3
+ export const applySkill = {
4
+ name: "opensddrag-apply",
5
+ description:
6
+ "Implement the next pending task against spec acceptance criteria",
7
+ body: (slug, note) => `# OpenSddRag — Apply
8
+ ${note}## When to use
9
+ To implement tasks one at a time, validating each against its spec acceptance criteria before
10
+ marking it done. Read ALL planning artifacts (proposal + specs + design) as context first.
11
+
12
+ ## Inputs
13
+ $ARGUMENTS = change name, or a specific task name.
14
+
15
+ ## Workflow
16
+
17
+ ### Step 1 — Load full planning context
18
+ \`get_working_context(project_slug="${slug}")\`
19
+ \`read_artifact(name="<change-name>-proposal", project_slug="${slug}")\`
20
+ \`read_artifact(name="<change-name>-design", project_slug="${slug}")\`
21
+ Get and read all specs linked to this change.
22
+
23
+ ### Step 2 — List pending tasks
24
+ \`list_artifacts(type="task", status="active", project_slug="${slug}")\`
25
+ \`list_artifacts(type="task", status="draft", project_slug="${slug}")\`
26
+ Combine both; filter by metadata.change_name. Prioritize \`active\` (resuming) then \`draft\` in dependency order.
27
+
28
+ ### Step 3 — Select the next task
29
+ If $ARGUMENTS names a task, use it. Otherwise:
30
+ 1. Prefer any task with status="active" (interrupted session).
31
+ 2. Else pick the first draft task whose dependencies are all archived.
32
+ \`read_artifact(name="<task-name>", project_slug="${slug}")\`
33
+
34
+ ### Step 4 — Mark the task active
35
+ \`update_artifact(name="<task-name>", status="active", project_slug="${slug}")\`
36
+ \`update_working_context(context={"current_task": "<task-name>"}, project_slug="${slug}")\`
37
+
38
+ ### Step 5 — Implement the task
39
+ Write the code changes required by the task using Edit/Write/Bash (local files — this is expected).
40
+ The implementation MUST satisfy every acceptance criterion. Pause and ask if anything is unclear — do not guess.
41
+
42
+ ### Step 6 — Validate against spec requirements
43
+ For each acceptance criterion (REQ-NNN): confirm the implementation satisfies it and no spec scenario is broken.
44
+
45
+ ${harnessChecklistBlock(slug, "on_apply", "Marking the task archived")}
46
+ ### Step 7 — Mark the task done
47
+ \`update_artifact(name="<task-name>", status="archived", project_slug="${slug}")\`
48
+
49
+ ### Step 8 — Record and check remaining work
50
+ \`record_trace(action="apply_task", result_summary="Completed task: <task-name>", artifact_id="<artifact-id>", project_slug="${slug}")\`
51
+ \`list_artifacts(type="task", status="draft", project_slug="${slug}")\`
52
+ - If tasks remain: "Task complete. Run /opsr:apply <change-name> for the next task."
53
+ - If all done: "All tasks complete. Run /opsr:verify <change-name>, then /opsr:archive <change-name>."
54
+
55
+ ## Output
56
+ - Code changes on disk satisfying the task's acceptance criteria.
57
+ - Task status advanced draft → active → archived in the database.
58
+
59
+ ## Important rules
60
+ - Read ALL planning artifacts before implementing — never code from the task alone.
61
+ - Run the harness checklist (on_apply) BEFORE marking a task archived; STOP on any error-severity rule.
62
+ - One task at a time; do not batch-archive tasks.
63
+ `,
64
+ };
@@ -0,0 +1,52 @@
1
+ import { harnessChecklistBlock } from "./_shared.js";
2
+
3
+ export const archiveSkill = {
4
+ name: "opensddrag-archive",
5
+ description: "Finalize a completed change by archiving all its artifacts",
6
+ body: (slug, note) => `# OpenSddRag — Archive
7
+ ${note}## When to use
8
+ To finalize a completed change: run completion checks, sync delta specs into main specs, then
9
+ archive all the change's artifacts.
10
+
11
+ ## Inputs
12
+ $ARGUMENTS = change name. If not provided, list active changes and ask.
13
+
14
+ ## Workflow
15
+
16
+ ### Step 1 — Get the full status of the change
17
+ \`list_artifacts(type="proposal", project_slug="${slug}")\`
18
+ \`get_relationships(name="<change-name>-proposal", project_slug="${slug}")\`
19
+ Gather all linked artifacts (specs, design, tasks).
20
+
21
+ ### Step 2 — Validate artifact completion
22
+ \`list_artifacts(type="task", status="draft", project_slug="${slug}")\`
23
+ If pending tasks exist → warn the user and ask for confirmation to archive anyway.
24
+
25
+ ### Step 3 — Validate task completion
26
+ Count draft vs archived tasks. If any draft tasks remain → warn and confirm.
27
+
28
+ ### Step 4 — Check for delta specs that need syncing
29
+ \`list_artifacts(type="spec", project_slug="${slug}")\`
30
+ Filter for metadata.change_name = "<change-name>" AND metadata.is_delta = true.
31
+ If deltas exist: show the affected capabilities and ask "Sync delta specs to main specs now? (recommended)".
32
+ - If yes → run the /opsr:sync workflow (load the opensddrag-sync skill) for each delta.
33
+ - If no → archive without syncing.
34
+
35
+ ${harnessChecklistBlock(slug, "on_archive", "Archiving change artifacts")}
36
+ ### Step 5 — Archive all change artifacts
37
+ For each artifact (proposal, all specs, design, all tasks):
38
+ \`update_artifact(name="<artifact>", status="archived", metadata={"archived_at": "<ISO timestamp>", "change_name": "<change-name>"}, project_slug="${slug}")\`
39
+
40
+ ### Step 6 — Record and show a summary
41
+ \`record_trace(action="archive", result_summary="Archived change: <change-name> (<N> artifacts)", project_slug="${slug}")\`
42
+ Show: artifacts archived, specs synced (if any), and "Change <change-name> is complete."
43
+
44
+ ## Output
45
+ - Every artifact of the change set to status=archived; deltas merged into main specs.
46
+
47
+ ## Important rules
48
+ - Run the harness checklist (on_archive) BEFORE archiving; STOP on any error-severity rule.
49
+ - Never archive over pending tasks without explicit user confirmation.
50
+ - Sync delta specs before archiving so the main specs stay authoritative.
51
+ `,
52
+ };
@@ -0,0 +1,63 @@
1
+ export const continueSkill = {
2
+ name: "opensddrag-continue",
3
+ description: "Create the next single artifact in the SDD dependency chain",
4
+ body: (slug, note) => `# OpenSddRag — Continue
5
+ ${note}## When to use
6
+ To create the NEXT SINGLE artifact in the dependency chain for a change and then stop. Unlike
7
+ /opsr:flow (which creates everything), this advances exactly one step per invocation.
8
+
9
+ Dependency order: proposal → specs → design → tasks.
10
+
11
+ ## Inputs
12
+ $ARGUMENTS = change name.
13
+
14
+ ## Workflow
15
+
16
+ ### Step 1 — Get the current status
17
+ \`list_artifacts(type="proposal", project_slug="${slug}")\`
18
+ \`get_relationships(name="<change-name>-proposal", project_slug="${slug}")\`
19
+ Gather all existing artifacts for this change.
20
+
21
+ ### Step 2 — Find the next artifact to create
22
+ Walk the dependency order and find the first gap:
23
+ 1. proposal → if missing, stop and tell the user to run /opsr:propose first.
24
+ 2. specs → if any capability has no spec → the next artifact is ONE spec.
25
+ 3. design → if missing and all specs exist → the next artifact is the design.
26
+ 4. tasks → if missing and the design exists → the next artifacts are the tasks.
27
+
28
+ If every artifact already exists → tell the user "All planning artifacts complete. Run /opsr:apply."
29
+
30
+ ### Step 3 — Create the NEXT artifact only, by delegating to the matching skill
31
+ Do NOT inline the workflow here — load the corresponding skill and follow it for a single artifact:
32
+ - next = spec → load the \`opensddrag-spec\` skill and create ONE capability's spec.
33
+ - next = design → load the \`opensddrag-design\` skill and create the design.
34
+ - next = tasks → load the \`opensddrag-tasks\` skill and create the tasks.
35
+ Then STOP — do not proceed to the following artifact in this invocation.
36
+
37
+ ### Step 4 — Show progress
38
+ - Show what was created.
39
+ - Show what is now unlocked (next in the dependency chain).
40
+ - Suggest: "Run /opsr:continue <change-name> to create the next artifact."
41
+
42
+ ## Worked example
43
+ Given a change with a proposal and 2 of 3 capabilities specced:
44
+ 1. Step 2 detects the gap: one capability still has no spec.
45
+ 2. Step 3 loads \`opensddrag-spec\` and creates ONLY that capability's spec, then stops.
46
+ 3. Step 4 reports "spec created (3/3). Next: design. Run /opsr:continue <change-name>."
47
+
48
+ Next invocation detects all specs exist but no design → creates the design and stops. And so on
49
+ until tasks exist, at which point it directs the user to /opsr:apply.
50
+
51
+ ## Why one step at a time
52
+ /opsr:continue is for reviewing each artifact before the next is generated. When you want the
53
+ whole chain produced in one pass without pausing, use /opsr:flow instead.
54
+
55
+ ## Output
56
+ - Exactly one new artifact (or one batch of tasks), advancing the change by a single step.
57
+
58
+ ## Important rules
59
+ - Create ONE artifact (or the single tasks batch) per invocation, then stop.
60
+ - Delegate the actual artifact creation to the matching skill — never duplicate its steps here.
61
+ - Respect dependency order; never skip a missing upstream artifact.
62
+ `,
63
+ };
@@ -0,0 +1,82 @@
1
+ export const designSkill = {
2
+ name: "opensddrag-design",
3
+ description:
4
+ "Document technical decisions, architecture, and trade-offs for a change",
5
+ body: (slug, note) => `# OpenSddRag — Design
6
+ ${note}## When to use
7
+ After the specs exist, to capture the technical decisions, architecture, trade-offs, and open
8
+ questions for a change. The design is grounded in the proposal and spec artifacts already saved.
9
+
10
+ ## Inputs
11
+ $ARGUMENTS = change name.
12
+
13
+ ## Workflow
14
+
15
+ ### Step 1 — Read proposal and all specs
16
+ \`read_artifact(name="<change-name>-proposal", project_slug="${slug}")\`
17
+ \`list_artifacts(type="spec", project_slug="${slug}")\`
18
+ \`get_relationships(name="<change-name>-proposal", project_slug="${slug}")\`
19
+ Read each spec linked to this change.
20
+
21
+ ### Step 2 — Search for related prior designs
22
+ \`search_semantic(query="<change topic> design decisions", project_slug="${slug}", limit=3)\`
23
+ Use findings as context — do not duplicate prior work.
24
+
25
+ ### Step 3 — Write the design content
26
+ \`\`\`markdown
27
+ # Design: <change-name>
28
+
29
+ ## Context
30
+ [Background, current state, constraints that shaped this design]
31
+
32
+ ## Goals / Non-Goals
33
+ **Goals:**
34
+ - [What this design achieves]
35
+
36
+ **Non-Goals:**
37
+ - [What this design deliberately does NOT address]
38
+
39
+ ## Decisions
40
+
41
+ ### Decision: <Title>
42
+ **Chosen:** [What was chosen and why]
43
+ **Alternatives considered:**
44
+ - [Alternative 1] — rejected because [reason]
45
+ - [Alternative 2] — rejected because [reason]
46
+
47
+ ## Architecture
48
+ [Components, data flow, integration points — ASCII diagrams if helpful]
49
+
50
+ ## Risks / Trade-offs
51
+ | Risk | Mitigation |
52
+ |------|------------|
53
+ | [Risk] | [Mitigation] |
54
+
55
+ ## Migration Plan
56
+ [Deployment steps, backward compatibility, rollback plan]
57
+
58
+ ## Open Questions
59
+ - [ ] [Question that still needs resolution]
60
+ \`\`\`
61
+
62
+ ### Step 4 — Save the design
63
+ \`create_artifact(name="<change-name>-design", type="design", content="<full design markdown>", metadata={"change_name": "<change-name>"}, project_slug="${slug}")\`
64
+ If a draft design skeleton already exists, use \`update_artifact\` instead of creating a duplicate.
65
+
66
+ ### Step 5 — Link the design to the proposal
67
+ \`link_artifacts(source_name="<change-name>-design", target_name="<change-name>-proposal", relationship_type="depends_on", project_slug="${slug}")\`
68
+
69
+ ### Step 6 — Record and show next steps
70
+ \`record_trace(action="design", result_summary="Created design: <change-name>-design", project_slug="${slug}")\`
71
+ Tell the user: "Design saved. Run /opsr:tasks <change-name> to decompose into tasks."
72
+
73
+ ## Output
74
+ - A \`<change-name>-design\` artifact linked to the proposal.
75
+ - **Unlocks:** /opsr:tasks.
76
+
77
+ ## Important rules
78
+ - Every Decision MUST list the chosen approach AND the alternatives considered with reasons.
79
+ - DO NOT write application code — this phase is design only.
80
+ - If a design already exists, amend it (update_artifact) rather than creating a second one.
81
+ `,
82
+ };
@@ -0,0 +1,62 @@
1
+ export const exploreSkill = {
2
+ name: "opensddrag-explore",
3
+ description: "Investigate a problem or idea without writing any code",
4
+ body: (slug, note) => `# OpenSddRag — Explore
5
+ ${note}## When to use
6
+ Thinking mode — to investigate a problem, idea, or question and build understanding BEFORE
7
+ committing to a proposal. You may capture insights as artifacts, but you NEVER write code here.
8
+
9
+ ## Inputs
10
+ $ARGUMENTS = topic, question, or idea to explore.
11
+
12
+ ## Stance
13
+ You are in THINKING MODE. Your role is to:
14
+ - Ask clarifying questions.
15
+ - Surface at least two options with trade-offs.
16
+ - Investigate the codebase (read-only).
17
+ - Create ASCII diagrams to illustrate ideas.
18
+ - Challenge assumptions and reference existing specs for context.
19
+
20
+ You MUST NOT:
21
+ - Write application code.
22
+ - Create implementation files.
23
+ - Make changes to the codebase.
24
+
25
+ ## Workflow
26
+
27
+ ### Step 1 — Check for existing related work
28
+ \`search_semantic(query="$ARGUMENTS", project_slug="${slug}", limit=5)\`
29
+ \`recall_episodes(query="$ARGUMENTS", project_slug="${slug}", limit=3)\`
30
+ Share any existing specs or past decisions that are relevant.
31
+
32
+ ### Step 2 — Investigate and think
33
+ - Read relevant codebase files (read-only).
34
+ - Identify constraints and dependencies.
35
+ - Surface at least two different approaches; for each, list trade-offs.
36
+
37
+ ### Step 3 — Capture insights (only if the user asks)
38
+ \`create_artifact(name="explore-<topic>-<date>", type="proposal", content="<exploration notes, options, trade-offs>", metadata={"explore": true}, project_slug="${slug}")\`
39
+ If amending an existing design/proposal, use \`update_artifact\` instead.
40
+
41
+ ### Step 4 — Transition when ready
42
+ Summarize the key findings and a recommendation, then ask:
43
+ "Ready to create a formal proposal? Run /opsr:propose <name>."
44
+
45
+ ## Example prompts this skill handles well
46
+ - "Is it coherent to refactor X this way?" → validate the premise against the code, surface risks.
47
+ - "Two ways to model Y — which is better here?" → compare approaches with trade-offs and a pick.
48
+ - "What would it take to add Z?" → scope the work, list constraints and dependencies, no code.
49
+
50
+ ## Output shape
51
+ A short written analysis: premise check → 2+ options with trade-offs → a recommendation →
52
+ optional follow-up actions (amend a design, create an explore-* artifact, or move to /opsr:propose).
53
+
54
+ ## Output
55
+ - Shared analysis and a recommendation; optionally an \`explore-*\` artifact capturing the decision.
56
+
57
+ ## Important rules
58
+ - NEVER write application code or create implementation files in this phase.
59
+ - Only create/update OpenSddRag artifacts when the user explicitly asks to capture something.
60
+ - Prefer presenting trade-offs and a recommendation over an exhaustive survey.
61
+ `,
62
+ };
@@ -0,0 +1,65 @@
1
+ export const flowSkill = {
2
+ name: "opensddrag-flow",
3
+ description: "Run the complete SDD flow end-to-end in one session",
4
+ body: (slug, note) => `# OpenSddRag — Flow
5
+ ${note}## When to use
6
+ To run the complete SDD flow end-to-end in a single session: propose → spec → design → tasks →
7
+ apply → archive. Planning artifacts are saved to the database; implementation code is written locally.
8
+
9
+ This skill is a thin **orchestrator**: each phase delegates to the matching skill, which is the
10
+ single source of truth for that phase's workflow. Do NOT duplicate those steps here.
11
+
12
+ ## Inputs
13
+ $ARGUMENTS = feature description or change name.
14
+
15
+ ## Workflow
16
+
17
+ ### Phase 1 — Propose
18
+ Load the \`opensddrag-propose\` skill and follow it: search for duplicates, compose the proposal
19
+ (Why / What Changes / Capabilities / Impact), and save the \`<change-name>-proposal\` artifact.
20
+
21
+ ### Phase 2 — Spec
22
+ Load the \`opensddrag-spec\` skill and follow it for each capability in the proposal: compose the
23
+ spec (Purpose / Requirements with SHALL / Scenarios with WHEN-THEN), save it, link it to the
24
+ proposal, and validate it. Fix validation errors before continuing.
25
+
26
+ ### Phase 3 — Design
27
+ Load the \`opensddrag-design\` skill and follow it: read all specs, compose the design
28
+ (Context / Goals / Decisions / Architecture / Risks / Migration), save it, and link it to the proposal.
29
+
30
+ ### Phase 4 — Tasks
31
+ Load the \`opensddrag-tasks\` skill and follow it: read proposal + specs + design, create one task
32
+ artifact per unit of work, link each to its spec(s), and update the working context.
33
+
34
+ ### Phase 5 — Apply (repeat for each task in order)
35
+ Load the \`opensddrag-apply\` skill and follow it for each task: read all planning artifacts, mark
36
+ the task active, implement it locally (Edit/Write/Bash), run the on_apply harness checklist, then
37
+ mark it archived and record a trace. Repeat until no draft tasks remain.
38
+
39
+ ### Phase 6 — Archive
40
+ Load the \`opensddrag-archive\` skill and follow it: sync any delta specs, run the on_archive
41
+ harness checklist, archive all change artifacts, and record the completion trace.
42
+
43
+ ## Resuming a partially-complete flow
44
+ Flow is idempotent at the phase level. Before each phase, check what already exists
45
+ (\`get_relationships(name="<change-name>-proposal", project_slug="${slug}")\`) and skip phases whose
46
+ artifacts are already present:
47
+ - Proposal exists → skip Phase 1.
48
+ - All capabilities specced → skip Phase 2.
49
+ - Design exists → skip Phase 3.
50
+ - Tasks exist → skip Phase 4 and resume Phase 5 at the first non-archived task.
51
+ This lets /opsr:flow pick up an interrupted change instead of recreating planning artifacts.
52
+
53
+ ## Pacing
54
+ Pause for user confirmation between planning phases (1–4) when scope is ambiguous; once tasks are
55
+ agreed, Phase 5 can run task-by-task with a trace after each.
56
+
57
+ ## Output
58
+ - A fully executed change: all planning artifacts archived, deltas synced, code implemented.
59
+
60
+ ## Important rules
61
+ - Delegate each phase to its skill — never inline another skill's workflow into this one.
62
+ - Honor every phase gate (validation, harness checklists) as defined by the delegated skill.
63
+ - Implementation code is written to local files; planning artifacts live only in the database.
64
+ `,
65
+ };