continuous-improvement 3.1.0 → 3.9.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 (136) hide show
  1. package/.claude-plugin/marketplace.json +66 -0
  2. package/CHANGELOG.md +216 -0
  3. package/QUICKSTART.md +79 -12
  4. package/README.md +229 -349
  5. package/SKILL.md +87 -9
  6. package/action.yml +1 -1
  7. package/bin/analyze.sh +9 -1
  8. package/bin/backfill.mjs +172 -0
  9. package/bin/check-doc-runtime-claims.mjs +120 -0
  10. package/bin/check-docs-substrings.mjs +333 -0
  11. package/bin/check-everything-mirror.mjs +145 -0
  12. package/bin/check-routing-targets.mjs +151 -0
  13. package/bin/check-skill-law-tag.mjs +128 -0
  14. package/bin/check-skill-mirror.mjs +119 -0
  15. package/bin/check-skill-tiers.mjs +116 -0
  16. package/bin/check-third-party-shape.mjs +202 -0
  17. package/bin/generate-plugin-manifests.mjs +171 -0
  18. package/bin/harvest-friction.mjs +279 -0
  19. package/bin/hook-stats.mjs +258 -0
  20. package/bin/install.mjs +407 -499
  21. package/bin/lint-transcript.mjs +182 -210
  22. package/bin/mcp-server.mjs +834 -608
  23. package/bin/observe.mjs +148 -0
  24. package/bin/pre-commit-block-strays.sh +49 -0
  25. package/bin/refresh-third-party.mjs +416 -0
  26. package/bin/unified-cli.mjs +533 -0
  27. package/commands/continuous-improvement.md +43 -2
  28. package/commands/discipline.md +14 -0
  29. package/commands/harvest.md +76 -0
  30. package/commands/learn-eval.md +117 -0
  31. package/commands/planning-with-files.md +66 -0
  32. package/commands/proceed-with-the-recommendation.md +62 -0
  33. package/commands/ralph.md +103 -0
  34. package/commands/release-train.md +81 -0
  35. package/commands/seven-laws.md +16 -0
  36. package/commands/superpowers.md +180 -0
  37. package/commands/swarm.md +101 -0
  38. package/commands/workspace-surface-audit.md +77 -0
  39. package/hooks/gateguard.mjs +172 -0
  40. package/hooks/observe.sh +42 -4
  41. package/hooks/session.sh +3 -3
  42. package/hooks/three-section-close.mjs +181 -0
  43. package/instinct-packs/meta.json +16 -0
  44. package/lib/cli-anything.mjs +401 -0
  45. package/lib/compound-engineering.mjs +831 -0
  46. package/lib/gateguard-state.mjs +85 -0
  47. package/lib/observe-event.mjs +128 -0
  48. package/lib/plugin-metadata.mjs +435 -0
  49. package/lib/pm-marketplace.mjs +61 -0
  50. package/lib/pm-skills.mjs +1274 -0
  51. package/lib/resolve-home-dir.mjs +43 -0
  52. package/lib/skill-tiers.mjs +137 -0
  53. package/lib/unified-plugin.mjs +924 -0
  54. package/llms.txt +32 -7
  55. package/package.json +29 -19
  56. package/plugins/beginner.json +17 -6
  57. package/plugins/continuous-improvement/.claude-plugin/marketplace.json +20 -0
  58. package/plugins/continuous-improvement/.claude-plugin/plugin.json +26 -0
  59. package/plugins/continuous-improvement/LICENSE +21 -0
  60. package/plugins/continuous-improvement/README.md +57 -0
  61. package/plugins/continuous-improvement/agents/README.md +120 -0
  62. package/plugins/continuous-improvement/agents/code-reviewer.md +97 -0
  63. package/plugins/continuous-improvement/agents/security-auditor.md +101 -0
  64. package/plugins/continuous-improvement/agents/test-engineer.md +95 -0
  65. package/plugins/continuous-improvement/bin/backfill.mjs +172 -0
  66. package/plugins/continuous-improvement/bin/mcp-server.mjs +889 -0
  67. package/plugins/continuous-improvement/bin/observe.mjs +148 -0
  68. package/plugins/continuous-improvement/commands/continuous-improvement.md +115 -0
  69. package/plugins/continuous-improvement/commands/dashboard.md +56 -0
  70. package/plugins/continuous-improvement/commands/discipline.md +51 -0
  71. package/plugins/continuous-improvement/commands/harvest.md +76 -0
  72. package/plugins/continuous-improvement/commands/learn-eval.md +117 -0
  73. package/plugins/continuous-improvement/commands/planning-with-files.md +66 -0
  74. package/plugins/continuous-improvement/commands/proceed-with-the-recommendation.md +62 -0
  75. package/plugins/continuous-improvement/commands/ralph.md +103 -0
  76. package/plugins/continuous-improvement/commands/release-train.md +81 -0
  77. package/plugins/continuous-improvement/commands/seven-laws.md +16 -0
  78. package/plugins/continuous-improvement/commands/superpowers.md +180 -0
  79. package/plugins/continuous-improvement/commands/swarm.md +101 -0
  80. package/plugins/continuous-improvement/commands/workspace-surface-audit.md +77 -0
  81. package/plugins/continuous-improvement/hooks/gateguard.mjs +172 -0
  82. package/plugins/continuous-improvement/hooks/hooks.json +65 -0
  83. package/plugins/continuous-improvement/hooks/observe.sh +172 -0
  84. package/plugins/continuous-improvement/hooks/session.sh +106 -0
  85. package/plugins/continuous-improvement/hooks/three-section-close.mjs +181 -0
  86. package/plugins/continuous-improvement/instinct-packs/go.json +58 -0
  87. package/plugins/continuous-improvement/instinct-packs/meta.json +16 -0
  88. package/plugins/continuous-improvement/instinct-packs/python.json +58 -0
  89. package/plugins/continuous-improvement/instinct-packs/react.json +58 -0
  90. package/plugins/continuous-improvement/lib/observe-event.mjs +128 -0
  91. package/plugins/continuous-improvement/lib/plugin-metadata.mjs +435 -0
  92. package/plugins/continuous-improvement/lib/resolve-home-dir.mjs +43 -0
  93. package/plugins/continuous-improvement/skills/README.md +37 -0
  94. package/plugins/continuous-improvement/skills/continuous-improvement/SKILL.md +249 -0
  95. package/plugins/continuous-improvement/skills/deploy-receipt/SKILL.md +178 -0
  96. package/plugins/continuous-improvement/skills/gateguard/SKILL.md +163 -0
  97. package/plugins/continuous-improvement/skills/para-memory-files/SKILL.md +108 -0
  98. package/plugins/continuous-improvement/skills/proceed-with-the-recommendation/SKILL.md +447 -0
  99. package/plugins/continuous-improvement/skills/ralph/SKILL.md +221 -0
  100. package/plugins/continuous-improvement/skills/recovery-classification/SKILL.md +73 -0
  101. package/plugins/continuous-improvement/skills/safety-guard/SKILL.md +76 -0
  102. package/plugins/continuous-improvement/skills/state-reconciliation/SKILL.md +63 -0
  103. package/plugins/continuous-improvement/skills/strategic-compact/SKILL.md +104 -0
  104. package/plugins/continuous-improvement/skills/superpowers/SKILL.md +219 -0
  105. package/plugins/continuous-improvement/skills/tdd-workflow/SKILL.md +411 -0
  106. package/plugins/continuous-improvement/skills/token-budget-advisor/SKILL.md +136 -0
  107. package/plugins/continuous-improvement/skills/verification-loop/SKILL.md +224 -0
  108. package/plugins/continuous-improvement/skills/wild-risa-balance/SKILL.md +191 -0
  109. package/plugins/continuous-improvement/skills/workspace-surface-audit/SKILL.md +147 -0
  110. package/plugins/continuous-improvement/skills/worktree-safety/SKILL.md +66 -0
  111. package/plugins/continuous-improvement/templates/planning-with-files/findings.md +8 -0
  112. package/plugins/continuous-improvement/templates/planning-with-files/progress.md +7 -0
  113. package/plugins/continuous-improvement/templates/planning-with-files/task_plan.md +23 -0
  114. package/plugins/expert.json +26 -5
  115. package/skills/README.md +79 -0
  116. package/skills/deploy-receipt.md +178 -0
  117. package/skills/gateguard.md +163 -0
  118. package/skills/para-memory-files.md +108 -0
  119. package/skills/proceed-with-the-recommendation.md +447 -0
  120. package/skills/ralph.md +221 -0
  121. package/skills/recovery-classification.md +73 -0
  122. package/skills/safety-guard.md +76 -0
  123. package/skills/state-reconciliation.md +63 -0
  124. package/skills/strategic-compact.md +104 -0
  125. package/skills/superpowers.md +219 -0
  126. package/skills/tdd-workflow.md +411 -0
  127. package/skills/token-budget-advisor.md +136 -0
  128. package/skills/verification-loop.md +224 -0
  129. package/skills/wild-risa-balance.md +191 -0
  130. package/skills/workspace-surface-audit.md +147 -0
  131. package/skills/worktree-safety.md +66 -0
  132. package/templates/insights-claude-md.md +91 -0
  133. package/templates/planning-with-files/findings.md +8 -0
  134. package/templates/planning-with-files/progress.md +7 -0
  135. package/templates/planning-with-files/task_plan.md +23 -0
  136. package/templates/verify-ladder.example.json +60 -0
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: test-engineer
3
+ description: QA engineer specialized in test strategy, test writing, and coverage analysis. Use for designing test suites, writing tests for existing code, or evaluating test quality.
4
+ ---
5
+
6
+ # Test Engineer
7
+
8
+ You are an experienced QA Engineer focused on test strategy and quality assurance. Your role is to design test suites, write tests, analyze coverage gaps, and ensure that code changes are properly verified.
9
+
10
+ ## Approach
11
+
12
+ ### 1. Analyze Before Writing
13
+
14
+ Before writing any test:
15
+ - Read the code being tested to understand its behavior
16
+ - Identify the public API / interface (what to test)
17
+ - Identify edge cases and error paths
18
+ - Check existing tests for patterns and conventions
19
+
20
+ ### 2. Test at the Right Level
21
+
22
+ ```
23
+ Pure logic, no I/O → Unit test
24
+ Crosses a boundary → Integration test
25
+ Critical user flow → E2E test
26
+ ```
27
+
28
+ Test at the lowest level that captures the behavior. Don't write E2E tests for things unit tests can cover.
29
+
30
+ ### 3. Follow the Prove-It Pattern for Bugs
31
+
32
+ When asked to write a test for a bug:
33
+ 1. Write a test that demonstrates the bug (must FAIL with current code)
34
+ 2. Confirm the test fails
35
+ 3. Report the test is ready for the fix implementation
36
+
37
+ ### 4. Write Descriptive Tests
38
+
39
+ ```
40
+ describe('[Module/Function name]', () => {
41
+ it('[expected behavior in plain English]', () => {
42
+ // Arrange → Act → Assert
43
+ });
44
+ });
45
+ ```
46
+
47
+ ### 5. Cover These Scenarios
48
+
49
+ For every function or component:
50
+
51
+ | Scenario | Example |
52
+ |----------|---------|
53
+ | Happy path | Valid input produces expected output |
54
+ | Empty input | Empty string, empty array, null, undefined |
55
+ | Boundary values | Min, max, zero, negative |
56
+ | Error paths | Invalid input, network failure, timeout |
57
+ | Concurrency | Rapid repeated calls, out-of-order responses |
58
+
59
+ ## Output Format
60
+
61
+ When analyzing test coverage:
62
+
63
+ ```markdown
64
+ ## Test Coverage Analysis
65
+
66
+ ### Current Coverage
67
+ - [X] tests covering [Y] functions/components
68
+ - Coverage gaps identified: [list]
69
+
70
+ ### Recommended Tests
71
+ 1. **[Test name]** — [What it verifies, why it matters]
72
+ 2. **[Test name]** — [What it verifies, why it matters]
73
+
74
+ ### Priority
75
+ - Critical: [Tests that catch potential data loss or security issues]
76
+ - High: [Tests for core business logic]
77
+ - Medium: [Tests for edge cases and error handling]
78
+ - Low: [Tests for utility functions and formatting]
79
+ ```
80
+
81
+ ## Rules
82
+
83
+ 1. Test behavior, not implementation details
84
+ 2. Each test should verify one concept
85
+ 3. Tests should be independent — no shared mutable state between tests
86
+ 4. Avoid snapshot tests unless reviewing every change to the snapshot
87
+ 5. Mock at system boundaries (database, network), not between internal functions
88
+ 6. Every test name should read like a specification
89
+ 7. A test that never fails is as useless as a test that always fails
90
+
91
+ ## Composition
92
+
93
+ - **Invoke directly when:** the user asks for test design, coverage analysis, or a Prove-It test for a specific bug.
94
+ - **Invoke via:** `/test` (TDD workflow) or `/ship` (parallel fan-out for coverage gap analysis alongside `code-reviewer` and `security-auditor`).
95
+ - **Do not invoke from another persona.** Recommendations to add tests belong in your report; the user or a slash command decides when to act on them. See [agents/README.md](README.md).
@@ -0,0 +1,172 @@
1
+ #!/usr/bin/env node
2
+ // backfill.mts — Tag legacy thin-schema observation rows for skip-clean
3
+ // consumption by the analysis pass.
4
+ //
5
+ // Walks ~/.claude/instincts/<hash>/observations.jsonl files and writes a
6
+ // `schema: "thin" | "rich"` field on every row that doesn't already have one.
7
+ // Per the plan doc: this is a flag-pass, not a content-recovery — the original
8
+ // thin rows lack the input we'd need to fabricate richer fields. Tagging lets
9
+ // the analysis pass cleanly skip thin rows and surface a "X% of observations
10
+ // were thin" stat to operators so they understand why their auto-instinct
11
+ // pipeline historically produced nothing.
12
+ //
13
+ // Output:
14
+ // - <home>/.claude/instincts/<hash>/observations.jsonl (rewritten in place
15
+ // with schema field appended; original preserved as .bak)
16
+ // - <home>/.claude/instincts/backfill-summary.json (per-project digest)
17
+ //
18
+ // Flags:
19
+ // --dry-run Read everything, write nothing; print counts to stdout.
20
+ //
21
+ // Idempotent: re-running on already-tagged rows is a no-op.
22
+ // Exit code: always 0. Failures land on stderr only.
23
+ import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";
24
+ import { homedir } from "node:os";
25
+ import { basename, join } from "node:path";
26
+ const args = process.argv.slice(2);
27
+ const DRY_RUN = args.includes("--dry-run");
28
+ const HELP = args.includes("--help") || args.includes("-h");
29
+ if (HELP) {
30
+ console.log(`
31
+ backfill — Tag legacy thin-schema observation rows.
32
+
33
+ Usage:
34
+ npx continuous-improvement backfill Tag rows in place
35
+ npx continuous-improvement backfill --dry-run Report counts, write nothing
36
+
37
+ What it does:
38
+ Walks ~/.claude/instincts/<hash>/observations.jsonl files and adds a
39
+ schema field ("thin" or "rich") to every row that lacks one. Thin rows
40
+ came from the legacy bash fallback (jq missing) and have no input_summary;
41
+ rich rows came from the Node observer and have full tool_input.command /
42
+ Edit.file_path / etc.
43
+
44
+ Output:
45
+ - observations.jsonl rewritten in place (original kept as .bak)
46
+ - backfill-summary.json with per-project counts
47
+
48
+ Idempotent. Always exits 0 — failures go to stderr only.
49
+ `);
50
+ process.exit(0);
51
+ }
52
+ main();
53
+ function main() {
54
+ try {
55
+ runBackfill();
56
+ }
57
+ catch (error) {
58
+ process.stderr.write(`[backfill] ${error instanceof Error ? error.message : String(error)}\n`);
59
+ }
60
+ process.exit(0);
61
+ }
62
+ function runBackfill() {
63
+ const home = process.env.HOME || process.env.USERPROFILE || homedir();
64
+ const instinctsDir = join(home, ".claude", "instincts");
65
+ if (!existsSync(instinctsDir)) {
66
+ if (!DRY_RUN)
67
+ mkdirSync(instinctsDir, { recursive: true });
68
+ return;
69
+ }
70
+ const projectDirs = listProjectDirs(instinctsDir);
71
+ const summary = {
72
+ total: 0,
73
+ thin: 0,
74
+ rich: 0,
75
+ projects: {},
76
+ generated_at: new Date().toISOString(),
77
+ };
78
+ for (const dir of projectDirs) {
79
+ const obsFile = join(dir, "observations.jsonl");
80
+ if (!existsSync(obsFile))
81
+ continue;
82
+ const projectId = basename(dir);
83
+ const stat = { total: 0, thin: 0, rich: 0 };
84
+ const newLines = [];
85
+ const corruptLines = [];
86
+ let mutated = false;
87
+ const raw = readFileSync(obsFile, "utf8");
88
+ for (const line of raw.split("\n")) {
89
+ const trimmed = line.trim();
90
+ if (trimmed.length === 0)
91
+ continue;
92
+ let row;
93
+ try {
94
+ row = JSON.parse(trimmed);
95
+ }
96
+ catch {
97
+ process.stderr.write(`[backfill] skipped corrupt row in ${projectId}: ${trimmed.slice(0, 80)}\n`);
98
+ // Drop from main file but preserve in observations.corrupt.jsonl
99
+ // so the operator never silently loses data.
100
+ corruptLines.push(trimmed);
101
+ mutated = true;
102
+ continue;
103
+ }
104
+ stat.total++;
105
+ summary.total++;
106
+ const previousSchema = row.schema;
107
+ const isRich = typeof row.input_summary === "string" && row.input_summary.length > 0;
108
+ const newSchema = isRich ? "rich" : "thin";
109
+ if (previousSchema !== newSchema) {
110
+ row.schema = newSchema;
111
+ mutated = true;
112
+ }
113
+ if (newSchema === "thin") {
114
+ stat.thin++;
115
+ summary.thin++;
116
+ }
117
+ else {
118
+ stat.rich++;
119
+ summary.rich++;
120
+ }
121
+ newLines.push(JSON.stringify(row));
122
+ }
123
+ summary.projects[projectId] = stat;
124
+ if (mutated && !DRY_RUN) {
125
+ // Atomic-ish write: backup → write → keep .bak for one cycle.
126
+ const backup = obsFile + ".bak";
127
+ renameSync(obsFile, backup);
128
+ writeFileSync(obsFile, newLines.join("\n") + "\n", "utf8");
129
+ if (corruptLines.length > 0) {
130
+ // Quarantine corrupt rows so operator data is never silently lost.
131
+ const corruptFile = join(dir, "observations.corrupt.jsonl");
132
+ const existing = existsSync(corruptFile) ? readFileSync(corruptFile, "utf8") : "";
133
+ writeFileSync(corruptFile, existing + corruptLines.join("\n") + "\n", "utf8");
134
+ }
135
+ }
136
+ }
137
+ if (DRY_RUN) {
138
+ process.stdout.write(formatReport(summary, true));
139
+ return;
140
+ }
141
+ const summaryPath = join(instinctsDir, "backfill-summary.json");
142
+ writeFileSync(summaryPath, JSON.stringify(summary, null, 2) + "\n", "utf8");
143
+ process.stdout.write(formatReport(summary, false));
144
+ }
145
+ function listProjectDirs(instinctsDir) {
146
+ // Real project-hash dirs are sha256[:12] (hex). Test fixtures use 12-char
147
+ // alpha labels (g/h/i are not hex but make tests readable). Both are
148
+ // matched here; the broader pattern is harmless because real instincts/
149
+ // sub-dirs only ever contain hex hashes plus 'global' / loose dotfiles.
150
+ return readdirSync(instinctsDir)
151
+ .filter((name) => /^[0-9a-z]{12}$/.test(name))
152
+ .map((name) => join(instinctsDir, name))
153
+ .filter((dir) => {
154
+ try {
155
+ return statSync(dir).isDirectory();
156
+ }
157
+ catch {
158
+ return false;
159
+ }
160
+ });
161
+ }
162
+ function formatReport(summary, isDryRun) {
163
+ const projects = Object.keys(summary.projects);
164
+ const lines = [
165
+ isDryRun ? "[backfill --dry-run] would tag the following:" : "[backfill] tagged:",
166
+ ` total rows: ${summary.total}`,
167
+ ` thin rows: ${summary.thin}`,
168
+ ` rich rows: ${summary.rich}`,
169
+ ` projects: ${projects.length}`,
170
+ ];
171
+ return lines.join("\n") + "\n";
172
+ }