productkit 1.9.0 → 1.10.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 (34) hide show
  1. package/README.md +25 -2
  2. package/package.json +6 -3
  3. package/src/cli.js +10 -1
  4. package/src/commands/check.js +2 -2
  5. package/src/commands/completion.js +26 -2
  6. package/src/commands/diff.js +4 -16
  7. package/src/commands/doctor.js +12 -4
  8. package/src/commands/export.js +169 -14
  9. package/src/commands/init.js +66 -6
  10. package/src/commands/list.js +17 -0
  11. package/src/commands/reset.js +1 -12
  12. package/src/commands/status.js +15 -12
  13. package/src/commands/update.js +42 -3
  14. package/src/commands/workspace.js +63 -0
  15. package/src/utils/fileUtils.js +57 -11
  16. package/templates/CLAUDE.md +29 -2
  17. package/templates/README.md +17 -0
  18. package/templates/commands/productkit.analyze.md +9 -0
  19. package/templates/commands/productkit.assumptions.md +9 -0
  20. package/templates/commands/productkit.audit.md +7 -0
  21. package/templates/commands/productkit.bootstrap.md +8 -1
  22. package/templates/commands/productkit.clarify.md +9 -0
  23. package/templates/commands/productkit.constitution.md +22 -1
  24. package/templates/commands/productkit.landscape.md +130 -0
  25. package/templates/commands/productkit.learn.md +80 -0
  26. package/templates/commands/productkit.prioritize.md +9 -0
  27. package/templates/commands/productkit.problem.md +10 -0
  28. package/templates/commands/productkit.solution.md +9 -0
  29. package/templates/commands/productkit.spec.md +9 -0
  30. package/templates/commands/productkit.stories.md +166 -0
  31. package/templates/commands/productkit.techreview.md +221 -0
  32. package/templates/commands/productkit.users.md +10 -0
  33. package/templates/commands/productkit.validate.md +18 -6
  34. package/templates/knowledge-README.md +33 -0
@@ -1,6 +1,7 @@
1
1
  const fs = require('fs-extra');
2
2
  const path = require('path');
3
3
  const chalk = require('chalk');
4
+ const { getWorkspaceRoot } = require('../utils/fileUtils');
4
5
 
