@trieungoctam/speckit 0.2.2 → 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 (41) hide show
  1. package/README.md +32 -5
  2. package/dist/adapters/antigravity-adapter.js +4 -4
  3. package/dist/adapters/claude-code-adapter.js +7 -5
  4. package/dist/adapters/codex-adapter.js +5 -3
  5. package/dist/adapters/cursor-adapter.js +7 -3
  6. package/dist/adapters/opencode-adapter.js +1 -1
  7. package/dist/cli.js +28 -0
  8. package/dist/commands/doctor.js +2 -1
  9. package/dist/commands/graph.d.ts +7 -0
  10. package/dist/commands/graph.js +51 -0
  11. package/dist/commands/init.js +3 -1
  12. package/dist/commands/memory.d.ts +6 -0
  13. package/dist/commands/memory.js +11 -0
  14. package/dist/commands/session.d.ts +9 -0
  15. package/dist/commands/session.js +49 -0
  16. package/dist/commands/sprint.d.ts +7 -0
  17. package/dist/commands/sprint.js +54 -0
  18. package/dist/commands/start.js +4 -3
  19. package/dist/commands/sync.js +3 -0
  20. package/dist/commands/triage.js +2 -15
  21. package/dist/core/agent-scaffold.d.ts +2 -0
  22. package/dist/core/agent-scaffold.js +57 -0
  23. package/dist/core/beads-mirror.d.ts +3 -0
  24. package/dist/core/beads-mirror.js +46 -0
  25. package/dist/core/memory.d.ts +1 -0
  26. package/dist/core/memory.js +47 -0
  27. package/dist/core/scaffold.js +33 -63
  28. package/dist/core/session-manager.d.ts +15 -0
  29. package/dist/core/session-manager.js +139 -0
  30. package/dist/core/skill-catalog.d.ts +2 -0
  31. package/dist/core/skill-catalog.js +177 -0
  32. package/dist/core/synced-stories.d.ts +8 -0
  33. package/dist/core/synced-stories.js +17 -0
  34. package/dist/core/templates.d.ts +2 -0
  35. package/dist/core/templates.js +54 -0
  36. package/docs/development-roadmap.md +7 -5
  37. package/docs/product-contract.md +7 -4
  38. package/docs/project-changelog.md +30 -0
  39. package/docs/spec-enterprise-harness-plan.md +18 -1
  40. package/docs/workflow-model.md +23 -0
  41. package/package.json +1 -1
package/README.md CHANGED
@@ -4,15 +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"
13
20
  npx @trieungoctam/speckit@latest context .speckit/stories/<story>.md
14
21
  npx @trieungoctam/speckit@latest sync
22
+ npx @trieungoctam/speckit@latest sprint plan
23
+ npx @trieungoctam/speckit@latest graph triage --json
15
24
  npx @trieungoctam/speckit@latest ready .speckit/stories/<story>.md
25
+ npx @trieungoctam/speckit@latest session checkpoint --note "red complete"
16
26
  npx @trieungoctam/speckit@latest review
17
27
  ```
18
28
 
@@ -29,16 +39,22 @@ speckit doctor
29
39
  ```text
30
40
  intent
31
41
  -> start session
42
+ -> super agent routing
43
+ -> refresh project memory
32
44
  -> shape
33
45
  -> plan
46
+ -> sprint plan
34
47
  -> context
35
48
  -> story with acceptance criteria
36
- -> sync / triage
49
+ -> sync / graph triage
37
50
  -> readiness gate
38
51
  -> red test evidence
52
+ -> session checkpoint
39
53
  -> minimal implementation
40
54
  -> green test evidence
55
+ -> session checkpoint
41
56
  -> refactor validation
57
+ -> session compact
42
58
  -> review
