@trieungoctam/speckit 0.2.0 → 0.3.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 (52) hide show
  1. package/README.md +37 -5
  2. package/dist/adapters/antigravity-adapter.js +5 -5
  3. package/dist/adapters/claude-code-adapter.js +10 -5
  4. package/dist/adapters/codex-adapter.js +7 -3
  5. package/dist/adapters/cursor-adapter.js +10 -3
  6. package/dist/adapters/opencode-adapter.js +1 -0
  7. package/dist/cli.js +32 -0
  8. package/dist/commands/context.js +56 -22
  9. package/dist/commands/doctor.js +2 -1
  10. package/dist/commands/graph.d.ts +7 -0
  11. package/dist/commands/graph.js +51 -0
  12. package/dist/commands/init.js +3 -1
  13. package/dist/commands/memory.d.ts +6 -0
  14. package/dist/commands/memory.js +11 -0
  15. package/dist/commands/plan.js +19 -2
  16. package/dist/commands/quick.js +20 -2
  17. package/dist/commands/ready.d.ts +7 -0
  18. package/dist/commands/ready.js +20 -0
  19. package/dist/commands/run.js +15 -2
  20. package/dist/commands/session.d.ts +9 -0
  21. package/dist/commands/session.js +49 -0
  22. package/dist/commands/sprint.d.ts +7 -0
  23. package/dist/commands/sprint.js +54 -0
  24. package/dist/commands/start.js +4 -3
  25. package/dist/commands/sync.js +5 -2
  26. package/dist/commands/triage.js +2 -15
  27. package/dist/core/agent-scaffold.d.ts +2 -0
  28. package/dist/core/agent-scaffold.js +57 -0
  29. package/dist/core/beads-mirror.d.ts +3 -0
  30. package/dist/core/beads-mirror.js +46 -0
  31. package/dist/core/memory.d.ts +1 -0
  32. package/dist/core/memory.js +47 -0
  33. package/dist/core/readiness.d.ts +13 -0
  34. package/dist/core/readiness.js +120 -0
  35. package/dist/core/scaffold.js +72 -43
  36. package/dist/core/session-manager.d.ts +15 -0
  37. package/dist/core/session-manager.js +139 -0
  38. package/dist/core/skill-catalog.d.ts +2 -0
  39. package/dist/core/skill-catalog.js +177 -0
  40. package/dist/core/story.d.ts +5 -0
  41. package/dist/core/story.js +34 -0
  42. package/dist/core/synced-stories.d.ts +8 -0
  43. package/dist/core/synced-stories.js +17 -0
  44. package/dist/core/templates.d.ts +2 -0
  45. package/dist/core/templates.js +54 -0
  46. package/docs/development-roadmap.md +9 -7
  47. package/docs/product-contract.md +7 -4
  48. package/docs/project-changelog.md +66 -0
  49. package/docs/release-checklist.md +1 -1
  50. package/docs/spec-enterprise-harness-plan.md +18 -1
  51. package/docs/workflow-model.md +23 -0
  52. package/package.json +1 -1
package/README.md CHANGED
@@ -4,12 +4,25 @@ Speckit is a local-first Agile + TDD workflow compiler for agentic IDEs. It turn
4
4
 
5
5
  Speckit owns the workflow contract and generates adapters for the tools you already use. The public product vocabulary is Speckit-only: Agile shaping, TDD execution, task graph triage, and IDE adapter compilation.
6
6
 
7
+ Speckit also ships a portable skill catalog and super-agent router. IDE-specific agents read `.speckit/agents/super-agent.md` and `.speckit/skills/catalog.md` first, then load only the focused skill needed for the current phase.
8
+
9
+ The curated skill set is intentionally small: `spec-shape`, `spec-research`, `spec-plan`, `spec-context`, `spec-graph`, `spec-session`, `spec-tdd`, `spec-test`, `spec-debug`, `spec-review`, `spec-docs`, and `spec-ship`. These are adapted from proven orchestration patterns without importing a broad domain-specific catalog.
10
+
7
11
  ## Quickstart
8
12
 
9
13
  ```bash
14
+ npx @trieungoctam/speckit@latest init --ide cursor
10
15
  npx @trieungoctam/speckit@latest init --ide all
11
16
  npx @trieungoctam/speckit@latest init --enterprise --ide all
17
+ npx @trieungoctam/speckit@latest memory refresh
18
+ npx @trieungoctam/speckit@latest session start "Add checkout validation"
12
19
  npx @trieungoctam/speckit@latest quick "Add checkout validation"
20
+ npx @trieungoctam/speckit@latest context .speckit/stories/<story>.md
21
+ npx @trieungoctam/speckit@latest sync
22
+ npx @trieungoctam/speckit@latest sprint plan
23
+ npx @trieungoctam/speckit@latest graph triage --json
24
+ npx @trieungoctam/speckit@latest ready .speckit/stories/<story>.md
25
+ npx @trieungoctam/speckit@latest session checkpoint --note "red complete"
13
26
  npx @trieungoctam/speckit@latest review
14
27
  ```
15
28
 
