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.
- package/.claude-plugin/marketplace.json +66 -0
- package/CHANGELOG.md +216 -0
- package/QUICKSTART.md +79 -12
- package/README.md +229 -349
- package/SKILL.md +87 -9
- package/action.yml +1 -1
- package/bin/analyze.sh +9 -1
- package/bin/backfill.mjs +172 -0
- package/bin/check-doc-runtime-claims.mjs +120 -0
- package/bin/check-docs-substrings.mjs +333 -0
- package/bin/check-everything-mirror.mjs +145 -0
- package/bin/check-routing-targets.mjs +151 -0
- package/bin/check-skill-law-tag.mjs +128 -0
- package/bin/check-skill-mirror.mjs +119 -0
- package/bin/check-skill-tiers.mjs +116 -0
- package/bin/check-third-party-shape.mjs +202 -0
- package/bin/generate-plugin-manifests.mjs +171 -0
- package/bin/harvest-friction.mjs +279 -0
- package/bin/hook-stats.mjs +258 -0
- package/bin/install.mjs +407 -499
- package/bin/lint-transcript.mjs +182 -210
- package/bin/mcp-server.mjs +834 -608
- package/bin/observe.mjs +148 -0
- package/bin/pre-commit-block-strays.sh +49 -0
- package/bin/refresh-third-party.mjs +416 -0
- package/bin/unified-cli.mjs +533 -0
- package/commands/continuous-improvement.md +43 -2
- package/commands/discipline.md +14 -0
- package/commands/harvest.md +76 -0
- package/commands/learn-eval.md +117 -0
- package/commands/planning-with-files.md +66 -0
- package/commands/proceed-with-the-recommendation.md +62 -0
- package/commands/ralph.md +103 -0
- package/commands/release-train.md +81 -0
- package/commands/seven-laws.md +16 -0
- package/commands/superpowers.md +180 -0
- package/commands/swarm.md +101 -0
- package/commands/workspace-surface-audit.md +77 -0
- package/hooks/gateguard.mjs +172 -0
- package/hooks/observe.sh +42 -4
- package/hooks/session.sh +3 -3
- package/hooks/three-section-close.mjs +181 -0
- package/instinct-packs/meta.json +16 -0
- package/lib/cli-anything.mjs +401 -0
- package/lib/compound-engineering.mjs +831 -0
- package/lib/gateguard-state.mjs +85 -0
- package/lib/observe-event.mjs +128 -0
- package/lib/plugin-metadata.mjs +435 -0
- package/lib/pm-marketplace.mjs +61 -0
- package/lib/pm-skills.mjs +1274 -0
- package/lib/resolve-home-dir.mjs +43 -0
- package/lib/skill-tiers.mjs +137 -0
- package/lib/unified-plugin.mjs +924 -0
- package/llms.txt +32 -7
- package/package.json +29 -19
- package/plugins/beginner.json +17 -6
- package/plugins/continuous-improvement/.claude-plugin/marketplace.json +20 -0
- package/plugins/continuous-improvement/.claude-plugin/plugin.json +26 -0
- package/plugins/continuous-improvement/LICENSE +21 -0
- package/plugins/continuous-improvement/README.md +57 -0
- package/plugins/continuous-improvement/agents/README.md +120 -0
- package/plugins/continuous-improvement/agents/code-reviewer.md +97 -0
- package/plugins/continuous-improvement/agents/security-auditor.md +101 -0
- package/plugins/continuous-improvement/agents/test-engineer.md +95 -0
- package/plugins/continuous-improvement/bin/backfill.mjs +172 -0
- package/plugins/continuous-improvement/bin/mcp-server.mjs +889 -0
- package/plugins/continuous-improvement/bin/observe.mjs +148 -0
- package/plugins/continuous-improvement/commands/continuous-improvement.md +115 -0
- package/plugins/continuous-improvement/commands/dashboard.md +56 -0
- package/plugins/continuous-improvement/commands/discipline.md +51 -0
- package/plugins/continuous-improvement/commands/harvest.md +76 -0
- package/plugins/continuous-improvement/commands/learn-eval.md +117 -0
- package/plugins/continuous-improvement/commands/planning-with-files.md +66 -0
- package/plugins/continuous-improvement/commands/proceed-with-the-recommendation.md +62 -0
- package/plugins/continuous-improvement/commands/ralph.md +103 -0
- package/plugins/continuous-improvement/commands/release-train.md +81 -0
- package/plugins/continuous-improvement/commands/seven-laws.md +16 -0
- package/plugins/continuous-improvement/commands/superpowers.md +180 -0
- package/plugins/continuous-improvement/commands/swarm.md +101 -0
- package/plugins/continuous-improvement/commands/workspace-surface-audit.md +77 -0
- package/plugins/continuous-improvement/hooks/gateguard.mjs +172 -0
- package/plugins/continuous-improvement/hooks/hooks.json +65 -0
- package/plugins/continuous-improvement/hooks/observe.sh +172 -0
- package/plugins/continuous-improvement/hooks/session.sh +106 -0
- package/plugins/continuous-improvement/hooks/three-section-close.mjs +181 -0
- package/plugins/continuous-improvement/instinct-packs/go.json +58 -0
- package/plugins/continuous-improvement/instinct-packs/meta.json +16 -0
- package/plugins/continuous-improvement/instinct-packs/python.json +58 -0
- package/plugins/continuous-improvement/instinct-packs/react.json +58 -0
- package/plugins/continuous-improvement/lib/observe-event.mjs +128 -0
- package/plugins/continuous-improvement/lib/plugin-metadata.mjs +435 -0
- package/plugins/continuous-improvement/lib/resolve-home-dir.mjs +43 -0
- package/plugins/continuous-improvement/skills/README.md +37 -0
- package/plugins/continuous-improvement/skills/continuous-improvement/SKILL.md +249 -0
- package/plugins/continuous-improvement/skills/deploy-receipt/SKILL.md +178 -0
- package/plugins/continuous-improvement/skills/gateguard/SKILL.md +163 -0
- package/plugins/continuous-improvement/skills/para-memory-files/SKILL.md +108 -0
- package/plugins/continuous-improvement/skills/proceed-with-the-recommendation/SKILL.md +447 -0
- package/plugins/continuous-improvement/skills/ralph/SKILL.md +221 -0
- package/plugins/continuous-improvement/skills/recovery-classification/SKILL.md +73 -0
- package/plugins/continuous-improvement/skills/safety-guard/SKILL.md +76 -0
- package/plugins/continuous-improvement/skills/state-reconciliation/SKILL.md +63 -0
- package/plugins/continuous-improvement/skills/strategic-compact/SKILL.md +104 -0
- package/plugins/continuous-improvement/skills/superpowers/SKILL.md +219 -0
- package/plugins/continuous-improvement/skills/tdd-workflow/SKILL.md +411 -0
- package/plugins/continuous-improvement/skills/token-budget-advisor/SKILL.md +136 -0
- package/plugins/continuous-improvement/skills/verification-loop/SKILL.md +224 -0
- package/plugins/continuous-improvement/skills/wild-risa-balance/SKILL.md +191 -0
- package/plugins/continuous-improvement/skills/workspace-surface-audit/SKILL.md +147 -0
- package/plugins/continuous-improvement/skills/worktree-safety/SKILL.md +66 -0
- package/plugins/continuous-improvement/templates/planning-with-files/findings.md +8 -0
- package/plugins/continuous-improvement/templates/planning-with-files/progress.md +7 -0
- package/plugins/continuous-improvement/templates/planning-with-files/task_plan.md +23 -0
- package/plugins/expert.json +26 -5
- package/skills/README.md +79 -0
- package/skills/deploy-receipt.md +178 -0
- package/skills/gateguard.md +163 -0
- package/skills/para-memory-files.md +108 -0
- package/skills/proceed-with-the-recommendation.md +447 -0
- package/skills/ralph.md +221 -0
- package/skills/recovery-classification.md +73 -0
- package/skills/safety-guard.md +76 -0
- package/skills/state-reconciliation.md +63 -0
- package/skills/strategic-compact.md +104 -0
- package/skills/superpowers.md +219 -0
- package/skills/tdd-workflow.md +411 -0
- package/skills/token-budget-advisor.md +136 -0
- package/skills/verification-loop.md +224 -0
- package/skills/wild-risa-balance.md +191 -0
- package/skills/workspace-surface-audit.md +147 -0
- package/skills/worktree-safety.md +66 -0
- package/templates/insights-claude-md.md +91 -0
- package/templates/planning-with-files/findings.md +8 -0
- package/templates/planning-with-files/progress.md +7 -0
- package/templates/planning-with-files/task_plan.md +23 -0
- package/templates/verify-ladder.example.json +60 -0
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Unified Continuous Improvement CLI.
|
|
4
|
+
*
|
|
5
|
+
* Comprehensive command-line interface for the unified plugin that combines
|
|
6
|
+
* CLI-Anything, Compound Engineering, and PM-Skills.
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
import UnifiedContinuousImprovement from "../lib/unified-plugin.mjs";
|
|
11
|
+
const DEFAULT_CONFIG = {
|
|
12
|
+
workspace: "./ci-workspace",
|
|
13
|
+
verbose: false,
|
|
14
|
+
defaultMode: "expert",
|
|
15
|
+
};
|
|
16
|
+
function getErrorMessage(error) {
|
|
17
|
+
return error instanceof Error ? error.message : String(error);
|
|
18
|
+
}
|
|
19
|
+
function parseJsonOption(raw) {
|
|
20
|
+
if (!raw)
|
|
21
|
+
return undefined;
|
|
22
|
+
try {
|
|
23
|
+
return JSON.parse(raw);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
throw new Error(`Invalid JSON option: ${getErrorMessage(error)}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
class UnifiedCLI {
|
|
30
|
+
plugin = null;
|
|
31
|
+
config;
|
|
32
|
+
constructor() {
|
|
33
|
+
this.config = this.loadConfig();
|
|
34
|
+
}
|
|
35
|
+
loadConfig() {
|
|
36
|
+
const configPath = join(process.cwd(), ".ci-config.json");
|
|
37
|
+
if (existsSync(configPath)) {
|
|
38
|
+
try {
|
|
39
|
+
const parsed = JSON.parse(readFileSync(configPath, "utf8"));
|
|
40
|
+
return { ...DEFAULT_CONFIG, ...parsed };
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
console.warn("Warning: Invalid config file, using defaults");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { ...DEFAULT_CONFIG };
|
|
47
|
+
}
|
|
48
|
+
initializePlugin(options) {
|
|
49
|
+
this.plugin = new UnifiedContinuousImprovement({
|
|
50
|
+
workspace: options.workspace ?? this.config.workspace,
|
|
51
|
+
verbose: options.verbose ?? this.config.verbose,
|
|
52
|
+
});
|
|
53
|
+
return this.plugin;
|
|
54
|
+
}
|
|
55
|
+
requirePlugin() {
|
|
56
|
+
if (!this.plugin) {
|
|
57
|
+
throw new Error("CLI plugin not initialized");
|
|
58
|
+
}
|
|
59
|
+
return this.plugin;
|
|
60
|
+
}
|
|
61
|
+
async runCommand(command, args, options = {}) {
|
|
62
|
+
this.initializePlugin(options);
|
|
63
|
+
switch (command) {
|
|
64
|
+
case "init":
|
|
65
|
+
return this.handleInit(args, options);
|
|
66
|
+
case "workflow":
|
|
67
|
+
return this.handleWorkflow(args, options);
|
|
68
|
+
case "research":
|
|
69
|
+
return this.handleResearch(options);
|
|
70
|
+
case "planning":
|
|
71
|
+
return this.handlePlanning(options);
|
|
72
|
+
case "execution":
|
|
73
|
+
return this.handleExecution();
|
|
74
|
+
case "review":
|
|
75
|
+
return this.handleReview(options);
|
|
76
|
+
case "status":
|
|
77
|
+
return this.handleStatus();
|
|
78
|
+
case "cli":
|
|
79
|
+
return this.handleCLI(args);
|
|
80
|
+
case "pm":
|
|
81
|
+
return this.handlePM(args, options);
|
|
82
|
+
case "compound":
|
|
83
|
+
return this.handleCompound(args);
|
|
84
|
+
case "learnings":
|
|
85
|
+
return this.handleLearnings(args);
|
|
86
|
+
case "config":
|
|
87
|
+
return this.handleConfig(args);
|
|
88
|
+
default:
|
|
89
|
+
throw new Error(`Unknown command: ${command}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async handleInit(args, options) {
|
|
93
|
+
if (args.length < 2) {
|
|
94
|
+
throw new Error("Usage: ci init <project-name> <objective> [options]");
|
|
95
|
+
}
|
|
96
|
+
const [name, ...objectiveParts] = args;
|
|
97
|
+
const objective = objectiveParts.join(" ");
|
|
98
|
+
console.log(`π Initializing project: ${name}`);
|
|
99
|
+
console.log(`π Objective: ${objective}`);
|
|
100
|
+
const plugin = this.requirePlugin();
|
|
101
|
+
const result = await plugin.initializeProject({
|
|
102
|
+
name: name,
|
|
103
|
+
objective,
|
|
104
|
+
product: parseJsonOption(options.product) ?? {},
|
|
105
|
+
industry: options.industry ?? "",
|
|
106
|
+
targetMarket: parseJsonOption(options.targetMarket) ?? {},
|
|
107
|
+
});
|
|
108
|
+
console.log(`β
Project initialized successfully!`);
|
|
109
|
+
console.log(`π Project ID: ${result.projectId}`);
|
|
110
|
+
console.log(`π Session ID: ${result.sessionId}`);
|
|
111
|
+
console.log(`π PM Analysis: ${result.pmAnalysis.totalSkills} skills completed`);
|
|
112
|
+
console.log(`\nπ― Next steps:`);
|
|
113
|
+
result.nextSteps.forEach((step, i) => {
|
|
114
|
+
console.log(` ${i + 1}. ${step}`);
|
|
115
|
+
});
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
async handleWorkflow(args, options) {
|
|
119
|
+
if (args.length < 2) {
|
|
120
|
+
throw new Error("Usage: ci workflow <project-name> <objective> [options]");
|
|
121
|
+
}
|
|
122
|
+
const [name, ...objectiveParts] = args;
|
|
123
|
+
const objective = objectiveParts.join(" ");
|
|
124
|
+
console.log(`π Starting complete workflow for: ${name}`);
|
|
125
|
+
console.log(`π Objective: ${objective}`);
|
|
126
|
+
const progressCallback = (message) => {
|
|
127
|
+
console.log(` β³ ${message}`);
|
|
128
|
+
};
|
|
129
|
+
const plugin = this.requirePlugin();
|
|
130
|
+
const result = await plugin.executeCompleteWorkflow({
|
|
131
|
+
name: name,
|
|
132
|
+
objective,
|
|
133
|
+
product: parseJsonOption(options.product) ?? {},
|
|
134
|
+
industry: options.industry ?? "",
|
|
135
|
+
targetMarket: parseJsonOption(options.targetMarket) ?? {},
|
|
136
|
+
}, {
|
|
137
|
+
researchContext: options.repo ? { repositoryPath: options.repo } : {},
|
|
138
|
+
progressCallback,
|
|
139
|
+
});
|
|
140
|
+
console.log(`π Complete workflow finished!`);
|
|
141
|
+
console.log(`π Project: ${result.project}`);
|
|
142
|
+
console.log(`π Session: ${result.sessionId}`);
|
|
143
|
+
for (const [phase] of Object.entries(result.phases)) {
|
|
144
|
+
console.log(`\nπ ${phase.charAt(0).toUpperCase() + phase.slice(1)} Phase:`);
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
148
|
+
async handleResearch(options) {
|
|
149
|
+
console.log(`π Starting research phase...`);
|
|
150
|
+
const context = {};
|
|
151
|
+
if (options.repo)
|
|
152
|
+
context.repositoryPath = options.repo;
|
|
153
|
+
if (options.context)
|
|
154
|
+
context.additionalContext = parseJsonOption(options.context);
|
|
155
|
+
const plugin = this.requirePlugin();
|
|
156
|
+
const result = await plugin.executeResearchPhase(context);
|
|
157
|
+
console.log(`β
Research phase completed!`);
|
|
158
|
+
console.log(`π‘ Generated ${result.brainstorm.ideas.length} ideas`);
|
|
159
|
+
console.log(`π Identified ${result.brainstorm.risks.length} risks`);
|
|
160
|
+
if (result.cliTools) {
|
|
161
|
+
console.log(`π οΈ Generated CLI with ${result.cliTools.commands.length} commands`);
|
|
162
|
+
}
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
async handlePlanning(options) {
|
|
166
|
+
console.log(`π Starting planning phase...`);
|
|
167
|
+
const preferences = parseJsonOption(options.preferences) ?? {};
|
|
168
|
+
const plugin = this.requirePlugin();
|
|
169
|
+
const result = await plugin.executePlanningPhase(preferences);
|
|
170
|
+
console.log(`β
Planning phase completed!`);
|
|
171
|
+
console.log(`π Created plan with ${result.corePlan.steps.length} steps`);
|
|
172
|
+
const estimated = result.corePlan.timeline?.estimated;
|
|
173
|
+
if (estimated)
|
|
174
|
+
console.log(`β±οΈ Timeline: ${estimated}`);
|
|
175
|
+
console.log(`β οΈ Identified ${result.risks.length} risks`);
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
async handleExecution() {
|
|
179
|
+
console.log(`π§ Starting execution phase...`);
|
|
180
|
+
const progressCallback = (message) => {
|
|
181
|
+
console.log(` β‘ ${message}`);
|
|
182
|
+
};
|
|
183
|
+
const plugin = this.requirePlugin();
|
|
184
|
+
const result = await plugin.executeWorkingPhase(progressCallback);
|
|
185
|
+
console.log(`β
Execution phase completed!`);
|
|
186
|
+
console.log(`π Completed ${result.coreWork.steps.length} steps`);
|
|
187
|
+
console.log(`π§ Resolved ${result.issues.length} issues`);
|
|
188
|
+
console.log(`π‘ Applied ${result.solutions.length} solutions`);
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
191
|
+
async handleReview(options) {
|
|
192
|
+
console.log(`π Starting review phase...`);
|
|
193
|
+
const criteria = parseJsonOption(options.criteria);
|
|
194
|
+
const plugin = this.requirePlugin();
|
|
195
|
+
const result = await plugin.executeReviewPhase(criteria);
|
|
196
|
+
console.log(`β
Review phase completed!`);
|
|
197
|
+
console.log(`π Overall score: ${result.coreReview.review.overallScore}/100`);
|
|
198
|
+
console.log(`π‘ Generated ${result.learnings.length} learnings`);
|
|
199
|
+
console.log(`π Created ${result.recommendations.length} recommendations`);
|
|
200
|
+
return result;
|
|
201
|
+
}
|
|
202
|
+
async handleStatus() {
|
|
203
|
+
const plugin = this.requirePlugin();
|
|
204
|
+
const status = await plugin.getProjectStatus();
|
|
205
|
+
console.log(`π Project Status:`);
|
|
206
|
+
console.log(` Project: ${status.project ?? "No active project"}`);
|
|
207
|
+
console.log(` Session: ${status.sessionId ?? "N/A"}`);
|
|
208
|
+
console.log(` Current Phase: ${status.currentPhase ?? "N/A"}`);
|
|
209
|
+
if (status.progress) {
|
|
210
|
+
console.log(` Progress: ${status.progress.completed}/${status.progress.total} (${status.progress.percentage}%)`);
|
|
211
|
+
}
|
|
212
|
+
if (status.nextSteps && status.nextSteps.length > 0) {
|
|
213
|
+
console.log(`\nπ― Next Steps:`);
|
|
214
|
+
status.nextSteps.forEach((step, i) => {
|
|
215
|
+
console.log(` ${i + 1}. ${step}`);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return status;
|
|
219
|
+
}
|
|
220
|
+
async handleCLI(args) {
|
|
221
|
+
const [subcommand, ...subArgs] = args;
|
|
222
|
+
switch (subcommand) {
|
|
223
|
+
case "generate":
|
|
224
|
+
if (subArgs.length === 0) {
|
|
225
|
+
throw new Error("Usage: ci cli generate <repository-path>");
|
|
226
|
+
}
|
|
227
|
+
return this.handleCLIGenerate(subArgs[0]);
|
|
228
|
+
case "list":
|
|
229
|
+
return this.handleCLIList();
|
|
230
|
+
default:
|
|
231
|
+
throw new Error("Usage: ci cli <generate|list> [args]");
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
async handleCLIGenerate(repoPath) {
|
|
235
|
+
console.log(`π οΈ Generating CLI for: ${repoPath}`);
|
|
236
|
+
const plugin = this.requirePlugin();
|
|
237
|
+
const result = await plugin.cliAnything.generateCLI(repoPath);
|
|
238
|
+
console.log(`β
CLI generated successfully!`);
|
|
239
|
+
console.log(`π Output: ${result.outputPath}`);
|
|
240
|
+
console.log(`π§ Commands: ${result.commands.length}`);
|
|
241
|
+
console.log(`\nπ Available Commands:`);
|
|
242
|
+
for (const cmd of result.commands) {
|
|
243
|
+
console.log(` ${cmd.name.padEnd(15)} - ${cmd.description}`);
|
|
244
|
+
}
|
|
245
|
+
return result;
|
|
246
|
+
}
|
|
247
|
+
handleCLIList() {
|
|
248
|
+
console.log(`π οΈ CLI Generation Tool Status: Ready`);
|
|
249
|
+
console.log(` Repository Analysis: Supported`);
|
|
250
|
+
console.log(` Project Types: Node.js, React, Python, Docker, and more`);
|
|
251
|
+
console.log(` Output Format: Executable JavaScript`);
|
|
252
|
+
}
|
|
253
|
+
async handlePM(args, options) {
|
|
254
|
+
const [subcommand, ...subArgs] = args;
|
|
255
|
+
switch (subcommand) {
|
|
256
|
+
case "analyze":
|
|
257
|
+
return this.handlePMAnalyze(options);
|
|
258
|
+
case "skill":
|
|
259
|
+
return this.handlePMSkill(subArgs);
|
|
260
|
+
case "list":
|
|
261
|
+
return this.handlePMList();
|
|
262
|
+
default:
|
|
263
|
+
throw new Error("Usage: ci pm <analyze|skill|list> [args]");
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
async handlePMAnalyze(options) {
|
|
267
|
+
console.log(`π Running comprehensive PM analysis...`);
|
|
268
|
+
const productInfo = {
|
|
269
|
+
product: parseJsonOption(options.product) ?? {},
|
|
270
|
+
industry: options.industry ?? "Technology",
|
|
271
|
+
targetMarket: parseJsonOption(options.targetMarket) ?? {},
|
|
272
|
+
};
|
|
273
|
+
const plugin = this.requirePlugin();
|
|
274
|
+
const result = await plugin.pmSkills.runProductAnalysis(productInfo);
|
|
275
|
+
console.log(`β
PM analysis completed!`);
|
|
276
|
+
console.log(`π Summary: ${result.summary.completedSkills}/${result.summary.totalSkills} skills completed`);
|
|
277
|
+
console.log(`π‘ Key insights: ${result.summary.keyInsights.length}`);
|
|
278
|
+
console.log(`π Recommendations: ${result.summary.recommendations.length}`);
|
|
279
|
+
console.log(`π Results saved to: ${result.savedTo}`);
|
|
280
|
+
return result;
|
|
281
|
+
}
|
|
282
|
+
async handlePMSkill(args) {
|
|
283
|
+
if (args.length === 0) {
|
|
284
|
+
throw new Error("Usage: ci pm skill <skill-name>");
|
|
285
|
+
}
|
|
286
|
+
const [skillName] = args;
|
|
287
|
+
console.log(`π Executing PM skill: ${skillName}`);
|
|
288
|
+
const input = {
|
|
289
|
+
product: { name: "Sample Product" },
|
|
290
|
+
market: { size: "Medium" },
|
|
291
|
+
};
|
|
292
|
+
const plugin = this.requirePlugin();
|
|
293
|
+
const result = await plugin.pmSkills.executeSkill(skillName, input);
|
|
294
|
+
console.log(`β
PM skill ${skillName} completed!`);
|
|
295
|
+
console.log(`π Results saved to: ${result.savedTo}`);
|
|
296
|
+
return result;
|
|
297
|
+
}
|
|
298
|
+
handlePMList() {
|
|
299
|
+
const plugin = this.requirePlugin();
|
|
300
|
+
const skills = plugin.pmSkills.getAvailableSkills();
|
|
301
|
+
console.log(`π Available PM Skills:`);
|
|
302
|
+
for (const skill of skills) {
|
|
303
|
+
console.log(` ${skill.name.padEnd(20)} - ${skill.description} [${skill.category}]`);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
async handleCompound(args) {
|
|
307
|
+
const [subcommand, ...subArgs] = args;
|
|
308
|
+
switch (subcommand) {
|
|
309
|
+
case "session":
|
|
310
|
+
return this.handleCompoundSession(subArgs);
|
|
311
|
+
case "learnings":
|
|
312
|
+
return this.handleCompoundLearnings();
|
|
313
|
+
default:
|
|
314
|
+
throw new Error("Usage: ci compound <session|learnings> [args]");
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
async handleCompoundSession(args) {
|
|
318
|
+
if (args.length < 2) {
|
|
319
|
+
throw new Error("Usage: ci compound session <project-name> <objective>");
|
|
320
|
+
}
|
|
321
|
+
const [name, ...objectiveParts] = args;
|
|
322
|
+
const objective = objectiveParts.join(" ");
|
|
323
|
+
console.log(`π§ Starting compound engineering session...`);
|
|
324
|
+
const plugin = this.requirePlugin();
|
|
325
|
+
const session = await plugin.compoundEngineering.startSession(name, objective);
|
|
326
|
+
console.log(`β
Session started!`);
|
|
327
|
+
console.log(`π Session ID: ${session.id}`);
|
|
328
|
+
console.log(`π Objective: ${session.objective}`);
|
|
329
|
+
console.log(`π Current Phase: ${session.phase}`);
|
|
330
|
+
return session;
|
|
331
|
+
}
|
|
332
|
+
async handleCompoundLearnings() {
|
|
333
|
+
console.log(`π Loading compound engineering learnings...`);
|
|
334
|
+
const plugin = this.requirePlugin();
|
|
335
|
+
await plugin.compoundEngineering.loadLearnings();
|
|
336
|
+
const learnings = plugin.compoundEngineering.getAllLearnings();
|
|
337
|
+
console.log(`π Found ${learnings.length} learnings:`);
|
|
338
|
+
for (const learning of learnings) {
|
|
339
|
+
console.log(` [${learning.confidence.toFixed(2)}] ${learning.summary}`);
|
|
340
|
+
}
|
|
341
|
+
return learnings;
|
|
342
|
+
}
|
|
343
|
+
async handleLearnings(args) {
|
|
344
|
+
const [subcommand, ...subArgs] = args;
|
|
345
|
+
switch (subcommand) {
|
|
346
|
+
case "search":
|
|
347
|
+
return this.handleLearningsSearch(subArgs.join(" "));
|
|
348
|
+
case "all":
|
|
349
|
+
return this.handleLearningsAll();
|
|
350
|
+
default:
|
|
351
|
+
throw new Error("Usage: ci learnings <search|all> [query]");
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
async handleLearningsSearch(query) {
|
|
355
|
+
console.log(`π Searching learnings for: "${query}"`);
|
|
356
|
+
const plugin = this.requirePlugin();
|
|
357
|
+
await plugin.compoundEngineering.loadLearnings();
|
|
358
|
+
const results = plugin.compoundEngineering.searchLearnings(query);
|
|
359
|
+
console.log(`π Found ${results.length} matching learnings:`);
|
|
360
|
+
for (const learning of results) {
|
|
361
|
+
console.log(` [${learning.confidence.toFixed(2)}] ${learning.summary}`);
|
|
362
|
+
}
|
|
363
|
+
return results;
|
|
364
|
+
}
|
|
365
|
+
async handleLearningsAll() {
|
|
366
|
+
console.log(`π Loading all learnings...`);
|
|
367
|
+
const plugin = this.requirePlugin();
|
|
368
|
+
await plugin.compoundEngineering.loadLearnings();
|
|
369
|
+
const learnings = plugin.compoundEngineering.getAllLearnings();
|
|
370
|
+
console.log(`π Total learnings: ${learnings.length}`);
|
|
371
|
+
const grouped = learnings.reduce((groups, learning) => {
|
|
372
|
+
const type = learning.type || "general";
|
|
373
|
+
if (!groups[type])
|
|
374
|
+
groups[type] = [];
|
|
375
|
+
groups[type].push(learning);
|
|
376
|
+
return groups;
|
|
377
|
+
}, {});
|
|
378
|
+
for (const [type, items] of Object.entries(grouped)) {
|
|
379
|
+
console.log(`\n ${type.charAt(0).toUpperCase() + type.slice(1)} (${items.length}):`);
|
|
380
|
+
for (const learning of items) {
|
|
381
|
+
console.log(` [${learning.confidence.toFixed(2)}] ${learning.summary}`);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return learnings;
|
|
385
|
+
}
|
|
386
|
+
async handleConfig(args) {
|
|
387
|
+
const [subcommand, ...subArgs] = args;
|
|
388
|
+
switch (subcommand) {
|
|
389
|
+
case "show":
|
|
390
|
+
return this.handleConfigShow();
|
|
391
|
+
case "set":
|
|
392
|
+
return this.handleConfigSet(subArgs);
|
|
393
|
+
default:
|
|
394
|
+
throw new Error("Usage: ci config <show|set> [key] [value]");
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
handleConfigShow() {
|
|
398
|
+
console.log(`βοΈ Current Configuration:`);
|
|
399
|
+
console.log(` Workspace: ${this.config.workspace}`);
|
|
400
|
+
console.log(` Verbose: ${this.config.verbose}`);
|
|
401
|
+
console.log(` Default Mode: ${this.config.defaultMode}`);
|
|
402
|
+
}
|
|
403
|
+
handleConfigSet(args) {
|
|
404
|
+
if (args.length < 2) {
|
|
405
|
+
throw new Error("Usage: ci config set <key> <value>");
|
|
406
|
+
}
|
|
407
|
+
const [key, value] = args;
|
|
408
|
+
if (!key || value === undefined) {
|
|
409
|
+
throw new Error("Usage: ci config set <key> <value>");
|
|
410
|
+
}
|
|
411
|
+
if (key === "workspace") {
|
|
412
|
+
this.config.workspace = value;
|
|
413
|
+
}
|
|
414
|
+
else if (key === "verbose") {
|
|
415
|
+
this.config.verbose = value === "true";
|
|
416
|
+
}
|
|
417
|
+
else if (key === "defaultMode") {
|
|
418
|
+
this.config.defaultMode = value;
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
throw new Error(`Unknown config key: ${key}`);
|
|
422
|
+
}
|
|
423
|
+
console.log(`β
Configuration updated: ${key} = ${value}`);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
function parseGlobalOptions(args) {
|
|
427
|
+
const options = {};
|
|
428
|
+
for (let i = 0; i < args.length; i++) {
|
|
429
|
+
const flag = args[i];
|
|
430
|
+
const next = args[i + 1];
|
|
431
|
+
const consumeValue = (key) => {
|
|
432
|
+
if (next === undefined)
|
|
433
|
+
return;
|
|
434
|
+
options[key] = next;
|
|
435
|
+
args.splice(i, 2);
|
|
436
|
+
i--;
|
|
437
|
+
};
|
|
438
|
+
switch (flag) {
|
|
439
|
+
case "--workspace":
|
|
440
|
+
consumeValue("workspace");
|
|
441
|
+
break;
|
|
442
|
+
case "--verbose":
|
|
443
|
+
options.verbose = true;
|
|
444
|
+
args.splice(i, 1);
|
|
445
|
+
i--;
|
|
446
|
+
break;
|
|
447
|
+
case "--repo":
|
|
448
|
+
consumeValue("repo");
|
|
449
|
+
break;
|
|
450
|
+
case "--product":
|
|
451
|
+
consumeValue("product");
|
|
452
|
+
break;
|
|
453
|
+
case "--industry":
|
|
454
|
+
consumeValue("industry");
|
|
455
|
+
break;
|
|
456
|
+
case "--target-market":
|
|
457
|
+
consumeValue("targetMarket");
|
|
458
|
+
break;
|
|
459
|
+
default:
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return options;
|
|
464
|
+
}
|
|
465
|
+
async function main() {
|
|
466
|
+
const [, , command, ...args] = process.argv;
|
|
467
|
+
if (!command || command === "--help" || command === "-h") {
|
|
468
|
+
console.log(`
|
|
469
|
+
Unified Continuous Improvement CLI
|
|
470
|
+
|
|
471
|
+
Usage: ci <command> [args] [options]
|
|
472
|
+
|
|
473
|
+
Main Commands:
|
|
474
|
+
init <name> <objective> Initialize new project with comprehensive analysis
|
|
475
|
+
workflow <name> <objective> Run complete end-to-end workflow
|
|
476
|
+
research Execute research phase
|
|
477
|
+
planning Execute planning phase
|
|
478
|
+
execution Execute execution phase
|
|
479
|
+
review Execute review phase
|
|
480
|
+
status Show project status
|
|
481
|
+
|
|
482
|
+
Tool Commands:
|
|
483
|
+
cli generate <repo-path> Generate CLI for repository
|
|
484
|
+
pm analyze Run comprehensive PM analysis
|
|
485
|
+
pm skill <name> Execute specific PM skill
|
|
486
|
+
pm list List available PM skills
|
|
487
|
+
compound session <name> <obj> Start compound engineering session
|
|
488
|
+
compound learnings Show compound engineering learnings
|
|
489
|
+
learnings search <query> Search through all learnings
|
|
490
|
+
learnings all Show all learnings
|
|
491
|
+
|
|
492
|
+
Configuration:
|
|
493
|
+
config show Show current configuration
|
|
494
|
+
config set <key> <value> Set configuration value
|
|
495
|
+
|
|
496
|
+
Global Options:
|
|
497
|
+
--workspace <dir> Workspace directory
|
|
498
|
+
--verbose Enable verbose logging
|
|
499
|
+
--repo <path> Repository path for CLI generation
|
|
500
|
+
--product <json> Product information as JSON
|
|
501
|
+
--industry <name> Industry name
|
|
502
|
+
--target-market <json> Target market as JSON
|
|
503
|
+
|
|
504
|
+
Examples:
|
|
505
|
+
ci init "MyApp" "Build a task management app"
|
|
506
|
+
ci workflow "MyApp" "Build task management" --repo ./my-app
|
|
507
|
+
ci cli generate ./my-repo
|
|
508
|
+
ci pm analyze --industry "SaaS" --target-market '{"segment":"SMB"}'
|
|
509
|
+
ci learnings search "performance"
|
|
510
|
+
`);
|
|
511
|
+
process.exit(0);
|
|
512
|
+
}
|
|
513
|
+
const cli = new UnifiedCLI();
|
|
514
|
+
const options = parseGlobalOptions(args);
|
|
515
|
+
try {
|
|
516
|
+
const result = await cli.runCommand(command, args, options);
|
|
517
|
+
if (options.verbose && result) {
|
|
518
|
+
console.log(`\nπ Detailed result:`);
|
|
519
|
+
console.log(JSON.stringify(result, null, 2));
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
catch (error) {
|
|
523
|
+
console.error(`β Error: ${getErrorMessage(error)}`);
|
|
524
|
+
process.exit(1);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
528
|
+
main().catch((error) => {
|
|
529
|
+
console.error(`β Fatal error: ${getErrorMessage(error)}`);
|
|
530
|
+
process.exit(1);
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
export default UnifiedCLI;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: continuous-improvement
|
|
3
|
-
description: "Reflect on the current session, analyze observations for patterns, and show instinct status.
|
|
3
|
+
description: "Reflect on the current session, analyze observations for patterns, and show instinct status. Runs on-demand to save tokens."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# /continuous-improvement
|
|
7
7
|
|
|
8
|
-
Run this
|
|
8
|
+
Run this when you want to reflect and learn β not every session. Three steps in order.
|
|
9
9
|
|
|
10
10
|
## Step 1: Reflect
|
|
11
11
|
|
|
@@ -17,10 +17,20 @@ Generate a reflection for this session based on what happened:
|
|
|
17
17
|
- What failed:
|
|
18
18
|
- What I'd do differently:
|
|
19
19
|
- Rule to add:
|
|
20
|
+
- Iteration β Next best recommendations (ranked, top 3):
|
|
21
|
+
1. <primary β strongest next move>
|
|
22
|
+
2. <alternative β different angle>
|
|
23
|
+
3. <alternative β smaller/larger scope>
|
|
20
24
|
```
|
|
21
25
|
|
|
22
26
|
If there's a "Rule to add", create an instinct YAML file with 0.6 starting confidence in the project's instinct directory.
|
|
23
27
|
|
|
28
|
+
The "Iteration β Next best recommendations" field is the Law 6 handoff. List the **top 3 ranked** core-development moves β what to build, fix, refactor, or investigate next so the feature/system advances. Item #1 is the strongest; #2 and #3 are alternatives the user can pivot to. NOT git steps (commit, push, PR), NOT verification re-runs, NOT deploy actions β those belong in the end-of-run summary.
|
|
29
|
+
|
|
30
|
+
Format per item: `<verb> <object at path:line> (<why, one clause grounded in current context>)`.
|
|
31
|
+
|
|
32
|
+
Rules: always exactly 3 distinct directions, not padding. If fewer real moves exist, fill remaining slots with `None β goal met from this angle.` If the goal is fully met across all angles, write `1. None β goal met, stop.` and omit #2 and #3.
|
|
33
|
+
|
|
24
34
|
## Step 2: Analyze Observations
|
|
25
35
|
|
|
26
36
|
Check `~/.claude/instincts/` for the current project (detect via git root β SHA-256 first 12 chars).
|
|
@@ -39,6 +49,15 @@ Look at `~/.claude/instincts/<hash>/observations.jsonl`. If 20+ lines exist:
|
|
|
39
49
|
|
|
40
50
|
If fewer than 20 observations, skip analysis and note the count.
|
|
41
51
|
|
|
52
|
+
### Multi-Agent Analysis (500+ observations)
|
|
53
|
+
|
|
54
|
+
When observation backlog is large, parallelize:
|
|
55
|
+
- **Agent 1:** User corrections + errorβfix patterns
|
|
56
|
+
- **Agent 2:** Repeated workflows + tool preferences
|
|
57
|
+
- **Agent 3:** Cross-reference existing instincts for updates
|
|
58
|
+
|
|
59
|
+
Merge results and deduplicate before writing YAML files.
|
|
60
|
+
|
|
42
61
|
## Step 3: Show Status
|
|
43
62
|
|
|
44
63
|
Display all instincts for the current project + global:
|
|
@@ -53,6 +72,10 @@ Display all instincts for the current project + global:
|
|
|
53
72
|
- What failed: [from this session]
|
|
54
73
|
- What I'd do differently: [from this session]
|
|
55
74
|
- Rule to add: [captured as instinct]
|
|
75
|
+
- Iteration β Next best recommendations (ranked, top 3):
|
|
76
|
+
1. [primary core-development move]
|
|
77
|
+
2. [alternative angle]
|
|
78
|
+
3. [alternative scope]
|
|
56
79
|
|
|
57
80
|
## Learning
|
|
58
81
|
NEW [instinct-id] [domain] [confidence] (from reflection)
|
|
@@ -72,3 +95,21 @@ Display all instincts for the current project + global:
|
|
|
72
95
|
```
|
|
73
96
|
|
|
74
97
|
If no instincts or observations exist yet, explain this is expected β the system is in CAPTURE level and will create instincts after 20+ observations accumulate.
|
|
98
|
+
|
|
99
|
+
## Subcommands
|
|
100
|
+
|
|
101
|
+
### `/continuous-improvement weekly`
|
|
102
|
+
|
|
103
|
+
Set up a weekly analysis schedule:
|
|
104
|
+
1. Create a cron/loop schedule that runs `/continuous-improvement analyze` every 7 days
|
|
105
|
+
2. Confirm the schedule to the user
|
|
106
|
+
3. Show next scheduled run date
|
|
107
|
+
|
|
108
|
+
### `/continuous-improvement always-on`
|
|
109
|
+
|
|
110
|
+
Toggle always-on mode for the current project:
|
|
111
|
+
1. Find project hash
|
|
112
|
+
2. Create/update `~/.claude/instincts/<hash>/config.yaml` with `always_on: true|false`
|
|
113
|
+
3. Confirm the change
|
|
114
|
+
|
|
115
|
+
**Default is off** β observations accumulate silently, analysis only runs when you ask.
|
package/commands/discipline.md
CHANGED
|
@@ -19,6 +19,20 @@ Print this card and check yourself against each law.
|
|
|
19
19
|
| 6 | **Iterate One Change** | Am I changing one thing at a time? | "And also..." |
|
|
20
20
|
| 7 | **Learn From Every Session** | Did I capture this as an instinct? | "Next time I'll..." |
|
|
21
21
|
|
|
22
|
+
## Operator Stakes
|
|
23
|
+
|
|
24
|
+
The Laws above are the *how*. These five principles are the *why*: code ships from your account, the incident lands on your pager, the bill hits your budget. Each one pairs with the Law that prevents it from going wrong.
|
|
25
|
+
|
|
26
|
+
| # | Principle | Vibe coder | Engineer | Law |
|
|
27
|
+
|---|-----------|------------|----------|-----|
|
|
28
|
+
| 1 | **Ownership** | Ships auth, moves on | Adds rate limits, audit logs, password-reset flow, incident runbook before shipping | 4 |
|
|
29
|
+
| 2 | **Reliability over cleverness** | Accepts a clever regex + heavy lib that breaks on ISO 8601 with millis | Picks the boring tested API, writes tests for leap years and DST | 1 |
|
|
30
|
+
| 3 | **Systems thinking** | Builds in-memory CSV export, works for 100 dev users, OOMs in prod | Asks row count first, picks paginated background job + S3 link | 2 |
|
|
31
|
+
| 4 | **Problem framing** | Builds the websocket chat the ticket asked for | Finds out users wanted faster support replies, not chat | 1 |
|
|
32
|
+
| 5 | **Constraints management** | Calls the $0.02/image model on every upload | Does the math, adds client-side validation + caching + cheaper triage model | 2 |
|
|
33
|
+
|
|
34
|
+
Code is a liability, not an asset. Speed without these five turns into someone else's incident at 3am β except the someone is you.
|
|
35
|
+
|
|
22
36
|
## The Loop
|
|
23
37
|
|
|
24
38
|
```
|