Skip to content

Commit 0b70ecd

Browse files
authored
feat: import 5 CEP workflow commands and add convert-cc-defs skill (#61)
* feat: import 5 CEP workflow commands and add convert-cc-defs skill Import brainstorm, compound, plan, review, and work workflow commands from CEP upstream (04ee7e4). Each command went through mechanical conversion via the converter pipeline followed by intelligent rewrites: code block audits, branding fixes, CC-specific feature handling. Add convert-cc-defs project skill (.opencode/skills/) for importing and syncing definitions from CEP/Superpowers into Systematic. Includes 5-phase workflow, manifest tracking, manual override preservation, and re-sync support. Other changes: - Extend sync-manifest schema with upstream_content_hash, rewrites, manual_overrides fields - Populate sync-manifest.json with all 5 command entries - Fix CEP/CC disambiguation in docs (CEP is a plugin FOR Claude Code) - Add converter tests for new tool mappings and edge cases * feat: structured manual override tracking with agent workflow Upgrade manual_overrides from string[] to structured ManualOverride[] objects with field, reason, original, and overridden_at. This enables agents to track post-import customizations with provenance, and the re-sync workflow to detect conflicts between upstream changes and local overrides. Changes: - Add ManualOverride interface and isManualOverride type guard - Update JSON Schema with structured override object definition - Add Phase 4e 'Record Manual Edit' sub-workflow to convert-cc-defs skill - Add override merge matrix and conflict presentation to Re-Sync Workflow - Add 5 new tests for override validation (structured, empty, string rejection, missing fields, optional original) * docs(solutions): document structured manual override tracking pattern Add best practice doc for structured ManualOverride[] tracking in sync manifest. Includes agent workflow for recording post-import edits and re-sync conflict resolution matrix. Cross-linked with converter doc. * docs: update AGENTS.md with module and test file counts - Update module count from 12 to 13 in core implementation section. - Add details about upstream provenance tracking in data flow. - Correct test file counts in commands and tests sections. - Enhance manifest tracking information in key types and modules.
1 parent 520fc6d commit 0b70ecd

22 files changed

Lines changed: 1378 additions & 212 deletions

.opencode/skills/convert-cc-defs/SKILL.md

Lines changed: 553 additions & 0 deletions
Large diffs are not rendered by default.

AGENTS.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# AGENTS.md - Coding Agent Guidelines for Systematic
22

3-
**Generated:** 2026-02-09 | **Commit:** b00201d | **Branch:** main
3+
**Generated:** 2026-02-10 | **Commit:** b58d17c | **Branch:** feat/import-cep-workflow-commands
44

55
## Overview
66

7-
OpenCode plugin providing structured engineering workflows. Converts Claude Code (CEP) agents, skills, and commands to OpenCode format.
7+
OpenCode plugin providing structured engineering workflows. Ported from the [Compound Engineering Plugin (CEP)](https://github.com/EveryInc/compound-engineering-plugin) for Claude Code, with improvements and OpenCode SDK integration. Converts CC-format agents, skills, and commands to OpenCode format. Tracks upstream provenance via `sync-manifest.json`.
88

99
**Two distinct parts:**
1010
1. **TypeScript source** (`src/`) — Plugin logic, tools, config handling
@@ -17,7 +17,7 @@ bun install # Install deps
1717
bun run build # Build to dist/
1818
bun run typecheck # Type check (strict)
1919
bun run lint # Biome linter
20-
bun test tests/unit # Unit tests (10 files)
20+
bun test tests/unit # Unit tests (11 files)
2121
bun test tests/integration # Integration tests (2 files)
2222
bun test # All tests
2323
bun test --filter "pattern" # Filter tests
@@ -42,16 +42,20 @@ systematic/
4242
├── src/
4343
│ ├── index.ts # Plugin entry (SystematicPlugin)
4444
│ ├── cli.ts # CLI entry (list/convert/config commands)
45-
│ └── lib/ # 12 core modules (see src/lib/AGENTS.md)
45+
│ └── lib/ # 13 core modules (see src/lib/AGENTS.md)
4646
├── skills/ # 8 bundled skills (SKILL.md format)
4747
├── agents/ # 11 bundled agents (4 categories: design/research/review/workflow)
48-
├── commands/ # 9 bundled commands (with workflows/ subdir)
48+
├── commands/ # 9 bundled commands (5 workflow + 4 utility)
49+
│ └── workflows/ # brainstorm, compound, plan, review, work
4950
├── docs/ # Starlight docs workspace (see docs/AGENTS.md)
5051
│ ├── scripts/ # Content generation from bundled assets
5152
│ └── src/content/ # Manual guides + generated reference
5253
├── tests/
53-
│ ├── unit/ # 10 test files
54+
│ ├── unit/ # 11 test files
5455
│ └── integration/ # 2 test files
56+
├── .opencode/ # Project-specific OC config + skills
57+
│ └── skills/ # Project-only skills (convert-cc-defs)
58+
├── sync-manifest.json # Upstream provenance tracking
5559
└── dist/ # Build output
5660
```
5761

@@ -70,10 +74,12 @@ systematic/
7074
| Asset discovery | `src/lib/skills.ts`, `agents.ts`, `commands.ts` |
7175
| Directory walking | `src/lib/walk-dir.ts` |
7276
| Config loading (JSONC) | `src/lib/config.ts` |
77+
| Upstream sync manifest | `src/lib/manifest.ts`, `sync-manifest.json` |
7378
| CLI commands | `src/cli.ts` |
7479
| Add new skill | `skills/<name>/SKILL.md` |
7580
| Add new agent | `agents/<category>/<name>.md` |
7681
| Add new command | `commands/<name>.md` |
82+
| Import from CEP upstream | `.opencode/skills/convert-cc-defs/SKILL.md` |
7783
| Docs content generation | `docs/scripts/transform-content.ts` |
7884
| Docs site config | `docs/astro.config.mjs` |
7985

@@ -82,18 +88,22 @@ systematic/
8288
| Symbol | Type | Location | Refs | Role |
8389
|--------|------|----------|------|------|
8490
| `SystematicPlugin` | export | src/index.ts:30 | 2 | Main plugin factory |
85-
| `createConfigHandler` | fn | src/lib/config-handler.ts:205 | 3 | Config hook — merges bundled assets |
91+
| `createConfigHandler` | fn | src/lib/config-handler.ts:207 | 3 | Config hook — merges bundled assets |
8692
| `createSkillTool` | fn | src/lib/skill-tool.ts:87 | 3 | systematic_skill tool factory |
8793
| `getBootstrapContent` | fn | src/lib/bootstrap.ts:32 | 3 | System prompt injection |
88-
| `convertContent` | fn | src/lib/converter.ts:234 | 4 | CEP→OpenCode body conversion |
89-
| `convertFileWithCache` | fn | src/lib/converter.ts:274 | 6 | Cached file conversion (mtime invalidation) |
94+
| `convertContent` | fn | src/lib/converter.ts:371 | 4 | CEP→OpenCode body conversion |
95+
| `convertFileWithCache` | fn | src/lib/converter.ts:411 | 6 | Cached file conversion (mtime invalidation) |
9096
| `findSkillsInDir` | fn | src/lib/skills.ts:90 | 6 | Skill discovery (highest centrality) |
9197
| `findAgentsInDir` | fn | src/lib/agents.ts:47 | 4 | Agent discovery (category from subdir) |
9298
| `findCommandsInDir` | fn | src/lib/commands.ts:27 | 4 | Command discovery |
9399
| `loadConfig` | fn | src/lib/config.ts:47 | 5 | JSONC config loading + 3-source merge |
94100
| `parseFrontmatter` | fn | src/lib/frontmatter.ts:19 | 7 | YAML frontmatter extraction (regex-based) |
95101
| `walkDir` | fn | src/lib/walk-dir.ts:17 | 3 | Recursive dir walker (foundation layer) |
96102
| `loadSkill` | fn | src/lib/skill-loader.ts:31 | 2 | Skill content loading + XML wrapping |
103+
| `readManifest` | fn | src/lib/manifest.ts:116 | 1 | Read + validate sync-manifest.json |
104+
| `validateManifest` | fn | src/lib/manifest.ts:100 | 2 | Schema validation for manifest data |
105+
| `writeManifest` | fn | src/lib/manifest.ts:140 | 1 | Write manifest with sorted keys |
106+
| `findStaleEntries` | fn | src/lib/manifest.ts:145 | 1 | Detect definitions missing from filesystem |
97107

98108
## Conventions
99109

@@ -134,10 +144,15 @@ Skills registered as commands with `systematic:` prefix (auto-prepended if no co
134144

135145
All disabled lists merge (union), bootstrap config shallow-merges.
136146

147+
## Upstream Sync
148+
149+
CEP definitions are imported via the `convert-cc-defs` skill (`.opencode/skills/`). `sync-manifest.json` tracks provenance: upstream commit, content hash, rewrites applied, and manual overrides. Re-sync compares hashes for idempotency.
150+
137151
## Notes
138152

139153
- Bootstrap injection is opt-out via `bootstrap.enabled: false`
140154
- Converter caches results using file mtime
141155
- CLI commands: `list` (skills/agents/commands), `convert` (file conversion), `config show/path`
142156
- Experimental hook: `experimental.chat.system.transform`
143157
- `docs/` is a separate workspace — run `bun run docs:generate` to sync reference content from bundled assets
158+
- Use `bun src/cli.ts` for local dev instead of `bunx systematic` to avoid slow resolution

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Agents are specialized subagents with pre-configured prompts and expertise. They
146146

147147
### Using Agents
148148

149-
Agents are invoked via OpenCode's `@mention` syntax or `delegate_task`:
149+
Agents are invoked via OpenCode's `@mention` syntax or `task`:
150150

151151
```
152152
@architecture-strategist Review the authentication refactoring in this PR
@@ -155,7 +155,7 @@ Agents are invoked via OpenCode's `@mention` syntax or `delegate_task`:
155155
Or programmatically in skills/commands:
156156

157157
```
158-
delegate_task(subagent_type="architecture-strategist", prompt="Review...")
158+
task(subagent_type="architecture-strategist", prompt="Review...")
159159
```
160160

161161
## Commands
@@ -387,7 +387,7 @@ See [`AGENTS.md`](./AGENTS.md) for detailed development guidelines, code style c
387387

388388
## Converting from Claude Code
389389

390-
Migrating skills, agents, or commands from Claude Code (CEP) to Systematic? See the [Conversion Guide](https://fro.bot/systematic/guides/conversion-guide/) for field mappings and examples. Also available as [local Markdown](./docs/CONVERSION-GUIDE.md).
390+
Migrating skills, agents, or commands from CEP or other Claude Code-format sources to Systematic? See the [Conversion Guide](https://fro.bot/systematic/guides/conversion-guide/) for field mappings and examples. Also available as [local Markdown](./docs/CONVERSION-GUIDE.md).
391391

392392
## References
393393

commands/workflows/brainstorm.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ Evaluate whether brainstorming is needed based on the feature description.
3333
- Constrained, well-defined scope
3434

3535
**If requirements are already clear:**
36-
Use **AskUserQuestion tool** to suggest: "Your requirements seem detailed enough to proceed directly to planning. Should I run `/workflows:plan` instead, or would you like to explore the idea further?"
36+
Use the **question tool** to suggest: "Your requirements seem detailed enough to proceed directly to planning. Should I run `/workflows:plan` instead, or would you like to explore the idea further?"
3737

3838
### Phase 1: Understand the Idea
3939

4040
#### 1.1 Repository Research (Lightweight)
4141

4242
Run a quick repo scan to understand existing patterns:
4343

44-
- Task repo-research-analyst("Understand existing patterns related to: <feature_description>")
44+
- task repo-research-analyst("Understand existing patterns related to: <feature_description>")
4545

46-
Focus on: similar features, established patterns, CLAUDE.md guidance.
46+
Focus on: similar features, established patterns, AGENTS.md guidance.
4747

4848
#### 1.2 Collaborative Dialogue
4949

50-
Use the **AskUserQuestion tool** to ask questions **one at a time**.
50+
Use the **question tool** to ask questions **one at a time**.
5151

5252
**Guidelines (see `brainstorming` skill for detailed techniques):**
5353
- Prefer multiple choice when natural options exist
@@ -68,7 +68,7 @@ For each approach, provide:
6868

6969
Lead with your recommendation and explain why. Apply YAGNI—prefer simpler solutions.
7070

71-
Use **AskUserQuestion tool** to ask which approach the user prefers.
71+
Use the **question tool** to ask which approach the user prefers.
7272

7373
### Phase 3: Capture the Design
7474

@@ -80,15 +80,24 @@ Ensure `docs/brainstorms/` directory exists before writing.
8080

8181
### Phase 4: Handoff
8282

83-
Use **AskUserQuestion tool** to present next steps:
83+
Use the **question tool** to present next steps:
8484

8585
**Question:** "Brainstorm captured. What would you like to do next?"
8686

8787
**Options:**
88-
1. **Proceed to planning** - Run `/workflows:plan` (will auto-detect this brainstorm)
89-
2. **Refine design further** - Continue exploring
88+
1. **Review and refine** - Improve the document through structured self-review
89+
2. **Proceed to planning** - Run `/workflows:plan` (will auto-detect this brainstorm)
9090
3. **Done for now** - Return later
9191

92+
**If user selects "Review and refine":**
93+
94+
Load the `document-review` skill and apply it to the brainstorm document.
95+
96+
When document-review returns "Review complete", present next steps:
97+
98+
1. **Move to planning** - Continue to `/workflows:plan` with this document
99+
2. **Done for now** - Brainstorming complete. To start planning later: `/workflows:plan [document-path]`
100+
92101
## Output Summary
93102

94103
When complete, display:

commands/workflows/compound.md

Lines changed: 95 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -21,53 +21,83 @@ Captures problem solutions while context is fresh, creating structured documenta
2121
/workflows:compound [brief context] # Provide additional context hint
2222
```
2323

24-
## Execution Strategy: Parallel Subagents
25-
26-
This command launches multiple specialized subagents IN PARALLEL to maximize efficiency:
27-
28-
### 1. **Context Analyzer** (Parallel)
29-
- Extracts conversation history
30-
- Identifies problem type, component, symptoms
31-
- Validates against CORA schema
32-
- Returns: YAML frontmatter skeleton
33-
34-
### 2. **Solution Extractor** (Parallel)
35-
- Analyzes all investigation steps
36-
- Identifies root cause
37-
- Extracts working solution with code examples
38-
- Returns: Solution content block
39-
40-
### 3. **Related Docs Finder** (Parallel)
41-
- Searches `docs/solutions/` for related documentation
42-
- Identifies cross-references and links
43-
- Finds related GitHub issues
44-
- Returns: Links and relationships
45-
46-
### 4. **Prevention Strategist** (Parallel)
47-
- Develops prevention strategies
48-
- Creates best practices guidance
49-
- Generates test cases if applicable
50-
- Returns: Prevention/testing content
51-
52-
### 5. **Category Classifier** (Parallel)
53-
- Determines optimal `docs/solutions/` category
54-
- Validates category against schema
55-
- Suggests filename based on slug
56-
- Returns: Final path and filename
57-
58-
### 6. **Documentation Writer** (Parallel)
59-
- Assembles complete markdown file
60-
- Validates YAML frontmatter
61-
- Formats content for readability
62-
- Creates the file in correct location
63-
64-
### 7. **Optional: Specialized Agent Invocation** (Post-Documentation)
65-
Based on problem type detected, automatically invoke applicable agents:
66-
- **performance_issue**`performance-oracle`
67-
- **security_issue**`security-sentinel`
68-
- **database_issue**`data-integrity-guardian`
69-
- **test_failure**`cora-test-reviewer`
70-
- Any code-heavy issue → `kieran-rails-reviewer` + `code-simplicity-reviewer`
24+
## Execution Strategy: Two-Phase Orchestration
25+
26+
<critical_requirement>
27+
**Only ONE file gets written - the final documentation.**
28+
29+
Phase 1 subagents return TEXT DATA to the orchestrator. They must NOT use Write, Edit, or create any files. Only the orchestrator (Phase 2) writes the final documentation file.
30+
</critical_requirement>
31+
32+
### Phase 1: Parallel Research
33+
34+
<parallel_tasks>
35+
36+
Launch these subagents IN PARALLEL. Each returns text data to the orchestrator.
37+
38+
#### 1. **Context Analyzer**
39+
- Extracts conversation history
40+
- Identifies problem type, component, symptoms
41+
- Validates against schema
42+
- Returns: YAML frontmatter skeleton
43+
44+
#### 2. **Solution Extractor**
45+
- Analyzes all investigation steps
46+
- Identifies root cause
47+
- Extracts working solution with code examples
48+
- Returns: Solution content block
49+
50+
#### 3. **Related Docs Finder**
51+
- Searches `docs/solutions/` for related documentation
52+
- Identifies cross-references and links
53+
- Finds related GitHub issues
54+
- Returns: Links and relationships
55+
56+
#### 4. **Prevention Strategist**
57+
- Develops prevention strategies
58+
- Creates best practices guidance
59+
- Generates test cases if applicable
60+
- Returns: Prevention/testing content
61+
62+
#### 5. **Category Classifier**
63+
- Determines optimal `docs/solutions/` category
64+
- Validates category against schema
65+
- Suggests filename based on slug
66+
- Returns: Final path and filename
67+
68+
</parallel_tasks>
69+
70+
### Phase 2: Assembly & Write
71+
72+
<sequential_tasks>
73+
74+
**WAIT for all Phase 1 subagents to complete before proceeding.**
75+
76+
The orchestrating agent (main conversation) performs these steps:
77+
78+
1. Collect all text results from Phase 1 subagents
79+
2. Assemble complete markdown file from the collected pieces
80+
3. Validate YAML frontmatter against schema
81+
4. Create directory if needed: `mkdir -p docs/solutions/[category]/`
82+
5. Write the SINGLE final file: `docs/solutions/[category]/[filename].md`
83+
84+
</sequential_tasks>
85+
86+
### Phase 3: Optional Enhancement
87+
88+
**WAIT for Phase 2 to complete before proceeding.**
89+
90+
<parallel_tasks>
91+
92+
Based on problem type, optionally invoke specialized agents to review the documentation:
93+
94+
- **performance_issue**`performance-oracle`
95+
- **security_issue**`security-sentinel`
96+
- **database_issue**`data-integrity-guardian`
97+
- **test_failure**`cora-test-reviewer`
98+
- Any code-heavy issue → `kieran-rails-reviewer` + `code-simplicity-reviewer`
99+
100+
</parallel_tasks>
71101

72102
## What It Captures
73103

@@ -110,24 +140,29 @@ This command launches multiple specialized subagents IN PARALLEL to maximize eff
110140
- integration-issues/
111141
- logic-errors/
112142

143+
## Common Mistakes to Avoid
144+
145+
| Wrong | Correct |
146+
|----------|-----------:|
147+
| Subagents write files like `context-analysis.md`, `solution-draft.md` | Subagents return text data; orchestrator writes one final file |
148+
| Research and assembly run in parallel | Research completes, then assembly runs |
149+
| Multiple files created during workflow | Single file: `docs/solutions/[category]/[filename].md` |
150+
113151
## Success Output
114152

115153
```
116-
✓ Parallel documentation generation complete
117-
118-
Primary Subagent Results:
119-
✓ Context Analyzer: Identified performance_issue in brief_system
120-
✓ Solution Extractor: Extracted 3 code fixes
121-
✓ Related Docs Finder: Found 2 related issues
122-
✓ Prevention Strategist: Generated test cases
123-
✓ Category Classifier: docs/solutions/performance-issues/
124-
✓ Documentation Writer: Created complete markdown
154+
Subagent Results:
155+
Context Analyzer: Identified performance_issue in brief_system
156+
Solution Extractor: 3 code fixes
157+
Related Docs Finder: 2 related issues
158+
Prevention Strategist: Prevention strategies, test suggestions
159+
Category Classifier: `performance-issues`
125160
126161
Specialized Agent Reviews (Auto-Triggered):
127-
performance-oracle: Validated query optimization approach
128-
kieran-rails-reviewer: Code examples meet Rails standards
129-
code-simplicity-reviewer: Solution is appropriately minimal
130-
every-style-editor: Documentation style verified
162+
performance-oracle: Validated query optimization approach
163+
kieran-rails-reviewer: Code examples meet Rails standards
164+
code-simplicity-reviewer: Solution is appropriately minimal
165+
every-style-editor: Documentation style verified
131166
132167
File created:
133168
- docs/solutions/performance-issues/n-plus-one-brief-generation.md

0 commit comments

Comments
 (0)