compound-workflow 0.1.1

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.
Files changed (55) hide show
  1. package/.claude-plugin/marketplace.json +11 -0
  2. package/.claude-plugin/plugin.json +12 -0
  3. package/.cursor-plugin/plugin.json +12 -0
  4. package/README.md +155 -0
  5. package/package.json +22 -0
  6. package/scripts/install-cli.mjs +313 -0
  7. package/scripts/sync-into-repo.sh +103 -0
  8. package/src/.agents/agents/research/best-practices-researcher.md +132 -0
  9. package/src/.agents/agents/research/framework-docs-researcher.md +134 -0
  10. package/src/.agents/agents/research/git-history-analyzer.md +62 -0
  11. package/src/.agents/agents/research/learnings-researcher.md +288 -0
  12. package/src/.agents/agents/research/repo-research-analyst.md +146 -0
  13. package/src/.agents/agents/review/agent-native-reviewer.md +299 -0
  14. package/src/.agents/agents/workflow/bug-reproduction-validator.md +87 -0
  15. package/src/.agents/agents/workflow/lint.md +20 -0
  16. package/src/.agents/agents/workflow/spec-flow-analyzer.md +149 -0
  17. package/src/.agents/commands/assess.md +60 -0
  18. package/src/.agents/commands/install.md +53 -0
  19. package/src/.agents/commands/metrics.md +59 -0
  20. package/src/.agents/commands/setup.md +9 -0
  21. package/src/.agents/commands/sync.md +9 -0
  22. package/src/.agents/commands/test-browser.md +393 -0
  23. package/src/.agents/commands/workflow/brainstorm.md +252 -0
  24. package/src/.agents/commands/workflow/compound.md +142 -0
  25. package/src/.agents/commands/workflow/plan.md +737 -0
  26. package/src/.agents/commands/workflow/review-v2.md +148 -0
  27. package/src/.agents/commands/workflow/review.md +110 -0
  28. package/src/.agents/commands/workflow/triage.md +54 -0
  29. package/src/.agents/commands/workflow/work.md +439 -0
  30. package/src/.agents/references/README.md +12 -0
  31. package/src/.agents/references/standards/README.md +9 -0
  32. package/src/.agents/scripts/self-check.mjs +227 -0
  33. package/src/.agents/scripts/sync-opencode.mjs +355 -0
  34. package/src/.agents/skills/agent-browser/SKILL.md +223 -0
  35. package/src/.agents/skills/audit-traceability/SKILL.md +260 -0
  36. package/src/.agents/skills/brainstorming/SKILL.md +250 -0
  37. package/src/.agents/skills/compound-docs/SKILL.md +533 -0
  38. package/src/.agents/skills/compound-docs/assets/critical-pattern-template.md +34 -0
  39. package/src/.agents/skills/compound-docs/assets/resolution-template.md +97 -0
  40. package/src/.agents/skills/compound-docs/references/yaml-schema.md +87 -0
  41. package/src/.agents/skills/compound-docs/schema.project.yaml +18 -0
  42. package/src/.agents/skills/compound-docs/schema.yaml +119 -0
  43. package/src/.agents/skills/data-foundations/SKILL.md +185 -0
  44. package/src/.agents/skills/document-review/SKILL.md +108 -0
  45. package/src/.agents/skills/file-todos/SKILL.md +177 -0
  46. package/src/.agents/skills/file-todos/assets/todo-template.md +106 -0
  47. package/src/.agents/skills/financial-workflow-integrity/SKILL.md +423 -0
  48. package/src/.agents/skills/git-worktree/SKILL.md +268 -0
  49. package/src/.agents/skills/pii-protection-prisma/SKILL.md +629 -0
  50. package/src/.agents/skills/process-metrics/SKILL.md +46 -0
  51. package/src/.agents/skills/process-metrics/assets/daily-template.md +37 -0
  52. package/src/.agents/skills/process-metrics/assets/monthly-template.md +21 -0
  53. package/src/.agents/skills/process-metrics/assets/weekly-template.md +25 -0
  54. package/src/.agents/skills/technical-review/SKILL.md +83 -0
  55. package/src/AGENTS.md +213 -0
