@kal-elsam/kairo-runtime 0.4.3 → 0.5.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 (103) hide show
  1. package/README.md +124 -17
  2. package/global-template/components/catalog.json +63 -6
  3. package/global-template/components/sdd-core/personas/teaching.md +42 -0
  4. package/global-template/components/sdd-core/skills/sdd-apply/SKILL.md +34 -0
  5. package/global-template/components/sdd-core/skills/sdd-apply/references/contract.md +4 -0
  6. package/global-template/components/sdd-core/skills/sdd-archive/SKILL.md +34 -0
  7. package/global-template/components/sdd-core/skills/sdd-archive/references/contract.md +4 -0
  8. package/global-template/components/sdd-core/skills/sdd-design/SKILL.md +34 -0
  9. package/global-template/components/sdd-core/skills/sdd-design/references/contract.md +4 -0
  10. package/global-template/components/sdd-core/skills/sdd-explore/SKILL.md +34 -0
  11. package/global-template/components/sdd-core/skills/sdd-explore/references/contract.md +4 -0
  12. package/global-template/components/sdd-core/skills/sdd-init/SKILL.md +34 -0
  13. package/global-template/components/sdd-core/skills/sdd-init/references/contract.md +4 -0
  14. package/global-template/components/sdd-core/skills/sdd-propose/SKILL.md +35 -0
  15. package/global-template/components/sdd-core/skills/sdd-propose/references/contract.md +4 -0
  16. package/global-template/components/sdd-core/skills/sdd-spec/SKILL.md +34 -0
  17. package/global-template/components/sdd-core/skills/sdd-spec/references/contract.md +4 -0
  18. package/global-template/components/sdd-core/skills/sdd-tasks/SKILL.md +34 -0
  19. package/global-template/components/sdd-core/skills/sdd-tasks/references/contract.md +4 -0
  20. package/global-template/components/sdd-core/skills/sdd-verify/SKILL.md +34 -0
  21. package/global-template/components/sdd-core/skills/sdd-verify/references/contract.md +4 -0
  22. package/package.json +1 -1
  23. package/scripts/cockpit-smoke.mjs +29 -8
  24. package/scripts/smoke-test.sh +9 -0
  25. package/src/cli.js +54 -5
  26. package/src/global/action-planner.js +17 -4
  27. package/src/global/component-authoring.js +1 -2
  28. package/src/global/component-ecosystem-checks.js +74 -15
  29. package/src/global/component-health.js +56 -0
  30. package/src/global/component-integration-cli.js +302 -0
  31. package/src/global/component-manifest.js +214 -0
  32. package/src/global/component-registry.js +19 -2
  33. package/src/global/component-resolve.js +51 -0
  34. package/src/global/components/sdd-core.js +6 -0
  35. package/src/global/control-plane-proposals.js +229 -0
  36. package/src/global/control-plane-snapshot.js +212 -0
  37. package/src/global/dashboard-guidance.js +27 -3
  38. package/src/global/diff.js +2 -5
  39. package/src/global/global-cli.js +16 -1
  40. package/src/global/global-doctor.js +75 -2
  41. package/src/global/global-installer.js +43 -6
  42. package/src/global/governance-actions.js +212 -0
  43. package/src/global/governance-repair.js +13 -0
  44. package/src/global/ink/cockpit-changes.js +124 -0
  45. package/src/global/ink/cockpit-control-center.js +106 -0
  46. package/src/global/ink/cockpit-controller.js +17 -0
  47. package/src/global/ink/cockpit-enter.js +27 -0
  48. package/src/global/ink/cockpit-focus.js +7 -1
  49. package/src/global/ink/cockpit-models.js +98 -46
  50. package/src/global/ink/cockpit-proposals.js +82 -0
  51. package/src/global/ink/cockpit-recovery.js +120 -0
  52. package/src/global/ink/cockpit-runs.js +47 -0
  53. package/src/global/ink/cockpit-scan.js +60 -0
  54. package/src/global/ink/cockpit-views.js +144 -74
  55. package/src/global/ink/orchestrator-app.js +156 -42
  56. package/src/global/ink/orchestrator-state.js +6 -0
  57. package/src/global/ink/use-orchestrator-data.js +239 -17
  58. package/src/global/integrations/engram-apply.js +105 -0
  59. package/src/global/integrations/engram-evidence.js +218 -0
  60. package/src/global/integrations/engram-exec.js +107 -0
  61. package/src/global/integrations/engram-plan.js +60 -0
  62. package/src/global/integrations/engram-provider.js +22 -0
  63. package/src/global/integrations/engram-receipts.js +116 -0
  64. package/src/global/integrations/engram-rollback.js +131 -0
  65. package/src/global/integrations/index.js +12 -0
  66. package/src/global/integrations/provider-contract.js +83 -0
  67. package/src/global/integrations/provider-registry.js +47 -0
  68. package/src/global/integrations/sdd-apply.js +190 -0
  69. package/src/global/integrations/sdd-destinations.js +95 -0
  70. package/src/global/integrations/sdd-evidence.js +89 -0
  71. package/src/global/integrations/sdd-fs-guard.js +183 -0
  72. package/src/global/integrations/sdd-lifecycle.js +84 -0
  73. package/src/global/integrations/sdd-persona.js +71 -0
  74. package/src/global/integrations/sdd-plan.js +87 -0
  75. package/src/global/integrations/sdd-provider.js +21 -0
  76. package/src/global/integrations/sdd-receipts.js +44 -0
  77. package/src/global/integrations/sdd-rollback.js +269 -0
  78. package/src/global/integrations/sdd-skill-files.js +61 -0
  79. package/src/global/integrations/sdd-state.js +175 -0
  80. package/src/global/integrations/sdd-verify.js +122 -0
  81. package/src/global/intelligence/backends/opencode-catalog.js +212 -0
  82. package/src/global/intelligence/backends/opencode-cli.js +247 -0
  83. package/src/global/intelligence/backends/opencode-evidence.js +129 -0
  84. package/src/global/intelligence/backends/opencode-http.js +152 -0
  85. package/src/global/intelligence/backends/opencode-invoke.js +83 -0
  86. package/src/global/intelligence/backends/opencode-providers.js +67 -0
  87. package/src/global/intelligence/backends/opencode-runtime.js +242 -0
  88. package/src/global/intelligence/context-compiler.js +95 -50
  89. package/src/global/intelligence/index.js +38 -1
  90. package/src/global/intelligence/orchestrate.js +4 -2
  91. package/src/global/intelligence/registry.js +62 -6
  92. package/src/global/intelligence/router.js +188 -70
  93. package/src/global/intelligence/transport-registry.js +147 -0
  94. package/src/global/intelligence/types.js +21 -2
  95. package/src/global/intelligence-cli.js +48 -17
  96. package/src/global/intelligence-session.js +37 -0
  97. package/src/global/json-output.js +1 -0
  98. package/src/global/load-component-catalog.js +10 -28
  99. package/src/global/load-workspace-component-catalog.js +22 -63
  100. package/src/global/state-migration.js +21 -1
  101. package/src/global/state.js +13 -8
  102. package/src/global/status.js +4 -17
  103. package/src/global/sync.js +2 -5
