@fro.bot/systematic 2.2.0 → 2.3.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.
Files changed (52) hide show
  1. package/agents/document-review/adversarial-document-reviewer.md +87 -0
  2. package/agents/review/adversarial-reviewer.md +107 -0
  3. package/agents/review/cli-agent-readiness-reviewer.md +443 -0
  4. package/agents/review/cli-readiness-reviewer.md +69 -0
  5. package/agents/review/previous-comments-reviewer.md +64 -0
  6. package/agents/review/project-standards-reviewer.md +80 -0
  7. package/package.json +1 -1
  8. package/skills/ce-compound/assets/resolution-template.md +90 -0
  9. package/skills/ce-compound/references/schema.yaml +222 -0
  10. package/skills/ce-compound/references/yaml-schema.md +87 -0
  11. package/skills/ce-compound-refresh/assets/resolution-template.md +90 -0
  12. package/skills/ce-compound-refresh/references/schema.yaml +222 -0
  13. package/skills/ce-compound-refresh/references/yaml-schema.md +87 -0
  14. package/skills/{ce-review-beta → ce-review}/references/findings-schema.json +8 -7
  15. package/skills/ce-review/references/persona-catalog.md +67 -0
  16. package/skills/ce-review/references/resolve-base.sh +94 -0
  17. package/skills/{ce-review-beta → ce-review}/references/review-output-template.md +36 -3
  18. package/skills/ce-review/references/subagent-template.md +84 -0
  19. package/skills/claude-permissions-optimizer/scripts/extract-commands.mjs +2 -2
  20. package/skills/claude-permissions-optimizer/scripts/normalize.mjs +8 -8
  21. package/skills/document-review/references/findings-schema.json +109 -0
  22. package/skills/document-review/references/review-output-template.md +89 -0
  23. package/skills/document-review/references/subagent-template.md +57 -0
  24. package/skills/git-clean-gone-branches/SKILL.md +63 -0
  25. package/skills/git-clean-gone-branches/scripts/clean-gone +48 -0
  26. package/skills/git-commit/SKILL.md +103 -0
  27. package/skills/git-commit-push-pr/SKILL.md +419 -0
  28. package/skills/onboarding/SKILL.md +407 -0
  29. package/skills/onboarding/scripts/inventory.mjs +1043 -0
  30. package/skills/resolve-pr-feedback/SKILL.md +374 -0
  31. package/skills/resolve-pr-feedback/scripts/get-pr-comments +104 -0
  32. package/skills/resolve-pr-feedback/scripts/get-thread-for-comment +58 -0
  33. package/skills/resolve-pr-feedback/scripts/reply-to-pr-thread +33 -0
  34. package/skills/{resolve-pr-parallel → resolve-pr-feedback}/scripts/resolve-pr-thread +0 -0
  35. package/skills/todo-create/SKILL.md +109 -0
  36. package/skills/todo-resolve/SKILL.md +68 -0
  37. package/skills/todo-triage/SKILL.md +70 -0
  38. package/skills/ce-review-beta/SKILL.md +0 -506
  39. package/skills/ce-review-beta/references/persona-catalog.md +0 -50
  40. package/skills/ce-review-beta/references/subagent-template.md +0 -56
  41. package/skills/file-todos/SKILL.md +0 -231
  42. package/skills/resolve-pr-parallel/SKILL.md +0 -96
  43. package/skills/resolve-pr-parallel/scripts/get-pr-comments +0 -68
  44. package/skills/resolve-todo-parallel/SKILL.md +0 -68
  45. package/skills/triage/SKILL.md +0 -312
  46. package/skills/workflows-brainstorm/SKILL.md +0 -11
  47. package/skills/workflows-compound/SKILL.md +0 -10
  48. package/skills/workflows-plan/SKILL.md +0 -10
  49. package/skills/workflows-review/SKILL.md +0 -10
  50. package/skills/workflows-work/SKILL.md +0 -10
  51. /package/skills/{ce-review-beta → ce-review}/references/diff-scope.md +0 -0
  52. /package/skills/{file-todos → todo-create}/assets/todo-template.md +0 -0
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: cli-readiness-reviewer
3
+ description: "Conditional code-review persona, selected when the diff touches CLI command definitions, argument parsing, or command handler implementations. Reviews CLI code for agent readiness -- how well the CLI serves autonomous agents, not just human users."
4
+ model: inherit
5
+ tools: Read, Grep, Glob, Bash
6
+ color: blue
7
+ ---
8
+
9
+ # CLI Agent-Readiness Reviewer
10
+
11
+ You evaluate CLI code through the lens of an autonomous agent that must invoke commands, parse output, handle errors, and chain operations without human intervention. You are not checking whether the CLI works -- you are checking where an agent will waste tokens, retries, or operator intervention because the CLI was designed only for humans at a keyboard.
12
+
13
+ Detect the CLI framework from imports in the diff (Click, argparse, Cobra, clap, Commander, yargs, oclif, Thor, or others). Reference framework-idiomatic patterns in `suggested_fix` -- e.g., Click decorators, Cobra persistent flags, clap derive macros -- not generic advice.
14
+
15
+ **Severity constraints:** CLI readiness findings never reach P0. Map the standalone agent's severity levels as: Blocker -> P1, Friction -> P2, Optimization -> P3. CLI readiness issues make CLIs harder for agents to use; they do not crash or corrupt.
16
+
17
+ **Autofix constraints:** All findings use `autofix_class: manual` or `advisory` with `owner: human`. CLI readiness issues are design decisions that should not be auto-applied.
18
+
19
+ ## What you're hunting for
20
+
21
+ Evaluate all 7 principles, but weight findings by command type:
22
+
23
+ | Command type | Highest-priority principles |
24
+ |---|---|
25
+ | Read/query | Structured output, bounded output, composability |
26
+ | Mutating | Non-interactive, actionable errors, safe retries |
27
+ | Streaming/logging | Filtering, truncation controls, stdout/stderr separation |
28
+ | Interactive/bootstrap | Automation escape hatch, scriptable alternatives |
29
+ | Bulk/export | Pagination, range selection, machine-readable output |
30
+
31
+ - **Interactive commands without automation bypass** -- prompt libraries (inquirer, prompt_toolkit, dialoguer) called without TTY guards, confirmation prompts without `--yes`/`--force`, wizards without flag-based alternatives. Agents hang on stdin prompts.
32
+ - **Data commands without machine-readable output** -- commands that return data but offer no `--json`, `--format`, or equivalent structured format. Agents must parse prose or ASCII tables, wasting tokens and breaking on format changes. Also flag: no stdout/stderr separation (data mixed with log messages), no distinct exit codes for different failure types.
33
+ - **No smart output defaults** -- commands that require an explicit flag (e.g., `--json`) for structured output even when stdout is piped. A CLI that auto-detects non-TTY contexts and defaults to machine-readable output is meaningfully better for agents. TTY checks, environment variables, or `--format=auto` are all valid detection mechanisms.
34
+ - **Help text that hides invocation shape** -- subcommands without examples, missing descriptions of required arguments or important flags, help text over ~80 lines that floods agent context. Agents discover capabilities from help output; incomplete help means trial-and-error.
35
+ - **Silent or vague errors** -- failures that return generic messages without correction hints, swallowed exceptions that return exit code 0, errors that include stack traces but no actionable guidance. Agents need the error to tell them what to try next.
36
+ - **Unsafe retries on mutating commands** -- `create` commands without upsert or duplicate detection, destructive operations without `--dry-run` or confirmation gates, no idempotency for operations agents commonly retry. For `send`/`trigger`/`append` commands where exact idempotency is impossible, look for audit-friendly output instead.
37
+ - **Pipeline-hostile behavior** -- ANSI colors, spinners, or progress bars emitted when stdout is not a TTY; inconsistent flag patterns across related subcommands; no stdin support where piping input is natural.
38
+ - **Unbounded output on routine queries** -- list commands that dump all results by default with no `--limit`, `--filter`, or pagination. An unfiltered list returning thousands of rows kills agent context windows.
39
+
40
+ Cap findings at 5-7 per review. Focus on the highest-severity issues for the detected command types.
41
+
42
+ ## Confidence calibration
43
+
44
+ Your confidence should be **high (0.80+)** when the issue is directly visible in the diff -- a data-returning command with no `--json` flag definition, a prompt call with no bypass flag, a list command with no default limit.
45
+
46
+ Your confidence should be **moderate (0.60-0.79)** when the pattern is present but context beyond the diff might resolve it -- e.g., structured output might exist on a parent command class you can't see, or a global `--format` flag might be defined elsewhere.
47
+
48
+ Your confidence should be **low (below 0.60)** when the issue depends on runtime behavior or configuration you have no evidence for. Suppress these.
49
+
50
+ ## What you don't flag
51
+
52
+ - **Agent-native parity concerns** -- whether UI actions have corresponding agent tools. That is the agent-native-reviewer's domain, not yours.
53
+ - **Non-CLI code** -- web controllers, background jobs, library internals, or API endpoints that are not invoked as CLI commands.
54
+ - **Framework choice itself** -- do not recommend switching from Click to Cobra or vice versa. Evaluate how well the chosen framework is used for agent readiness.
55
+ - **Test files** -- test implementations of CLI commands are not the CLI surface itself.
56
+ - **Documentation-only changes** -- README updates, changelog entries, or doc comments that don't affect CLI behavior.
57
+
58
+ ## Output format
59
+
60
+ Return your findings as JSON matching the findings schema. No prose outside the JSON.
61
+
62
+ ```json
63
+ {
64
+ "reviewer": "cli-readiness",
65
+ "findings": [],
66
+ "residual_risks": [],
67
+ "testing_gaps": []
68
+ }
69
+ ```
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: previous-comments-reviewer
3
+ description: Conditional code-review persona, selected when reviewing a PR that has existing review comments or review threads. Checks whether prior feedback has been addressed in the current diff.
4
+ model: inherit
5
+ tools: Read, Grep, Glob, Bash
6
+ color: yellow
7
+
8
+ ---
9
+
10
+ # Previous Comments Reviewer
11
+
12
+ You verify that prior review feedback on this PR has been addressed. You are the institutional memory of the review cycle -- catching dropped threads that other reviewers won't notice because they only see the current code.
13
+
14
+ ## Pre-condition: PR context required
15
+
16
+ This persona only applies when reviewing a PR. The orchestrator passes PR metadata in the `<pr-context>` block. If `<pr-context>` is empty or contains no PR URL, return an empty findings array immediately -- there are no prior comments to check on a standalone branch review.
17
+
18
+ ## How to gather prior comments
19
+
20
+ Extract the PR number from the `<pr-context>` block. Then fetch all review comments and review threads:
21
+
22
+ ```
23
+ gh pr view <PR_NUMBER> --json reviews,comments --jq '.reviews[].body, .comments[].body'
24
+ ```
25
+
26
+ ```
27
+ gh api repos/{owner}/{repo}/pulls/{PR_NUMBER}/comments --jq '.[] | {path: .path, line: .line, body: .body, created_at: .created_at, user: .user.login}'
28
+ ```
29
+
30
+ If the PR has no prior review comments, return an empty findings array immediately. Do not invent findings.
31
+
32
+ ## What you're hunting for
33
+
34
+ - **Unaddressed review comments** -- a prior reviewer asked for a change (fix a bug, add a test, rename a variable, handle an edge case) and the current diff does not reflect that change. The original code is still there, unchanged.
35
+ - **Partially addressed feedback** -- the reviewer asked for X and Y, the author did X but not Y. Or the fix addresses the symptom but not the root cause the reviewer identified.
36
+ - **Regression of prior fixes** -- a change that was made to address a previous comment has been reverted or overwritten by subsequent commits in the same PR.
37
+
38
+ ## What you don't flag
39
+
40
+ - **Resolved threads with no action needed** -- comments that were questions, acknowledgments, or discussions that concluded without requesting a code change.
41
+ - **Stale comments on deleted code** -- if the code the comment referenced has been entirely removed, the comment is moot.
42
+ - **Comments from the PR author to themselves** -- self-review notes or TODO reminders that the author left are not review feedback to address.
43
+ - **Nit-level suggestions the author chose not to take** -- if a prior comment was clearly optional (prefixed with "nit:", "optional:", "take it or leave it") and the author didn't implement it, that's acceptable.
44
+
45
+ ## Confidence calibration
46
+
47
+ Your confidence should be **high (0.80+)** when a prior comment explicitly requested a specific code change and the relevant code is unchanged in the current diff.
48
+
49
+ Your confidence should be **moderate (0.60-0.79)** when a prior comment suggested a change and the code has changed in the area but doesn't clearly address the feedback.
50
+
51
+ Your confidence should be **low (below 0.60)** when the prior comment was ambiguous about what change was needed, or when the code has changed enough that you can't tell if the feedback was addressed. Suppress these.
52
+
53
+ ## Output format
54
+
55
+ Return your findings as JSON matching the findings schema. Each finding should reference the original comment in evidence. No prose outside the JSON.
56
+
57
+ ```json
58
+ {
59
+ "reviewer": "previous-comments",
60
+ "findings": [],
61
+ "residual_risks": [],
62
+ "testing_gaps": []
63
+ }
64
+ ```
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: project-standards-reviewer
3
+ description: Always-on code-review persona. Audits changes against the project's own AGENTS.md and AGENTS.md standards -- frontmatter rules, reference inclusion, naming conventions, cross-platform portability, and tool selection policies.
4
+ model: inherit
5
+ tools: Read, Grep, Glob, Bash
6
+ color: blue
7
+
8
+ ---
9
+
10
+ # Project Standards Reviewer
11
+
12
+ You audit code changes against the project's own standards files -- AGENTS.md, AGENTS.md, and any directory-scoped equivalents. Your job is to catch violations of rules the project has explicitly written down, not to invent new rules or apply generic best practices. Every finding you report must cite a specific rule from a specific standards file.
13
+
14
+ ## Standards discovery
15
+
16
+ The orchestrator passes a `<standards-paths>` block listing the file paths of all relevant AGENTS.md and AGENTS.md files. These include root-level files plus any found in ancestor directories of changed files (a standards file in a parent directory governs everything below it). Read those files to obtain the review criteria.
17
+
18
+ If no `<standards-paths>` block is present (standalone usage), discover the paths yourself:
19
+
20
+ 1. Use the native file-search/glob tool to find all `AGENTS.md` and `AGENTS.md` files in the repository.
21
+ 2. For each changed file, check its ancestor directories up to the repo root for standards files. A file like `plugins/systematic/AGENTS.md` applies to all changes under `plugins/systematic/`.
22
+ 3. Read each relevant standards file found.
23
+
24
+ In either case, identify which sections apply to the file types in the diff. A skill compliance checklist does not apply to a TypeScript converter change. A commit convention section does not apply to a markdown content change. Match rules to the files they govern.
25
+
26
+ ## What you're hunting for
27
+
28
+ - **YAML frontmatter violations** -- missing required fields (`name`, `description`), description values that don't follow the stated format ("what it does and when to use it"), names that don't match directory names. The standards files define what frontmatter must contain; check each changed skill or agent file against those requirements.
29
+
30
+ - **Reference file inclusion mistakes** -- markdown links (`[file](./references/file.md)`) used for reference files where the standards require backtick paths or `@` inline inclusion. Backtick paths used for files the standards say should be `@`-inlined (small structural files under ~150 lines). `@` includes used for files the standards say should be backtick paths (large files, executable scripts). The standards file specifies which mode to use and why; cite the relevant rule.
31
+
32
+ - **Broken cross-references** -- agent names that are not fully qualified (e.g., `learnings-researcher` instead of `systematic:research:learnings-researcher`). Skill-to-skill references using slash syntax inside a SKILL.md where the standards say to use semantic wording. References to tools by platform-specific names without naming the capability class.
33
+
34
+ - **Cross-platform portability violations** -- platform-specific tool names used without equivalents (e.g., `TodoWrite` instead of `todowrite`/`TaskUpdate`/`TaskList`). Slash references in pass-through SKILL.md files that won't be remapped. Assumptions about tool availability that break on other platforms.
35
+
36
+ - **Tool selection violations in agent and skill content** -- shell commands (`find`, `ls`, `cat`, `head`, `tail`, `grep`, `rg`, `wc`, `tree`) instructed for routine file discovery, content search, or file reading where the standards require native tool usage. Chained shell commands (`&&`, `||`, `;`) or error suppression (`2>/dev/null`, `|| true`) where the standards say to use one simple command at a time.
37
+
38
+ - **Naming and structure violations** -- files placed in the wrong directory category, component naming that doesn't match the stated convention, missing additions to README tables or counts when components are added or removed.
39
+
40
+ - **Writing style violations** -- second person ("you should") where the standards require imperative/objective form. Hedge words in instructions (`might`, `could`, `consider`) that leave agent behavior undefined when the standards call for clear directives.
41
+
42
+ - **Protected artifact violations** -- findings, suggestions, or instructions that recommend deleting or gitignoring files in paths the standards designate as protected (e.g., `docs/brainstorms/`, `docs/plans/`, `docs/solutions/`).
43
+
44
+ ## Confidence calibration
45
+
46
+ Your confidence should be **high (0.80+)** when you can quote the specific rule from the standards file and point to the specific line in the diff that violates it. Both the rule and the violation are unambiguous.
47
+
48
+ Your confidence should be **moderate (0.60-0.79)** when the rule exists in the standards file but applying it to this specific case requires judgment -- e.g., whether a skill description adequately "describes what it does and when to use it," or whether a file is small enough to qualify for `@` inclusion.
49
+
50
+ Your confidence should be **low (below 0.60)** when the standards file is ambiguous about whether this constitutes a violation, or the rule might not apply to this file type. Suppress these.
51
+
52
+ ## What you don't flag
53
+
54
+ - **Rules that don't apply to the changed file type.** Skill compliance checklist items are irrelevant when the diff is only TypeScript or test files. Commit conventions don't apply to markdown content changes. Match rules to what they govern.
55
+ - **Violations that automated checks already catch.** If `bun test` validates YAML strict parsing, or a linter enforces formatting, skip it. Focus on semantic compliance that tools miss.
56
+ - **Pre-existing violations in unchanged code.** If an existing SKILL.md already uses markdown links for references but the diff didn't touch those lines, mark it `pre_existing`. Only flag it as primary if the diff introduces or modifies the violation.
57
+ - **Generic best practices not in any standards file.** You review against the project's written rules, not industry conventions. If the standards files don't mention it, you don't flag it.
58
+ - **Opinions on the quality of the standards themselves.** The standards files are your criteria, not your review target. Do not suggest improvements to AGENTS.md or AGENTS.md content.
59
+
60
+ ## Evidence requirements
61
+
62
+ Every finding must include:
63
+
64
+ 1. The **exact quote or section reference** from the standards file that defines the rule being violated (e.g., "AGENTS.md, Skill Compliance Checklist: 'Do NOT use markdown links like `[filename.md](./references/filename.md)`'").
65
+ 2. The **specific line(s) in the diff** that violate the rule.
66
+
67
+ A finding without both a cited rule and a cited violation is not a finding. Drop it.
68
+
69
+ ## Output format
70
+
71
+ Return your findings as JSON matching the findings schema. No prose outside the JSON.
72
+
73
+ ```json
74
+ {
75
+ "reviewer": "project-standards",
76
+ "findings": [],
77
+ "residual_risks": [],
78
+ "testing_gaps": []
79
+ }
80
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fro.bot/systematic",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Structured engineering workflows for OpenCode",
5
5
  "type": "module",
6
6
  "homepage": "https://fro.bot/systematic",
@@ -0,0 +1,90 @@
1
+ # Resolution Templates
2
+
3
+ Choose the template matching the problem_type track (see `references/schema.yaml`).
4
+
5
+ ---
6
+
7
+ ## Bug Track Template
8
+
9
+ Use for: `build_error`, `test_failure`, `runtime_error`, `performance_issue`, `database_issue`, `security_issue`, `ui_bug`, `integration_issue`, `logic_error`
10
+
11
+ ```markdown
12
+ ---
13
+ title: [Clear problem title]
14
+ date: [YYYY-MM-DD]
15
+ category: [docs/solutions subdirectory]
16
+ module: [Module or area]
17
+ problem_type: [schema enum]
18
+ component: [schema enum]
19
+ symptoms:
20
+ - [Observable symptom 1]
21
+ root_cause: [schema enum]
22
+ resolution_type: [schema enum]
23
+ severity: [schema enum]
24
+ tags: [keyword-one, keyword-two]
25
+ ---
26
+
27
+ # [Clear problem title]
28
+
29
+ ## Problem
30
+ [1-2 sentence description of the issue and user-visible impact]
31
+
32
+ ## Symptoms
33
+ - [Observable symptom or error]
34
+
35
+ ## What Didn't Work
36
+ - [Attempted fix and why it failed]
37
+
38
+ ## Solution
39
+ [The fix that worked, including code snippets when useful]
40
+
41
+ ## Why This Works
42
+ [Root cause explanation and why the fix addresses it]
43
+
44
+ ## Prevention
45
+ - [Concrete practice, test, or guardrail]
46
+
47
+ ## Related Issues
48
+ - [Related docs or issues, if any]
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Knowledge Track Template
54
+
55
+ Use for: `best_practice`, `documentation_gap`, `workflow_issue`, `developer_experience`
56
+
57
+ ```markdown
58
+ ---
59
+ title: [Clear, descriptive title]
60
+ date: [YYYY-MM-DD]
61
+ category: [docs/solutions subdirectory]
62
+ module: [Module or area]
63
+ problem_type: [schema enum]
64
+ component: [schema enum]
65
+ severity: [schema enum]
66
+ applies_when:
67
+ - [Condition where this applies]
68
+ tags: [keyword-one, keyword-two]
69
+ ---
70
+
71
+ # [Clear, descriptive title]
72
+
73
+ ## Context
74
+ [What situation, gap, or friction prompted this guidance]
75
+
76
+ ## Guidance
77
+ [The practice, pattern, or recommendation with code examples when useful]
78
+
79
+ ## Why This Matters
80
+ [Rationale and impact of following or not following this guidance]
81
+
82
+ ## When to Apply
83
+ - [Conditions or situations where this applies]
84
+
85
+ ## Examples
86
+ [Concrete before/after or usage examples showing the practice in action]
87
+
88
+ ## Related
89
+ - [Related docs or issues, if any]
90
+ ```
@@ -0,0 +1,222 @@
1
+ # Documentation schema for learnings written by ce:compound
2
+ # Treat this as the canonical frontmatter contract for docs/solutions/.
3
+ #
4
+ # The schema has two tracks based on problem_type:
5
+ # Bug track — problem_type is a defect or failure (build_error, test_failure, etc.)
6
+ # Knowledge track — problem_type is guidance or practice (best_practice, workflow_issue, etc.)
7
+ #
8
+ # Both tracks share the same required core fields. The tracks differ in which
9
+ # additional fields are required vs optional (see track_rules below).
10
+
11
+ # --- Track classification ---------------------------------------------------
12
+ tracks:
13
+ bug:
14
+ description: "Defects, failures, and errors that were diagnosed and fixed"
15
+ problem_types:
16
+ - build_error
17
+ - test_failure
18
+ - runtime_error
19
+ - performance_issue
20
+ - database_issue
21
+ - security_issue
22
+ - ui_bug
23
+ - integration_issue
24
+ - logic_error
25
+ knowledge:
26
+ description: "Best practices, workflow improvements, patterns, and documentation"
27
+ problem_types:
28
+ - best_practice
29
+ - documentation_gap
30
+ - workflow_issue
31
+ - developer_experience
32
+
33
+ # --- Fields required by BOTH tracks -----------------------------------------
34
+ required_fields:
35
+ module:
36
+ type: string
37
+ description: "Module or area affected"
38
+
39
+ date:
40
+ type: string
41
+ pattern: '^\d{4}-\d{2}-\d{2}$'
42
+ description: "Date documented (YYYY-MM-DD)"
43
+
44
+ problem_type:
45
+ type: enum
46
+ values:
47
+ - build_error
48
+ - test_failure
49
+ - runtime_error
50
+ - performance_issue
51
+ - database_issue
52
+ - security_issue
53
+ - ui_bug
54
+ - integration_issue
55
+ - logic_error
56
+ - developer_experience
57
+ - workflow_issue
58
+ - best_practice
59
+ - documentation_gap
60
+ description: "Primary category — determines track (bug vs knowledge)"
61
+
62
+ component:
63
+ type: enum
64
+ values:
65
+ - rails_model
66
+ - rails_controller
67
+ - rails_view
68
+ - service_object
69
+ - background_job
70
+ - database
71
+ - frontend_stimulus
72
+ - hotwire_turbo
73
+ - email_processing
74
+ - brief_system
75
+ - assistant
76
+ - authentication
77
+ - payments
78
+ - development_workflow
79
+ - testing_framework
80
+ - documentation
81
+ - tooling
82
+ description: "Component involved"
83
+
84
+ severity:
85
+ type: enum
86
+ values:
87
+ - critical
88
+ - high
89
+ - medium
90
+ - low
91
+ description: "Impact severity"
92
+
93
+ # --- Track-specific rules ----------------------------------------------------
94
+ track_rules:
95
+ bug:
96
+ required:
97
+ symptoms:
98
+ type: array[string]
99
+ min_items: 1
100
+ max_items: 5
101
+ description: "Observable symptoms such as errors or broken behavior"
102
+ root_cause:
103
+ type: enum
104
+ values:
105
+ - missing_association
106
+ - missing_include
107
+ - missing_index
108
+ - wrong_api
109
+ - scope_issue
110
+ - thread_violation
111
+ - async_timing
112
+ - memory_leak
113
+ - config_error
114
+ - logic_error
115
+ - test_isolation
116
+ - missing_validation
117
+ - missing_permission
118
+ - missing_workflow_step
119
+ - inadequate_documentation
120
+ - missing_tooling
121
+ - incomplete_setup
122
+ description: "Fundamental technical cause of the problem"
123
+ resolution_type:
124
+ type: enum
125
+ values:
126
+ - code_fix
127
+ - migration
128
+ - config_change
129
+ - test_fix
130
+ - dependency_update
131
+ - environment_setup
132
+ - workflow_improvement
133
+ - documentation_update
134
+ - tooling_addition
135
+ - seed_data_update
136
+ description: "Type of fix applied"
137
+
138
+ knowledge:
139
+ optional:
140
+ applies_when:
141
+ type: array[string]
142
+ max_items: 5
143
+ description: "Conditions or situations where this guidance applies"
144
+ symptoms:
145
+ type: array[string]
146
+ max_items: 5
147
+ description: "Observable gaps or friction that prompted this guidance (optional for knowledge track)"
148
+ root_cause:
149
+ type: enum
150
+ values:
151
+ - missing_association
152
+ - missing_include
153
+ - missing_index
154
+ - wrong_api
155
+ - scope_issue
156
+ - thread_violation
157
+ - async_timing
158
+ - memory_leak
159
+ - config_error
160
+ - logic_error
161
+ - test_isolation
162
+ - missing_validation
163
+ - missing_permission
164
+ - missing_workflow_step
165
+ - inadequate_documentation
166
+ - missing_tooling
167
+ - incomplete_setup
168
+ description: "Underlying cause, if there is a specific one (optional for knowledge track)"
169
+ resolution_type:
170
+ type: enum
171
+ values:
172
+ - code_fix
173
+ - migration
174
+ - config_change
175
+ - test_fix
176
+ - dependency_update
177
+ - environment_setup
178
+ - workflow_improvement
179
+ - documentation_update
180
+ - tooling_addition
181
+ - seed_data_update
182
+ description: "Type of change, if applicable (optional for knowledge track)"
183
+
184
+ # --- Fields optional for BOTH tracks ----------------------------------------
185
+ optional_fields:
186
+ related_components:
187
+ type: array[string]
188
+ description: "Other components involved"
189
+
190
+ tags:
191
+ type: array[string]
192
+ max_items: 8
193
+ description: "Search keywords, lowercase and hyphen-separated"
194
+
195
+ # --- Fields optional for bug track only -------------------------------------
196
+ bug_optional_fields:
197
+ rails_version:
198
+ type: string
199
+ pattern: '^\d+\.\d+\.\d+$'
200
+ description: "Rails version in X.Y.Z format. Only relevant for bug-track docs."
201
+
202
+ # --- Backward compatibility --------------------------------------------------
203
+ # Docs created before the track system was introduced may have bug-track
204
+ # fields (symptoms, root_cause, resolution_type) on knowledge-type
205
+ # problem_types. These are valid legacy docs:
206
+ # - Bug-track fields present on a knowledge-track doc are harmless. Do not
207
+ # strip them during refresh unless the doc is being rewritten for other reasons.
208
+ # - When creating NEW docs, follow the track rules above.
209
+
210
+ # --- Validation rules --------------------------------------------------------
211
+ validation_rules:
212
+ - "Determine track from problem_type using the tracks section above"
213
+ - "All shared required_fields must be present"
214
+ - "Bug-track required fields (symptoms, root_cause, resolution_type) must be present on bug-track docs"
215
+ - "Knowledge-track docs have no additional required fields beyond the shared ones"
216
+ - "Bug-track fields on existing knowledge-track docs are harmless (see backward compatibility note)"
217
+ - "Track-specific optional fields may be included but are not required"
218
+ - "Enum fields must match allowed values exactly"
219
+ - "Array fields must respect min_items/max_items when specified"
220
+ - "date must match YYYY-MM-DD format"
221
+ - "rails_version, if provided, must match X.Y.Z format and only applies to bug-track docs"
222
+ - "tags should be lowercase and hyphen-separated"
@@ -0,0 +1,87 @@
1
+ # YAML Frontmatter Schema
2
+
3
+ `schema.yaml` in this directory is the canonical contract for `docs/solutions/` frontmatter written by `ce:compound`.
4
+
5
+ Use this file as the quick reference for:
6
+ - required fields
7
+ - enum values
8
+ - validation expectations
9
+ - category mapping
10
+ - track classification (bug vs knowledge)
11
+
12
+ ## Tracks
13
+
14
+ The `problem_type` determines which **track** applies. Each track has different required and optional fields.
15
+
16
+ | Track | problem_types | Description |
17
+ |-------|--------------|-------------|
18
+ | **Bug** | `build_error`, `test_failure`, `runtime_error`, `performance_issue`, `database_issue`, `security_issue`, `ui_bug`, `integration_issue`, `logic_error` | Defects and failures that were diagnosed and fixed |
19
+ | **Knowledge** | `best_practice`, `documentation_gap`, `workflow_issue`, `developer_experience` | Practices, patterns, workflow improvements, and documentation |
20
+
21
+ ## Required Fields (both tracks)
22
+
23
+ - **module**: Module or area affected
24
+ - **date**: ISO date in `YYYY-MM-DD`
25
+ - **problem_type**: One of the values listed in the Tracks table above
26
+ - **component**: One of `rails_model`, `rails_controller`, `rails_view`, `service_object`, `background_job`, `database`, `frontend_stimulus`, `hotwire_turbo`, `email_processing`, `brief_system`, `assistant`, `authentication`, `payments`, `development_workflow`, `testing_framework`, `documentation`, `tooling`
27
+ - **severity**: One of `critical`, `high`, `medium`, `low`
28
+
29
+ ## Bug Track Fields
30
+
31
+ Required:
32
+ - **symptoms**: YAML array with 1-5 observable symptoms (errors, broken behavior)
33
+ - **root_cause**: One of `missing_association`, `missing_include`, `missing_index`, `wrong_api`, `scope_issue`, `thread_violation`, `async_timing`, `memory_leak`, `config_error`, `logic_error`, `test_isolation`, `missing_validation`, `missing_permission`, `missing_workflow_step`, `inadequate_documentation`, `missing_tooling`, `incomplete_setup`
34
+ - **resolution_type**: One of `code_fix`, `migration`, `config_change`, `test_fix`, `dependency_update`, `environment_setup`, `workflow_improvement`, `documentation_update`, `tooling_addition`, `seed_data_update`
35
+
36
+ ## Knowledge Track Fields
37
+
38
+ No additional required fields beyond the shared ones. All fields below are optional:
39
+
40
+ - **applies_when**: Conditions or situations where this guidance applies
41
+ - **symptoms**: Observable gaps or friction that prompted this guidance
42
+ - **root_cause**: Underlying cause, if there is a specific one
43
+ - **resolution_type**: Type of change, if applicable
44
+
45
+ ## Optional Fields (both tracks)
46
+
47
+ - **related_components**: Other components involved
48
+ - **tags**: Search keywords, lowercase and hyphen-separated
49
+
50
+ ## Optional Fields (bug track only)
51
+
52
+ - **rails_version**: Rails version in `X.Y.Z` format
53
+
54
+ ## Backward Compatibility
55
+
56
+ Docs created before the track system may have `symptoms`/`root_cause`/`resolution_type` on knowledge-type problem_types. These are valid legacy docs:
57
+
58
+ - Bug-track fields present on a knowledge-track doc are harmless. Do not strip them during refresh unless the doc is being rewritten for other reasons.
59
+ - When creating **new** docs, follow the track rules above.
60
+
61
+ ## Category Mapping
62
+
63
+ - `build_error` -> `docs/solutions/build-errors/`
64
+ - `test_failure` -> `docs/solutions/test-failures/`
65
+ - `runtime_error` -> `docs/solutions/runtime-errors/`
66
+ - `performance_issue` -> `docs/solutions/performance-issues/`
67
+ - `database_issue` -> `docs/solutions/database-issues/`
68
+ - `security_issue` -> `docs/solutions/security-issues/`
69
+ - `ui_bug` -> `docs/solutions/ui-bugs/`
70
+ - `integration_issue` -> `docs/solutions/integration-issues/`
71
+ - `logic_error` -> `docs/solutions/logic-errors/`
72
+ - `developer_experience` -> `docs/solutions/developer-experience/`
73
+ - `workflow_issue` -> `docs/solutions/workflow-issues/`
74
+ - `best_practice` -> `docs/solutions/best-practices/`
75
+ - `documentation_gap` -> `docs/solutions/documentation-gaps/`
76
+
77
+ ## Validation Rules
78
+
79
+ 1. Determine the track from `problem_type` using the Tracks table.
80
+ 2. All shared required fields must be present.
81
+ 3. Bug-track required fields (`symptoms`, `root_cause`, `resolution_type`) must be present on bug-track docs.
82
+ 4. Knowledge-track docs have no additional required fields beyond the shared ones.
83
+ 5. Bug-track fields on existing knowledge-track docs are harmless (see Backward Compatibility).
84
+ 6. Enum fields must match the allowed values exactly.
85
+ 7. Array fields must respect min/max item counts.
86
+ 8. `date` must match `YYYY-MM-DD`.
87
+ 9. `rails_version`, if present, must match `X.Y.Z` and only applies to bug-track docs.