@@ -26,15 +39,22 @@ speckit doctor
26
39
  ```text
27
40
  intent
28
41
  -> start session
42
+ -> super agent routing
43
+ -> refresh project memory
29
44
  -> shape
30
45
  -> plan
46
+ -> sprint plan
31
47
  -> context
32
48
  -> story with acceptance criteria
33
- -> sync / triage
49
+ -> sync / graph triage
50
+ -> readiness gate
34
51
  -> red test evidence
52
+ -> session checkpoint
35
53
  -> minimal implementation
36
54
  -> green test evidence
55
+ -> session checkpoint
37
56
  -> refactor validation
57
+ -> session compact
38
58
  -> review
39
59
  ```
40
60
 
@@ -44,19 +64,31 @@ For implementation stories, red-green-refactor evidence is mandatory. A story is
44
64
 
45
65
  | Command | Purpose |
46
66
  | --- | --- |
47
- | `speckit init` | Create `.speckit/` core rules and all IDE adapters. |
48
- | `speckit init --enterprise` | Add flow, tool policy, and prompt harness files. |
49
- | `speckit init --ide <name>` | Generate one adapter: `claude-code`, `codex`, `antigravity`, `opencode`, or `cursor`. |
67
+ | `speckit init` | Create `.speckit/` core runtime, super-agent, skill catalog, and all IDE adapters. |
68
+ | `speckit init --enterprise` | Add flow, tool policy, and prompt harness files on top of the shared runtime. |
69
+ | `speckit init --ide <name>` | Generate shared Speckit runtime plus one adapter: `claude-code`, `codex`, `antigravity`, `opencode`, or `cursor`. |
50
70
  | `speckit doctor` | Report required tools, optional integrations, test commands, and adapter readiness. |
51
71
  | `speckit doctor --deep` | Verify core enterprise harness files. |
52
72
  | `speckit start "<idea>"` | Create a durable session handoff and current context. |
73
+ | `speckit memory refresh` | Create durable project memory files for long-running agent work. |
74
+ | `speckit session start` | Create or resume the active session state. |
75
+ | `speckit session checkpoint` | Append a long-session checkpoint and artifact log entry. |
76
+ | `speckit session compact` | Create an anchored summary for resume or handoff. |
77
+ | `speckit session resume` | Mark a session as active and print its handoff path. |
78
+ | `speckit session status` | Print active session state paths. |
53
79
  | `speckit shape "<intent>"` | Create a short spec contract. |
54
80
  | `speckit context <story>` | Build the current implementation context from a story. |
55
81
  | `speckit quick "<intent>"` | Create one story plus matching TDD evidence file. |
56
82
  | `speckit plan "<intent>"` | Create PRD, architecture, story, and evidence skeletons. |
57
83
  | `speckit triage` | Summarize synced story state without interactive graph commands. |
58
84
  | `speckit next` | Safely wraps `bv --robot-next --format json`. |
59
- | `speckit sync` | Export Speckit stories as beads-compatible JSONL metadata. |
85
+ | `speckit sprint plan` | Build a sprint plan and status file from synced stories. |
86
+ | `speckit sprint next` | Pick the next selectable story from sprint state. |
87
+ | `speckit graph triage` | Run Beads Viewer robot triage, or local JSON fallback if `bv` is missing. |
88
+ | `speckit graph plan` | Run Beads Viewer robot plan, or local JSON fallback if `bv` is missing. |
89
+ | `speckit graph insights` | Run Beads Viewer robot insights, or local JSON fallback if `bv` is missing. |
90
+ | `speckit sync` | Export Speckit stories as `.speckit/sync/beads-sync.jsonl` and prepare `.beads/beads.jsonl` for Beads Viewer. |
91
+ | `speckit ready <story>` | Validate story status, context, evidence, graph sync, and safety policy before implementation. |
60
92
  | `speckit run <story>` | Print the TDD execution handoff for a story. |
61
93
  | `speckit review` | Print the review checklist and current diff summary. |
62
94
  | `speckit close <story>` | Create a closure checklist linked to the story and sync step. |
@@ -12,12 +12,12 @@ export const antigravityAdapter = {
12
12
  ],