package/README.md CHANGED
@@ -35,9 +35,10 @@ kairo
35
35
  **First run** (no `~/.harness/state.json`): interactive onboarding → safe diagnosis →
36
36
  setup with confirmation → full-screen operations cockpit.
37
37
 
38
- **Later runs** (state present): full-screen cockpit Home that explains what Kairo
39
- does, shows real readiness, and recommends a useful next action. Layout adapts to
40
- terminal size:
38
+ **Later runs** (state present): full-screen Control Center that explains what Kairo
39
+ does, shows coverage/integrity, evidence-backed proposals, and the next governance
40
+ action (scan → evidence → preview → confirm → apply → re-scan → recovery). Runs stay
41
+ secondary. Layout adapts to terminal size:
41
42
 
42
43
  | Mode | Size | Layout |
43
44
  |------|------|--------|
@@ -216,17 +217,30 @@ kairo uninstall
216
217
  kairo install --scope=workspace # opt-in / legacy
217
218
  ```
218
219
 
219
- ### Intelligence layer (0.2.0)
220
+ ### Intelligence layer
220
221
 
221
- Kairo owns **Harness Engineering** governance: compile relevant project context, route to a backend, and require human confirmation for cloud transmission. It does not store credentials.
222
+ Kairo owns **Harness Engineering** governance: compile relevant project context, route to a backend, and require human confirmation for cloud transmission. It does not store credentials and never reads OpenCode `auth.json`.
222
223
 
223
224
  | Backend | Detection | Invoke |
224
225
  |---|---|---|
225
226
  | Ollama | `GET $OLLAMA_HOST/api/tags` (default `http://127.0.0.1:11434`) | Local chat |
227
+ | OpenCode Go | `OPENCODE_API_KEY` → `https://opencode.ai/zen/go/v1` | Chat Completions (subscription labels; entitlement unverified from key alone) |
228
+ | OpenCode Zen | `OPENCODE_API_KEY` → `https://opencode.ai/zen/v1` | Chat Completions + Responses (credits; never auto-spent from Go failures) |
229
+ | OpenCode CLI (`opencode`) | CLI installed + `opencode auth list` providers | `opencode run --format json --model` with an analysis-only preamble (not a universal non-mutation guarantee) |
226
230
  | OpenRouter | `OPENROUTER_API_KEY` in env | `openrouter/free` after `--cloud-consent` + `--yes` |
