@kynetic-ai/spec 0.3.0 → 0.4.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.
- package/dist/cli/batch-exec.d.ts +0 -9
- package/dist/cli/batch-exec.d.ts.map +1 -1
- package/dist/cli/batch-exec.js +16 -4
- package/dist/cli/batch-exec.js.map +1 -1
- package/dist/cli/commands/derive.d.ts.map +1 -1
- package/dist/cli/commands/derive.js +2 -1
- package/dist/cli/commands/derive.js.map +1 -1
- package/dist/cli/commands/log.d.ts.map +1 -1
- package/dist/cli/commands/log.js +5 -4
- package/dist/cli/commands/log.js.map +1 -1
- package/dist/cli/commands/meta.d.ts.map +1 -1
- package/dist/cli/commands/meta.js +2 -1
- package/dist/cli/commands/meta.js.map +1 -1
- package/dist/cli/commands/plan-import.d.ts.map +1 -1
- package/dist/cli/commands/plan-import.js +50 -19
- package/dist/cli/commands/plan-import.js.map +1 -1
- package/dist/cli/commands/ralph.d.ts.map +1 -1
- package/dist/cli/commands/ralph.js +18 -7
- package/dist/cli/commands/ralph.js.map +1 -1
- package/dist/cli/commands/session.d.ts.map +1 -1
- package/dist/cli/commands/session.js +6 -7
- package/dist/cli/commands/session.js.map +1 -1
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +41 -7
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/skill-install.d.ts +4 -1
- package/dist/cli/commands/skill-install.d.ts.map +1 -1
- package/dist/cli/commands/skill-install.js +62 -5
- package/dist/cli/commands/skill-install.js.map +1 -1
- package/dist/cli/commands/task.d.ts.map +1 -1
- package/dist/cli/commands/task.js +35 -24
- package/dist/cli/commands/task.js.map +1 -1
- package/dist/cli/commands/tasks.d.ts.map +1 -1
- package/dist/cli/commands/tasks.js +2 -4
- package/dist/cli/commands/tasks.js.map +1 -1
- package/dist/cli/commands/triage.d.ts.map +1 -1
- package/dist/cli/commands/triage.js +12 -98
- package/dist/cli/commands/triage.js.map +1 -1
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +4 -2
- package/dist/cli/output.js.map +1 -1
- package/dist/daemon/routes/triage.ts +4 -70
- package/dist/parser/config.d.ts +106 -0
- package/dist/parser/config.d.ts.map +1 -1
- package/dist/parser/config.js +47 -0
- package/dist/parser/config.js.map +1 -1
- package/dist/parser/plan-document.d.ts +8 -0
- package/dist/parser/plan-document.d.ts.map +1 -1
- package/dist/parser/plan-document.js +1 -0
- package/dist/parser/plan-document.js.map +1 -1
- package/dist/ralph/events.d.ts.map +1 -1
- package/dist/ralph/events.js +24 -0
- package/dist/ralph/events.js.map +1 -1
- package/dist/ralph/index.d.ts +1 -1
- package/dist/ralph/index.d.ts.map +1 -1
- package/dist/ralph/index.js +1 -1
- package/dist/ralph/index.js.map +1 -1
- package/dist/ralph/subagent.d.ts +12 -1
- package/dist/ralph/subagent.d.ts.map +1 -1
- package/dist/ralph/subagent.js +22 -3
- package/dist/ralph/subagent.js.map +1 -1
- package/dist/schema/batch.d.ts +2 -0
- package/dist/schema/batch.d.ts.map +1 -1
- package/dist/schema/common.d.ts +6 -0
- package/dist/schema/common.d.ts.map +1 -1
- package/dist/schema/common.js +8 -0
- package/dist/schema/common.js.map +1 -1
- package/dist/sessions/store.d.ts +8 -0
- package/dist/sessions/store.d.ts.map +1 -1
- package/dist/sessions/store.js +219 -37
- package/dist/sessions/store.js.map +1 -1
- package/dist/strings/errors.d.ts +4 -0
- package/dist/strings/errors.d.ts.map +1 -1
- package/dist/strings/errors.js +2 -0
- package/dist/strings/errors.js.map +1 -1
- package/dist/triage/actions.d.ts +27 -0
- package/dist/triage/actions.d.ts.map +1 -0
- package/dist/triage/actions.js +95 -0
- package/dist/triage/actions.js.map +1 -0
- package/dist/triage/constants.d.ts +6 -0
- package/dist/triage/constants.d.ts.map +1 -0
- package/dist/triage/constants.js +7 -0
- package/dist/triage/constants.js.map +1 -0
- package/dist/triage/index.d.ts +3 -0
- package/dist/triage/index.d.ts.map +1 -0
- package/dist/triage/index.js +3 -0
- package/dist/triage/index.js.map +1 -0
- package/package.json +1 -1
- package/plugin/.claude-plugin/marketplace.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugins/kspec/skills/create-workflow/SKILL.md +235 -0
- package/plugin/plugins/kspec/skills/observations/SKILL.md +143 -0
- package/plugin/plugins/kspec/skills/plan/SKILL.md +343 -0
- package/plugin/plugins/kspec/skills/reflect/SKILL.md +161 -0
- package/plugin/plugins/kspec/skills/review/SKILL.md +193 -0
- package/plugin/plugins/kspec/skills/task-work/SKILL.md +303 -0
- package/plugin/plugins/kspec/skills/triage-automation/SKILL.md +140 -0
- package/plugin/plugins/kspec/skills/triage-inbox/SKILL.md +232 -0
- package/plugin/plugins/kspec/skills/writing-specs/SKILL.md +340 -0
- package/templates/agents-sections/03-task-lifecycle.md +2 -2
- package/templates/agents-sections/04-pr-workflow.md +3 -3
- package/templates/skills/create-workflow/SKILL.md +228 -0
- package/templates/skills/manifest.yaml +45 -0
- package/templates/skills/observations/SKILL.md +137 -0
- package/templates/skills/plan/SKILL.md +336 -0
- package/templates/skills/reflect/SKILL.md +155 -0
- package/templates/skills/review/SKILL.md +186 -0
- package/templates/skills/task-work/SKILL.md +296 -0
- package/templates/skills/triage-automation/SKILL.md +134 -0
- package/templates/skills/triage-inbox/SKILL.md +225 -0
- package/templates/skills/writing-specs/SKILL.md +333 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { KspecContext } from "../parser/yaml.js";
|
|
2
|
+
import type { LoadedTriageRecord } from "../parser/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Result of executing a triage action.
|
|
5
|
+
*/
|
|
6
|
+
export interface TriageActionResult {
|
|
7
|
+
resultRef?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Options for executeTriageAction.
|
|
11
|
+
* - dryRun: If true, describe what would happen without executing.
|
|
12
|
+
* - onInfo: Optional callback for informational messages (used by CLI for logging).
|
|
13
|
+
*/
|
|
14
|
+
export interface ExecuteTriageActionOptions {
|
|
15
|
+
dryRun?: boolean;
|
|
16
|
+
onInfo?: (message: string) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Execute a triage action against the kspec context.
|
|
20
|
+
*
|
|
21
|
+
* Shared between CLI and daemon. The CLI passes dryRun and onInfo for
|
|
22
|
+
* user-facing output; the daemon calls with no options for silent execution.
|
|
23
|
+
*
|
|
24
|
+
* AC: @triage-cli-commands ac-4, ac-5, ac-6, ac-7, ac-8
|
|
25
|
+
*/
|
|
26
|
+
export declare function executeTriageAction(record: LoadedTriageRecord, ctx: KspecContext, options?: ExecuteTriageActionOptions): Promise<TriageActionResult>;
|
|
27
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/triage/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAe7D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,kBAAkB,EAC1B,GAAG,EAAE,YAAY,EACjB,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,kBAAkB,CAAC,CAyF7B"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { createObservation, createTask, deleteInboxItem, findInboxItemByRef, loadAllItems, loadAllTasks, loadInboxItems, ReferenceIndex, saveObservation, saveTask, } from "../parser/index.js";
|
|
2
|
+
import { truncateText } from "../export/triage.js";
|
|
3
|
+
/**
|
|
4
|
+
* Execute a triage action against the kspec context.
|
|
5
|
+
*
|
|
6
|
+
* Shared between CLI and daemon. The CLI passes dryRun and onInfo for
|
|
7
|
+
* user-facing output; the daemon calls with no options for silent execution.
|
|
8
|
+
*
|
|
9
|
+
* AC: @triage-cli-commands ac-4, ac-5, ac-6, ac-7, ac-8
|
|
10
|
+
*/
|
|
11
|
+
export async function executeTriageAction(record, ctx, options = {}) {
|
|
12
|
+
const { dryRun = false, onInfo } = options;
|
|
13
|
+
const action = record.action;
|
|
14
|
+
if (!action) {
|
|
15
|
+
throw new Error("Record has no action to execute");
|
|
16
|
+
}
|
|
17
|
+
switch (action) {
|
|
18
|
+
case "promote": {
|
|
19
|
+
// AC: @triage-cli-commands ac-4
|
|
20
|
+
if (dryRun) {
|
|
21
|
+
onInfo?.(`Would create task from inbox item snapshot: "${truncateText(record.item_snapshot)}"`);
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
const task = createTask({
|
|
25
|
+
title: record.item_snapshot.split("\n")[0].slice(0, 100),
|
|
26
|
+
type: "task",
|
|
27
|
+
priority: 3,
|
|
28
|
+
spec_ref: null,
|
|
29
|
+
tags: [],
|
|
30
|
+
description: record.item_snapshot,
|
|
31
|
+
});
|
|
32
|
+
await saveTask(ctx, task);
|
|
33
|
+
const tasks = await loadAllTasks(ctx);
|
|
34
|
+
const items = await loadAllItems(ctx);
|
|
35
|
+
const index = new ReferenceIndex(tasks, items);
|
|
36
|
+
const taskRef = `@${index.shortUlid(task._ulid)}`;
|
|
37
|
+
onInfo?.(`Created task: ${taskRef} - ${task.title}`);
|
|
38
|
+
return { resultRef: taskRef };
|
|
39
|
+
}
|
|
40
|
+
case "delete": {
|
|
41
|
+
// AC: @triage-cli-commands ac-5
|
|
42
|
+
if (dryRun) {
|
|
43
|
+
onInfo?.(`Would delete inbox item: ${record.inbox_ref.slice(0, 8)}`);
|
|
44
|
+
return {};
|
|
45
|
+
}
|
|
46
|
+
const inboxItems = await loadInboxItems(ctx);
|
|
47
|
+
const inboxItem = findInboxItemByRef(inboxItems, record.inbox_ref);
|
|
48
|
+
if (inboxItem) {
|
|
49
|
+
await deleteInboxItem(ctx, inboxItem._ulid);
|
|
50
|
+
onInfo?.(`Deleted inbox item: ${record.inbox_ref.slice(0, 8)}`);
|
|
51
|
+
}
|
|
52
|
+
return {};
|
|
53
|
+
}
|
|
54
|
+
case "defer": {
|
|
55
|
+
// AC: @triage-cli-commands ac-6
|
|
56
|
+
if (dryRun) {
|
|
57
|
+
onInfo?.(`Would defer: no side effects beyond recording the deferral`);
|
|
58
|
+
return {};
|
|
59
|
+
}
|
|
60
|
+
return {};
|
|
61
|
+
}
|
|
62
|
+
case "spec-gap": {
|
|
63
|
+
// AC: @triage-cli-commands ac-7
|
|
64
|
+
if (dryRun) {
|
|
65
|
+
onInfo?.(`Would create spec-gap observation from: "${truncateText(record.item_snapshot)}"`);
|
|
66
|
+
return {};
|
|
67
|
+
}
|
|
68
|
+
const content = `[spec-gap] ${record.item_snapshot}\n\nReasoning: ${record.reasoning || ""}`;
|
|
69
|
+
const observation = createObservation("question", content, {
|
|
70
|
+
configAuthor: ctx.config?.identity?.author,
|
|
71
|
+
});
|
|
72
|
+
await saveObservation(ctx, observation);
|
|
73
|
+
const obsRef = `@${observation._ulid.slice(0, 8)}`;
|
|
74
|
+
onInfo?.(`Created spec-gap observation: ${obsRef}`);
|
|
75
|
+
return { resultRef: obsRef };
|
|
76
|
+
}
|
|
77
|
+
case "duplicate": {
|
|
78
|
+
// AC: @triage-cli-commands ac-8
|
|
79
|
+
if (dryRun) {
|
|
80
|
+
onInfo?.(`Would delete duplicate inbox item: ${record.inbox_ref.slice(0, 8)}`);
|
|
81
|
+
return {};
|
|
82
|
+
}
|
|
83
|
+
const dupItems = await loadInboxItems(ctx);
|
|
84
|
+
const dupItem = findInboxItemByRef(dupItems, record.inbox_ref);
|
|
85
|
+
if (dupItem) {
|
|
86
|
+
await deleteInboxItem(ctx, dupItem._ulid);
|
|
87
|
+
onInfo?.(`Deleted duplicate inbox item: ${record.inbox_ref.slice(0, 8)}`);
|
|
88
|
+
}
|
|
89
|
+
return {};
|
|
90
|
+
}
|
|
91
|
+
default:
|
|
92
|
+
return {};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/triage/actions.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,eAAe,EACf,QAAQ,GACT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAmBnD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAA0B,EAC1B,GAAiB,EACjB,UAAsC,EAAE;IAExC,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,SAAS,CAAC,CAAC,CAAC;YACf,gCAAgC;YAChC,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,EAAE,CAAC,gDAAgD,YAAY,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;gBAChG,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,MAAM,IAAI,GAAG,UAAU,CAAC;gBACtB,KAAK,EAAE,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAA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,GAAG,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC;YAC3C,MAAM,OAAO,GAAG,kBAAkB,CAAC,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;YAC/D,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;gBAC1C,MAAM,EAAE,CAAC,iCAAiC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YAC5E,CAAC;YACD,OAAO,EAAE,CAAC;QACZ,CAAC;QAED;YACE,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/triage/constants.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAA+B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TriageActionSchema } from "../schema/triage.js";
|
|
2
|
+
/**
|
|
3
|
+
* Valid triage actions derived from the Zod schema.
|
|
4
|
+
* Single source of truth — use this instead of hardcoding action strings.
|
|
5
|
+
*/
|
|
6
|
+
export const VALID_ACTIONS = TriageActionSchema.options;
|
|
7
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/triage/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAsB,kBAAkB,CAAC,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/triage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,GACxB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/triage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,mBAAmB,GAGpB,MAAM,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-workflow
|
|
3
|
+
description: Formalize repeatable patterns into trackable kspec workflows.
|
|
4
|
+
Design steps, choose triggers, create loop variants, and integrate with
|
|
5
|
+
skills.
|
|
6
|
+
---
|
|
7
|
+
<!-- kspec-managed -->
|
|
8
|
+
# Create Workflow
|
|
9
|
+
|
|
10
|
+
Formalize repeatable patterns into trackable kspec workflows. A meta-workflow for building new workflows with consistent structure.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Formalizing a repeated process into a trackable workflow
|
|
15
|
+
- Converting step-by-step documentation into executable steps
|
|
16
|
+
- Adding quality gates that are easy to skip without structure
|
|
17
|
+
|
|
18
|
+
**Not for:** Running existing workflows (use `kspec workflow start @id`), one-off processes, or tasks that don't repeat.
|
|
19
|
+
|
|
20
|
+
## Identifying Good Candidates
|
|
21
|
+
|
|
22
|
+
Look for processes that are:
|
|
23
|
+
|
|
24
|
+
| Signal | Example |
|
|
25
|
+
|--------|---------|
|
|
26
|
+
| Step-by-step instructions in docs | "To release: bump version, tag, push, create release" |
|
|
27
|
+
| Checklists that get skipped | "Before merge: check CI, resolve threads, verify AC" |
|
|
28
|
+
| Repeated command sequences | "Start daemon, run tests, check output, stop daemon" |
|
|
29
|
+
| Quality gates with multiple criteria | "Review: AC coverage, test quality, code style, regressions" |
|
|
30
|
+
|
|
31
|
+
Good sources: AGENTS.md, existing skills, task notes, session reflections.
|
|
32
|
+
|
|
33
|
+
## Workflow Structure
|
|
34
|
+
|
|
35
|
+
Every workflow has:
|
|
36
|
+
|
|
37
|
+
```yaml
|
|
38
|
+
id: kebab-case-name
|
|
39
|
+
description: What this workflow does
|
|
40
|
+
trigger: when-it-starts
|
|
41
|
+
mode: interactive # or loop
|
|
42
|
+
steps:
|
|
43
|
+
- id: step-1
|
|
44
|
+
type: action # action, check, or decision
|
|
45
|
+
content: What to do in this step
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Triggers
|
|
49
|
+
|
|
50
|
+
| Trigger | When |
|
|
51
|
+
|---------|------|
|
|
52
|
+
| `manual` | Invoked explicitly |
|
|
53
|
+
| `session-start` | Beginning of work session |
|
|
54
|
+
| `session-end` | End of work session |
|
|
55
|
+
| `task-complete` | After completing a task |
|
|
56
|
+
| `behavior-change` | Before implementing changes |
|
|
57
|
+
| `pre-release` | Before creating a release |
|
|
58
|
+
| `pr-merge` | Before merging a PR |
|
|
59
|
+
|
|
60
|
+
### Step Types
|
|
61
|
+
|
|
62
|
+
| Type | Purpose | Example |
|
|
63
|
+
|------|---------|---------|
|
|
64
|
+
| `action` | Do something | "Run tests and verify all pass" |
|
|
65
|
+
| `check` | Verify a condition | "All CI checks passing?" |
|
|
66
|
+
| `decision` | Choose a path | "Import or manual path?" |
|
|
67
|
+
|
|
68
|
+
### Modes
|
|
69
|
+
|
|
70
|
+
- **interactive** — Pauses for user input at each step
|
|
71
|
+
- **loop** — Auto-resolves decisions, no user prompts (for automated agents)
|
|
72
|
+
|
|
73
|
+
Loop mode workflows typically have a `based_on` field referencing the interactive version.
|
|
74
|
+
|
|
75
|
+
## Creating a Workflow
|
|
76
|
+
|
|
77
|
+
### Step 1: Design the Steps
|
|
78
|
+
|
|
79
|
+
Before creating, outline your steps on paper:
|
|
80
|
+
|
|
81
|
+
1. What's the trigger?
|
|
82
|
+
2. What steps are needed?
|
|
83
|
+
3. Which are actions vs checks vs decisions?
|
|
84
|
+
4. What inputs does each step need?
|
|
85
|
+
5. What's the exit criteria?
|
|
86
|
+
|
|
87
|
+
### Step 2: Create the Workflow
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
kspec meta add workflow \
|
|
91
|
+
--id my-workflow \
|
|
92
|
+
--trigger manual \
|
|
93
|
+
--description "Description of what this workflow does" \
|
|
94
|
+
--tag category \
|
|
95
|
+
--steps '[
|
|
96
|
+
{"id":"step-1","type":"action","content":"First action to take"},
|
|
97
|
+
{"id":"step-2","type":"check","content":"Verify the condition"},
|
|
98
|
+
{"id":"step-3","type":"decision","content":"Choose path A or B"}
|
|
99
|
+
]'
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Step 3: Test the Workflow
|
|
103
|
+
|
|
104
|
+
Run through it end-to-end:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
kspec workflow start @my-workflow
|
|
108
|
+
kspec workflow next --notes "Testing step 1"
|
|
109
|
+
kspec workflow next --input decision="path-a" --notes "Chose A because..."
|
|
110
|
+
# Continue through all steps
|
|
111
|
+
kspec workflow show # Verify inputs and notes captured
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Step 4: Consider a Matching Skill
|
|
115
|
+
|
|
116
|
+
A workflow may benefit from a matching skill when:
|
|
117
|
+
|
|
118
|
+
| Create a skill when | Skip the skill when |
|
|
119
|
+
|---------------------|---------------------|
|
|
120
|
+
| Steps need detailed context | Workflow is self-contained |
|
|
121
|
+
| Multiple sub-documents help | Context exists elsewhere |
|
|
122
|
+
| Users need a `/command` entrypoint | Workflow is internal/automated |
|
|
123
|
+
| Complex decision logic | Simple sequential steps |
|
|
124
|
+
|
|
125
|
+
If creating a skill, write it to `templates/skills/<name>/SKILL.md` and add a manifest entry.
|
|
126
|
+
|
|
127
|
+
### Step 5: Commit
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Workflow definition auto-committed to shadow branch by kspec
|
|
131
|
+
# Skill files (if created) need manual commit to main branch
|
|
132
|
+
git add templates/skills/<name>/SKILL.md
|
|
133
|
+
git commit -m "feat: add <name> skill for workflow integration"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Step Design Guidelines
|
|
137
|
+
|
|
138
|
+
### Action Steps
|
|
139
|
+
|
|
140
|
+
Clear, specific instructions:
|
|
141
|
+
|
|
142
|
+
```yaml
|
|
143
|
+
- id: run-tests
|
|
144
|
+
type: action
|
|
145
|
+
content: |
|
|
146
|
+
Run the full test suite. Fix any failures before proceeding.
|
|
147
|
+
Verify both unit and integration tests pass.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Check Steps
|
|
151
|
+
|
|
152
|
+
Binary yes/no verification:
|
|
153
|
+
|
|
154
|
+
```yaml
|
|
155
|
+
- id: ci-passing
|
|
156
|
+
type: check
|
|
157
|
+
content: |
|
|
158
|
+
Verify all CI checks are passing on the current HEAD.
|
|
159
|
+
If not, wait for CI or fix failures.
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Decision Steps
|
|
163
|
+
|
|
164
|
+
Clear options with guidance:
|
|
165
|
+
|
|
166
|
+
```yaml
|
|
167
|
+
- id: choose-path
|
|
168
|
+
type: decision
|
|
169
|
+
content: |
|
|
170
|
+
Choose execution path:
|
|
171
|
+
- Import: 3+ specs, structured document, batch creation
|
|
172
|
+
- Manual: 1-2 specs, incremental, quick additions
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Tips
|
|
176
|
+
|
|
177
|
+
- Keep steps atomic — one action per step
|
|
178
|
+
- Include the "why" when it's not obvious
|
|
179
|
+
- Decision steps should list all options
|
|
180
|
+
- Check steps should describe what to do on failure
|
|
181
|
+
- Use `content` for detailed multi-line instructions
|
|
182
|
+
|
|
183
|
+
## Loop Mode Variants
|
|
184
|
+
|
|
185
|
+
For automated agents, create a loop variant:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
kspec meta add workflow \
|
|
189
|
+
--id my-workflow-loop \
|
|
190
|
+
--trigger manual \
|
|
191
|
+
--mode loop \
|
|
192
|
+
--based-on @my-workflow \
|
|
193
|
+
--description "Automated variant of my-workflow" \
|
|
194
|
+
--steps '[...]'
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Loop variants typically:
|
|
198
|
+
- Auto-resolve decisions (pick the most common path)
|
|
199
|
+
- Skip user confirmation steps
|
|
200
|
+
- Add higher confidence thresholds
|
|
201
|
+
- Include automated exit conditions
|
|
202
|
+
|
|
203
|
+
## Workflow Lifecycle
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# Create
|
|
207
|
+
kspec meta add workflow --id ... --steps '[...]'
|
|
208
|
+
|
|
209
|
+
# Run
|
|
210
|
+
kspec workflow start @id
|
|
211
|
+
kspec workflow next --notes "..."
|
|
212
|
+
kspec workflow next --input key=value
|
|
213
|
+
|
|
214
|
+
# Manage
|
|
215
|
+
kspec workflow show # Check progress
|
|
216
|
+
kspec workflow pause # Pause for later
|
|
217
|
+
kspec workflow resume # Resume paused run
|
|
218
|
+
|
|
219
|
+
# Update (edit the meta YAML)
|
|
220
|
+
kspec meta set workflow @id --steps '[...]'
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Regenerate Agent Instructions
|
|
224
|
+
|
|
225
|
+
After creating a workflow, regenerate agent instructions so the workflow appears in the available workflows list:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
kspec agents generate
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Integration
|
|
232
|
+
|
|
233
|
+
- **`/kspec:reflect`** — Session reflections surface patterns worth formalizing
|
|
234
|
+
- **`/kspec:observations`** — Friction observations may reveal missing workflows
|
|
235
|
+
- **`kspec agents generate`** — Regenerate after creating workflows
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: observations
|
|
3
|
+
description: Capture and act on systemic patterns — friction, successes,
|
|
4
|
+
questions, and ideas. The feedback loop that drives process improvement.
|
|
5
|
+
---
|
|
6
|
+
<!-- kspec-managed -->
|
|
7
|
+
# Observations
|
|
8
|
+
|
|
9
|
+
Capture and act on systemic patterns — friction, successes, questions, and ideas. Observations are the feedback loop that drives process improvement.
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- You hit friction (something harder than it should be)
|
|
14
|
+
- You notice a success worth replicating
|
|
15
|
+
- A systemic question arises (not session-specific)
|
|
16
|
+
- An improvement idea surfaces during work
|
|
17
|
+
|
|
18
|
+
**Not for:** Session-local questions (use `kspec meta question`), future work items (use `kspec inbox add`), or task-specific notes (use `kspec task note`).
|
|
19
|
+
|
|
20
|
+
## Observation Types
|
|
21
|
+
|
|
22
|
+
| Type | When to use | Example |
|
|
23
|
+
|------|-------------|---------|
|
|
24
|
+
| `friction` | Something is harder than it should be | "Bulk updates require too many commands" |
|
|
25
|
+
| `success` | A pattern that worked well | "Dry-run before derive prevented duplicate tasks" |
|
|
26
|
+
| `question` | A systemic question about process | "When should agents use inbox vs tasks?" |
|
|
27
|
+
| `idea` | An improvement opportunity | "CLI could suggest next steps after task completion" |
|
|
28
|
+
|
|
29
|
+
## Capturing Observations
|
|
30
|
+
|
|
31
|
+
Capture in the moment — don't wait until later. The value is in the raw context.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Friction: something was harder than it should be
|
|
35
|
+
kspec meta observe friction "Had to run 5 commands to update one spec field"
|
|
36
|
+
|
|
37
|
+
# Success: a pattern worth remembering
|
|
38
|
+
kspec meta observe success "Using --dry-run before derive prevented duplicate tasks"
|
|
39
|
+
|
|
40
|
+
# Question: systemic, not session-local
|
|
41
|
+
kspec meta observe question "When should agents enter plan mode vs just implement?"
|
|
42
|
+
|
|
43
|
+
# Idea: something that could improve the system
|
|
44
|
+
kspec meta observe idea "CLI could suggest next steps after task completion"
|
|
45
|
+
|
|
46
|
+
# Link to a workflow for context
|
|
47
|
+
kspec meta observe friction "Plan import dropped acceptance criteria" --workflow @spec-plan-import
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Reviewing Observations
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# All unresolved observations (default)
|
|
54
|
+
kspec meta observations
|
|
55
|
+
|
|
56
|
+
# Only those awaiting resolution
|
|
57
|
+
kspec meta observations --pending-resolution
|
|
58
|
+
|
|
59
|
+
# Filter by type
|
|
60
|
+
kspec meta observations --type friction
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Acting on Observations
|
|
64
|
+
|
|
65
|
+
### Promote to Task
|
|
66
|
+
|
|
67
|
+
When an observation reveals clear, actionable work:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
kspec meta promote @ref --title "Add bulk AC command" --priority 2
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Resolve
|
|
74
|
+
|
|
75
|
+
When addressed, documented, or no longer relevant:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Single observation with resolution note
|
|
79
|
+
kspec meta resolve @ref "Fixed in PR #123"
|
|
80
|
+
|
|
81
|
+
# Batch resolve related observations
|
|
82
|
+
kspec meta resolve --refs @ref1 @ref2 @ref3 --resolution "All addressed by new workflow"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Convert from Inbox
|
|
86
|
+
|
|
87
|
+
When an inbox item is really a pattern observation, not future work:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
kspec meta observe --from-inbox @inbox-ref
|
|
91
|
+
kspec meta observe --from-inbox @inbox-ref --type friction
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Decision Flow
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
When you notice something during work:
|
|
98
|
+
├── Is it future work?
|
|
99
|
+
│ └── Yes → kspec inbox add "..."
|
|
100
|
+
├── Is it about THIS task only?
|
|
101
|
+
│ └── Yes → kspec task note @task "..."
|
|
102
|
+
└── Is it a systemic pattern?
|
|
103
|
+
└── Yes → kspec meta observe <type> "..."
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
For each pending observation:
|
|
108
|
+
├── Still relevant?
|
|
109
|
+
│ ├── No → resolve with note
|
|
110
|
+
│ └── Yes → Needs action?
|
|
111
|
+
│ ├── No (just learning) → document and resolve
|
|
112
|
+
│ └── Yes → Scope clear?
|
|
113
|
+
│ ├── Yes → promote to task
|
|
114
|
+
│ └── No → add to inbox for later triage
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Where Observations Fit
|
|
118
|
+
|
|
119
|
+
| What you have | Where | Why |
|
|
120
|
+
|---------------|-------|-----|
|
|
121
|
+
| Vague idea for future | `inbox add` | Low-friction capture, triage later |
|
|
122
|
+
| Clear actionable work | `task add` | Ready to implement |
|
|
123
|
+
| Something was hard | `meta observe friction` | Informs process improvement |
|
|
124
|
+
| Something worked well | `meta observe success` | Worth replicating |
|
|
125
|
+
| Session-local question | `meta question add` | Track during current session |
|
|
126
|
+
| Systemic process question | `meta observe question` | Broader than one session |
|
|
127
|
+
|
|
128
|
+
## Batch Capture
|
|
129
|
+
|
|
130
|
+
When capturing multiple observations at once (e.g., during reflection), use `kspec batch`:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
kspec batch --commands '[
|
|
134
|
+
{"command":"meta observe","args":{"type":"friction","content":"Bulk updates require too many commands"}},
|
|
135
|
+
{"command":"meta observe","args":{"type":"success","content":"Dry-run before derive prevented duplicates"}}
|
|
136
|
+
]'
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Integration
|
|
140
|
+
|
|
141
|
+
- **`/kspec:triage observations`** — Processes pending observations during triage
|
|
142
|
+
- **`/kspec:reflect`** — Creates observations from session learnings
|
|
143
|
+
- **`kspec session start`** — Shows pending observation count
|