13
13
  render() {
14
14
  return [
15
- rule("agile", "Follow Speckit Agile: shape intent, create stories with ACs, preserve dependencies, and emit artifacts for review."),
16
- rule("tdd", "For code changes, use TDD: record red evidence, green evidence, and refactor validation."),
15
+ rule("agile", "Follow Speckit Agile: shape intent, read .speckit/agents/super-agent.md, .speckit/skills/catalog.md, .speckit/memory/project-context.md, .speckit/sessions/active.md, and .speckit/context/current.md, create stories with ACs, preserve session handoff, and emit artifacts for review."),
16
+ rule("tdd", "For code changes, use TDD: confirm acceptance criteria, use red-green-refactor, checkpoint each boundary, compact before handoff, and record evidence for each step."),
17
17
  rule("enterprise-safety", "Require human approval for destructive commands, production changes, secrets access, and deployment."),
18
- workflow("plan", "Create a Speckit plan artifact with PRD, architecture, stories, risks, and dependencies."),
19
- workflow("tdd-run", "Run a story with TDD. Emit artifact sections: Test Intent, Red, Green, Refactor."),
20
- workflow("review", "Review the produced artifacts and code diff. Flag AC gaps, TDD gaps, security issues, and docs needs."),
18
+ workflow("plan", "Create a Speckit plan artifact with PRD, architecture, stories, risks, dependencies, and graph sync notes."),
19
+ workflow("tdd-run", "Run a story with TDD from the Speckit super agent router, skill catalog, .speckit/memory/project-context.md, .speckit/context/current.md, .speckit/context/subagent-handoff.md, and active session summary. Require speckit ready <story> first. Emit artifact sections: Test Intent, Red, Green, Refactor. Use only robot-safe graph commands."),
20
+ workflow("review", "Review the produced artifacts and code diff. Flag AC gaps, TDD gaps, security issues, docs needs, session checkpoint freshness, and session handoff gaps."),
21
21
  ];
22
22
  },
23
23
  };
@@ -1,5 +1,5 @@
1
1
  import { json, markdown } from "../core/managed-files.js";
2
- const skillIntro = `Follow Speckit: Agile story flow plus mandatory TDD evidence. Use project-local context first.`;
2
+ const skillIntro = `Follow Speckit: Agile story flow plus mandatory TDD evidence. Read .speckit/memory/project-context.md, .speckit/context/current.md, and active session summary first. Preserve session handoff, checkpoint long work, use red-green-refactor, and use robot-safe graph commands only.`;
3
3
  export const claudeCodeAdapter = {
4
4
  name: "claude-code",
5
5
  displayName: "Claude Code",
@@ -21,7 +21,12 @@ Use Speckit for Agile + TDD work.
21
21
  - Start from \`.speckit/rules/agile-policy.md\`.
22
22
  - For implementation, follow \`.speckit/rules/tdd-policy.md\`.
23
23
  - For safety, follow \`.speckit/rules/enterprise-safety.md\`.
24
- - Prefer \`speckit quick\`, \`speckit plan\`, \`speckit run\`, and \`speckit review\` over ad hoc prompts.
24
+ - Prefer \`speckit start\`, \`speckit memory refresh\`, \`speckit session checkpoint\`, \`speckit context\`, \`speckit sync\`, \`speckit graph triage\`, \`speckit run\`, and \`speckit review\` over ad hoc prompts.
25
+ - Read \`.speckit/agents/super-agent.md\`, \`.speckit/skills/catalog.md\`, \`.speckit/memory/project-context.md\`, and \`.speckit/sessions/active.md\` before long-running work.
26
+ - Run \`speckit ready <story>\` before implementation; story status must be \`ready-for-dev\` and context status must be \`fresh\`.
27
+ - Run \`speckit session compact\` before context gets noisy or before handoff.
28
+ - For code stories, confirm acceptance criteria and record red-green-refactor evidence before handoff.
29
+ - Never run bare \`bv\`; use robot flags such as \`bv --robot-next --format json\`.
25
30
  `),
26
31
  },
27
32
  {
@@ -33,9 +38,9 @@ Use Speckit for Agile + TDD work.
33
38
  includeCoAuthoredBy: false,
34
39
  }),
35
40
  },
36
- skill("speckit-plan", "Create or update a Speckit Agile plan.", "Read `.speckit/workflows/shape.md`, then create PRD, architecture, and story artifacts with acceptance criteria."),
37
- skill("speckit-tdd", "Execute a Speckit story with TDD.", "Read `.speckit/workflows/tdd-run.md`. Do not implement before test intent and red evidence are recorded."),
38
- skill("speckit-review", "Review a Speckit change.", "Read `.speckit/workflows/review.md`. Prioritize bugs, TDD evidence gaps, security, and missing docs."),
41
+ skill("speckit-plan", "Create or update a Speckit Agile plan.", "Read `.speckit/agents/super-agent.md`, `.speckit/skills/catalog.md`, and `.speckit/workflows/shape.md`, preserve the session id, then create PRD, architecture, and story artifacts with acceptance criteria."),
42
+ skill("speckit-tdd", "Execute a Speckit story with TDD.", "Read `.speckit/memory/project-context.md`, `.speckit/context/current.md`, `.speckit/context/subagent-handoff.md`, active session summary, and `.speckit/workflows/tdd-run.md`. Do not implement before `speckit ready <story>` passes, test intent is clear, and red evidence is recorded. Checkpoint after red, green, and refactor."),
43
+ skill("speckit-review", "Review a Speckit change.", "Read `.speckit/workflows/review.md` and the active session artifact log. Prioritize AC coverage, TDD evidence gaps, security, docs impact, session checkpoint freshness, and graph sync status."),
39
44
  ];
40
45
  },
41
46
  };
@@ -19,6 +19,10 @@ This repository uses Speckit: Agile + TDD for agentic development.
19
19
 
20
20
  Rules:
21
21
  - Shape intent before implementation.