43
59
  ```
44
60
 
@@ -48,19 +64,30 @@ For implementation stories, red-green-refactor evidence is mandatory. A story is
48
64
 
49
65
  | Command | Purpose |
50
66
  | --- | --- |
51
- | `speckit init` | Create `.speckit/` core rules and all IDE adapters. |
52
- | `speckit init --enterprise` | Add flow, tool policy, and prompt harness files. |
53
- | `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`. |
54
70
  | `speckit doctor` | Report required tools, optional integrations, test commands, and adapter readiness. |
55
71
  | `speckit doctor --deep` | Verify core enterprise harness files. |
56
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. |
57
79
  | `speckit shape "<intent>"` | Create a short spec contract. |
58
80
  | `speckit context <story>` | Build the current implementation context from a story. |
59
81
  | `speckit quick "<intent>"` | Create one story plus matching TDD evidence file. |
60
82
  | `speckit plan "<intent>"` | Create PRD, architecture, story, and evidence skeletons. |
61
83
  | `speckit triage` | Summarize synced story state without interactive graph commands. |
62
84
  | `speckit next` | Safely wraps `bv --robot-next --format json`. |
63
- | `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. |
64
91
  | `speckit ready <story>` | Validate story status, context, evidence, graph sync, and safety policy before implementation. |
65
92
  | `speckit run <story>` | Print the TDD execution handoff for a story. |
66
93
  | `speckit review` | Print the review checklist and current diff summary. |
@@ -12,12 +12,12 @@ export const antigravityAdapter = {
12
12
  ],
13
13
  render() {
14
14
  return [
15
- rule("agile", "Follow Speckit Agile: shape intent, read .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, and record evidence for each step."),
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
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 .speckit/context/current.md and .speckit/context/subagent-handoff.md. 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, and session handoff gaps."),
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. Read .speckit/context/current.md first, preserve session handoff, use red-green-refactor, and use robot-safe graph commands only.`;
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,8 +21,10 @@ 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 start\`, \`speckit context\`, \`speckit sync\`, \`speckit triage\`, \`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.
25
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.
26
28
  - For code stories, confirm acceptance criteria and record red-green-refactor evidence before handoff.
27
29
  - Never run bare \`bv\`; use robot flags such as \`bv --robot-next --format json\`.
28
30
  `),
@@ -36,9 +38,9 @@ Use Speckit for Agile + TDD work.
36
38
  includeCoAuthoredBy: false,
37
39
  }),
38
40
  },
39
- skill("speckit-plan", "Create or update a Speckit Agile plan.", "Read `.speckit/workflows/shape.md`, preserve the session id, then create PRD, architecture, and story artifacts with acceptance criteria."),
40
- skill("speckit-tdd", "Execute a Speckit story with TDD.", "Read `.speckit/context/current.md`, `.speckit/context/subagent-handoff.md`, and `.speckit/workflows/tdd-run.md`. Do not implement before `speckit ready <story>` passes, test intent is clear, and red evidence is recorded."),
41
- skill("speckit-review", "Review a Speckit change.", "Read `.speckit/workflows/review.md`. Prioritize AC coverage, TDD evidence gaps, security, docs impact, and graph sync status."),
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."),
42
44
  ];
43
45
  },
44
46
  };
@@ -19,8 +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.
22
23
  - Read \`.speckit/context/current.md\` before running code changes.
23
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.
24
26
  - For code stories, write test intent and capture red/green/refactor evidence.
25
27
  - Never call bare \`bv\`; use \`bv --robot-*\`.
26
28
  - Do not weaken approval or sandbox settings.
@@ -39,9 +41,9 @@ web_search = true
39
41
  [features]
40
42
  child_agents_md = true`),
41
43
  },
42
- prompt("plan", "Create a Speckit plan from the user intent. Preserve session context, include PRD, architecture, stories, ACs, TDD checklist, risks, and graph sync notes."),
43
- prompt("tdd-run", "Execute the selected Speckit story using .speckit/context/current.md, .speckit/context/subagent-handoff.md, and red-green-refactor. Require speckit ready <story>, confirm ACs, record command evidence, and use only robot-safe graph commands."),
44
- prompt("review", "Review the current diff against Speckit ACs, TDD evidence, security, docs impact, session handoff, and graph sync status."),
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."),
45
47
  ];
46
48
  },
47
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. Read .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, 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, and graph sync status."),
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,9 +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.
33
36
  - Read \`.speckit/context/current.md\` before implementation work.
34
37
  - Read \`.speckit/context/subagent-handoff.md\` before implementation work.
35
38
  - Run \`speckit ready <story>\` before code changes.
39
+ - Run \`speckit session checkpoint\` at task boundaries and \`speckit session compact\` before handoff.
36
40
  - Never run bare \`bv\`; use robot commands only.
37
41
  `),