227
231
  | Custom HTTP | Profile `customProviders` (`baseUrl`, `modelId`, optional local-only `apiKeyEnv`) | OpenAI-compatible `/chat/completions` |
228
232
 
229
- Routing order: user override → Ollama → OpenRouter free (consent) → diagnostics mode.
233
+ Routing order: ephemeral CLI `--backend`/`--model` → profile override → Ollama → OpenCode Go → OpenCode Zen → OpenRouter free → diagnostics. OpenCode CLI runtime is override-only (not auto-routed).
234
+
235
+ ```bash
236
+ export OPENCODE_API_KEY=... # env only; never persisted by Kairo
237
+ kairo intelligence status --json
238
+ kairo intelligence models --backend opencode-go
239
+ kairo intelligence route --backend opencode-go --model kimi-k2.7-code --cloud-consent
240
+ kairo intelligence ask --prompt "Summarize risks" --backend opencode --model opencode/claude-haiku-4-5 --cloud-consent --yes
241
+ ```
242
+
243
+ Detection states stay differentiated: configured ≠ authenticated ≠ entitlement ≠ balance. An API key means a credential is present, not that login, subscription, or spend was verified.
230
244
 
231
245
  Private paths (`.env`, secrets, keys) are excluded from context packs unless `--include-private`.
232
246
  Remote custom providers require explicit cloud consent and cannot receive an `apiKeyEnv` credential in 0.2.0; use a built-in provider or a local custom endpoint for env-backed authentication.
@@ -275,7 +289,15 @@ kairo setup --agents all
275
289
  kairo install --agents all
276
290
  ```
277
291
 
278
- Primary flow remains `kairo` → `status` → `sync` (or `kairo setup` explicitly).
292
+ Primary governance flow:
293
+
294
+ ```txt
295
+ scan (read-only) → evidence proposals → preview → confirm → apply → re-scan → recovery
296
+ ```
297
+
298
+ Bare `kairo` opens the Control Center cockpit when the ecosystem is configured.
299
+ Runs stay secondary until setup/repairs/verification are healthy. CLI equivalents
300
+ remain `kairo status` / `kairo diff` / `kairo sync` (or `kairo setup` explicitly).
279
301
 
280
302
  ## Install scopes
281
303
 
@@ -303,8 +325,9 @@ kairo install --agents cursor,codex --yes
303
325
  ### `kairo status`
304
326
 
305
327
  Control panel for the local ecosystem: detected vs managed agents, installed
306
- components, check counts (ok/missing/stale), backups, overall status, and the
307
- recommended next action.
328
+ components, check counts (ok/missing/stale/warning), backups, overall status, and the
329
+ recommended next action. Installed components expose public health
330
+ (`healthy` / `degraded` / `drifted` / `missing`).
308
331
 
309
332
  ```bash
310
333
  kairo status
