@structured-vibe-coding/core 0.3.0 → 0.3.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.
@@ -0,0 +1,16 @@
1
+ import {
2
+ ALL_AGENT_TARGETS,
3
+ PROTOCOL_MD,
4
+ SDD_AGENT_ROLES,
5
+ installAgentIntegrations,
6
+ refreshActiveAgentContext,
7
+ renderThinAgent
8
+ } from "./chunk-ANNG5SIL.js";
9
+ export {
10
+ ALL_AGENT_TARGETS,
11
+ PROTOCOL_MD,
12
+ SDD_AGENT_ROLES,
13
+ installAgentIntegrations,
14
+ refreshActiveAgentContext,
15
+ renderThinAgent
16
+ };
@@ -518,7 +518,7 @@ async function createChange(input) {
518
518
  await materializeStageArtifacts(projectRoot, config, id, workflow, meta, firstStage);
519
519
  await setActiveChange(projectRoot, config, id);
520
520
  try {
521
- const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-7PTSPJFQ.js");
521
+ const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-AIH2DNH3.js");
522
522
  await refreshActiveAgentContext2(projectRoot);
523
523
  } catch {
524
524
  }
@@ -738,7 +738,7 @@ async function advanceStage(projectRoot, config, changeId, opts) {
738
738
  stage
739
739
  );
740
740
  try {
741
- const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-7PTSPJFQ.js");
741
+ const { refreshActiveAgentContext: refreshActiveAgentContext2 } = await import("./agents-AIH2DNH3.js");
742
742
  await refreshActiveAgentContext2(projectRoot);
743
743
  } catch {
744
744
  }
@@ -961,6 +961,45 @@ async function buildAgentPrompt(ctx, config, projectRoot) {
961
961
 
962
962
  // src/agents.ts
963
963
  var ALL_AGENT_TARGETS = ["copilot", "claude-code", "intellij"];
964
+ var SDD_AGENT_ROLES = [
965
+ {
966
+ id: "sdd",
967
+ description: "Default SDD agent. Use for any Spec-Driven Development work on the active change pack.",
968
+ roleLine: "Router: inspect stage in active-context; plan or implement accordingly.",
969
+ roleRules: [
970
+ "If stage is intent/feature/design/tasks/stories/research: act as planner (artifacts, little or no product code).",
971
+ "If stage is implement: act as implementer (scoped code only).",
972
+ "If stage is local_verify: act as reviewer (gaps vs acceptance; fixes only)."
973
+ ]
974
+ },
975
+ {
976
+ id: "sdd-planner",
977
+ description: "SDD planner. Use when filling intent, design, research, stories, or tasks \u2014 not large code changes.",
978
+ roleLine: "Planner: produce/update stage markdown only.",
979
+ roleRules: [
980
+ "Do not make large product code changes unless the user explicitly overrides.",
981
+ "Keep artifacts short and actionable."
982
+ ]
983
+ },
984
+ {
985
+ id: "sdd-implementer",
986
+ description: "SDD implementer. Use when coding the active change (implement stage).",
987
+ roleLine: "Implementer: code only for the active change pack.",
988
+ roleRules: [
989
+ "Follow tasks.md / acceptance; honor arb-decision and design constraints.",
990
+ "Do not expand scope beyond the change title/intent."
991
+ ]
992
+ },
993
+ {
994
+ id: "sdd-reviewer",
995
+ description: "SDD reviewer. Use before verify/complete or to check work against the change pack.",
996
+ roleLine: "Reviewer: compare work to acceptance and stage artifacts.",
997
+ roleRules: [
998
+ "List gaps; suggest minimal fixes only.",
999
+ "Remind user to run sdd verify before sdd complete."
1000
+ ]
1001
+ }
1002
+ ];
964
1003
  async function installAgentIntegrations(opts) {
965
1004
  const targets = opts.targets?.length ? opts.targets : ALL_AGENT_TARGETS;
966
1005
  const created = [];
@@ -976,36 +1015,34 @@ async function installAgentIntegrations(opts) {
976
1015
  await writeText(full, content);
977
1016
  created.push(rel);
978
1017
  };
1018
+ await write(join4(".sdd", "protocol.md"), PROTOCOL_MD);
979
1019
  await refreshActiveAgentContext(root);
980
- if (targets.includes("copilot")) {
981
- await write(
982
- ".github/copilot-instructions.md",
983
- COPILOT_INSTRUCTIONS
984
- );
985
- await write(
986
- ".github/agents/sdd.agent.md",
987
- COPILOT_SDD_AGENT
988
- );
989
- await write(
990
- ".github/instructions/sdd.instructions.md",
991
- COPILOT_PATH_INSTRUCTIONS
992
- );
993
- }
994
- if (targets.includes("claude-code")) {
995
- await write(".claude/skills/sdd/SKILL.md", CLAUDE_SDD_SKILL);
996
- await write(".claude/CLAUDE.md", CLAUDE_PROJECT_MD);
1020
+ if (targets.includes("copilot") || targets.includes("claude-code")) {
1021
+ for (const role of SDD_AGENT_ROLES) {
1022
+ const body = renderThinAgent(role);
1023
+ if (targets.includes("claude-code")) {
1024
+ await write(`.claude/agents/${role.id}.md`, body);
1025
+ }
1026
+ if (targets.includes("copilot")) {
1027
+ await write(`.github/agents/${role.id}.agent.md`, body);
1028
+ }
1029
+ }
997
1030
  }
998
1031
  if (targets.includes("intellij")) {
999
1032
  await write(".idea/sdd-agent-notes.md", INTELLIJ_NOTES);
1000
- await write("AGENTS.md", AGENTS_MD);
1001
- } else if (targets.includes("copilot") || targets.includes("claude-code")) {
1002
- await write("AGENTS.md", AGENTS_MD);
1033
+ }
1034
+ if (targets.includes("copilot") || targets.includes("claude-code") || targets.includes("intellij")) {
1035
+ await write("AGENTS.md", AGENTS_MD_THIN);
1003
1036
  }
1004
1037
  await write(
1005
1038
  join4(".sdd", "agents.json"),
1006
1039
  JSON.stringify(
1007
1040
  {
1008
- version: 1,
1041
+ version: 2,
1042
+ mode: "agents-only",
1043
+ protocol: ".sdd/protocol.md",
1044
+ activeContext: ".sdd/active-context.md",
1045
+ roles: SDD_AGENT_ROLES.map((r) => r.id),
1009
1046
  installed: targets,
1010
1047
  updated: (/* @__PURE__ */ new Date()).toISOString()
1011
1048
  },
@@ -1015,11 +1052,42 @@ async function installAgentIntegrations(opts) {
1015
1052
  );
1016
1053
  return { created, skipped, targets };
1017
1054
  }
1055
+ function renderThinAgent(role) {
1056
+ const rules = role.roleRules.map((r) => `- ${r}`).join("\n");
1057
+ return `---
1058
+ name: ${role.id}
1059
+ description: ${role.description}
1060
+ ---
1061
+
1062
+ # ${role.id}
1063
+
1064
+ ${role.roleLine}
1065
+
1066
+ ## Required reads (in order)
1067
+
1068
+ 1. \`.sdd/active-context.md\` \u2014 current change and stage
1069
+ 2. \`.sdd/protocol.md\` \u2014 SDD rules for this repo (single playbook)
1070
+ 3. Active change files under \`changes/<id>/\` as listed in active-context
1071
+
1072
+ ## Role rules
1073
+
1074
+ ${rules}
1075
+
1076
+ ## Done
1077
+
1078
+ Remind the human: \`sdd verify\` then \`sdd next\` / \`sdd complete\` as appropriate.
1079
+ Do not claim the change is complete without local verification when the workflow requires it.
1080
+ `;
1081
+ }
1018
1082
  async function refreshActiveAgentContext(projectRoot) {
1019
1083
  const markerDir = sddRoot(projectRoot);
1020
1084
  if (!await pathExists(join4(markerDir, "config.yaml"))) {
1021
1085
  return null;
1022
1086
  }
1087
+ const protocolPath = join4(markerDir, "protocol.md");
1088
+ if (!await pathExists(protocolPath)) {
1089
+ await writeText(protocolPath, PROTOCOL_MD);
1090
+ }
1023
1091
  const config = await loadConfig(projectRoot);
1024
1092
  const activeId = await getActiveChangeId(projectRoot, config);
1025
1093
  const outPath = join4(markerDir, "active-context.md");
@@ -1029,6 +1097,8 @@ async function refreshActiveAgentContext(projectRoot) {
1029
1097
  _No active change._ Run \`sdd new "\u2026"\` or **SDD: New Change** in the IDE.
1030
1098
 
1031
1099
  Then re-run \`sdd agents refresh\` (or advance a stage) to update this file.
1100
+
1101
+ Protocol: \`.sdd/protocol.md\`
1032
1102
  `;
1033
1103
  await writeText(outPath, empty);
1034
1104
  return outPath;
@@ -1038,8 +1108,9 @@ Then re-run \`sdd agents refresh\` (or advance a stage) to update this file.
1038
1108
  const status = formatStatus(ctx);
1039
1109
  const body = `# SDD active context
1040
1110
 
1041
- > Auto-generated for GitHub Copilot, Claude Code, and IDE agents.
1042
- > Change: **${ctx.meta.title}** \xB7 \`${ctx.id}\` \xB7 stage **${ctx.meta.stage}**
1111
+ > Auto-generated for coding agents.
1112
+ > Change: **${ctx.meta.title}** \xB7 \`${ctx.id}\` \xB7 stage **${ctx.meta.stage}**
1113
+ > Protocol: \`.sdd/protocol.md\`
1043
1114
 
1044
1115
  ## Status
1045
1116
 
@@ -1052,191 +1123,85 @@ ${handoff}
1052
1123
  await writeText(outPath, body);
1053
1124
  return outPath;
1054
1125
  }
1055
- var AGENTS_MD = `# Agent instructions \u2014 Structured Vibe Coding (SDD)
1056
-
1057
- This repository uses **Spec-Driven Development** via the \`sdd\` tool (CLI / VS Code / IntelliJ).
1126
+ var PROTOCOL_MD = `# SDD protocol
1058
1127
 
1059
- ## Always
1128
+ This repo uses **Structured Vibe Coding** (\`sdd\`). Agents must follow this file plus \`.sdd/active-context.md\`. Do not invent a parallel process.
1060
1129
 
1061
- 1. Prefer the **active change pack** under \`changes/<id>/\` as the source of truth for the current task.
1062
- 2. Read \`.sdd/active-context.md\` at the start of a coding session (refresh with \`sdd agents refresh\`).
1063
- 3. Read \`memory/\` for product and architecture constraints.
1064
- 4. Do **not** invent large features outside the current change intent.
1065
- 5. Respect **ARB / gate decisions** (e.g. \`arb-decision.md\`) and workflow constraints.
1066
- 6. When implementation is done, remind the human to run **local verify** (\`sdd verify\`) before \`sdd complete\`.
1130
+ ## Source of truth
1067
1131
 
1068
- ## Workflows
1132
+ | What | Where |
1133
+ |------|--------|
1134
+ | Process state | \`changes/<id>/meta.yaml\` (workflow, stage, gates) |
1135
+ | Current task snapshot | \`.sdd/active-context.md\` |
1136
+ | Stable product/tech rules | \`memory/*.md\` |
1137
+ | Stage artifacts | files in \`changes/<id>/\` for the active change |
1069
1138
 
1070
- Process is defined in \`.sdd/workflows/*.yaml\`. Stages produce markdown artifacts in the change folder. Do not skip hard gates.
1071
-
1072
- ## Tools
1073
-
1074
- | Surface | How |
1075
- |---------|-----|
1076
- | CLI | \`sdd status\`, \`sdd next\`, \`sdd agent\`, \`sdd verify\` |
1077
- | VS Code / Cursor | Command Palette \u2192 **SDD:*** |
1078
- | IntelliJ | Tools \u2192 **SDD** actions (runs CLI) |
1079
- | GitHub Copilot | \`.github/copilot-instructions.md\` + agent \`sdd\` |
1080
- | Claude Code | \`.claude/skills/sdd/SKILL.md\` |
1081
-
1082
- ## Local only
1083
-
1084
- Verification is **local development**. Do not assume CI replaced \`sdd verify\`.
1085
- `;
1086
- var COPILOT_INSTRUCTIONS = `<!-- Structured Vibe Coding (SDD) \u2014 GitHub Copilot instructions -->
1139
+ ## Required read order
1087
1140
 
1088
- # Project coding agent rules
1089
-
1090
- This repo uses **Spec-Driven Development (SDD)** with the \`sdd\` CLI / IDE plugins.
1091
-
1092
- ## Before writing code
1093
-
1094
- 1. Open and follow \`.sdd/active-context.md\` if present.
1095
- 2. Open the active change under \`changes/\` (see \`changes/.active\` or the latest in-progress folder).
1096
- 3. Prefer artifacts for the **current stage** (intent/feature/design/tasks) over guessing.
1097
- 4. Honor \`memory/product.md\`, \`memory/architecture.md\`, \`memory/conventions.md\`.
1141
+ 1. \`.sdd/active-context.md\`
1142
+ 2. This file (\`.sdd/protocol.md\`)
1143
+ 3. \`meta.yaml\` + artifacts for the **current stage** (and prior stages if needed)
1144
+ 4. \`memory/\` when architecture or conventions matter
1098
1145
 
1099
- ## While coding
1146
+ ## Stage behavior
1100
1147
 
1101
- - Stay within the change scope (title + intent/feature).
1102
- - Match patterns described in \`research.md\` / design when present.
1103
- - Do not violate constraints in \`arb-decision.md\` or gate notes.
1104
- - Prefer small, reviewable diffs.
1148
+ | Stage kind | Agent focus |
1149
+ |------------|-------------|
1150
+ | intent / feature / stories | Clarify scope; write short artifacts |
1151
+ | design / lld / db / research / hl_arb | Specs and decisions; minimal product code |
1152
+ | tasks | Break work into implementable checklist |
1153
+ | implement | Code only for this change; follow tasks/acceptance |
1154
+ | local_verify | Check acceptance; fix only; prepare for complete |
1105
1155
 
1106
- ## When finishing
1156
+ ## Hard rules
1107
1157
 
1108
- - Suggest \`sdd verify\` (local) and only then \`sdd complete\`.
1109
- - Do not claim the change is complete without local verification when the workflow has a verify stage.
1158
+ 1. **Do not skip hard gates.** If blocked, tell the human to run \`sdd gate approve\` (or fix the gate).
1159
+ 2. **Stay in scope** of the active change title/intent. No drive-by refactors or new features.
1160
+ 3. **Honor constraints** in \`arb-decision.md\`, design, and memory non-negotiables.
1161
+ 4. **Local verify** is part of done when the workflow has a verify stage: \`sdd verify\`.
1162
+ 5. Prefer small, reviewable diffs.
1110
1163
 
1111
- ## Commands the human may run
1164
+ ## Commands (human / shell)
1112
1165
 
1113
1166
  \`\`\`bash
1114
1167
  sdd status
1115
1168
  sdd next
1116
- sdd agent # print handoff
1117
- sdd agents refresh # refresh .sdd/active-context.md
1169
+ sdd agent # print handoff
1170
+ sdd agents refresh # refresh active-context.md
1118
1171
  sdd verify
1119
1172
  sdd complete
1120
1173
  \`\`\`
1121
- `;
1122
- var COPILOT_SDD_AGENT = `---
1123
- name: sdd
1124
- description: Spec-Driven Development agent for this repo. Use when implementing the active sdd change, advancing stages, or following .sdd workflows.
1125
- ---
1126
-
1127
- # SDD agent (GitHub Copilot)
1128
-
1129
- You are the **SDD implementer** for this workspace.
1130
-
1131
- ## Mission
1132
1174
 
1133
- Implement only what the **active change pack** specifies. Specs and gates win over improvisation.
1175
+ ## Out of scope for agents
1134
1176
 
1135
- ## Required reads (in order)
1136
-
1137
- 1. \`.sdd/active-context.md\`
1138
- 2. \`changes/<active-id>/meta.yaml\` (workflow + stage)
1139
- 3. Artifacts for the current stage and prior stages in that folder
1140
- 4. \`memory/*.md\`
1141
-
1142
- ## Behavior
1143
-
1144
- - If there is no active change, tell the user to run \`sdd new "\u2026"\` or **SDD: New Change**.
1145
- - If \`meta.yaml\` stage is not \`implement\`, help fill the current stage artifact instead of large code rewrites\u2014unless the user explicitly wants implementation early.
1146
- - On implement stage: execute tasks from \`tasks.md\` / acceptance criteria; keep diffs scoped.
1147
- - After code changes: remind them to run **local** \`sdd verify\`.
1148
-
1149
- ## Out of scope
1150
-
1151
- - Redesigning the whole product
1152
- - Skipping hard gates
1153
- - Inventing requirements not in the change pack
1177
+ - Replacing CI/CD or team process tools
1178
+ - Deleting \`.sdd\` / archive history
1179
+ - Claiming complete without verify when required
1154
1180
  `;
1155
- var COPILOT_PATH_INSTRUCTIONS = `---
1156
- applyTo: "changes/**,memory/**,.sdd/**"
1157
- ---
1181
+ var AGENTS_MD_THIN = `# Agents
1158
1182
 
1159
- # SDD paths
1183
+ This repo uses **SDD agents only** (no skills).
1160
1184
 
1161
- Files under \`changes/\`, \`memory/\`, and \`.sdd/\` drive Spec-Driven Development.
1185
+ | Read first | |
1186
+ |------------|--|
1187
+ | Live task | \`.sdd/active-context.md\` |
1188
+ | Playbook | \`.sdd/protocol.md\` |
1162
1189
 
1163
- - Treat \`changes/**/meta.yaml\` as process state (do not invent fields).
1164
- - Prefer editing stage artifacts over deleting workflow history.
1165
- - When modifying code for an active change, keep alignment with that change's intent/design/tasks.
1166
- `;
1167
- var CLAUDE_SDD_SKILL = `---
1168
- name: sdd
1169
- description: Use Spec-Driven Development (sdd) for this repository \u2014 read active change, follow stages, implement within scope, local verify.
1170
- ---
1171
-
1172
- # Skill: Structured Vibe Coding (SDD)
1173
-
1174
- ## When to use
1175
-
1176
- - User asks to implement a feature/fix in this repo
1177
- - User mentions sdd, change packs, stages, ARB, or local verify
1178
- - You need the source of truth for the current task
1179
-
1180
- ## Instructions
1181
-
1182
- 1. Read \`.sdd/active-context.md\` (if missing, run \`sdd agents refresh\` via bash or ask the user).
1183
- 2. Read \`changes/<id>/meta.yaml\` for \`workflow\` and \`stage\`.
1184
- 3. Read relevant artifacts in that change folder (intent/feature/design/tasks/acceptance).
1185
- 4. Read \`memory/\` for global constraints.
1186
- 5. Implement **only** in-scope work for the current change.
1187
- 6. Prefer project conventions in \`memory/conventions.md\`.
1188
- 7. When done coding, instruct the user to run:
1189
-
1190
- \`\`\`bash
1191
- sdd verify
1192
- sdd gate approve # if hard gate
1193
- sdd next # or sdd complete on last stage
1194
- \`\`\`
1190
+ | Host | Agents |
1191
+ |------|--------|
1192
+ | Claude Code | \`.claude/agents/\` (\`sdd\`, \`sdd-planner\`, \`sdd-implementer\`, \`sdd-reviewer\`) |
1193
+ | GitHub Copilot | \`.github/agents/*.agent.md\` (same roles) |
1195
1194
 
1196
- ## Bash helpers (if tools allow)
1197
-
1198
- \`\`\`bash
1199
- sdd status
1200
- sdd agent
1201
- sdd agents refresh
1202
- \`\`\`
1203
-
1204
- ## Do not
1205
-
1206
- - Skip hard gates
1207
- - Expand scope beyond the change title/intent
1208
- - Delete \`.sdd\` or archive history casually
1209
- `;
1210
- var CLAUDE_PROJECT_MD = `# Claude Code \u2014 this repo uses SDD
1211
-
1212
- Load the **sdd** skill under \`.claude/skills/sdd/\` for implementation work.
1213
-
1214
- Always check \`.sdd/active-context.md\` and the active folder under \`changes/\` before large edits.
1215
-
1216
- CLI: \`sdd\` (npm: \`@structured-vibe-coding/cli\`).
1195
+ Refresh context: \`sdd agents refresh\`.
1217
1196
  `;
1218
- var INTELLIJ_NOTES = `# SDD + IntelliJ / GitHub Copilot
1219
-
1220
- This project uses Structured Vibe Coding (\`sdd\`).
1221
-
1222
- ## IntelliJ plugin
1223
-
1224
- Install the **Structured Vibe Coding (SDD)** plugin (or run the Gradle plugin from \`packages/intellij\`).
1225
- Actions under **Tools \u2192 SDD** shell out to the \`sdd\` CLI \u2014 install the CLI on PATH:
1226
-
1227
- \`\`\`bash
1228
- npm i -g @structured-vibe-coding/cli
1229
- \`\`\`
1230
-
1231
- ## GitHub Copilot in IntelliJ
1232
-
1233
- Copilot respects repository instructions:
1197
+ var INTELLIJ_NOTES = `# SDD + IntelliJ
1234
1198
 
1235
- - \`.github/copilot-instructions.md\`
1236
- - \`AGENTS.md\`
1237
- - \`.sdd/active-context.md\` (refresh often)
1199
+ Agents only. Playbook: \`.sdd/protocol.md\`. Live: \`.sdd/active-context.md\`.
1238
1200
 
1239
- Use the SDD plugin action **Refresh agent context** after \`sdd new\` / stage changes.
1201
+ 1. Install \`sdd\` on PATH: \`npm i -g @structured-vibe-coding/cli\`
1202
+ 2. Tools \u2192 SDD \u2192 Initialize / Install Agent Integrations
1203
+ 3. GitHub Copilot uses \`.github/agents/*\` + active-context (same as VS Code)
1204
+ 4. After stage changes: **Refresh Agent Context**
1240
1205
  `;
1241
1206
 
1242
1207
  export {
@@ -1292,8 +1257,11 @@ export {
1292
1257
  changeDirName,
1293
1258
  uniqueChangeDirName,
1294
1259
  ALL_AGENT_TARGETS,
1260
+ SDD_AGENT_ROLES,
1295
1261
  installAgentIntegrations,
1262
+ renderThinAgent,
1296
1263
  refreshActiveAgentContext,
1264
+ PROTOCOL_MD,
1297
1265
  createChange,
1298
1266
  loadChangeMeta,
1299
1267
  saveChangeMeta,
package/dist/index.d.ts CHANGED
@@ -1166,6 +1166,16 @@ declare function buildAgentPrompt(ctx: ChangeContext, config: Config, projectRoo
1166
1166
 
1167
1167
  type AgentTarget = "copilot" | "claude-code" | "intellij";
1168
1168
  declare const ALL_AGENT_TARGETS: AgentTarget[];
1169
+ /** Roles emitted as thin agents (shared body generator — no skill files). */
1170
+ type SddAgentRoleId = "sdd" | "sdd-planner" | "sdd-implementer" | "sdd-reviewer";
1171
+ interface SddAgentRole {
1172
+ id: SddAgentRoleId;
1173
+ description: string;
1174
+ roleLine: string;
1175
+ /** Extra one-liner constraints for this role only */
1176
+ roleRules: string[];
1177
+ }
1178
+ declare const SDD_AGENT_ROLES: SddAgentRole[];
1169
1179
  interface InstallAgentsOptions {
1170
1180
  projectRoot: string;
1171
1181
  targets?: AgentTarget[];
@@ -1177,12 +1187,19 @@ interface InstallAgentsResult {
1177
1187
  targets: AgentTarget[];
1178
1188
  }
1179
1189
  /**
1180
- * Install IDE / coding-agent integration files so GitHub Copilot, Claude Code,
1181
- * and JetBrains (via shared instructions) follow SDD.
1190
+ * Install **agents only** (no skills, no fat instructions).
1191
+ *
1192
+ * Single playbook: `.sdd/protocol.md`
1193
+ * Live state: `.sdd/active-context.md`
1194
+ * Thin agents: `.claude/agents/*` and `.github/agents/*` (pointers + role)
1182
1195
  */
1183
1196
  declare function installAgentIntegrations(opts: InstallAgentsOptions): Promise<InstallAgentsResult>;
1197
+ /** Thin agent body shared by Claude Code and GitHub Copilot (same text). */
1198
+ declare function renderThinAgent(role: SddAgentRole): string;
1184
1199
  /** Write .sdd/active-context.md for the current change (all agents read this). */
1185
1200
  declare function refreshActiveAgentContext(projectRoot: string): Promise<string | null>;
1201
+ /** Single playbook — only long agent-facing content we author once. */
1202
+ declare const PROTOCOL_MD = "# SDD protocol\n\nThis repo uses **Structured Vibe Coding** (`sdd`). Agents must follow this file plus `.sdd/active-context.md`. Do not invent a parallel process.\n\n## Source of truth\n\n| What | Where |\n|------|--------|\n| Process state | `changes/<id>/meta.yaml` (workflow, stage, gates) |\n| Current task snapshot | `.sdd/active-context.md` |\n| Stable product/tech rules | `memory/*.md` |\n| Stage artifacts | files in `changes/<id>/` for the active change |\n\n## Required read order\n\n1. `.sdd/active-context.md`\n2. This file (`.sdd/protocol.md`)\n3. `meta.yaml` + artifacts for the **current stage** (and prior stages if needed)\n4. `memory/` when architecture or conventions matter\n\n## Stage behavior\n\n| Stage kind | Agent focus |\n|------------|-------------|\n| intent / feature / stories | Clarify scope; write short artifacts |\n| design / lld / db / research / hl_arb | Specs and decisions; minimal product code |\n| tasks | Break work into implementable checklist |\n| implement | Code only for this change; follow tasks/acceptance |\n| local_verify | Check acceptance; fix only; prepare for complete |\n\n## Hard rules\n\n1. **Do not skip hard gates.** If blocked, tell the human to run `sdd gate approve` (or fix the gate).\n2. **Stay in scope** of the active change title/intent. No drive-by refactors or new features.\n3. **Honor constraints** in `arb-decision.md`, design, and memory non-negotiables.\n4. **Local verify** is part of done when the workflow has a verify stage: `sdd verify`.\n5. Prefer small, reviewable diffs.\n\n## Commands (human / shell)\n\n```bash\nsdd status\nsdd next\nsdd agent # print handoff\nsdd agents refresh # refresh active-context.md\nsdd verify\nsdd complete\n```\n\n## Out of scope for agents\n\n- Replacing CI/CD or team process tools\n- Deleting `.sdd` / archive history\n- Claiming complete without verify when required\n";
1186
1203
 
1187
1204
  interface InitOptions {
1188
1205
  projectRoot: string;
@@ -1247,4 +1264,4 @@ declare function listFiles(path: string): Promise<string[]>;
1247
1264
  declare function copyDir(src: string, dest: string): Promise<void>;
1248
1265
  declare function removePath(path: string): Promise<void>;
1249
1266
 
1250
- export { ALL_AGENT_TARGETS, type AdvanceResult, type AgentTarget, type ArtifactDef, ArtifactDefSchema, type ChangeContext, type ChangeMeta, ChangeMetaSchema, type Complexity, type Config, ConfigSchema, type CreateChangeInput, type Gate, GateSchema, type InitOptions, type InitResult, type InstallAgentsOptions, type InstallAgentsResult, SDD_DIR, type Stage, StageSchema, VerifyCommandSchema, type VerifyResult, type Workflow, WorkflowSchema, activePointerPath, activeStages, advanceStage, approveGate, archiveDir, buildAgentPrompt, buildContext, canLeaveStage, changeDirName, changeMetaPath, changePath, changesDir, clearActiveIf, completeChange, configPath, copyDir, createChange, defaultConfig, defaultMemoryDir, defaultTemplatesDir, defaultWorkflowsDir, defaultsRoot, domainsDir, ensureDir, firstActiveStageId, formatStatus, getActiveChangeId, getStage, inferComplexity, initProject, installAgentIntegrations, isInitialized, isStageSkipped, listChanges, listDirs, listFiles, listWorkflowNames, loadChangeMeta, loadConfig, loadWorkflow, memoryDir, nextStageId, nowIso, pathExists, previousStageId, projectPaths, readText, readYaml, recommendWorkflow, refreshActiveAgentContext, removePath, resolveChangeId, resolveStages, runLocalVerify, saveChangeMeta, saveConfig, sddRoot, setActiveChange, shouldAutoSkip, skipStage, slugify, switchWorkflow, templatesDir, todayIsoDate, uniqueChangeDirName, workflowsDir, writeText, writeYaml };
1267
+ export { ALL_AGENT_TARGETS, type AdvanceResult, type AgentTarget, type ArtifactDef, ArtifactDefSchema, type ChangeContext, type ChangeMeta, ChangeMetaSchema, type Complexity, type Config, ConfigSchema, type CreateChangeInput, type Gate, GateSchema, type InitOptions, type InitResult, type InstallAgentsOptions, type InstallAgentsResult, PROTOCOL_MD, SDD_AGENT_ROLES, SDD_DIR, type SddAgentRole, type SddAgentRoleId, type Stage, StageSchema, VerifyCommandSchema, type VerifyResult, type Workflow, WorkflowSchema, activePointerPath, activeStages, advanceStage, approveGate, archiveDir, buildAgentPrompt, buildContext, canLeaveStage, changeDirName, changeMetaPath, changePath, changesDir, clearActiveIf, completeChange, configPath, copyDir, createChange, defaultConfig, defaultMemoryDir, defaultTemplatesDir, defaultWorkflowsDir, defaultsRoot, domainsDir, ensureDir, firstActiveStageId, formatStatus, getActiveChangeId, getStage, inferComplexity, initProject, installAgentIntegrations, isInitialized, isStageSkipped, listChanges, listDirs, listFiles, listWorkflowNames, loadChangeMeta, loadConfig, loadWorkflow, memoryDir, nextStageId, nowIso, pathExists, previousStageId, projectPaths, readText, readYaml, recommendWorkflow, refreshActiveAgentContext, removePath, renderThinAgent, resolveChangeId, resolveStages, runLocalVerify, saveChangeMeta, saveConfig, sddRoot, setActiveChange, shouldAutoSkip, skipStage, slugify, switchWorkflow, templatesDir, todayIsoDate, uniqueChangeDirName, workflowsDir, writeText, writeYaml };
package/dist/index.js CHANGED
@@ -4,6 +4,8 @@ import {
4
4
  ChangeMetaSchema,
5
5
  ConfigSchema,
6
6
  GateSchema,
7
+ PROTOCOL_MD,
8
+ SDD_AGENT_ROLES,
7
9
  SDD_DIR,
8
10
  StageSchema,
9
11
  VerifyCommandSchema,
@@ -54,6 +56,7 @@ import {
54
56
  recommendWorkflow,
55
57
  refreshActiveAgentContext,
56
58
  removePath,
59
+ renderThinAgent,
57
60
  resolveChangeId,
58
61
  resolveStages,
59
62
  saveChangeMeta,
@@ -70,7 +73,7 @@ import {
70
73
  workflowsDir,
71
74
  writeText,
72
75
  writeYaml
73
- } from "./chunk-PT2BZ23N.js";
76
+ } from "./chunk-ANNG5SIL.js";
74
77
 
75
78
  // src/init.ts
76
79
  import { join as join2 } from "pathe";
@@ -338,6 +341,8 @@ export {
338
341
  ChangeMetaSchema,
339
342
  ConfigSchema,
340
343
  GateSchema,
344
+ PROTOCOL_MD,
345
+ SDD_AGENT_ROLES,
341
346
  SDD_DIR,
342
347
  StageSchema,
343
348
  VerifyCommandSchema,
@@ -393,6 +398,7 @@ export {
393
398
  recommendWorkflow,
394
399
  refreshActiveAgentContext,
395
400
  removePath,
401
+ renderThinAgent,
396
402
  resolveChangeId,
397
403
  resolveStages,
398
404
  runLocalVerify,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@structured-vibe-coding/core",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Core engine for structured vibe coding (local-first Spec-Driven Development)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,10 +0,0 @@
1
- import {
2
- ALL_AGENT_TARGETS,
3
- installAgentIntegrations,
4
- refreshActiveAgentContext
5
- } from "./chunk-PT2BZ23N.js";
6
- export {
7
- ALL_AGENT_TARGETS,
8
- installAgentIntegrations,
9
- refreshActiveAgentContext
10
- };