38
42
  },
@@ -53,7 +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/context/current.md\` and \`.speckit/context/subagent-handoff.md\` before implementation work, require \`speckit ready <story>\`, confirm acceptance criteria, preserve session handoff, record red-green-refactor evidence, and use only robot-safe graph commands.
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.
57
57
  `),
58
58
  };
59
59
  }
package/dist/cli.js CHANGED
@@ -5,6 +5,10 @@ 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";
@@ -35,6 +39,20 @@ export async function main(argv = process.argv.slice(2), root = process.cwd()) {
35
39
  return quickCommand({ root, intent: requiredIntent(parsed) });
36
40
  case "plan":
37
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") });
38
56
  case "triage":
39
57
  return triageCommand({ root, json: has(parsed, "json") });
40
58
  case "next":
@@ -92,6 +110,12 @@ function requiredIntent(parsed) {
92
110
  throw new Error(`Command "${parsed.command}" requires a target or intent.`);
93
111
  return intent;
94
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
+ }
95
119
  function value(parsed, name) {
96
120
  const found = parsed.flags.get(name);
97
121
  return typeof found === "string" ? found : undefined;
@@ -111,6 +135,10 @@ Usage:
111
135
  speckit context <story-path-or-id>
112
136
  speckit quick "<intent>"
113
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]
114
142
  speckit triage [--json]
115
143
  speckit next
116
144
  speckit sync
@@ -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
+ }
@@ -0,0 +1,9 @@
1
+ export type SessionOptions = {
2
+ root: string;
3
+ action: string;
4
+ target?: string;
5
+ note?: string;
6
+ json?: boolean;
7
+ stdout?: Pick<typeof console, "log" | "error">;
8
+ };
9
+ export declare function sessionCommand(options: SessionOptions): Promise<number>;
@@ -0,0 +1,49 @@
1
+ import { checkpointSession, compactSession, ensureSession, resumeSession, sessionStatus, } from "../core/session-manager.js";
2
+ export async function sessionCommand(options) {
3
+ const stdout = options.stdout ?? console;
4
+ switch (options.action) {
5
+ case "start": {
6
+ const session = await ensureSession(options.root, options.note ?? options.target ?? "long session");
7
+ stdout.log(session.id);
8
+ stdout.log(`${session.dir}/handoff.md`);
9
+ return 0;
10
+ }
11
+ case "checkpoint": {
12
+ const session = await checkpointSession({
13
+ root: options.root,
14
+ note: options.note ?? options.target,
15
+ story: options.target,
16
+ });
17
+ stdout.log(`Checkpointed ${session.id}`);
18
+ return 0;
19
+ }
20
+ case "compact": {
21
+ const session = await compactSession(options.root);
22
+ stdout.log(`${session.dir}/summary.md`);
23
+ return 0;
24
+ }
25
+ case "resume": {
26
+ const session = await resumeSession(options.root, options.target);
27
+ if (!session) {
28
+ stdout.error("No Speckit session to resume.");
29
+ return 1;
30
+ }
31
+ stdout.log(session.id);
32
+ stdout.log(`${session.dir}/handoff.md`);
33
+ return 0;
34
+ }
35
+ case "status": {
36
+ const status = await sessionStatus(options.root);
37
+ stdout.log(options.json ? JSON.stringify(status, null, 2) : renderStatus(status));
38
+ return status.status === "missing" ? 1 : 0;
39
+ }
40
+ default:
41
+ stdout.error("Usage: speckit session start|checkpoint|compact|resume|status");
42
+ return 1;
43
+ }
44
+ }
45
+ function renderStatus(status) {
46
+ if (status.status === "missing")
47
+ return "Spec session: missing";
48
+ return `Spec session: ${status.id}\nState: ${status.state}\nSummary: ${status.summary}\nHandoff: ${status.handoff}`;
49
+ }
@@ -0,0 +1,7 @@
1
+ export type SprintOptions = {
2
+ root: string;
3
+ action: string;
4
+ json?: boolean;
5
+ stdout?: Pick<typeof console, "log" | "error">;
6
+ };
7
+ export declare function sprintCommand(options: SprintOptions): Promise<number>;
@@ -0,0 +1,54 @@
1
+ import { markdown, text, writeManagedFiles } from "../core/managed-files.js";
2
+ import { readSyncedStories, selectableStories } from "../core/synced-stories.js";
3
+ export async function sprintCommand(options) {
4
+ const stdout = options.stdout ?? console;
5
+ const stories = await readSyncedStories(options.root);
6
+ switch (options.action) {
7
+ case "plan": {
8
+ const selected = selectableStories(stories);
9
+ await writeManagedFiles(options.root, [
10
+ {
11
+ path: ".speckit/sprint/status.yaml",
12
+ content: text(renderStatus(stories)),
13
+ },
14
+ {
15
+ path: ".speckit/sprint/plan.md",
16
+ content: markdown(renderPlan(selected)),
17
+ },
18
+ ], true);
19
+ stdout.log(`Planned sprint with ${selected.length} selectable stories`);
20
+ return 0;
21
+ }
22
+ case "next": {
23
+ const next = selectableStories(stories)[0] ?? null;
24
+ stdout.log(options.json ? JSON.stringify({ next }, null, 2) : renderNext(next));
25
+ return next ? 0 : 1;
26
+ }
27
+ default:
28
+ stdout.error("Usage: speckit sprint plan|next [--json]");
29
+ return 1;
30
+ }
31
+ }
32
+ function renderStatus(stories) {
33
+ const rows = stories.map((story) => ` ${story.id}: ${story.status}`);
34
+ return `version: 1\nsource: .speckit/sync/beads-sync.jsonl\ndevelopment_status:\n${rows.join("\n") || " none: empty"}\n`;
35
+ }
36
+ function renderPlan(stories) {
37
+ const rows = stories.map((story) => `- [ ] ${story.id} (${story.status}) - \`${story.path}\``);
38
+ return `# Spec Sprint Plan
39
+
40
+ ## Goal
41
+ Deliver the highest-priority ready stories while preserving TDD evidence and graph traceability.
42
+
43
+ ## Selected Stories
44
+ ${rows.join("\n") || "- No selectable stories. Run `speckit quick`, `speckit sync`, then retry."}
45
+
46
+ ## Automation
47
+ - Run \`speckit graph triage --json\` before claiming work.
48
+ - Run \`speckit context <story>\` and \`speckit ready <story>\` before implementation.
49
+ - Run \`speckit session checkpoint\` at task boundaries.
50
+ `;
51
+ }
52
+ function renderNext(story) {
53
+ return story ? `Next sprint story: ${story.id} (${story.path})` : "Next sprint story: none";
54
+ }
@@ -1,9 +1,10 @@
1
1
  import { markdown, writeManagedFiles } from "../core/managed-files.js";