@@ -312,8 +335,8 @@ kairo status --json
312
335
  ```
313
336
 
314
337
  `--json` prints a stable machine-readable envelope for CI, tooling, and debugging
315
- (`ok`, `overall`, `agents`, `components`, `checks`, `backups`, `nextAction`,
316
- `cliVersion`). Human text remains the default. Exit code is non-zero when
338
+ (`ok`, `overall`, `agents`, `components`, `componentHealth`, `checks`, `backups`,
339
+ `nextAction`, `cliVersion`). Human text remains the default. Exit code is non-zero when
317
340
  `overall` is not `ok`.
318
341
 
319
342
  ### `kairo sync`
@@ -465,8 +488,83 @@ deletes `~/.harness/state.json` and `~/.harness/core/`. Backups are preserved.
465
488
  ### Workspace components
466
489
 
467
490
  Opt-in custom components live in the current repo under `.harness/components/`.
468
- They never override bundled IDs (`orchestrator`, `sdd-core`) and install copies
469
- assets into `~/.harness/components/<id>/` only when you pass `--components`.
491
+ They never override bundled IDs (`orchestrator`, `sdd-core`, `engram-memory`,
492
+ `graphify-context`) and install copies assets into `~/.harness/components/<id>/`
493
+ only when you pass `--components`.
494
+
495
+ #### Component Manifest v2
496
+
497
+ Catalogs are a validated contract. Bundled `catalog.json` uses `schemaVersion: 2`
498
+ with `kind`, `capabilities`, `dependencies`, and `healthChecks`. Workspace v1
499
+ catalogs (no `schemaVersion`) still load — fields normalize in memory; persisted
500
+ `~/.harness/state.json` stays compatible and derives new metadata from the catalog.
501
+
502
+ - Dependencies resolve topologically (deps first, no duplicates).
503
+ - Public component health: `healthy` | `degraded` | `drifted` | `missing`.
504
+ - Engram/Graphify integration warnings degrade that component; they do not fail
505
+ global `doctor` by themselves.
506
+ - Workspace entries stay declarative JSON (no arbitrary code execution).
507
+ - `engram-memory` may declare `integration.provider: "engram"`. Kairo detects the
508
+ Engram binary, plans official `engram setup <agent>`, and never installs Engram
509
+ silently or runs `engram doctor` (SQLite side effects).
510
+
511
+ Configure Engram (requires `engram-memory` installed and Engram `>=1.19.0 <2.0.0`):
512
+
513
+ ```bash
514
+ kairo components configure engram-memory --agents codex,opencode --dry-run
515
+ kairo components configure engram-memory --agents codex,opencode --yes
516
+ kairo components rollback engram-memory --receipt <id> --dry-run
517
+ ```
518
+
519
+ Without `--agents`, Kairo uses the intersection of detected agents and
520
+ Kairo-managed Engram agents (`cursor`, `codex`, `opencode`, `claude` → setup slug
521
+ `claude-code`). After setup, status is `restart_required` — restart the agent to
522
+ load MCP; configuration evidence is not runtime-active. Receipts live under
523
+ `~/.harness/integrations/engram/`.
524
+
525
+ ### SDD Core skills
526
+
527
+ `sdd-core` (default with setup/install) materializes nine phase skills:
528
+
529
+ `sdd-init`, `sdd-explore`, `sdd-propose`, `sdd-spec`, `sdd-design`,
530
+ `sdd-tasks`, `sdd-apply`, `sdd-verify`, `sdd-archive`.
531
+
532
+ Each skill ships as a directory (`SKILL.md` + `references/contract.md`).
533
+
534
+ **Auto-materialization.** When `sdd-core` is selected/installed,
535
+ `install` / `setup` / `sync` / `upgrade` materialize (or repair) skills via the
536
+ same `sdd-core` apply path. Lifecycle keeps persona frozen (`preservePersona`):
537
+ it never auto-activates teaching. Explicit persona changes stay on
538
+ `kairo components configure sdd-core`.
539
+
540
+ **Destinations.** Cursor, Codex, and OpenCode share `~/.agents/skills/<id>/`.
541
+ Claude uses `~/.claude/skills/<id>/`. One physical tree per root; consumers are
542
+ recorded per destination.
543
+
544
+ **Persona.** Defaults to `off`. `--persona teaching` activates per managed
545
+ agent via `state.sdd.personaAgentIds` (managed-section gate only — explanations,
546
+ never code/docs/commits/PRs). `--persona off` removes teaching only for the
547
+ targeted agents.
548
+
549
+ **Consent and conflicts.** Dry-run writes nothing. Non-interactive mutating
550
+ configure/rollback without `--json` requires `--yes`, `--confirm`, or
551
+ `--no-preflight`. `--json` selects machine-readable output and skips the
552
+ prompt/consent gate (same apply-confirmation policy as setup/sync/upgrade).
553
+ Conflicts and user-owned files are never overwritten, even with `--yes`.
554
+ Receipts live under `~/.harness/integrations/sdd-core/` and may be `partial`
555
+ when some actions succeed and others fail.
556
+
557
+ **Session refresh.** After skill or managed-section changes, results report
558
+ `session_refresh_required` — restart agents to load skills; Kairo does not claim
559
+ existing sessions already loaded them. Verify health is
560
+ `configured` | `missing` | `drifted` | `conflict`.
561
+
562
+ ```bash
563
+ kairo components configure sdd-core --agents codex,opencode,cursor,claude --persona off --dry-run
564
+ kairo components configure sdd-core --agents codex,opencode --persona teaching --yes
565
+ kairo components verify sdd-core --json
566
+ kairo components rollback sdd-core --receipt <id> --dry-run
567
+ ```
470
568
 
471
569
  Create, validate, and install:
472
570
 
@@ -858,19 +956,28 @@ gentle-ai doctor
858
956
 
859
957
  ## Engram/Graphify integration
860
958
 
861
- This pack does not assume a specific implementation. It defines integration points in:
959
+ Engram and Graphify are **external** integrations. Kairo verifies configuration,
960
+ version, and freshness evidence when present; it does not install them, read the
961
+ Engram database, or traverse the Graphify graph at runtime, and never claims they
962
+ are actively running.
963
+
964
+ Integration points (repo docs / optional components):
862
965
 
863
966
  ```txt