22
+ - Read \`.speckit/agents/super-agent.md\`, \`.speckit/skills/catalog.md\`, \`.speckit/memory/project-context.md\`, and \`.speckit/sessions/active.md\` before long-running work.
23
+ - Read \`.speckit/context/current.md\` before running code changes.
24
+ - Run \`speckit ready <story>\` before implementation; story status must be \`ready-for-dev\` and context status must be \`fresh\`.
25
+ - Use \`speckit session checkpoint\` at red, green, refactor, and review boundaries; use \`speckit session compact\` before handoff.
22
26
  - For code stories, write test intent and capture red/green/refactor evidence.
23
27
  - Never call bare \`bv\`; use \`bv --robot-*\`.
24
28
  - Do not weaken approval or sandbox settings.
@@ -37,9 +41,9 @@ web_search = true
37
41
  [features]
38
42
  child_agents_md = true`),
39
43
  },
40
- prompt("plan", "Create a Speckit plan from the user intent. Include PRD, architecture, stories, ACs, TDD checklist, and risks."),
41
- prompt("tdd-run", "Execute the selected Speckit story using red-green-refactor. Record command evidence before marking done."),
42
- prompt("review", "Review the current diff against Speckit ACs, TDD evidence, security, and docs impact."),
44
+ prompt("plan", "Create a Speckit plan from the user intent. Use the Speckit super agent router and skill catalog. Preserve session context, project memory, PRD, architecture, stories, ACs, TDD checklist, risks, and graph sync notes."),
45
+ prompt("tdd-run", "Execute the selected Speckit story using .speckit/memory/project-context.md, .speckit/context/current.md, .speckit/context/subagent-handoff.md, active session summary, and red-green-refactor. Require speckit ready <story>, confirm ACs, checkpoint each boundary, record command evidence, and use only robot-safe graph commands."),
46
+ prompt("review", "Review the current diff against Speckit ACs, TDD evidence, security, docs impact, session handoff, session checkpoint freshness, and graph sync status."),
43
47
  ];
44
48
  },
45
49
  };
@@ -12,9 +12,9 @@ export const cursorAdapter = {
12
12
  ],
13
13
  render() {
14
14
  return [
15
- rule("agile", "alwaysApply: true", "Use Speckit Agile flow. Shape intent, create stories with ACs, and keep work scoped."),
16
- rule("tdd", "description: Apply when implementing or modifying code", "Use red-green-refactor. Record TDD evidence before review-ready."),
17
- rule("review", "description: Apply when reviewing code or preparing a PR", "Review AC coverage, TDD evidence, security, and docs impact."),
15
+ rule("agile", "alwaysApply: true", "Use Speckit Agile flow. Read .speckit/agents/super-agent.md, .speckit/skills/catalog.md, .speckit/memory/project-context.md, .speckit/sessions/active.md, .speckit/context/current.md, and .speckit/context/subagent-handoff.md. Preserve session handoff, create stories with ACs, and keep work scoped."),
16
+ rule("tdd", "description: Apply when implementing or modifying code", "Use red-green-refactor. Run speckit ready <story>, confirm acceptance criteria, checkpoint each TDD boundary, and record TDD evidence before review-ready."),
17
+ rule("review", "description: Apply when reviewing code or preparing a PR", "Review AC coverage, TDD evidence, security, docs impact, session checkpoint freshness, and graph sync status."),
18
18
  rule("enterprise-safety", "alwaysApply: true", "Do not expose secrets. Ask before destructive commands, deployment, or production changes."),
19
19
  {
20
20
  path: ".cursor/mcp.json",
@@ -30,6 +30,13 @@ Use Speckit for Agile + TDD work. Cursor-specific rules live in \`.cursor/rules/
30
30
 
31
31
  - Follow \`.speckit/rules/agile-policy.md\`.
32
32
  - Follow \`.speckit/rules/tdd-policy.md\` for code stories.
33
+ - Read \`.speckit/agents/super-agent.md\` and \`.speckit/skills/catalog.md\` before selecting an execution mode.
34
+ - Read \`.speckit/memory/project-context.md\` before long-running work.
35
+ - Read \`.speckit/sessions/active.md\` before resuming or compacting work.
36
+ - Read \`.speckit/context/current.md\` before implementation work.
37
+ - Read \`.speckit/context/subagent-handoff.md\` before implementation work.
38
+ - Run \`speckit ready <story>\` before code changes.
39
+ - Run \`speckit session checkpoint\` at task boundaries and \`speckit session compact\` before handoff.
33
40
  - Never run bare \`bv\`; use robot commands only.
34
41
  `),
35
42
  },
@@ -53,6 +53,7 @@ permission: ${JSON.stringify(permission)}
53
53
  # speckit-${name}
54
54
 
55
55
  Follow \`.speckit/rules/agile-policy.md\`, \`.speckit/rules/tdd-policy.md\`, and \`.speckit/rules/enterprise-safety.md\`.
56
+ Read \`.speckit/agents/super-agent.md\`, \`.speckit/skills/catalog.md\`, \`.speckit/memory/project-context.md\`, \`.speckit/sessions/active.md\`, \`.speckit/context/current.md\`, and \`.speckit/context/subagent-handoff.md\` before implementation work. Select the smallest matching Speckit skill. Require \`speckit ready <story>\`, confirm acceptance criteria, preserve session handoff, checkpoint red-green-refactor boundaries, compact before handoff, and use only robot-safe graph commands.
56
57
  `),