2
- import { slugify, timestamp } from "../core/slug.js";
2
+ import { createSession } from "../core/session-manager.js";
3
3
  export async function startCommand(options) {
4
4
  const stdout = options.stdout ?? console;
5
- const sessionId = `${timestamp()}-${slugify(options.intent)}`;
6
- const handoffPath = `.speckit/sessions/${sessionId}/handoff.md`;
5
+ const session = await createSession(options.root, options.intent);
6
+ const sessionId = session.id;
7
+ const handoffPath = `${session.dir}/handoff.md`;
7
8
  const contextPath = ".speckit/context/current.md";
8
9
  await writeManagedFiles(options.root, [
9
10
  {
@@ -2,6 +2,7 @@ import { readdir, readFile } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
3
  import { markdown, writeManagedFiles } from "../core/managed-files.js";
4
4
  import { firstHeading, frontmatterValue } from "../core/story.js";
5
+ import { writeBeadsMirror } from "../core/beads-mirror.js";
5
6
  export async function syncCommand(options) {
6
7
  const stdout = options.stdout ?? console;
7
8
  const storiesDir = join(options.root, ".speckit", "stories");
@@ -43,6 +44,8 @@ bv --robot-next --format json
43
44
  `),
44
45
  },
45
46
  ], true);
47
+ const beadsPath = await writeBeadsMirror(options.root, stories);
46
48
  stdout.log(`Synced ${stories.length} stories to .speckit/sync/beads-sync.jsonl`);
49
+ stdout.log(`Prepared Beads Viewer mirror at ${beadsPath}`);
47
50
  return 0;
48
51
  }
@@ -1,9 +1,8 @@
1
- import { readFile } from "node:fs/promises";
2
- import { join } from "node:path";
1
+ import { readSyncedStories, selectableStories } from "../core/synced-stories.js";
3
2
  export async function triageCommand(options) {
4
3
  const stdout = options.stdout ?? console;
5
4
  const stories = await readSyncedStories(options.root);
6
- const open = stories.filter((story) => ["open", "ready-for-dev", "in-progress"].includes(story.status));
5
+ const open = selectableStories(stories);
7
6
  const ready = stories.filter((story) => story.status !== "open");
8
7
  const report = {
9
8
  source: ".speckit/sync/beads-sync.jsonl",
@@ -19,15 +18,3 @@ export async function triageCommand(options) {
19
18
  stdout.log(open[0] ? `Next: ${open[0].id} (${open[0].path})` : "Next: none");
20
19
  return 0;
21
20
  }
22
- async function readSyncedStories(root) {
23
- try {
24
- const content = await readFile(join(root, ".speckit", "sync", "beads-sync.jsonl"), "utf8");
25
- return content
26
- .split("\n")
27
- .filter(Boolean)
28
- .map((line) => JSON.parse(line));
29
- }
30
- catch {
31
- return [];
32
- }
33
- }
@@ -0,0 +1,2 @@
1
+ import { ManagedFile } from "./managed-files.js";
2
+ export declare function agentFiles(): ManagedFile[];
@@ -0,0 +1,57 @@
1
+ import { markdown } from "./managed-files.js";
2
+ import { specSkillFiles } from "./skill-catalog.js";
3
+ export function agentFiles() {
4
+ return [
5
+ {
6
+ path: ".speckit/agents/super-agent.md",
7
+ content: markdown(`# Spec Super Agent
8
+
9
+ ## Mission
10
+
11
+ Act as the controller for Speckit enterprise work. Do not be the only worker when context isolation is useful; route work through focused skills and subagent handoffs.
12
+
13
+ ## Load Order
14
+
15
+ 1. \`.speckit/memory/project-context.md\`
16
+ 2. \`.speckit/sessions/active.md\` and the linked session summary
17
+ 3. \`.speckit/skills/catalog.md\`
18
+ 4. \`.speckit/context/current.md\`
19
+ 5. \`.speckit/context/subagent-handoff.md\`
20
+
21
+ ## Routing Rules
22
+
23
+ - Use planning skills before implementation.
24
+ - Select the smallest matching Speckit skill for the current phase.
25
+ - Route by the story state first, then by the requested action.
26
+ - Use TDD execution skills only after \`speckit ready <story>\` passes.
27
+ - Use graph skills before choosing or reordering work.
28
+ - Use session skills at every task boundary.
29
+ - Use review skills before closure.
30
+
31
+ ## Delegation Contract
32
+
33
+ Every handoff must include:
34
+
35
+ - Work context path.
36
+ - Reports path.
37
+ - Plans path.
38
+ - Files to read.
39
+ - Files to modify.
40
+ - Acceptance criteria.
41
+ - Constraints and stop conditions.
42
+
43
+ Subagents must finish with one status: \`DONE\`, \`DONE_WITH_CONCERNS\`, \`BLOCKED\`, or \`NEEDS_CONTEXT\`.
44
+
45
+ ## Long Session Contract
46
+
47
+ - Keep durable facts in files, not in chat.
48
+ - Checkpoint after red, green, refactor, and review.
49
+ - Compact before handoff, after noisy tool output, or before switching stories.
50
+ - Prefer focused subagent handoffs over passing full conversation history.
51
+ - Hydrate runtime tasks from unchecked plan/story checkboxes at session start.
52
+ - Sync completed runtime tasks back to durable plan/story files before close.
53
+ `),
54
+ },
55
+ ...specSkillFiles(),
56
+ ];
57
+ }
@@ -0,0 +1,3 @@
1
+ import { SyncedStory } from "./synced-stories.js";
2
+ export declare function writeBeadsMirror(root: string, stories: SyncedStory[]): Promise<string>;
3
+ export declare function prepareBeadsMirror(root: string): Promise<string>;