5
6
  async function list() {
6
7
  const root = process.cwd();
@@ -25,6 +26,22 @@ async function list() {
25
26
  console.log(chalk.bold('Available slash commands:'));
26
27
  console.log();
27
28
 
29
+ // Show workspace landscape command if in a workspace
30
+ const workspaceRoot = getWorkspaceRoot(root);
31
+ if (workspaceRoot) {
32
+ const landscapePath = path.join(workspaceRoot, '.claude', 'commands', 'productkit.landscape.md');
33
+ if (fs.existsSync(landscapePath)) {
34
+ const content = fs.readFileSync(landscapePath, 'utf-8');
35
+ let description = '';
36
+ const match = content.match(/^---\s*\n[\s\S]*?description:\s*(.+)\n[\s\S]*?---/);
37
+ if (match) description = match[1].trim();
38
+
39
+ console.log(` ${chalk.cyan('/productkit.landscape')} ${chalk.dim('(workspace)')}`);
40
+ if (description) console.log(` ${description}`);
41
+ console.log();
42
+ }
43
+ }
44
+
28
45
  for (const file of files) {
29
46
  const name = '/' + file.replace('.md', '');
30
47
  const content = fs.readFileSync(path.join(commandsDir, file), 'utf-8');
@@ -2,18 +2,7 @@ const fs = require('fs-extra');
2
2
  const path = require('path');
3
3
  const chalk = require('chalk');
4
4
  const readline = require('readline');
5
- const { getArtifactDir } = require('../utils/fileUtils');
6
-
7
- const ARTIFACTS = [
8
- 'constitution.md',
9
- 'users.md',
10
- 'problem.md',
11
- 'assumptions.md',
12
- 'validation.md',
13
- 'solution.md',
14
- 'priorities.md',
15
- 'spec.md',
16
- ];
5
+ const { getArtifactDir, ARTIFACT_FILES: ARTIFACTS } = require('../utils/fileUtils');
17
6
 
18
7
  function confirm(question) {
19
8
  const rl = readline.createInterface({
@@ -1,18 +1,7 @@
1
1
  const fs = require('fs-extra');
2
2
  const path = require('path');
3
3
  const chalk = require('chalk');
4
- const { getArtifactDir } = require('../utils/fileUtils');
5
-
6
- const ARTIFACTS = [
7
- { file: 'constitution.md', command: '/productkit.constitution', label: 'Constitution' },
8
- { file: 'users.md', command: '/productkit.users', label: 'Users' },
9
- { file: 'problem.md', command: '/productkit.problem', label: 'Problem' },
10
- { file: 'assumptions.md', command: '/productkit.assumptions', label: 'Assumptions' },
11
- { file: 'validation.md', command: '/productkit.validate', label: 'Validation' },
12
- { file: 'solution.md', command: '/productkit.solution', label: 'Solution' },
13
- { file: 'priorities.md', command: '/productkit.prioritize', label: 'Priorities' },
14
- { file: 'spec.md', command: '/productkit.spec', label: 'Spec' },
15
- ];
4
+ const { getArtifactDir, getWorkspaceRoot, ARTIFACTS_WITH_COMMANDS: ARTIFACTS } = require('../utils/fileUtils');
16
5
 
17
6
  async function status() {
18
7
  const root = process.cwd();
@@ -25,6 +14,7 @@ async function status() {
25
14
  }
26
15
 
27
16
  const artifactDir = getArtifactDir(root);
17
+ const workspaceRoot = getWorkspaceRoot(root);
28
18
  const done = [];
29
19
  const remaining = [];
30
20
 
@@ -38,6 +28,19 @@ async function status() {
38
28
  }
39
29
 
40
30
  console.log();
31
+
32
+ // Show workspace landscape status if in a workspace
33
+ if (workspaceRoot) {
34
+ const landscapeExists = fs.existsSync(path.join(workspaceRoot, 'landscape.md'));
35
+ console.log(chalk.bold('Workspace:'));
36
+ if (landscapeExists) {
37
+ console.log(chalk.green(' done Landscape (landscape.md)'));
38
+ } else {
39
+ console.log(chalk.yellow(' todo Landscape — run /productkit.landscape from workspace root'));
40
+ }
41
+ console.log();
42
+ }
43
+
41
44
  console.log(chalk.bold(`Progress: ${done.length}/${ARTIFACTS.length} artifacts`));
42
45
  console.log();
43
46
 
@@ -18,11 +18,20 @@ async function update() {
18
18
 
19
19
  fs.ensureDirSync(targetDir);
20
20
 
21
- const commandFiles = fs.readdirSync(commandsDir);
21
+ let commandFiles;
22
+ try {
23
+ commandFiles = fs.readdirSync(commandsDir);
24
+ } catch {
25
+ console.error(chalk.red('Templates directory missing — Product Kit installation may be corrupted.'));
26
+ process.exit(1);
27
+ }
22
28
  let updated = 0;
23
29
  let added = 0;
24
30
 
25
31
  for (const file of commandFiles) {
32
+ // Landscape is workspace-only, skip for projects
33
+ if (file === 'productkit.landscape.md') continue;
34
+
26
35
  const src = path.join(commandsDir, file);
27
36
  const dest = path.join(targetDir, file);
28
37
  const existed = fs.existsSync(dest);
@@ -37,10 +46,40 @@ async function update() {
37
46
  }
38
47
  }
39
48
 
40
- // Update CLAUDE.md
49
+ // Update workspace landscape command if in a workspace
50
+ const { getWorkspaceRoot } = require('../utils/fileUtils');
51
+ const workspaceRoot = getWorkspaceRoot(root);
52
+ if (workspaceRoot) {
53
+ const wsSrc = path.join(commandsDir, 'productkit.landscape.md');
54
+ const wsDest = path.join(workspaceRoot, '.claude', 'commands', 'productkit.landscape.md');
55
+ if (fs.existsSync(wsSrc)) {
56
+ fs.ensureDirSync(path.join(workspaceRoot, '.claude', 'commands'));
57
+ fs.copyFileSync(wsSrc, wsDest);
58
+ console.log(chalk.green(' ~ workspace landscape command updated'));
59
+ }
60
+ }
61
+
62
+ // Update CLAUDE.md — replace the Product Kit section, preserve user customizations
41
63
  const claudeSrc = path.join(templatesDir, 'CLAUDE.md');
42
64
  const claudeDest = path.join(root, 'CLAUDE.md');
43
- fs.copyFileSync(claudeSrc, claudeDest);
65
+ const templateContent = fs.readFileSync(claudeSrc, 'utf-8');
66
+
67
+ if (fs.existsSync(claudeDest)) {
68
+ const existingContent = fs.readFileSync(claudeDest, 'utf-8');
69
+ // Check if the file was created by init --existing (appended to user's CLAUDE.md)
70
+ const marker = '# Product Kit Project';
71
+ const markerIndex = existingContent.indexOf(marker);
72
+ if (markerIndex > 0) {
73
+ // Preserve everything before the Product Kit section
74
+ const userContent = existingContent.substring(0, markerIndex);
75
+ fs.writeFileSync(claudeDest, userContent + templateContent);
76
+ } else {
77
+ // Standalone CLAUDE.md — safe to replace entirely
78
+ fs.copyFileSync(claudeSrc, claudeDest);
79
+ }
80
+ } else {
81
+ fs.copyFileSync(claudeSrc, claudeDest);
82
+ }
44
83
 
45
84
  console.log();
46
85
  console.log(chalk.green.bold('Slash commands updated!'));
@@ -0,0 +1,63 @@
1
+ const fs = require('fs-extra');
2
+ const path = require('path');
3
+ const chalk = require('chalk');
4
+
5
+ async function workspace(workspaceName) {
6
+ if (!workspaceName) {
7
+ console.error(chalk.red('Error: Workspace name is required.'));
8
+ console.error(chalk.dim('Usage: productkit workspace <name>'));
9
+ process.exit(1);
10
+ }
11
+
12
+ const workspaceRoot = path.join(process.cwd(), workspaceName);
13
+
14
+ if (fs.existsSync(workspaceRoot)) {
15
+ console.error(chalk.red(`Error: Directory "${workspaceName}" already exists`));
16
+ process.exit(1);
17
+ }
18
+
19
+ try {
20
+ const templatesDir = path.join(__dirname, '..', '..', 'templates');
21
+
22
+ // Create workspace directory and config
23
+ fs.ensureDirSync(path.join(workspaceRoot, '.productkit'));
24
+ const pkgVersion = require('../../package.json').version;
25
+ fs.writeJsonSync(path.join(workspaceRoot, '.productkit', 'config.json'), {
26
+ type: 'workspace',
27
+ version: pkgVersion,
28
+ created: new Date().toISOString(),
29
+ knowledge_dir: 'knowledge',
30
+ }, { spaces: 2 });
31
+
32
+ // Copy landscape slash command to workspace level
33
+ fs.ensureDirSync(path.join(workspaceRoot, '.claude', 'commands'));
34
+ fs.copyFileSync(
35
+ path.join(templatesDir, 'commands', 'productkit.landscape.md'),
36
+ path.join(workspaceRoot, '.claude', 'commands', 'productkit.landscape.md')
37
+ );
38
+
39
+ // Create workspace-level knowledge directory
40
+ const knowledgeDir = path.join(workspaceRoot, 'knowledge');
41
+ fs.ensureDirSync(knowledgeDir);
42
+ fs.copyFileSync(
43
+ path.join(templatesDir, 'knowledge-README.md'),
44
+ path.join(knowledgeDir, 'README.md')
45
+ );
46
+
47
+ console.log(chalk.green.bold('Workspace created successfully!'));
48
+ console.log();
49
+ console.log(chalk.cyan('Workspace:'), workspaceName);
50
+ console.log();
51
+ console.log(chalk.cyan('Next steps:'));
52
+ console.log(` 1. cd ${workspaceName}`);
53
+ console.log(' 2. productkit init my-app');
54
+ console.log(' 3. claude');
55
+ console.log(` 4. /productkit.landscape ${chalk.dim('(writes to workspace root)')}`);
56
+ console.log();
57
+ } catch (error) {
58
+ console.error(chalk.red('Error creating workspace:'), error.message);
59
+ process.exit(1);
60
+ }
61
+ }
62
+
63
+ module.exports = workspace;
@@ -1,15 +1,12 @@
1
1
  const fs = require('fs-extra');
2
2
  const path = require('path');
3
3
 
4
- function isProductKitProject() {
5
- return fs.existsSync(path.join(process.cwd(), '.productkit'));
6
- }
7
-
8
- function getProjectRoot() {
9
- if (isProductKitProject()) {
10
- return process.cwd();
4
+ function resolveContainedPath(root, relativePath, fallback) {
5
+ const resolved = path.resolve(root, relativePath);
6
+ if (!resolved.startsWith(root + path.sep) && resolved !== root) {
7
+ return fallback;
11
8
  }
12
- return null;
9
+ return resolved;
13
10
  }
14
11
 
15
12
  function getArtifactDir(root) {
@@ -17,14 +14,63 @@ function getArtifactDir(root) {
17
14
  try {
18
15
  const config = fs.readJsonSync(configPath);
19
16
  if (config.artifact_dir) {
20
- return path.join(root, config.artifact_dir);
17
+ return resolveContainedPath(root, config.artifact_dir, root);
21
18
  }
22
19
  } catch {}
23
20
  return root;
24
21
  }
25
22
 
23
+ function getWorkspaceRoot(projectRoot) {
24
+ const parentDir = path.dirname(projectRoot);
25
+ const configPath = path.join(parentDir, '.productkit', 'config.json');
26
+ try {
27
+ const config = fs.readJsonSync(configPath);
28
+ if (config.type === 'workspace') {
29
+ return parentDir;
30
+ }
31
+ } catch {}
32
+ return null;
33
+ }
34
+
35
+ const ARTIFACT_FILES = [
36
+ 'landscape.md',
37
+ 'constitution.md',
38
+ 'users.md',
39
+ 'problem.md',
40
+ 'assumptions.md',
41
+ 'validation.md',
42
+ 'solution.md',
43
+ 'priorities.md',
44
+ 'spec.md',
45
+ 'audit.md',
46
+ 'knowledge-index.md',
47
+ 'techreview.md',
48
+ 'stories.md',
49
+ ];
50
+
51
+ const ARTIFACTS_WITH_COMMANDS = [
52
+ { file: 'landscape.md', command: '/productkit.landscape', label: 'Landscape' },
53
+ { file: 'constitution.md', command: '/productkit.constitution', label: 'Constitution' },
54
+ { file: 'users.md', command: '/productkit.users', label: 'Users' },
55
+ { file: 'problem.md', command: '/productkit.problem', label: 'Problem' },
56
+ { file: 'assumptions.md', command: '/productkit.assumptions', label: 'Assumptions' },
57
+ { file: 'validation.md', command: '/productkit.validate', label: 'Validation' },
58
+ { file: 'solution.md', command: '/productkit.solution', label: 'Solution' },
59
+ { file: 'priorities.md', command: '/productkit.prioritize', label: 'Priorities' },
60
+ { file: 'spec.md', command: '/productkit.spec', label: 'Spec' },
61
+ { file: 'audit.md', command: '/productkit.audit', label: 'Audit' },
62
+ { file: 'knowledge-index.md', command: '/productkit.learn', label: 'Knowledge Index' },
63
+ { file: 'techreview.md', command: '/productkit.techreview', label: 'Tech Review' },
64
+ { file: 'stories.md', command: '/productkit.stories', label: 'Stories' },
65
+ ];
66
+
67
+ // Lighter version without command info (for export/diff)
68
+ const ARTIFACTS = ARTIFACTS_WITH_COMMANDS.map(({ file, label }) => ({ file, label }));
69
+
26
70
  module.exports = {
27
- isProductKitProject,
28
- getProjectRoot,
29
71
  getArtifactDir,
72
+ getWorkspaceRoot,
73
+ ARTIFACT_FILES,
74
+ ARTIFACTS,
75
+ ARTIFACTS_WITH_COMMANDS,
30
76
  };
@@ -6,6 +6,7 @@ This project uses Product Kit for structured product thinking.
6
6
 
7
7
  Use these commands in order to build your product foundation:
8
8
 
9
+ 0. `/productkit.landscape` — Capture company, team, and domain context (run once, before everything else)
9
10
  1. `/productkit.constitution` — Define your product principles
10
11
  2. `/productkit.users` — Define target user personas
11
12
  3. `/productkit.problem` — Frame the problem statement
@@ -17,11 +18,19 @@ Use these commands in order to build your product foundation:
17
18
  9. `/productkit.clarify` — Resolve ambiguities across artifacts
18
19
  10. `/productkit.analyze` — Run a completeness/consistency check
19
20
  11. `/productkit.bootstrap` — Auto-draft all artifacts from an existing codebase
20
- 12. `/productkit.audit` — Compare spec against codebase and surface gaps
21
+ 12. `/productkit.audit` — Compare spec against codebase and surface gaps (post-build — what was actually implemented vs spec)
22
+ 13. `/productkit.learn` — Index knowledge directory into a summary for faster commands
23
+ 14. `/productkit.techreview` — Review spec against codebase and flag what needs engineering input (pre-build — feasibility before implementation)
24
+ 15. `/productkit.stories` — Break spec into user stories with acceptance criteria
25
+
26
+ ## Mode
27
+
28
+ Check `.productkit/config.json` for a `mode` field — either `"solo"` (building alone) or `"team"` (working with engineers/designers). Commands should adapt their output based on mode: solo mode can skip team-oriented sections (e.g., handoff notes, engineering specs), while team mode should include collaboration artifacts and detailed technical specs.
21
29
 
22
30
  ## Artifacts
23
31
 
24
32
  Product artifacts are written as markdown files. Check `.productkit/config.json` for an `artifact_dir` field — if set, artifacts live in that directory instead of the project root. Default artifact locations:
33
+ - `landscape.md` — Company, team, and domain landscape
25
34
  - `constitution.md` — Product principles and values
26
35
  - `users.md` — Target user personas
27
36
  - `problem.md` — Problem statement
@@ -30,9 +39,27 @@ Product artifacts are written as markdown files. Check `.productkit/config.json`
30
39
  - `solution.md` — Chosen solution with alternatives considered
31
40
  - `priorities.md` — Scored and ranked feature list
32
41
  - `spec.md` — Complete product spec ready for engineering
42
+ - `audit.md` — Spec vs codebase audit with gap analysis
43
+ - `knowledge-index.md` — Summary index of research files in `knowledge/`
44
+ - `techreview.md` — Technical feasibility review with effort estimates
45
+ - `stories.md` — User stories grouped by epic with acceptance criteria
33
46
 
34
47
  ## Workflow
35
48
 
36
- Start with `/productkit.constitution` or `/productkit.users`, then work through the commands in order. Each command reads previous artifacts to maintain consistency.
49
+ Start with `/productkit.landscape` to front-load company knowledge, then `/productkit.constitution` or `/productkit.users`, and work through the commands in order. Each command reads previous artifacts to maintain consistency.
37
50
 
38
51
  For existing projects, use `/productkit.bootstrap` to auto-draft all artifacts from your codebase in one session.
52
+
53
+ ## Workspaces
54
+
55
+ If this project lives inside a workspace (created with `productkit workspace`), it shares a workspace directory. The workspace holds:
56
+ - `landscape.md` at the workspace root — shared company/domain context across all projects
57
+ - `knowledge/` at the workspace root — shared research files
58
+
59
+ All slash commands automatically detect workspace membership by checking `../.productkit/config.json` for `"type": "workspace"`. Workspace-level `landscape.md` and `knowledge/` supplement project-level files.
60
+
61
+ ## Knowledge Directory
62
+
63
+ The `knowledge/` directory is for raw research files — interview transcripts, survey results, analytics exports, PDFs, and other evidence. Run `/productkit.learn` to index these files into `knowledge-index.md` — a compact summary that all other slash commands read instead of scanning raw files directly. Check `.productkit/config.json` for a `knowledge_dir` field (default: `knowledge`).
64
+
65
+ If the project is inside a workspace, `/productkit.learn` also indexes the workspace-level `knowledge/` directory.
@@ -10,6 +10,7 @@ claude
10
10
 
11
11
  Then use the slash commands to build your product foundation:
12
12
 
13
+ 0. `/productkit.landscape` — Capture company, team, and domain context
13
14
  1. `/productkit.constitution` — Define your product principles
14
15
  2. `/productkit.users` — Define target user personas
15
16
  3. `/productkit.problem` — Frame the problem statement
@@ -22,6 +23,9 @@ Then use the slash commands to build your product foundation:
22
23
  10. `/productkit.analyze` — Check consistency and completeness
23
24
  11. `/productkit.bootstrap` — Auto-draft all artifacts from existing codebase
24
25
  12. `/productkit.audit` — Compare spec against actual implementation
26
+ 13. `/productkit.learn` — Index knowledge directory for faster commands
27
+ 14. `/productkit.techreview` — Review spec against codebase, flag engineering questions
28
+ 15. `/productkit.stories` — Break spec into user stories with acceptance criteria
25
29
 
26
30
  ## Artifacts
27
31
 
@@ -29,6 +33,7 @@ Artifacts are written to the project root by default. If `artifact_dir` is set i
29
33
 
30
34
  | File | Description |
31
35
  |------|-------------|
36
+ | `landscape.md` | Company, team, and domain landscape |
32
37
  | `constitution.md` | Product principles and values |
33
38
  | `users.md` | Target user personas |
34
39
  | `problem.md` | Problem statement |
@@ -37,3 +42,15 @@ Artifacts are written to the project root by default. If `artifact_dir` is set i
37
42
  | `solution.md` | Chosen solution with alternatives considered |
38
43
  | `priorities.md` | Scored and ranked feature list |
39
44
  | `spec.md` | Complete product spec ready for engineering |
45
+ | `audit.md` | Spec vs codebase audit with gap analysis |
46
+ | `knowledge-index.md` | Summary index of research files in `knowledge/` |
47
+ | `techreview.md` | Technical feasibility review with effort estimates |
48
+ | `stories.md` | User stories grouped by epic with acceptance criteria |
49
+
50
+ ## Workspaces
51
+
52
+ If this project lives inside a workspace (created with `productkit workspace <name>`), the workspace root contains shared `landscape.md` and `knowledge/` that all projects inherit automatically.
53
+
54
+ ## Knowledge Directory
55
+
56
+ Drop raw research files into the `knowledge/` directory — interview transcripts, survey results, analytics exports, PDFs, etc. Run `/productkit.learn` to index these files into `knowledge-index.md` — all other slash commands read this index instead of scanning raw files directly. If inside a workspace, `/productkit.learn` also indexes the workspace-level `knowledge/` directory.
@@ -13,11 +13,20 @@ Evaluate the overall quality, consistency, and completeness of the product think
13
13
  Check `.productkit/config.json` for an `artifact_dir` field. If set, read artifacts there instead of the project root. If not set, default to the project root.
14
14
 
15
15
  Read all existing artifacts:
16
+ - `landscape.md`
16
17
  - `constitution.md`
17
18
  - `users.md`
18
19
  - `problem.md`
19
20
  - `assumptions.md`
20
21
 
22
+ Read `knowledge-index.md` if it exists — it contains a summary of research from the `knowledge/` directory. Check whether artifacts adequately reference available evidence. If the file doesn't exist but `knowledge/` has files, suggest running `/productkit.learn` first.
23
+
24
+ ### Workspace Context
25
+
26
+ Check if this project is inside a workspace: look for `../.productkit/config.json` with `"type": "workspace"`. If yes:
27
+ - Read `landscape.md` from the workspace root (parent directory) — this is shared company/domain landscape.
28
+ - Also read workspace-level `knowledge-index.md` if it exists. Workspace research index supplements (does not replace) project-level research index.
29
+
21
30
  Work with whatever exists.
22
31
 
23
32
  ## Analysis Dimensions
@@ -17,8 +17,17 @@ Read these files first (required):
17
17
  If either file is missing, tell the user which commands to run first.
18
18
 
19
19
  Also read if they exist:
20
+ - `landscape.md` — company and domain landscape
20
21
  - `constitution.md` — product principles
21
22
 
23
+ Read `knowledge-index.md` if it exists — it contains a summary of research from the `knowledge/` directory. Reference relevant findings when identifying assumptions that need validation. If the file doesn't exist but `knowledge/` has files, suggest running `/productkit.learn` first.
24
+
25
+ ### Workspace Context
26
+
27
+ Check if this project is inside a workspace: look for `../.productkit/config.json` with `"type": "workspace"`. If yes:
28
+ - Read `landscape.md` from the workspace root (parent directory) — this is shared company/domain landscape.
29
+ - Also read workspace-level `knowledge-index.md` if it exists. Workspace research index supplements (does not replace) project-level research index.
30
+
22
31
  ## Process
23
32
 
24
33
  1. **Extract assumptions** — Read through each artifact and identify every assumption (stated and unstated)
@@ -17,10 +17,17 @@ Read these artifacts (required):
17
17
  - `priorities.md` — feature priorities and v1 scope (required)
18
18
 
19
19
  Also read if they exist:
20
+ - `landscape.md` — company and domain landscape
20
21
  - `solution.md` — chosen solution
21
22
  - `validation.md` — assumption validation results
22
23
  - `assumptions.md` — known risks
23
24
 
25
+ ### Workspace Context
26
+
27
+ Check if this project is inside a workspace: look for `../.productkit/config.json` with `"type": "workspace"`. If yes:
28
+ - Read `landscape.md` from the workspace root (parent directory) — this is shared company/domain landscape.
29
+ - Also read workspace-level `knowledge-index.md` if it exists. Workspace research index supplements (does not replace) project-level research index.
30
+
24
31
  At minimum, `spec.md` must exist. If it's missing, tell the user to run `/productkit.spec` first.
25
32
 
26
33
  ### Scan the codebase
@@ -10,7 +10,14 @@ Analyze the existing project — code, docs, README, config files, comments —
10
10
 
11
11
  ## Before You Start
12
12
 
13
- 1. Read the project's README, CLAUDE.md, package.json (or equivalent), and scan the directory structure to understand what this project does.
13
+ 1. Read the project's README, CLAUDE.md, package.json (or equivalent), and scan the directory structure to understand what this project does. Also read `landscape.md` if it exists — use it for company and domain context. Read `knowledge-index.md` if it exists — it contains a summary of research from the `knowledge/` directory. Reference relevant findings as evidence when drafting artifacts. If the file doesn't exist but `knowledge/` has files, suggest running `/productkit.learn` first.
14
+
15
+ ### Workspace Context
16
+
17
+ Check if this project is inside a workspace: look for `../.productkit/config.json` with `"type": "workspace"`. If yes:
18
+ - Read `landscape.md` from the workspace root (parent directory) — this is shared company/domain landscape.
19
+ - Also read workspace-level `knowledge-index.md` if it exists. Workspace research index supplements (does not replace) project-level research index.
20
+
14
21
  2. Check `.productkit/config.json` for an `artifact_dir` field. If set, read and write artifacts there instead of the project root. If not set, default to the project root.
15
22
  3. Check which artifacts already exist (constitution.md, users.md, problem.md, assumptions.md, solution.md, priorities.md, spec.md) in the artifact directory. **Skip any that already exist** — tell the user you're skipping them.
16
23
  4. Check `.productkit/config.json` — if `minimal: true`, skip `constitution.md`.
@@ -13,11 +13,20 @@ Cross-reference all existing artifacts, find inconsistencies, and guide the user
13
13
  Check `.productkit/config.json` for an `artifact_dir` field. If set, read and write artifacts there instead of the project root. If not set, default to the project root.
14
14
 
15
15
  Read all existing artifacts:
16
+ - `landscape.md`
16
17
  - `constitution.md`
17
18
  - `users.md`
18
19
  - `problem.md`
19
20
  - `assumptions.md`
20
21
 
22
+ Read `knowledge-index.md` if it exists — it contains a summary of research from the `knowledge/` directory. Reference relevant findings when checking for contradictions between research evidence and artifact claims. If the file doesn't exist but `knowledge/` has files, suggest running `/productkit.learn` first.
23
+
24
+ ### Workspace Context
25
+
26
+ Check if this project is inside a workspace: look for `../.productkit/config.json` with `"type": "workspace"`. If yes:
27
+ - Read `landscape.md` from the workspace root (parent directory) — this is shared company/domain landscape.
28
+ - Also read workspace-level `knowledge-index.md` if it exists. Workspace research index supplements (does not replace) project-level research index.
29
+
21
30
  Work with whatever exists — this command can run at any stage.
22
31
 
23
32
  ## Process
@@ -8,13 +8,28 @@ You are a product management coach helping establish a product constitution —
8
8
 
9
9
  Act as a seasoned PM mentor. Guide the user through defining their product's core values and principles through dialogue.
10
10
 
11
+ ## Before You Start
12
+
13
+ Check `.productkit/config.json` for an `artifact_dir` field. If set, write artifacts there instead of the project root. If not set, default to the project root.
14
+
15
+ Read `landscape.md` if it exists — use company, domain, and team context to ask more relevant questions and ground the constitution in real constraints.
16
+
17
+ Read `knowledge-index.md` if it exists — it contains a summary of research from the `knowledge/` directory. Reference relevant findings as evidence when drafting principles. If the file doesn't exist but `knowledge/` has files, suggest running `/productkit.learn` first.
18
+
19
+ ### Workspace Context
20
+
21
+ Check if this project is inside a workspace: look for `../.productkit/config.json` with `"type": "workspace"`. If yes:
22
+ - Read `landscape.md` from the workspace root (parent directory) — this is shared company/domain landscape.
23
+ - Also read workspace-level `knowledge-index.md` if it exists. Workspace research index supplements (does not replace) project-level research index.
24
+
11
25
  ## Process
12
26
 
13
27
  1. **Ask about the product vision** — What change do they want to see in the world?
14
28
  2. **Explore values** — What matters most? Speed vs quality? Privacy vs convenience? Ask them to make hard tradeoffs.
15
29
  3. **Identify non-negotiables** — What will this product NEVER do?
16
30
  4. **Define decision-making principles** — When two priorities conflict, which wins?
17
- 5. **Draft the constitution** — Synthesize into a clear, concise document.
31
+ 5. **Capture prior research & decisions** — What user research has been done for this project? Are there existing product documents (PRDs, strategy docs, OKRs)? What decisions are already locked in? What's been tried before that didn't work?
32
+ 6. **Draft the constitution** — Synthesize into a clear, concise document.
18
33
 
19
34
  ## Conversation Style
20
35
 
@@ -45,4 +60,10 @@ Write the final constitution to `constitution.md` with this format:
45
60
 
46
61
  ## Decision Framework
47
62
  When [X] conflicts with [Y], we choose [X] because [reason].
63
+
64
+ ## Prior Research & Decisions
65
+ - **Research Done:** [Summary of existing user research for this project]
66
+ - **Existing Docs:** [PRDs, strategy docs, OKRs, etc.]
67
+ - **Decisions Made:** [Key decisions already locked in]
68
+ - **Failed Approaches:** [What's been tried and didn't work]
48
69
  ```