57
58
  };
58
59
  }
package/dist/cli.js CHANGED
@@ -5,10 +5,15 @@ import { shapeCommand } from "./commands/shape.js";
5
5
  import { contextCommand } from "./commands/context.js";
6
6
  import { quickCommand } from "./commands/quick.js";
7
7
  import { planCommand } from "./commands/plan.js";
8
+ import { memoryCommand } from "./commands/memory.js";
9
+ import { sessionCommand } from "./commands/session.js";
10
+ import { sprintCommand } from "./commands/sprint.js";
11
+ import { graphCommand } from "./commands/graph.js";
8
12
  import { triageCommand } from "./commands/triage.js";
9
13
  import { nextCommand } from "./commands/next.js";
10
14
  import { syncCommand } from "./commands/sync.js";
11
15
  import { runCommand } from "./commands/run.js";
16
+ import { readyCommand } from "./commands/ready.js";
12
17
  import { reviewCommand } from "./commands/review.js";
13
18
  import { closeCommand } from "./commands/close.js";
14
19
  export async function main(argv = process.argv.slice(2), root = process.cwd()) {
@@ -34,12 +39,28 @@ export async function main(argv = process.argv.slice(2), root = process.cwd()) {
34
39
  return quickCommand({ root, intent: requiredIntent(parsed) });
35
40
  case "plan":
36
41
  return planCommand({ root, intent: requiredIntent(parsed) });
42
+ case "memory":
43
+ return memoryCommand({ root, action: requiredAction(parsed) });
44
+ case "session":
45
+ return sessionCommand({
46
+ root,
47
+ action: requiredAction(parsed),
48
+ target: parsed.args.slice(1).join(" ").trim() || undefined,
49
+ note: value(parsed, "note"),
50
+ json: has(parsed, "json"),
51
+ });
52
+ case "sprint":
53
+ return sprintCommand({ root, action: requiredAction(parsed), json: has(parsed, "json") });
54
+ case "graph":
55
+ return graphCommand({ root, action: requiredAction(parsed), json: has(parsed, "json") });
37
56
  case "triage":
38
57
  return triageCommand({ root, json: has(parsed, "json") });
39
58
  case "next":
40
59
  return nextCommand();
41
60
  case "sync":
42
61
  return syncCommand({ root });
62
+ case "ready":
63
+ return readyCommand({ root, target: requiredIntent(parsed), json: has(parsed, "json") });
43
64
  case "run":
44
65
  return runCommand({ root, target: requiredIntent(parsed) });
45
66
  case "review":
@@ -89,6 +110,12 @@ function requiredIntent(parsed) {
89
110
  throw new Error(`Command "${parsed.command}" requires a target or intent.`);
90
111
  return intent;
91
112
  }
113
+ function requiredAction(parsed) {
114
+ const action = parsed.args[0]?.trim();
115
+ if (!action)
116
+ throw new Error(`Command "${parsed.command}" requires an action.`);
117
+ return action;
118
+ }
92
119
  function value(parsed, name) {
93
120
  const found = parsed.flags.get(name);
94
121
  return typeof found === "string" ? found : undefined;
@@ -108,9 +135,14 @@ Usage:
108
135
  speckit context <story-path-or-id>
109
136
  speckit quick "<intent>"
110
137
  speckit plan "<intent>"
138
+ speckit memory refresh
139
+ speckit session start|checkpoint|compact|resume|status [target] [--note "..."] [--json]
140
+ speckit sprint plan|next [--json]
141
+ speckit graph triage|plan|insights [--json]
111
142
  speckit triage [--json]
112
143
  speckit next
113
144
  speckit sync
145
+ speckit ready <story-path-or-id> [--json]
114
146
  speckit run <story-path-or-id>
115
147
  speckit review
116
148
  speckit close <story-path-or-id>
@@ -1,5 +1,5 @@
1
1
  import { markdown, writeManagedFiles } from "../core/managed-files.js";
2
- import { resolveStory } from "../core/story.js";
2
+ import { extractEvidenceReference, extractSection, resolveStory } from "../core/story.js";
3
3
  export async function contextCommand(options) {
4
4
  const stdout = options.stdout ?? console;
5
5
  const story = await resolveStory(options.root, options.target);
@@ -8,10 +8,19 @@ export async function contextCommand(options) {
8
8
  return 1;
9
9
  }
10
10
  const contextPath = ".speckit/context/current.md";
11
+ const handoffPath = ".speckit/context/subagent-handoff.md";
12
+ const acceptanceCriteria = extractSection(story.content, "Acceptance Criteria") ?? "- Not defined";
13
+ const evidenceReference = story.evidencePath ?? extractEvidenceReference(story.content);
11
14
  await writeManagedFiles(options.root, [
12
15
  {
13
16
  path: contextPath,
14
- content: markdown(`# Current Spec Context
17
+ content: markdown(`---
18
+ status: fresh
19
+ story: ${story.path}
20
+ evidence: ${evidenceReference ?? "missing"}
21
+ ---
22
+
23
+ # Current Spec Context
15
24
 
16
25
  ## Story
17
26
  ${story.title}
@@ -19,35 +28,60 @@ ${story.title}
19
28
  ## Story Path
20
29
  \`${story.path}\`
21
30
 
31
+ ## Story Status
32
+ ${story.status ?? "missing"}
33
+
22
34
  ## Acceptance Criteria
23
- ${extractSection(story.content, "Acceptance Criteria") ?? "- Not defined"}
35
+ ${acceptanceCriteria}
24
36
 
25
37
  ## TDD Evidence
26
- ${extractEvidenceReference(story.content) ?? "- Create or update matching `.speckit/evidence/*tdd-evidence.md`"}
38
+ ${evidenceReference ? `\`${evidenceReference}\`` : "- Create or update matching `.speckit/evidence/*tdd-evidence.md`"}
39
+
40
+ ## Spec Anti-Mistake Checklist
41
+ - Reuse existing project patterns before adding new files.
42
+ - Verify file locations before editing.
43
+ - Do not introduce new libraries without explicit need.
44
+ - Preserve existing behavior unless an acceptance criterion requires change.
45
+ - Check prior related stories or changelog before repeating work.
27
46
 
28
47
  ## Next Command
48
+ \`speckit ready ${story.id}\`
29
49
  \`speckit run ${story.id}\`
50
+ `),
51
+ },
52
+ {
53
+ path: handoffPath,
54
+ content: markdown(`# Spec Subagent Handoff
55
+
56
+ ## Task
57
+ Implement the story in \`${story.path}\`.
58
+
59
+ ## Files To Read
60
+ - \`.speckit/context/current.md\`
61
+ - \`${story.path}\`
62
+ ${evidenceReference ? `- \`${evidenceReference}\`` : "- Matching TDD evidence file"}
63
+ - \`.speckit/tool-policy.yaml\`
64
+
65
+ ## Acceptance Criteria
66
+ ${acceptanceCriteria}
67
+
68
+ ## Constraints
69
+ - Confirm story status is \`ready-for-dev\` before code changes.
70
+ - Record red-green-refactor evidence.
71
+ - Use only robot-safe graph commands.
72
+ - Stop before destructive commands, production changes, or secret access.
73
+
74
+ ## Completion Signal
75
+ - All acceptance criteria satisfied.
76
+ - TDD evidence updated.
77
+ - \`speckit review\` run before handoff.
78
+
79
+ ## Work Context
80
+ ${options.root}
30
81
  `),
31
82
  },
32
83
  ], true);
33
84
  stdout.log(contextPath);
85
+ stdout.log(handoffPath);
34
86
  return 0;
35
87
  }
36
- function extractEvidenceReference(content) {
37
- const match = content.match(/`([^`]*tdd-evidence\.md)`/i);
38
- return match ? `\`${match[1]}\`` : undefined;
39
- }
40
- function extractSection(content, heading) {
41
- const lines = content.split("\n");
42
- const start = lines.findIndex((line) => line.trim().toLowerCase() === `## ${heading}`.toLowerCase());
43
- if (start === -1)
44
- return undefined;
45
- const collected = [];
46
- for (const line of lines.slice(start + 1)) {
47
- if (line.startsWith("## "))
48
- break;
49
- if (line.trim())
50
- collected.push(line);
51
- }
52
- return collected.length > 0 ? collected.join("\n") : undefined;
53
- }
@@ -4,6 +4,7 @@ import { getAdapters } from "../config/adapter-registry.js";
4
4
  import { checkTools } from "../adapters/tool-checks.js";
5
5
  import { detectTestCommands } from "../core/test-detection.js";
6
6
  import { coreFiles, enterpriseFiles } from "../core/scaffold.js";
7
+ import { agentFiles } from "../core/agent-scaffold.js";
7
8
  export async function doctorCommand(options) {
8
9
  const stdout = options.stdout ?? console;
9
10
  const tools = checkTools();
@@ -39,7 +40,7 @@ export async function doctorCommand(options) {
39
40
  return report.status === "ok" ? 0 : 1;
40
41
  }
41
42
  async function runDeepChecks(root) {
42
- const requiredFiles = [...coreFiles(), ...enterpriseFiles()];
43
+ const requiredFiles = [...coreFiles(), ...enterpriseFiles(), ...agentFiles()];
43
44
  return Promise.all(requiredFiles.map(async (file) => ({
44
45
  name: file.path,
45
46
  path: file.path,
@@ -0,0 +1,7 @@
1
+ export type GraphOptions = {
2
+ root: string;
3
+ action: string;
4
+ json?: boolean;
5
+ stdout?: Pick<typeof console, "log" | "error">;
6
+ };
7
+ export declare function graphCommand(options: GraphOptions): Promise<number>;
@@ -0,0 +1,51 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { commandExists } from "../adapters/tool-checks.js";
3
+ import { prepareBeadsMirror } from "../core/beads-mirror.js";
4
+ import { readSyncedStories, selectableStories } from "../core/synced-stories.js";
5
+ const robotActions = new Map([
6
+ ["triage", "--robot-triage"],
7
+ ["plan", "--robot-plan"],
8
+ ["insights", "--robot-insights"],
9
+ ]);
10
+ export async function graphCommand(options) {
11
+ const stdout = options.stdout ?? console;
12
+ const robotFlag = robotActions.get(options.action);
13
+ if (!robotFlag) {
14
+ stdout.error("Usage: speckit graph triage|plan|insights [--json]");
15
+ return 1;
16
+ }
17
+ if (commandExists("bv")) {
18
+ await prepareBeadsMirror(options.root);
19
+ const result = spawnSync("bv", [robotFlag, "--format", options.json ? "json" : "toon"], {
20
+ encoding: "utf8",
21
+ cwd: options.root,
22
+ });
23
+ if ((result.status ?? 1) === 0) {
24
+ if (result.stdout)
25
+ stdout.log(result.stdout.trim());
26
+ if (result.stderr)
27
+ stdout.error(result.stderr.trim());
28
+ return 0;
29
+ }
30
+ }
31
+ const fallback = await localGraphFallback(options.root, options.action);
32
+ stdout.log(JSON.stringify(fallback, null, 2));
33
+ return 0;
34
+ }
35
+ async function localGraphFallback(root, action) {
36
+ const stories = await readSyncedStories(root);
37
+ const selectable = selectableStories(stories);
38
+ return {
39
+ source: ".speckit/sync/beads-sync.jsonl",
40
+ provider: "speckit-local-fallback",
41
+ action,
42
+ status: "bv-unavailable-or-failed",
43
+ quick_ref: {
44
+ total: stories.length,
45
+ selectable: selectable.length,
46
+ top_pick: selectable[0] ?? null,
47
+ },
48
+ recommendations: selectable.slice(0, 3),
49
+ command: "Install Beads Viewer for graph metrics: bv --robot-triage --format json",
50
+ };
51
+ }
@@ -1,10 +1,12 @@
1
1
  import { coreFiles, enterpriseFiles } from "../core/scaffold.js";
2
+ import { agentFiles } from "../core/agent-scaffold.js";
2
3
  import { writeManagedFiles } from "../core/managed-files.js";
3
4
  import { getAdapters } from "../config/adapter-registry.js";
4
5
  export async function initCommand(options) {
5
6
  const stdout = options.stdout ?? console;
6
7
  const selectedIde = options.ide ?? "all";
7
- const baseFiles = options.enterprise ? [...coreFiles(), ...enterpriseFiles()] : coreFiles();
8
+ const sharedFiles = [...coreFiles(), ...agentFiles()];
9
+ const baseFiles = options.enterprise ? [...sharedFiles, ...enterpriseFiles()] : sharedFiles;
8
10
  const adapterFiles = getAdapters(selectedIde).flatMap((adapter) => adapter.render());
9
11
  const results = await writeManagedFiles(options.root, [...baseFiles, ...adapterFiles], options.force ?? false);
10
12
  const created = results.filter((result) => result.status === "created").length;
@@ -0,0 +1,6 @@
1
+ export type MemoryOptions = {
2
+ root: string;
3
+ action: string;
4
+ stdout?: Pick<typeof console, "log" | "error">;
5
+ };
6
+ export declare function memoryCommand(options: MemoryOptions): Promise<number>;
@@ -0,0 +1,11 @@
1
+ import { refreshMemory } from "../core/memory.js";
2
+ export async function memoryCommand(options) {
3
+ const stdout = options.stdout ?? console;
4
+ if (options.action !== "refresh") {
5
+ stdout.error("Usage: speckit memory refresh");
6
+ return 1;
7
+ }
8
+ const files = await refreshMemory(options.root);
9
+ stdout.log(`Refreshed Speckit memory: ${files.join(", ")}`);
10
+ return 0;
11
+ }
@@ -36,7 +36,13 @@ export async function planCommand(options) {
36
36
  },
37
37
  {
38
38
  path: `${dir}/story.md`,
39
- content: markdown(`# Story: ${options.intent}
39
+ content: markdown(`---
40
+ status: draft
41
+ evidence: ${dir}/tdd-evidence.md
42
+ context: pending
43
+ ---
44
+
45
+ # Story: ${options.intent}
40
46
 
41
47
  ## Acceptance Criteria
42
48
  - Given ...
@@ -47,11 +53,22 @@ export async function planCommand(options) {
47
53
  \`${dir}/tdd-evidence.md\`
48
54
 
49
55
  ## Implementation Notes
56
+
57
+ ## Spec Anti-Mistake Checklist
58
+ - Reuse existing project patterns before adding new files.
59
+ - Verify file locations before editing.
60
+ - Do not introduce new libraries without explicit need.
61
+ - Preserve existing behavior unless an acceptance criterion requires change.
50
62
  `),
51
63
  },
52
64
  {
53
65
  path: `${dir}/tdd-evidence.md`,
54
- content: markdown(`# TDD Evidence: ${options.intent}
66
+ content: markdown(`---
67
+ status: missing
68
+ story: ${dir}/story.md
69
+ ---
70
+
71
+ # TDD Evidence: ${options.intent}
55
72
 
56
73
  ## Red
57
74
 
@@ -11,7 +11,13 @@ export async function quickCommand(options) {
11
11
  await writeManagedFiles(options.root, [
12
12
  {
13
13
  path: storyPath,
14
- content: markdown(`# Story: ${options.intent}
14
+ content: markdown(`---
15
+ status: ready-for-dev
16
+ evidence: ${evidencePath}
17
+ context: pending
18
+ ---
19
+
20
+ # Story: ${options.intent}
15
21
 
16
22
  ## Intent
17
23
  ${options.intent}
@@ -29,11 +35,23 @@ ${options.intent}
29
35
 
30
36
  ## Suggested Test Command
31
37
  \`${testCommand}\`
38
+
39
+ ## Spec Anti-Mistake Checklist
40
+ - Reuse existing project patterns before adding new files.
41
+ - Verify file locations before editing.
42
+ - Do not introduce new libraries without explicit need.
43
+ - Preserve existing behavior unless an acceptance criterion requires change.
44
+ - Update docs only when behavior or workflow changes.
32
45
  `),
33
46
  },
34
47
  {
35
48
  path: evidencePath,
36
- content: markdown(`# TDD Evidence: ${options.intent}
49
+ content: markdown(`---
50
+ status: missing
51
+ story: ${storyPath}
52
+ ---
53
+
54
+ # TDD Evidence: ${options.intent}
37
55
 
38
56
  ## Test Intent
39
57
 
@@ -0,0 +1,7 @@
1
+ export type ReadyOptions = {
2
+ root: string;
3
+ target: string;
4
+ json?: boolean;
5
+ stdout?: Pick<typeof console, "log" | "error">;
6
+ };
7
+ export declare function readyCommand(options: ReadyOptions): Promise<number>;
@@ -0,0 +1,20 @@
1
+ import { evaluateReadiness } from "../core/readiness.js";
2
+ export async function readyCommand(options) {
3
+ const stdout = options.stdout ?? console;
4
+ const report = await evaluateReadiness(options.root, options.target);
5
+ if (options.json) {
6
+ stdout.log(JSON.stringify(report, null, 2));
7
+ return report.status === "ready" ? 0 : 1;
8
+ }
9
+ stdout.log(`# Speckit Readiness: ${report.status}`);
10
+ if (report.story) {
11
+ stdout.log(`Story: ${report.story.path}`);
12
+ }
13
+ for (const check of report.checks) {
14
+ stdout.log(`- ${check.ok ? "ok" : "blocked"} ${check.name}: ${check.detail}`);
15
+ }
16
+ if (report.status !== "ready") {
17
+ stdout.error("Run the suggested setup commands before `speckit run`.");
18
+ }
19
+ return report.status === "ready" ? 0 : 1;
20
+ }
@@ -1,4 +1,5 @@
1
1
  import { resolveStory } from "../core/story.js";
2
+ import { evaluateReadiness } from "../core/readiness.js";
2
3
  export async function runCommand(options) {
3
4
  const stdout = options.stdout ?? console;
4
5
  const story = await resolveStory(options.root, options.target);
@@ -6,16 +7,28 @@ export async function runCommand(options) {
6
7
  stdout.error(`Story not found: ${options.target}`);
7
8
  return 1;
8
9
  }
10
+ const readiness = await evaluateReadiness(options.root, options.target);
11
+ if (readiness.status !== "ready") {
12
+ stdout.error(`Story is not ready for implementation: ${story.path}`);
13
+ for (const check of readiness.checks.filter((item) => !item.ok)) {
14
+ stdout.error(`- ${check.name}: ${check.detail}`);
15
+ }
16
+ stdout.error(`Run \`speckit ready ${story.id}\` after preparing context and sync.`);
17
+ return 1;
18
+ }
9
19
  stdout.log(`# Speckit TDD Run
10
20
 
11
21
  Story: ${story.path}
12
22
 
13
- 1. Read the story and acceptance criteria.
23
+ Status: ready-for-dev
24
+
25
+ 1. Read \`.speckit/context/current.md\`, story, acceptance criteria, and subagent handoff.
14
26
  2. Identify the smallest executable test that should fail.
15
- 3. Record red evidence in the matching \`.speckit/evidence/*tdd-evidence.md\` file.
27
+ 3. Record red evidence in the linked TDD evidence file.
16
28
  4. Implement the minimal behavior.
17
29
  5. Record green evidence.
18
30
  6. Refactor only after tests are green, then record validation.
31
+ 7. Continue until all acceptance criteria are satisfied or a stop condition is hit.
19
32
 
20
33
  Recommended handoff:
21
34
  \`speckit review\` before commit or PR.