864
967
  docs/ai/context-graph.md
865
968
  docs/ai/memory.md
866
969
  docs/skills/context-graph.md
970
+ global-template/components/engram-memory/
971
+ global-template/components/graphify-context/
867
972
  ```
868
973
 
869
974
  The rule:
870
975
 
871
- - The repo keeps the source of truth in Markdown.
872
- - Engram can index decisions, specs, memory, and conventions.
873
- - Graphify can build the architecture graph: modules, dependencies, features, and risks.
976
+ - The repo keeps the source of truth in Markdown (`AGENTS.md`, `docs/ai/`, code).
977
+ - Engram may index decisions, specs, memory, and conventions when configured separately.
978
+ - Graphify may build an architecture graph when you run `graphify` yourself.
979
+ - Control-plane proposals for Engram/Graphify appear only with verifiable
980
+ config/version/freshness checks — never from optional intelligence absence alone.
874
981
  - No external memory replaces `AGENTS.md`, `docs/ai/`, or the code.
875
982
 
876
983
  ## v2 — Universal-first, adapter-based
@@ -1,19 +1,59 @@
1
1
  {
2
+ "schemaVersion": 2,
2
3
  "components": [
3
4
  {
4
5
  "id": "orchestrator",
6
+ "kind": "component",
5
7
  "label": "Orchestrator",
6
8
  "version": "1.0.0",
7
9
  "defaultEnabled": true,
10
+ "capabilities": ["orchestration"],
11
+ "dependencies": [],
12
+ "healthChecks": [
13
+ { "id": "assets", "type": "assets" },
14
+ { "id": "drift", "type": "drift" }
15
+ ],
8
16
  "assetFiles": ["orchestrator.md"],
9
17
  "adapterHints": {}
10
18
  },
11
19
  {
12
20
  "id": "sdd-core",
21
+ "kind": "component",
13
22
  "label": "SDD Core",
14
- "version": "1.0.0",
23
+ "version": "2.0.0",
15
24
  "defaultEnabled": true,
16
- "assetFiles": ["workflow.md", "spec-sizing.md", "handoff.md"],
25
+ "capabilities": ["sdd.workflow", "sdd.skills", "sdd.persona"],
26
+ "dependencies": [],
27
+ "healthChecks": [
28
+ { "id": "assets", "type": "assets" },
29
+ { "id": "drift", "type": "drift" },
30
+ { "id": "integration", "type": "integration", "optional": true }
31
+ ],
32
+ "integration": { "provider": "sdd-core" },
33
+ "assetFiles": [
34
+ "workflow.md",
35
+ "spec-sizing.md",
36
+ "handoff.md",
37
+ "skills/sdd-init/SKILL.md",
38
+ "skills/sdd-init/references/contract.md",
39
+ "skills/sdd-explore/SKILL.md",
40
+ "skills/sdd-explore/references/contract.md",
41
+ "skills/sdd-propose/SKILL.md",
42
+ "skills/sdd-propose/references/contract.md",
43
+ "skills/sdd-spec/SKILL.md",
44
+ "skills/sdd-spec/references/contract.md",
45
+ "skills/sdd-design/SKILL.md",
46
+ "skills/sdd-design/references/contract.md",
47
+ "skills/sdd-tasks/SKILL.md",
48
+ "skills/sdd-tasks/references/contract.md",
49
+ "skills/sdd-apply/SKILL.md",
50
+ "skills/sdd-apply/references/contract.md",
51
+ "skills/sdd-verify/SKILL.md",
52
+ "skills/sdd-verify/references/contract.md",
53
+ "skills/sdd-archive/SKILL.md",
54
+ "skills/sdd-archive/references/contract.md",
55
+ "personas/teaching.md"
56
+ ],
17
57
  "adapterHints": {
18
58
  "cursor": "- In repos with workspace harness: also read `.cursor/rules/` and `docs/specs/`.",
19
59
  "codex": "- In repos with workspace harness: also read `.codex/skills/sdd/` when present.",
@@ -23,22 +63,39 @@
23
63
  },
24
64
  {
25
65
  "id": "engram-memory",
66
+ "kind": "component",
26
67
  "label": "Engram Memory",
27
68
  "version": "1.0.0",
28
69
  "defaultEnabled": false,
70
+ "capabilities": ["memory"],
71
+ "dependencies": [],
72
+ "healthChecks": [
73
+ { "id": "assets", "type": "assets" },
74
+ { "id": "drift", "type": "drift" },
75
+ { "id": "integration", "type": "integration", "optional": true }
76
+ ],
77
+ "integration": { "provider": "engram" },
29
78
  "assetFiles": ["memory.md"],
30
79
  "adapterHints": {
31
- "cursor": "- Engram MCP (`mem_*` tools) is not auto-installed; configure in Cursor MCP settings when ready.",
32
- "codex": "- Engram MCP is not auto-installed; add MCP server config when ready.",
33
- "claude": "- Engram MCP is not auto-installed; add MCP server config when ready.",
34
- "opencode": "- Engram MCP is not auto-installed; add MCP server config when ready."
80
+ "cursor": "- Configure Engram via `kairo components configure engram-memory` (official `engram setup cursor`).",
81
+ "codex": "- Configure Engram via `kairo components configure engram-memory` (official `engram setup codex`).",
82
+ "claude": "- Configure Engram via `kairo components configure engram-memory` (official `engram setup claude-code`).",
83
+ "opencode": "- Configure Engram via `kairo components configure engram-memory` (official `engram setup opencode`)."
35
84
  }
36
85
  },
37
86
  {
38
87
  "id": "graphify-context",
88
+ "kind": "component",
39
89
  "label": "Graphify Context",
40
90
  "version": "1.0.0",
41
91
  "defaultEnabled": false,
92
+ "capabilities": ["context.graph"],
93
+ "dependencies": [],
94
+ "healthChecks": [
95
+ { "id": "assets", "type": "assets" },
96
+ { "id": "drift", "type": "drift" },
97
+ { "id": "integration", "type": "integration", "optional": true }
98
+ ],
42
99
  "assetFiles": ["context-graph.md"],
43
100
  "adapterHints": {
44
101
  "cursor": "- Graphify CLI is not auto-installed; run `graphify update .` after code changes when graphify is in PATH.",
@@ -0,0 +1,42 @@
1
+ # Teaching Persona
2
+
3
+ > Managed by `@kal-elsam/harness` component `sdd-core`.
4
+ > Enabled only with `--persona teaching`. Default is `off`.
5
+
6
+ ## Purpose
7
+
8
+ Explain SDD decisions and trade-offs to the user in clear language while the agent still follows repository authority and contracts.
9
+
10
+ ## Authority
11
+
12
+ ```txt
13
+ system/current user
14
+ → repository AGENTS.md
15
+ → repository docs/ai and docs/skills
16
+ → repository adapter instructions
17
+ → optional teaching persona
18
+ → global SDD fallback
19
+ → memory/model defaults
20
+ ```
21
+
22
+ ## Scope
23
+
24
+ Affects:
25
+
26
+ - explanations of classification, plans, and verification
27
+ - answers to the user about why a step exists
28
+
29
+ Does not affect:
30
+
31
+ - generated code
32
+ - UI copy
33
+ - documentation content
34
+ - commits or pull requests
35
+ - hidden solutions or forced verbosity
36
+
37
+ ## Rules
38
+
39
+ - Never override higher-authority instructions.
40
+ - Never hide a working solution behind teaching theater.
41
+ - Prefer short clarifying questions when ambiguity blocks progress.
42
+ - Keep SDD skill contracts as the source of workflow behavior.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: sdd-apply
3
+ description: "Implement the current SDD task with failing tests first."
4
+ ---
5
+
6
+ # SDD Apply
7
+
8
+ Use this skill to implement one approved task without expanding scope.
9
+
10
+ ## References
11
+ - [Phase contract](references/contract.md)
12
+ ## Source of truth
13
+
14
+ - `AGENTS.md`
15
+ - `docs/ai/harness.md`
16
+ - `docs/ai/test-driven-development.md`
17
+ - `docs/ai/testing.md`
18
+
19
+ ## Workflow
20
+
21
+ 1. Confirm the active task and its acceptance criteria.
22
+ 2. Write or update the failing regression or behavior tests first.
23
+ 3. Implement the smallest change that satisfies the task.
24
+ 4. Stop when the task is complete; do not pull later tasks forward.
25
+
26
+ ## Output
27
+
28
+ ```txt
29
+ Task:
30
+ Tests added:
31
+ Files changed:
32
+ Validation:
33
+ Remaining risks:
34
+ ```
@@ -0,0 +1,4 @@
1
+ # sdd-apply contract
2
+ Activation: One approved task is active and ready to implement. Hard rules: Failing tests first; smallest change; do not pull later tasks forward.
3
+ Gates: Task done → sdd-verify · blocked by design/spec → escalate, do not widen. Steps: Confirm task → write failing tests → implement minimum → stop at completion.
4
+ Output: Task | Tests added | Files changed | Validation | Remaining risks
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: sdd-archive
3
+ description: "Close the SDD cycle with durable notes and handoff evidence."
4
+ ---
5
+
6
+ # SDD Archive
7
+
8
+ Use this skill at the end of a completed SDD cycle to leave a recoverable trail for the next agent or reviewer.
9
+
10
+ ## References
11
+ - [Phase contract](references/contract.md)
12
+ ## Source of truth
13
+
14
+ - `AGENTS.md`
15
+ - `docs/ai/agent-workflow.md`
16
+ - `docs/ai/harness.md`
17
+ - `docs/specs/`
18
+
19
+ ## Workflow
20
+
21
+ 1. Summarize what shipped and what was deferred.
22
+ 2. Point to the spec, tasks, and verification evidence.
23
+ 3. Capture open questions and follow-up risks.
24
+ 4. Leave the workspace ready for the next request.
25
+
26
+ ## Output
27
+
28
+ ```txt
29
+ Shipped:
30
+ Deferred:
31
+ Evidence:
32
+ Open questions:
33
+ Suggested next action:
34
+ ```
@@ -0,0 +1,4 @@
1
+ # sdd-archive contract
2
+ Activation: Verification evidence is complete for this SDD cycle. Hard rules: Durable shipped/deferred notes only; do not reopen scope or implement.
3
+ Gates: Trail recoverable → stop · missing evidence → return to sdd-verify Steps: Summarize shipped/deferred → point to evidence → open questions → ready next.
4
+ Output: Shipped | Deferred | Evidence | Open questions | Suggested next action
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: sdd-design
3
+ description: "Translate an accepted spec into technical design boundaries."
4
+ ---
5
+
6
+ # SDD Design
7
+
8
+ Use this skill to convert the approved spec into technical structure before task breakdown.
9
+
10
+ ## References
11
+ - [Phase contract](references/contract.md)
12
+ ## Source of truth
13
+
14
+ - `AGENTS.md`
15
+ - `docs/ai/architecture.md`
16
+ - `docs/ai/spec-driven-development.md`
17
+ - `docs/ai/testing.md`
18
+
19
+ ## Workflow
20
+
21
+ 1. Map the affected modules and interfaces.
22
+ 2. Define invariants, error boundaries, and test seams.
23
+ 3. Capture trade-offs and non-goals.
24
+ 4. Prepare a clean handoff for task decomposition.
25
+
26
+ ## Output
27
+
28
+ ```txt
29
+ Design boundary:
30
+ Interfaces:
31
+ Risks:
32
+ Test seams:
33
+ Next skill:
34
+ ```
@@ -0,0 +1,4 @@
1
+ # sdd-design contract
2
+ Activation: After an accepted spec, before task breakdown. Hard rules: Define interfaces/invariants/non-goals; do not start implementation tasks.
3
+ Gates: Boundaries clear → sdd-tasks · spec gap found → return to sdd-spec Steps: Map modules → interfaces/error bounds → trade-offs → test seams → handoff.
4
+ Output: Design boundary | Interfaces | Risks | Test seams | Next skill
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: sdd-explore
3
+ description: "Gather focused repository context before proposing a spec."
4
+ ---
5
+
6
+ # SDD Explore
7
+
8
+ Use this skill to collect only the context needed to define scope, constraints, and affected files.
9
+
10
+ ## References
11
+ - [Phase contract](references/contract.md)
12
+ ## Source of truth
13
+
14
+ - `AGENTS.md`
15
+ - `docs/ai/context-budget.md`
16
+ - `docs/ai/architecture.md`
17
+ - `docs/ai/spec-driven-development.md`
18
+
19
+ ## Workflow
20
+
21
+ 1. Read the minimum relevant code and docs.
22
+ 2. Identify affected modules, contracts, and existing tests.
23
+ 3. Capture unknowns, dependencies, and rollout or rollback constraints.
24
+ 4. Stop exploration once the next decision is clear.
25
+
26
+ ## Output
27
+
28
+ ```txt
29
+ Context read:
30
+ Files analyzed:
31
+ Existing contract:
32
+ Unknowns:
33
+ Next skill:
34
+ ```
@@ -0,0 +1,4 @@
1
+ # sdd-explore contract
2
+ Activation: After init when scope still needs evidence before propose/spec. Hard rules: Read only what unlocks the next decision; do not propose or implement.
3
+ Gates: Enough context → sdd-propose · residual ambiguity/risk → sdd-spec Steps: Minimum relevant read → map modules/contracts/tests → capture unknowns → stop.
4
+ Output: Context read | Files analyzed | Existing contract | Unknowns | Next skill
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: sdd-init
3
+ description: "Classify the request and open the right SDD path."
4
+ ---
5
+
6
+ # SDD Init
7
+
8
+ Use this skill at the start of non-trivial work to classify the request before planning or implementation.
9
+
10
+ ## References
11
+ - [Phase contract](references/contract.md)
12
+ ## Source of truth
13
+
14
+ - `AGENTS.md`
15
+ - `docs/ai/harness.md`
16
+ - `docs/ai/spec-driven-development.md`
17
+ - `docs/ai/spec-sizing.md`
18
+
19
+ ## Workflow
20
+
21
+ 1. Read the current user request and repository constraints.
22
+ 2. Classify the work as `basic`, `standard`, or `complex`.
23
+ 3. State the main risk, the expected validation, and whether a spec is required.
24
+ 4. Route to `sdd-explore`, `sdd-propose`, or `sdd-spec` as the next skill.
25
+
26
+ ## Output
27
+
28
+ ```txt
29
+ Classification:
30
+ Why:
31
+ Primary risk:
32
+ Validation:
33
+ Next skill:
34
+ ```
@@ -0,0 +1,4 @@
1
+ # sdd-init contract
2
+ Activation: Non-trivial request start — before explore, propose, or spec. Hard rules: Classify and route only; never implement; prefer local refs over missing paths.
3
+ Gates: basic→sdd-propose · standard→sdd-explore · complex→sdd-spec Steps: Read request+constraints → classify → name risk/validation → hand off next skill.
4
+ Output: Classification | Why | Primary risk | Validation | Next skill
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: sdd-propose
3
+ description: "Turn explored context into a bounded implementation proposal."
4
+ ---
5
+
6
+ # SDD Propose
7
+
8
+ Use this skill after exploration to outline the smallest safe delivery slice.
9
+
10
+ ## References
11
+ - [Phase contract](references/contract.md)
12
+ ## Source of truth
13
+
14
+ - `AGENTS.md`
15
+ - `docs/ai/harness.md`
16
+ - `docs/ai/spec-driven-development.md`
17
+ - `docs/ai/architecture.md`
18
+
19
+ ## Workflow
20
+
21
+ 1. Define the user-visible outcome.
22
+ 2. Bound the change to one reviewable unit.
23
+ 3. List included work, excluded work, and validation.
24
+ 4. Escalate to `sdd-spec` when ambiguity or risk is still high.
25
+
26
+ ## Output
27
+
28
+ ```txt
29
+ Outcome:
30
+ Included:
31
+ Excluded:
32
+ Validation:
33
+ Open questions:
34
+ Next skill:
35
+ ```
@@ -0,0 +1,4 @@
1
+ # sdd-propose contract
2
+ Activation: After explore when a bounded delivery slice is visible. Hard rules: One reviewable unit; escalate remaining ambiguity to spec; no coding.
3
+ Gates: Slice clear → sdd-design/tasks path · still ambiguous → sdd-spec Steps: Define outcome → bound include/exclude → list validation → open questions.
4
+ Output: Outcome | Included | Excluded | Validation | Open questions | Next skill
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: sdd-spec
3
+ description: "Write or update the implementation spec for significant work."
4
+ ---
5
+
6
+ # SDD Spec
7
+
8
+ Use this skill when the request needs a written spec before implementation.
9
+
10
+ ## References
11
+ - [Phase contract](references/contract.md)
12
+ ## Source of truth
13
+
14
+ - `AGENTS.md`
15
+ - `docs/ai/spec-driven-development.md`
16
+ - `docs/ai/harness.md`
17
+ - `docs/specs/`
18
+
19
+ ## Workflow
20
+
21
+ 1. Create or update the spec in `docs/specs/`.
22
+ 2. Record scope, acceptance criteria, constraints, and rollback notes.
23
+ 3. Keep the spec aligned with the selected SDD level.
24
+ 4. Hand off to `sdd-design` or `sdd-tasks` once scope is stable.
25
+
26
+ ## Output
27
+
28
+ ```txt
29
+ Spec path:
30
+ Scope:
31
+ Acceptance criteria:
32
+ Validation plan:
33
+ Next skill:
34
+ ```
@@ -0,0 +1,4 @@
1
+ # sdd-spec contract
2
+ Activation: When risk or ambiguity requires a written implementation contract. Hard rules: Record scope/acceptance/rollback only; no design coding or task execution.
3
+ Gates: Scope stable → sdd-design · needs more evidence → sdd-explore Steps: Create/update docs/specs → acceptance+constraints → align SDD level → handoff.
4
+ Output: Spec path | Scope | Acceptance criteria | Validation plan | Next skill