@@ -0,0 +1,21 @@
1
+ ---
2
+ month: YYYY-MM
3
+ ---
4
+
5
+ # Monthly Metrics
6
+
7
+ ## Summary
8
+
9
+ - sessions: <int>
10
+ - success: <int>
11
+ - partial: <int>
12
+ - failed: <int>
13
+ - avg_minutes: <int>
14
+
15
+ ## Trends
16
+
17
+ - <trend>
18
+
19
+ ## Actions
20
+
21
+ - <action> (target: command|skill|agent|config)
@@ -0,0 +1,25 @@
1
+ ---
2
+ week: YYYY-WW
3
+ ---
4
+
5
+ # Weekly Metrics
6
+
7
+ ## Summary
8
+
9
+ - sessions: <int>
10
+ - success: <int>
11
+ - partial: <int>
12
+ - failed: <int>
13
+ - avg_minutes: <int>
14
+
15
+ ## Top Failure Modes
16
+
17
+ - <failure mode> (count)
18
+
19
+ ## Top Blockers
20
+
21
+ - <blocker> (count)
22
+
23
+ ## Actions
24
+
25
+ - <action> (target: command|skill|agent|config)
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: technical-review
3
+ description: Use when a feature approach or plan doc has passed document review and must be checked for technical correctness before build. Triggers on "technical review", "tech review", or as next step after document review in pre-build gate.
4
+ ---
5
+
6
+ # Technical Review
7
+
8
+ Review a feature approach or plan document for technical alignment with architecture, code standards, and quality. Output risk level, three options with justifications, and a recommendation. Do not approve for build until the plan is updated via a second document review.
9
+
10
+ ## When to Use
11
+
12
+ - After **document review** on a feature approach doc (pre-build gate flow).
13
+ - When the user asks for "technical review" or "tech review" of a plan.
14
+ - Input: document path if provided; otherwise discover latest in `docs/brainstorms/` or `docs/plans/`.
15
+
16
+ ## Step 1: Get the Document
17
+
18
+ **If a document path is provided:** Read it, then proceed to Step 2.
19
+
20
+ **If no document is specified:** Use the doc just reviewed in document review, or look for the most recent feature approach/plan in `docs/brainstorms/` or `docs/plans/` (e.g. by date prefix).
21
+
22
+ ## Step 2: Assess Against Technical Criteria
23
+
24
+ Evaluate the plan against:
25
+
26
+ | Criterion | What to Check |
27
+ | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
28
+ | **Architecture** | Alignment with repo architecture and patterns: layers, controllers, routing, encapsulation; no conflicting or missing patterns. |
29
+ | **Code standards** | Conventions, file layout (`app/`), naming, patterns used in the repo; no conflicting patterns. |
30
+ | **Quality** | Testability, observability, error handling, dependencies; feasibility and scope realism. |
31
+ | **Stack and libraries** | Expo, React Native, expo-router; existing deps and APIs used correctly; no unsupported or conflicting choices. |
32
+
33
+ Note findings. Do not fix the doc in this skill—output options and recommendation.
34
+
35
+ ## Step 3: Categorize Risk Level
36
+
37
+ Assign one **overall** risk level for the plan:
38
+
39
+ | Level | Definition |
40
+ | ---------- | ------------------------------------------------------------------------------------------------------------- |
41
+ | **Low** | Aligned with architecture and standards; no material unknowns; can build as described. |
42
+ | **Medium** | Minor gaps or deviations; fixable in the doc or during implementation with small adjustments. |
43
+ | **High** | Material misalignment, missing patterns, or feasibility concerns; doc or approach should change before build. |
44
+
45
+ State the risk level and one-line rationale.
46
+
47
+ ## Step 4: Three Options with Justifications
48
+
49
+ For each option, provide 2–3 sentences justification:
50
+
51
+ - **Option A — Proceed as-is** — When risk is low. Justify why no changes are needed.
52
+ - **Option B — Proceed with changes** — When risk is medium. List specific doc or code changes; justify why this is sufficient.
53
+ - **Option C — Rework or spike** — When risk is high or uncertain. Say what to rework or spike; justify why build should wait.
54
+
55
+ ## Step 5: Recommendation
56
+
57
+ State the **preferred option** and clear rationale (e.g. "Recommend Option B because …"). Tie to the risk level and findings.
58
+
59
+ ## Step 6: Output and Handoff
60
+
61
+ - **If pass (Option A or B with changes agreed):** Say "Approved for build" and optional notes. **Handoff:** Run **document review again** to update the plan with technical review findings (recommendation, agreed changes). Then build.
62
+ - **If issues (Option C or B with open changes):** List issues to fix in the doc; do not approve for build until addressed. Handoff: update the plan (or re-run document review to incorporate fixes), then optionally re-run technical review.
63
+
64
+ ## Required Output
65
+
66
+ End every technical review with:
67
+
68
+ - `Risk level:` low | medium | high (plus one-line rationale)
69
+ - `Options A/B/C:` 2–3 sentences each
70
+ - `Recommendation:` preferred option and rationale
71
+ - `Approved for build:` yes | no
72
+ - `Handoff:` re-run document review to update plan with findings before build (when approved), or list issues to fix (when not approved)
73
+
74
+ ## What NOT to Do
75
+
76
+ - Do not rewrite the plan in this skill.
77
+ - Do not add scope or new requirements.
78
+ - Do not approve for build when risk is high and no rework is agreed.
79
+ - Do not skip the second document review—the plan must be updated with technical review findings before build.
80
+
81
+ ## Integration
82
+
83
+ - **Repo:** Reference stack (Expo, React Native, expo-router) and `app/` layout from AGENTS.md when checking code standards and stack.
package/src/AGENTS.md ADDED
@@ -0,0 +1,213 @@
1
+ # Agent Operating Principles
2
+
3
+ This `.agents` workspace is portable and command-first.
4
+
5
+ ## Contents
6
+
7
+ - Canonical Workflow
8
+ - Non-negotiables (Structure Integrity)
9
+ - Planning Fidelity Model
10
+ - Routing Rules
11
+ - Repo Configuration (Optional)
12
+ - Directory Layout
13
+ - Implemented Components (Current Scope)
14
+ - Skill Index (When to Use What)
15
+ - Reference Standards Policy (Anti-Skill-Sprawl)
16
+
17
+ ## Core Principles
18
+
19
+ 1. Commands are the public API. Skills and agents are composable internals.
20
+ 2. Core workflows stay generic. Domain-specific behavior loads only when context requires it.
21
+ 3. Planning quality is explicit via fidelity selection.
22
+ 4. Selection must be deterministic and visible: always state which skills/agents were selected and why.
23
+ 5. Brainstorm and plan do not write code.
24
+
25
+ ## Canonical Workflow
26
+
27
+ 1. `/workflow:brainstorm` -> clarify what to build
28
+ 2. `/workflow:plan` -> define how to build it
29
+ 3. `/workflow:work` -> implement
30
+ 4. `/workflow:review` -> validate quality
31
+ 5. `/workflow:compound` -> capture durable learnings
32
+
33
+ Supporting command:
34
+
35
+ - `/workflow:triage` -> approve and prioritize pending todos
36
+
37
+ Continuous improvement:
38
+
39
+ - `/metrics` -> log + assess a session and suggest improvements
40
+ - `/assess` -> aggregate daily metrics (weekly/monthly) and propose improvements
41
+
42
+ Onboarding:
43
+
44
+ - `/install` -> one action: writes opencode.json, merges AGENTS.md, creates dirs, preserves Repo Config Block (run `npx compound-workflow install` in the project)
45
+
46
+ This workspace currently implements `brainstorm`, `plan`, `work`, `review`, `compound`, and optional QA utilities.
47
+
48
+ Use the canonical command names (`/workflow:plan`, `/workflow:work`, `/workflow:review`, etc.). This template does not ship aliases.
49
+
50
+ ## Non-negotiables (Structure Integrity)
51
+
52
+ - **Commands are the public API.** Keep `/workflow:*` command docs stable; add capability via skills/agents, not new command variants.
53
+ - **Brainstorm = WHAT, Plan = HOW.** `/workflow:plan` must not re-litigate decisions already captured in `docs/brainstorms/`.
54
+ - **Local grounding is mandatory.** Every plan must cite at least 1–3 internal file path/line refs (existing patterns) and any relevant `docs/solutions/**` learnings.
55
+ - **Fidelity + confidence are required declarations** in every plan file: always output the Fidelity/Confidence/Research-mode block; the chosen template must include the required sections for that fidelity (Low/Medium/High).
56
+ - **SpecFlow is a validation gate, not a rewrite engine.** High fidelity required; Medium recommended; Low optional. Output must translate into acceptance criteria/edge cases, not new scope.
57
+ - **Skills are invoked only by trigger.** `document-review` only when user selects "Review and refine" (or explicit request); guardrail skills (PII/financial/audit/data) only when the feature touches that domain.
58
+ - **No new files/directories by default** beyond `docs/plans/...` for planning output.
59
+ - **Plan file is the artifact.** Post-generation options are actions on the artifact; they do not change the workflow shape.
60
+ - **Tighten over expand.** Resolve ambiguity, standardize naming, enforce sections—avoid adding new process steps unless they reduce rework.
61
+
62
+ ## Planning Fidelity Model
63
+
64
+ `/workflow:plan` must always declare:
65
+
66
+ - `Fidelity selected`: `Low | Medium | High`
67
+ - `Confidence`: `High | Medium | Low`
68
+ - Why this fidelity (2-4 reasons)
69
+ - Research mode used (`local only` or `local + external`)
70
+ - Open questions (if any)
71
+
72
+ ### Selection Rules
73
+
74
+ - If any high-risk trigger exists, select `High`.
75
+ - If signals are mixed or unclear, default to `Medium`.
76
+ - Otherwise select `Low`.
77
+
78
+ High-risk triggers include: security, payments, privacy, data migration/backfills, production infra/deployment, or hard rollback.
79
+
80
+ ### Required Output by Fidelity
81
+
82
+ - `Low`: problem, constraints, acceptance criteria, implementation outline, verification checklist.
83
+ - `Medium`: all Low + alternatives/tradeoffs, dependency/risk table, rollout notes, observability/test notes.
84
+ - `High`: all Medium + failure modes, rollback plan, deployment gates, migration/data safety checks, expanded test matrix.
85
+
86
+ ## Routing Rules
87
+
88
+ - Prefer existing project patterns before introducing new ones.
89
+ - Always run local repo + institutional learnings research first for planning.
90
+ - Run external best-practice/framework research based on fidelity and risk.
91
+ - For medium/high fidelity plans that touch existing behavior, consider `git-history-analyzer` to understand why the current code is the way it is.
92
+ - Use generic fallback behavior if domain-specific skills are unavailable.
93
+
94
+ ## Repo Configuration (Optional)
95
+
96
+ To keep this `.agents` bundle portable, prefer configuring repo-specific commands and defaults in this file.
97
+
98
+ Suggested keys (examples):
99
+
100
+ - `default_branch: main`
101
+ - `dev_server_url: http://localhost:3000`
102
+ - `test_command: npm test`
103
+ - `test_fast_command: npm test -- --watch=false --runInBand`
104
+ - `lint_command: npm run lint`
105
+ - `format_command: npm run format`
106
+ - `project_tracker: github` (or `linear`)
107
+ - `worktree_dir: .worktrees` (optional; where worktrees are created)
108
+ - `worktree_copy_files: [...]` (optional; env/config files to copy into new worktrees; non-overwriting)
109
+ - `worktree_install_command: <cmd>` (optional; deps install command to run in new worktrees)
110
+ - `worktree_bootstrap_notes: [...]` (optional; prerequisites per worktree: system deps/services/tooling; documented only)
111
+
112
+ ### Repo Config Block (Optional)
113
+
114
+ If you want commands to read these values deterministically, add a small YAML block under this section:
115
+
116
+ ```yaml
117
+ default_branch: main
118
+ dev_server_url: http://localhost:3000
119
+ test_command: npm test
120
+ test_fast_command: npm test -- --watch=false
121
+ lint_command: npm run lint
122
+ format_command: npm run format
123
+ project_tracker: github
124
+ worktree_dir: .worktrees
125
+ worktree_copy_files:
126
+ - .env
127
+ - .env.local
128
+ worktree_install_command: npm ci
129
+ worktree_bootstrap_notes:
130
+ - Ensure required system deps are installed (e.g. via brew/apt)
131
+ - Ensure local services are running (e.g. postgres/redis)
132
+ - If using direnv: run `direnv allow`
133
+ ```
134
+
135
+ ## Directory Layout
136
+
137
+ - Commands: `.agents/commands/*.md` and `.agents/commands/workflow/*.md` (workflow namespace)
138
+ - Skills: `.agents/skills/*/SKILL.md`
139
+ - References: `.agents/references/**`
140
+ - Agents: `.agents/agents/**/*.md`
141
+
142
+ ## Implemented Components (Current Scope)
143
+
144
+ - Commands: `workflow:brainstorm`, `workflow:plan`, `workflow:work`, `workflow:triage`, `workflow:review`, `workflow:compound` (under `.agents/commands/workflow/`), plus `test-browser`, `metrics`, `assess`, `setup`, `sync` (root commands)
145
+ - Skills: `brainstorming`, `document-review`, `technical-review`, `compound-docs`, `file-todos`, `agent-browser`, `git-worktree`, `process-metrics`, `pii-protection-prisma`, `financial-workflow-integrity`, `audit-traceability`, `data-foundations`
146
+ - Agents:
147
+ - `repo-research-analyst`
148
+ - `learnings-researcher`
149
+ - `git-history-analyzer`
150
+ - `best-practices-researcher`
151
+ - `framework-docs-researcher`
152
+ - `spec-flow-analyzer`
153
+ - `lint`
154
+ - `bug-reproduction-validator`
155
+ - `agent-native-reviewer`
156
+
157
+ ## Skill Index (When to Use What)
158
+
159
+ Skills fall into two buckets:
160
+
161
+ 1. Workflow skills: invoked by commands to do work (e.g. `/workflow:review`, `/workflow:compound`).
162
+ 2. Reference standards: enforce design/build guardrails when the work touches security, privacy, money, or multi-tenant data.
163
+
164
+ Use reference standards proactively during `/workflow:plan`, `/workflow:work`, and PR review.
165
+
166
+ ## Reference Standards Policy (Anti-Skill-Sprawl)
167
+
168
+ To keep this workspace usable and portable, reference standards are intentionally limited.
169
+
170
+ Rules:
171
+
172
+ - Cap: MAX 12 reference standards skills under `.agents/skills/`.
173
+ - Promotion: create a new reference standard skill only if it meets at least 2 criteria:
174
+ - introduces MUST/MUST NOT rules that change build decisions
175
+ - includes required schema/contracts/checklists that can be enforced in review
176
+ - has operational failure modes/runbooks
177
+ - applies across multiple features (not one-off project trivia)
178
+ - prevents a high-cost incident if followed
179
+ - Overlap: each domain has a single "owner" skill; overlapping material MUST be added to the owner skill (as a new section) or demoted to a non-skill reference doc.
180
+ - References location: non-skill references live in `.agents/references/` (this repo: `src/.agents/references/`) and are linked from `src/AGENTS.md` or the owning skill.
181
+
182
+ Owner skills:
183
+
184
+ - `data-foundations`: multi-tenant boundaries (views/functions), RLS, grants/revokes, tenant context.
185
+ - `pii-protection-prisma`: PII placement, envelope encryption, key rotation, logging restrictions.
186
+ - `financial-workflow-integrity`: idempotency, concurrency, webhooks, approvals for money-adjacent workflows.
187
+ - `audit-traceability`: append-only audit logs, actor attribution, correlation IDs, privileged access audit.
188
+
189
+ Maintenance:
190
+
191
+ - If a reference standard becomes mostly examples/links, demote it into `.agents/references/` (this repo: `src/.agents/references/`) and keep the skill as the enforceable rules/checklists only.
192
+
193
+ ### Workflow skills
194
+
195
+ | Skill | Use when |
196
+ | --- | --- |
197
+ | `brainstorming` | You need structured idea exploration and clarification without writing code. |
198
+ | `document-review` | You need to review a document/spec and extract issues, gaps, and concrete next actions. |
199
+ | `technical-review` | A plan or feature approach has passed document review and must be checked for technical correctness before build. |
200
+ | `compound-docs` | A non-trivial problem is solved and should be captured as durable institutional knowledge. |
201
+ | `file-todos` | You need a file-backed todo workflow for iterative multi-step changes. |
202
+ | `agent-browser` | You need to inspect available agents/skills and route deterministically. |
203
+ | `git-worktree` | You need isolated parallel work (review/feature) using git worktrees. |
204
+ | `process-metrics` | You want to log and assess session performance and process improvements. |
205
+
206
+ ### Reference standards (guardrails)
207
+
208
+ | Skill | Use when |
209
+ | --- | --- |
210
+ | `data-foundations` | You are designing multi-tenant schema/access boundaries (views/functions, RLS, grants/revokes). |
211
+ | `pii-protection-prisma` | You store/process PII and need table separation + envelope encryption + rotation + logging rules. |
212
+ | `financial-workflow-integrity` | A workflow has money/regulatory outcomes and must be correct under retries/concurrency/webhooks/approvals. |
213
+ | `audit-traceability` | You need append-only auditing with actor attribution + correlation IDs without leaking PII. |