claude-autopm 1.20.1 → 1.22.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 (141) hide show
  1. package/README.md +255 -878
  2. package/autopm/.claude/agents/cloud/gcp-cloud-functions-engineer.md +5 -10
  3. package/autopm/.claude/agents/cloud/gemini-api-expert.md +1 -1
  4. package/autopm/.claude/agents/cloud/openai-python-expert.md +1 -1
  5. package/autopm/.claude/agents/cloud/terraform-infrastructure-expert.md +7 -11
  6. package/autopm/.claude/agents/core/mcp-manager.md +7 -0
  7. package/autopm/.claude/agents/data/airflow-orchestration-expert.md +1 -1
  8. package/autopm/.claude/agents/data/kedro-pipeline-expert.md +1 -1
  9. package/autopm/.claude/agents/data/langgraph-workflow-expert.md +1 -1
  10. package/autopm/.claude/agents/databases/bigquery-expert.md +1 -1
  11. package/autopm/.claude/agents/databases/cosmosdb-expert.md +1 -1
  12. package/autopm/.claude/agents/databases/mongodb-expert.md +1 -1
  13. package/autopm/.claude/agents/databases/postgresql-expert.md +1 -1
  14. package/autopm/.claude/agents/databases/redis-expert.md +1 -1
  15. package/autopm/.claude/agents/decision-matrices/playwright-testing-selection.md +6 -0
  16. package/autopm/.claude/agents/decision-matrices/python-backend-selection.md +7 -0
  17. package/autopm/.claude/agents/decision-matrices/ui-framework-selection.md +7 -0
  18. package/autopm/.claude/agents/devops/azure-devops-specialist.md +1 -1
  19. package/autopm/.claude/agents/devops/github-operations-specialist.md +7 -0
  20. package/autopm/.claude/agents/devops/mcp-context-manager.md +7 -0
  21. package/autopm/.claude/agents/devops/ssh-operations-expert.md +1 -1
  22. package/autopm/.claude/agents/devops/traefik-proxy-expert.md +1 -1
  23. package/autopm/.claude/agents/frameworks/nats-messaging-expert.md +1 -1
  24. package/autopm/.claude/agents/frameworks/react-frontend-engineer.md +1 -1
  25. package/autopm/.claude/agents/languages/bash-scripting-expert.md +1 -1
  26. package/autopm/.claude/agents/languages/javascript-frontend-engineer.md +1 -1
  27. package/autopm/.claude/agents/languages/nodejs-backend-engineer.md +3 -7
  28. package/autopm/.claude/agents/languages/python-backend-engineer.md +1 -1
  29. package/autopm/.claude/commands/ai/langgraph-workflow.md +17 -0
  30. package/autopm/.claude/commands/ai/openai-chat.md +17 -0
  31. package/autopm/.claude/commands/azure/active-work.md +17 -0
  32. package/autopm/.claude/commands/azure/aliases.md +17 -0
  33. package/autopm/.claude/commands/azure/blocked-items.md +17 -0
  34. package/autopm/.claude/commands/azure/clean.md +17 -0
  35. package/autopm/.claude/commands/azure/docs-query.md +17 -0
  36. package/autopm/.claude/commands/azure/feature-decompose.md +17 -0
  37. package/autopm/.claude/commands/azure/feature-list.md +17 -0
  38. package/autopm/.claude/commands/azure/feature-new.md +17 -0
  39. package/autopm/.claude/commands/azure/feature-show.md +17 -0
  40. package/autopm/.claude/commands/azure/feature-start.md +17 -0
  41. package/autopm/.claude/commands/azure/fix-integration-example.md +17 -0
  42. package/autopm/.claude/commands/azure/help.md +17 -0
  43. package/autopm/.claude/commands/azure/import-us.md +17 -0
  44. package/autopm/.claude/commands/azure/init.md +17 -0
  45. package/autopm/.claude/commands/azure/next-task.md +17 -0
  46. package/autopm/.claude/commands/azure/search.md +17 -0
  47. package/autopm/.claude/commands/azure/sprint-status.md +17 -0
  48. package/autopm/.claude/commands/azure/standup.md +17 -0
  49. package/autopm/.claude/commands/azure/sync-all.md +17 -0
  50. package/autopm/.claude/commands/azure/task-analyze.md +17 -0
  51. package/autopm/.claude/commands/azure/task-close.md +17 -0
  52. package/autopm/.claude/commands/azure/task-edit.md +17 -0
  53. package/autopm/.claude/commands/azure/task-list.md +17 -0
  54. package/autopm/.claude/commands/azure/task-new.md +17 -0
  55. package/autopm/.claude/commands/azure/task-reopen.md +17 -0
  56. package/autopm/.claude/commands/azure/task-show.md +17 -0
  57. package/autopm/.claude/commands/azure/task-start.md +17 -0
  58. package/autopm/.claude/commands/azure/task-status.md +17 -0
  59. package/autopm/.claude/commands/azure/task-sync.md +17 -0
  60. package/autopm/.claude/commands/azure/us-edit.md +17 -0
  61. package/autopm/.claude/commands/azure/us-list.md +17 -0
  62. package/autopm/.claude/commands/azure/us-new.md +17 -0
  63. package/autopm/.claude/commands/azure/us-parse.md +17 -0
  64. package/autopm/.claude/commands/azure/us-show.md +17 -0
  65. package/autopm/.claude/commands/azure/us-status.md +17 -0
  66. package/autopm/.claude/commands/azure/validate.md +17 -0
  67. package/autopm/.claude/commands/azure/work-item-sync.md +17 -0
  68. package/autopm/.claude/commands/cloud/infra-deploy.md +17 -0
  69. package/autopm/.claude/commands/config/toggle-features.md +15 -0
  70. package/autopm/.claude/commands/context/create.md +16 -0
  71. package/autopm/.claude/commands/context/prime.md +16 -0
  72. package/autopm/.claude/commands/context/update.md +16 -0
  73. package/autopm/.claude/commands/github/workflow-create.md +17 -0
  74. package/autopm/.claude/commands/infrastructure/ssh-security.md +17 -0
  75. package/autopm/.claude/commands/infrastructure/traefik-setup.md +17 -0
  76. package/autopm/.claude/commands/kubernetes/deploy.md +16 -0
  77. package/autopm/.claude/commands/mcp/context-setup.md +17 -0
  78. package/autopm/.claude/commands/mcp/docs-refresh.md +17 -0
  79. package/autopm/.claude/commands/playwright/test-scaffold.md +17 -0
  80. package/autopm/.claude/commands/pm/blocked.md +17 -0
  81. package/autopm/.claude/commands/pm/clean.md +17 -0
  82. package/autopm/.claude/commands/pm/context.md +17 -0
  83. package/autopm/.claude/commands/pm/epic-close.md +17 -0
  84. package/autopm/.claude/commands/pm/epic-decompose.md +16 -0
  85. package/autopm/.claude/commands/pm/epic-edit.md +17 -0
  86. package/autopm/.claude/commands/pm/epic-list.md +17 -0
  87. package/autopm/.claude/commands/pm/epic-merge.md +17 -0
  88. package/autopm/.claude/commands/pm/epic-oneshot.md +17 -0
  89. package/autopm/.claude/commands/pm/epic-refresh.md +17 -0
  90. package/autopm/.claude/commands/pm/epic-show.md +17 -0
  91. package/autopm/.claude/commands/pm/epic-split.md +17 -0
  92. package/autopm/.claude/commands/pm/epic-start.md +17 -0
  93. package/autopm/.claude/commands/pm/epic-status.md +17 -0
  94. package/autopm/.claude/commands/pm/epic-sync-modular.md +17 -0
  95. package/autopm/.claude/commands/pm/epic-sync-original.md +17 -0
  96. package/autopm/.claude/commands/pm/epic-sync.md +54 -4
  97. package/autopm/.claude/commands/pm/help.md +17 -0
  98. package/autopm/.claude/commands/pm/import.md +17 -0
  99. package/autopm/.claude/commands/pm/in-progress.md +17 -0
  100. package/autopm/.claude/commands/pm/init.md +17 -0
  101. package/autopm/.claude/commands/pm/issue-analyze.md +17 -0
  102. package/autopm/.claude/commands/pm/issue-close.md +17 -0
  103. package/autopm/.claude/commands/pm/issue-edit.md +17 -0
  104. package/autopm/.claude/commands/pm/issue-reopen.md +17 -0
  105. package/autopm/.claude/commands/pm/issue-show.md +17 -0
  106. package/autopm/.claude/commands/pm/issue-start.md +16 -0
  107. package/autopm/.claude/commands/pm/issue-status.md +17 -0
  108. package/autopm/.claude/commands/pm/issue-sync.md +17 -0
  109. package/autopm/.claude/commands/pm/next.md +17 -0
  110. package/autopm/.claude/commands/pm/prd-edit.md +17 -0
  111. package/autopm/.claude/commands/pm/prd-list.md +17 -0
  112. package/autopm/.claude/commands/pm/prd-new.md +16 -0
  113. package/autopm/.claude/commands/pm/prd-parse.md +17 -0
  114. package/autopm/.claude/commands/pm/prd-status.md +17 -0
  115. package/autopm/.claude/commands/pm/search.md +17 -0
  116. package/autopm/.claude/commands/pm/standup.md +17 -0
  117. package/autopm/.claude/commands/pm/status.md +17 -0
  118. package/autopm/.claude/commands/pm/sync.md +17 -0
  119. package/autopm/.claude/commands/pm/test-reference-update.md +17 -0
  120. package/autopm/.claude/commands/pm/validate.md +17 -0
  121. package/autopm/.claude/commands/pm/what-next.md +17 -0
  122. package/autopm/.claude/commands/python/api-scaffold.md +17 -0
  123. package/autopm/.claude/commands/python/docs-query.md +17 -0
  124. package/autopm/.claude/commands/react/app-scaffold.md +17 -0
  125. package/autopm/.claude/commands/testing/prime.md +17 -0
  126. package/autopm/.claude/commands/testing/run.md +17 -0
  127. package/autopm/.claude/commands/ui/bootstrap-scaffold.md +17 -0
  128. package/autopm/.claude/commands/ui/tailwind-system.md +17 -0
  129. package/autopm/.claude/hooks/pre-agent-context7.js +224 -0
  130. package/autopm/.claude/hooks/pre-command-context7.js +229 -0
  131. package/autopm/.claude/rules/context7-enforcement.md +292 -0
  132. package/autopm/.claude/rules/framework-path-rules.md +180 -0
  133. package/autopm/.claude/scripts/pm/epic-sync/README.md +208 -0
  134. package/autopm/.claude/scripts/pm/epic-sync/create-epic-issue.sh +68 -192
  135. package/autopm/.claude/scripts/pm/epic-sync/create-task-issues.sh +60 -328
  136. package/autopm/.claude/scripts/pm/epic-sync/update-epic-file.sh +61 -354
  137. package/autopm/.claude/scripts/pm/epic-sync/update-references.sh +67 -305
  138. package/autopm/.claude/scripts/pm/epic-sync.sh +137 -0
  139. package/package.json +4 -2
  140. package/scripts/add-context7-to-commands.js +351 -0
  141. package/scripts/validate-framework-paths.sh +104 -0
@@ -0,0 +1,229 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Pre-Command Context7 Hook
5
+ *
6
+ * MANDATORY: This hook enforces Context7 documentation queries BEFORE command execution.
7
+ *
8
+ * Workflow:
9
+ * 1. Intercept command execution (e.g., /pm:epic-decompose)
10
+ * 2. Extract command file path from .claude/commands/{category}/{command}.md
11
+ * 3. Parse "Documentation Queries" section
12
+ * 4. Query Context7 MCP for each link
13
+ * 5. Inject results into execution context
14
+ * 6. Allow command to proceed with Context7 knowledge
15
+ *
16
+ * Zero Tolerance: If Context7 query fails, execution STOPS.
17
+ */
18
+
19
+ const fs = require('fs');
20
+ const path = require('path');
21
+
22
+ /**
23
+ * Extract command metadata from invocation
24
+ * @param {string} commandInvocation - e.g., "/pm:epic-decompose feature-name"
25
+ * @returns {object} { category, command, args }
26
+ */
27
+ function parseCommandInvocation(commandInvocation) {
28
+ // Remove leading slash and split
29
+ const cleaned = commandInvocation.replace(/^\//, '');
30
+ const [categoryCommand, ...args] = cleaned.split(/\s+/);
31
+ const [category, command] = categoryCommand.split(':');
32
+
33
+ return {
34
+ category: category || 'pm', // Default to pm if no category
35
+ command: command || categoryCommand,
36
+ args: args,
37
+ fullCommand: categoryCommand
38
+ };
39
+ }
40
+
41
+ /**
42
+ * Find command file in .claude/commands/
43
+ * @param {string} category - Command category (pm, azure, cloud, etc.)
44
+ * @param {string} command - Command name (epic-decompose, issue-start, etc.)
45
+ * @returns {string|null} - Path to command file or null
46
+ */
47
+ function findCommandFile(category, command) {
48
+ const baseDir = path.join(process.cwd(), '.claude', 'commands');
49
+
50
+ // Try exact match first
51
+ let commandPath = path.join(baseDir, category, `${command}.md`);
52
+ if (fs.existsSync(commandPath)) {
53
+ return commandPath;
54
+ }
55
+
56
+ // Try with underscores (epic-decompose → epic_decompose)
57
+ const underscored = command.replace(/-/g, '_');
58
+ commandPath = path.join(baseDir, category, `${underscored}.md`);
59
+ if (fs.existsSync(commandPath)) {
60
+ return commandPath;
61
+ }
62
+
63
+ // Try without category prefix if command includes it
64
+ if (command.includes('-')) {
65
+ const [, actualCommand] = command.split('-', 2);
66
+ if (actualCommand) {
67
+ commandPath = path.join(baseDir, category, `${actualCommand}.md`);
68
+ if (fs.existsSync(commandPath)) {
69
+ return commandPath;
70
+ }
71
+ }
72
+ }
73
+
74
+ return null;
75
+ }
76
+
77
+ /**
78
+ * Extract Documentation Queries from command file
79
+ * @param {string} filePath - Path to command .md file
80
+ * @returns {Array<{url: string, description: string}>}
81
+ */
82
+ function extractDocumentationQueries(filePath) {
83
+ const content = fs.readFileSync(filePath, 'utf8');
84
+ const queries = [];
85
+
86
+ // Find the Documentation Queries section
87
+ const querySection = content.match(/\*\*Documentation Queries:\*\*\s*\n([\s\S]*?)(?=\n\n|\*\*Why This is Required|\n##|$)/);
88
+
89
+ if (!querySection) {
90
+ return queries; // No Documentation Queries section found
91
+ }
92
+
93
+ // Extract each mcp://context7/... line
94
+ const lines = querySection[1].split('\n');
95
+ for (const line of lines) {
96
+ const match = line.match(/`(mcp:\/\/context7\/[^`]+)`\s*-\s*(.+)/);
97
+ if (match) {
98
+ queries.push({
99
+ url: match[1],
100
+ description: match[2].trim()
101
+ });
102
+ }
103
+ }
104
+
105
+ return queries;
106
+ }
107
+
108
+ /**
109
+ * Query Context7 MCP server
110
+ * @param {string} mcpUrl - e.g., "mcp://context7/agile/epic-decomposition"
111
+ * @returns {Promise<object>} - Context7 response
112
+ */
113
+ async function queryContext7(mcpUrl) {
114
+ // Parse MCP URL: mcp://context7/category/topic
115
+ const urlMatch = mcpUrl.match(/mcp:\/\/context7\/(.+)/);
116
+ if (!urlMatch) {
117
+ throw new Error(`Invalid Context7 URL format: ${mcpUrl}`);
118
+ }
119
+
120
+ const topicPath = urlMatch[1]; // e.g., "agile/epic-decomposition"
121
+
122
+ // In real implementation, this would call the MCP server
123
+ // For now, return a placeholder that instructs Claude to query
124
+ return {
125
+ url: mcpUrl,
126
+ topic: topicPath,
127
+ instruction: `MANDATORY: Query Context7 MCP for topic "${topicPath}" before proceeding with implementation.`,
128
+ placeholder: true
129
+ };
130
+ }
131
+
132
+ /**
133
+ * Main hook execution
134
+ * @param {string} commandInvocation - Full command string from user
135
+ */
136
+ async function main(commandInvocation) {
137
+ console.log('\n🔒 Context7 Pre-Command Hook Activated\n');
138
+
139
+ // Parse command
140
+ const { category, command, args, fullCommand } = parseCommandInvocation(commandInvocation || process.argv[2] || '');
141
+
142
+ console.log(`📋 Command: /${fullCommand}`);
143
+ console.log(` Category: ${category}`);
144
+ console.log(` Command: ${command}`);
145
+ if (args.length > 0) {
146
+ console.log(` Arguments: ${args.join(' ')}`);
147
+ }
148
+
149
+ // Find command file
150
+ const commandFile = findCommandFile(category, command);
151
+ if (!commandFile) {
152
+ console.log(`\n⚠️ Warning: Command file not found for /${fullCommand}`);
153
+ console.log(` Searched: .claude/commands/${category}/${command}.md`);
154
+ console.log(` Proceeding without Context7 enforcement (file may not exist yet)\n`);
155
+ return;
156
+ }
157
+
158
+ console.log(` File: ${path.relative(process.cwd(), commandFile)}`);
159
+
160
+ // Extract Documentation Queries
161
+ const queries = extractDocumentationQueries(commandFile);
162
+
163
+ if (queries.length === 0) {
164
+ console.log(`\n❌ CRITICAL: No Documentation Queries found in command file!`);
165
+ console.log(` This violates Context7 enforcement policy.`);
166
+ console.log(` ALL commands MUST have Documentation Queries section.`);
167
+ console.log(`\n Please add to ${path.basename(commandFile)}:`);
168
+ console.log(` ## Required Documentation Access`);
169
+ console.log(` **MANDATORY:** Before [action], query Context7 for best practices:`);
170
+ console.log(` **Documentation Queries:**`);
171
+ console.log(` - \`mcp://context7/...\` - Description`);
172
+ console.log(`\n Blocking execution until fixed.\n`);
173
+ process.exit(1);
174
+ }
175
+
176
+ console.log(`\n📚 Context7 Documentation Queries Required: ${queries.length}\n`);
177
+
178
+ // Query Context7 for each link
179
+ const results = [];
180
+ for (const query of queries) {
181
+ console.log(` ➜ ${query.url}`);
182
+ console.log(` ${query.description}`);
183
+
184
+ try {
185
+ const result = await queryContext7(query.url);
186
+ results.push(result);
187
+ } catch (error) {
188
+ console.log(`\n❌ Context7 query FAILED: ${error.message}`);
189
+ console.log(` Cannot proceed without Context7 documentation.`);
190
+ console.log(` Please ensure Context7 MCP server is running.\n`);
191
+ process.exit(1);
192
+ }
193
+ }
194
+
195
+ console.log(`\n✅ Context7 Queries Complete\n`);
196
+ console.log(`📖 REMINDER: You MUST use Context7 documentation in your implementation:`);
197
+ console.log(` • Apply patterns from Context7 examples`);
198
+ console.log(` • Verify API signatures against Context7 results`);
199
+ console.log(` • Follow best practices documented in Context7`);
200
+ console.log(` • Flag any conflicts between training data and Context7`);
201
+ console.log(`\n🚀 Proceeding with command execution...\n`);
202
+
203
+ // In production, this would inject Context7 results into Claude's context
204
+ // For now, we output instruction for Claude to see
205
+ if (results.length > 0 && results[0].placeholder) {
206
+ console.log(`⚡ ACTION REQUIRED:`);
207
+ console.log(` Before implementing /${fullCommand}, you MUST:`);
208
+ for (const result of results) {
209
+ console.log(` • ${result.instruction}`);
210
+ }
211
+ console.log();
212
+ }
213
+ }
214
+
215
+ // Execute if run directly
216
+ if (require.main === module) {
217
+ const commandInvocation = process.argv.slice(2).join(' ');
218
+ main(commandInvocation).catch(error => {
219
+ console.error('\n❌ Hook execution failed:', error.message);
220
+ process.exit(1);
221
+ });
222
+ }
223
+
224
+ module.exports = {
225
+ parseCommandInvocation,
226
+ findCommandFile,
227
+ extractDocumentationQueries,
228
+ queryContext7
229
+ };
@@ -0,0 +1,292 @@
1
+ # Context7 Documentation Enforcement
2
+
3
+ > **CRITICAL**: This rule has HIGHEST PRIORITY. ALL commands and agents MUST query Context7 before execution.
4
+
5
+ ## Core Context7 Philosophy
6
+
7
+ **Prime Directive**: Query live documentation from Context7 MCP BEFORE implementing any solution.
8
+ **Zero Tolerance**: No implementation without Context7 query. No reliance on training data. No shortcuts.
9
+
10
+ ## Why This is Critical
11
+
12
+ ### Problems We Solve
13
+
14
+ - **Hallucinations**: AI training data becomes stale, leading to outdated patterns
15
+ - **API Changes**: Frameworks evolve - training data doesn't reflect latest versions
16
+ - **Best Practices Drift**: Industry standards change faster than model retraining
17
+ - **Version Conflicts**: Code suggestions may target wrong framework versions
18
+
19
+ ### Context7 Benefits
20
+
21
+ - **Always Current**: Live documentation reflects latest releases
22
+ - **Verified Patterns**: Real code examples from official sources
23
+ - **API Accuracy**: Current function signatures, parameters, return types
24
+ - **Breaking Changes**: Immediate awareness of deprecated patterns
25
+
26
+ ## The Context7 Cycle
27
+
28
+ ### 1. QUERY Phase (Before Implementation)
29
+
30
+ **MANDATORY Steps:**
31
+ 1. Read command/agent file to extract `**Documentation Queries:**` section
32
+ 2. Query EACH Context7 MCP link listed
33
+ 3. Analyze results for relevant patterns, APIs, and best practices
34
+ 4. Summarize key findings before proceeding
35
+
36
+ **Required Information:**
37
+ - Current API signatures and parameters
38
+ - Recommended patterns and anti-patterns
39
+ - Breaking changes from recent versions
40
+ - Official code examples
41
+
42
+ ### 2. IMPLEMENT Phase (Using Context7 Knowledge)
43
+
44
+ **Requirements:**
45
+ - Apply patterns EXACTLY as documented in Context7 results
46
+ - Use API signatures from Context7 (not from training data)
47
+ - Follow architectural recommendations from live docs
48
+ - Reference Context7 findings in code comments where applicable
49
+
50
+ **Verification:**
51
+ - Cross-check implementation against Context7 examples
52
+ - Validate parameters match current API documentation
53
+ - Ensure no deprecated patterns are used
54
+
55
+ ### 3. VALIDATE Phase (Post-Implementation)
56
+
57
+ **Mandatory Checks:**
58
+ - Implementation matches Context7 best practices
59
+ - No training data hallucinations introduced
60
+ - Code follows latest framework conventions
61
+ - All deprecation warnings addressed
62
+
63
+ ## Enforcement Rules
64
+
65
+ ### ABSOLUTE REQUIREMENTS
66
+
67
+ **For ALL Commands:**
68
+ - MUST read `## Required Documentation Access` section
69
+ - MUST query EVERY `mcp://context7/...` link before execution
70
+ - MUST summarize Context7 findings before proceeding
71
+ - MUST apply Context7 guidance in implementation
72
+
73
+ **For ALL Agents:**
74
+ - MUST read `**Documentation Queries:**` section
75
+ - MUST query Context7 before making technical decisions
76
+ - MUST verify API signatures against live documentation
77
+ - MUST flag conflicts between training data and Context7
78
+
79
+ **For ALL Implementations:**
80
+ - NO code based solely on training data for technical specifics
81
+ - NO assumptions about API signatures without Context7 verification
82
+ - NO "I think this is how it works" - VERIFY with Context7
83
+ - NO skipping Context7 "because it's a small change"
84
+
85
+ ### PROHIBITED PRACTICES
86
+
87
+ - ❌ Implementing without querying Context7 first
88
+ - ❌ "I remember how this works" - training data is stale
89
+ - ❌ Skipping Context7 for "simple" or "obvious" tasks
90
+ - ❌ Using cached knowledge instead of live documentation
91
+ - ❌ Proceeding when Context7 query fails (STOP and report)
92
+ - ❌ Ignoring Context7 guidance because training data "seems better"
93
+
94
+ ## Query Quality Standards
95
+
96
+ ### Effective Context7 Queries
97
+
98
+ **DO:**
99
+ - ✅ Query ALL links in Documentation Queries section
100
+ - ✅ Request specific topics relevant to the task
101
+ - ✅ Ask for code examples and patterns
102
+ - ✅ Verify API signatures and parameters
103
+ - ✅ Check for breaking changes and migrations
104
+
105
+ **DON'T:**
106
+ - ❌ Skip queries assuming training data is sufficient
107
+ - ❌ Query only one link when multiple are listed
108
+ - ❌ Accept generic results - request specifics
109
+ - ❌ Ignore version mismatches in results
110
+
111
+ ### Coverage Requirements
112
+
113
+ - **100% Query Rate**: Every command/agent execution queries Context7
114
+ - **Complete Coverage**: ALL listed Context7 links must be queried
115
+ - **Result Validation**: Verify Context7 returned relevant information
116
+ - **Fallback Protocol**: If Context7 fails, STOP and report (don't proceed with stale data)
117
+
118
+ ## Integration with Workflow
119
+
120
+ ### Command Execution Flow
121
+
122
+ ```
123
+ User executes command: /pm:epic-decompose feature-name
124
+
125
+ BEFORE execution:
126
+ 1. Read .claude/commands/pm/epic-decompose.md
127
+ 2. Extract Documentation Queries section:
128
+ - mcp://context7/agile/epic-decomposition
129
+ - mcp://context7/agile/task-sizing
130
+ - mcp://context7/agile/user-stories
131
+ - mcp://context7/project-management/task-breakdown
132
+ 3. Query Context7 for EACH link
133
+ 4. Summarize findings: "Context7 confirms INVEST criteria for user stories..."
134
+ 5. PROCEED with command execution using Context7 guidance
135
+
136
+ DURING execution:
137
+ - Apply Context7 patterns
138
+ - Reference Context7 examples
139
+ - Follow Context7 best practices
140
+
141
+ AFTER execution:
142
+ - Validate against Context7 standards
143
+ - Flag any deviations from documentation
144
+ ```
145
+
146
+ ### Agent Invocation Flow
147
+
148
+ ```
149
+ User invokes agent: @aws-cloud-architect design VPC
150
+
151
+ BEFORE invocation:
152
+ 1. Read .claude/agents/cloud/aws-cloud-architect.md
153
+ 2. Extract Documentation Queries section:
154
+ - mcp://context7/aws/compute
155
+ - mcp://context7/aws/networking
156
+ - mcp://context7/terraform/aws
157
+ 3. Query Context7 for EACH link
158
+ 4. Summarize: "Context7 shows VPC best practices: /16 for staging, /20 for prod..."
159
+ 5. PROCEED with agent work using Context7 knowledge
160
+
161
+ DURING agent work:
162
+ - Use current AWS API patterns from Context7
163
+ - Apply Terraform AWS provider patterns from Context7
164
+ - Follow networking best practices from Context7
165
+
166
+ AFTER agent work:
167
+ - Cross-check VPC design against Context7 recommendations
168
+ - Ensure no deprecated patterns used
169
+ ```
170
+
171
+ ## Violation Consequences
172
+
173
+ **If Context7 enforcement is violated:**
174
+
175
+ ### Immediate Actions
176
+
177
+ 1. **STOP** execution immediately
178
+ 2. **IDENTIFY** what was implemented without Context7 verification
179
+ 3. **DELETE** code based on potentially stale training data
180
+ 4. **QUERY** Context7 for the relevant documentation
181
+ 5. **REIMPLEMENT** using Context7 guidance
182
+ 6. **DOCUMENT** violation and correction
183
+
184
+ ### Severity Levels
185
+
186
+ **Level 1 - Minor (Warning):**
187
+ - Partial Context7 queries (some links skipped)
188
+ - Action: Complete missing queries, validate implementation
189
+
190
+ **Level 2 - Moderate (Correction Required):**
191
+ - No Context7 queries performed
192
+ - Action: Stop, query Context7, review implementation
193
+
194
+ **Level 3 - Critical (Revert and Redo):**
195
+ - Implementation contradicts Context7 documentation
196
+ - Action: Delete code, start over with Context7 guidance
197
+
198
+ ### No Exceptions Policy
199
+
200
+ - NO "small changes" exceptions
201
+ - NO "I'm confident this is right" exceptions
202
+ - NO "Context7 is slow" exceptions
203
+ - NO "training data matches Context7" assumptions
204
+
205
+ ## Success Metrics
206
+
207
+ ### Compliance Indicators
208
+
209
+ - ✅ 100% of commands query Context7 before execution
210
+ - ✅ 100% of agents query Context7 before implementation
211
+ - ✅ Zero implementations based solely on training data
212
+ - ✅ All API signatures verified against live documentation
213
+ - ✅ No deprecated patterns in codebase
214
+ - ✅ Context7 findings documented in comments/commits
215
+
216
+ ### Quality Indicators
217
+
218
+ - ✅ Implementation matches Context7 examples
219
+ - ✅ No "unexpected behavior" due to API changes
220
+ - ✅ Code follows latest framework conventions
221
+ - ✅ Breaking changes identified and addressed proactively
222
+
223
+ ## Automation and Enforcement
224
+
225
+ ### Pre-Command Hook
226
+
227
+ File: `.claude/hooks/pre-command-context7.js`
228
+
229
+ **Purpose**: Automatically extract and query Context7 before command execution
230
+
231
+ **Behavior**:
232
+ 1. Intercept command execution
233
+ 2. Read command file from `.claude/commands/{category}/{command}.md`
234
+ 3. Extract `**Documentation Queries:**` section
235
+ 4. Query Context7 MCP for each link
236
+ 5. Inject results into command context
237
+ 6. Proceed with execution
238
+
239
+ ### Pre-Agent Hook
240
+
241
+ File: `.claude/hooks/pre-agent-context7.js`
242
+
243
+ **Purpose**: Automatically extract and query Context7 before agent invocation
244
+
245
+ **Behavior**:
246
+ 1. Intercept agent invocation
247
+ 2. Read agent file from `.claude/agents/{category}/{agent}.md`
248
+ 3. Extract `**Documentation Queries:**` section
249
+ 4. Query Context7 MCP for each link
250
+ 5. Inject results into agent context
251
+ 6. Proceed with agent work
252
+
253
+ ### Validation Rule
254
+
255
+ File: `.claude/rules/context7-enforcement.md` (this file)
256
+
257
+ **Purpose**: Remind Claude to ALWAYS query Context7
258
+
259
+ **Enforcement**:
260
+ - Read by Claude on every session start
261
+ - Highest priority in rule hierarchy
262
+ - Zero tolerance for violations
263
+
264
+ ## Emergency Fallback
265
+
266
+ **If Context7 MCP is unavailable:**
267
+
268
+ 1. **ALERT** user immediately: "⚠️ Context7 MCP unavailable - cannot verify documentation"
269
+ 2. **REQUEST** user decision:
270
+ - WAIT for Context7 to become available (RECOMMENDED)
271
+ - PROCEED with explicit user acknowledgment and risk acceptance
272
+ 3. **DOCUMENT** in code: `// WARNING: Implemented without Context7 verification - Context7 MCP was unavailable`
273
+ 4. **FLAG** for review: Add TODO to re-verify with Context7 when available
274
+
275
+ **DO NOT:**
276
+ - ❌ Silently proceed without Context7
277
+ - ❌ Assume training data is sufficient
278
+ - ❌ Skip documentation queries
279
+
280
+ ## Related Rules
281
+
282
+ - **TDD Enforcement** (`.claude/rules/tdd.enforcement.md`) - Tests first, always
283
+ - **Agent Usage** (`.claude/rules/agent-usage.md`) - When to use specialized agents
284
+ - **Code Quality** (`.claude/rules/code-quality.md`) - Standards and anti-patterns
285
+
286
+ ## Final Reminder
287
+
288
+ > **Context7 is NOT optional. It is MANDATORY for EVERY command and agent execution.**
289
+ >
290
+ > Training data becomes stale. APIs change. Best practices evolve.
291
+ >
292
+ > Context7 keeps us current. Query it. Every. Single. Time.
@@ -0,0 +1,180 @@
1
+ # Framework Path Rules
2
+
3
+ ## Critical Path Convention
4
+
5
+ **NEVER** hardcode the `autopm/` directory path in framework files. The `autopm/` directory only exists during development and is **NOT** present after installation in user projects.
6
+
7
+ ## The Problem
8
+
9
+ During installation, files from `autopm/.claude/` are copied to user projects as `.claude/`. Any references to `autopm/.claude/` or `autopm/scripts/` will be broken after installation.
10
+
11
+ ```
12
+ ❌ WRONG (Development structure):
13
+ autopm/
14
+ ├── .claude/
15
+ │ ├── commands/
16
+ │ ├── scripts/
17
+ │ └── agents/
18
+
19
+ ✅ CORRECT (After installation):
20
+ user-project/
21
+ ├── .claude/
22
+ │ ├── commands/
23
+ │ ├── scripts/
24
+ │ └── agents/
25
+ ```
26
+
27
+ ## Rules
28
+
29
+ ### 1. Use Relative Paths from Project Root
30
+
31
+ All paths in framework files must be relative to the **user's project root** (where `.claude/` will exist after installation).
32
+
33
+ **✅ CORRECT:**
34
+ ```bash
35
+ bash .claude/scripts/pm/epic-sync/create-epic-issue.sh "$EPIC_NAME"
36
+ node .claude/lib/commands/pm/prdStatus.js
37
+ source .claude/scripts/lib/github-utils.sh
38
+ ```
39
+
40
+ **❌ WRONG:**
41
+ ```bash
42
+ bash autopm/.claude/scripts/pm/epic-sync/create-epic-issue.sh "$EPIC_NAME"
43
+ node autopm/.claude/lib/commands/pm/prdStatus.js
44
+ source autopm/.claude/scripts/lib/github-utils.sh
45
+ ```
46
+
47
+ ### 2. Exception: Comments and Documentation References
48
+
49
+ It's acceptable to reference `autopm/` in:
50
+ - Code comments explaining migration history
51
+ - Documentation describing the development structure
52
+ - Git commit messages
53
+
54
+ **✅ ACCEPTABLE:**
55
+ ```javascript
56
+ /**
57
+ * Migrated from autopm/.claude/scripts/azure/validate.sh to Node.js
58
+ */
59
+ ```
60
+
61
+ **✅ ACCEPTABLE:**
62
+ ```markdown
63
+ ## Development Structure
64
+ During development, framework files are in `autopm/.claude/`, but after
65
+ installation they are copied to the user project's `.claude/` directory.
66
+ ```
67
+
68
+ ### 3. Files That Must Follow These Rules
69
+
70
+ - **Commands** (`autopm/.claude/commands/**/*.md`)
71
+ - **Scripts** (`autopm/.claude/scripts/**/*.sh`, `**/*.js`)
72
+ - **Agents** (`autopm/.claude/agents/**/*.md`)
73
+ - **Rules** (`autopm/.claude/rules/**/*.md`)
74
+ - **Templates** (`autopm/.claude/templates/**/*`)
75
+
76
+ ### 4. Environment Variables
77
+
78
+ If you need to reference the framework location dynamically, use environment variables that work in both contexts:
79
+
80
+ **✅ CORRECT:**
81
+ ```bash
82
+ CLAUDE_DIR="${CLAUDE_DIR:-.claude}"
83
+ bash "${CLAUDE_DIR}/scripts/pm/epic-sync/create-epic-issue.sh"
84
+ ```
85
+
86
+ This allows:
87
+ - Development: `CLAUDE_DIR=autopm/.claude`
88
+ - Production: `CLAUDE_DIR=.claude` (default)
89
+
90
+ ## Validation
91
+
92
+ ### Pre-Commit Hook
93
+
94
+ A pre-commit hook validates all framework files before commit:
95
+
96
+ ```bash
97
+ # Checks for hardcoded autopm/ paths (excluding comments)
98
+ grep -r "bash autopm" autopm/.claude --include="*.md" --include="*.sh"
99
+ grep -r "node autopm" autopm/.claude --include="*.md" --include="*.sh"
100
+ grep -r "source autopm" autopm/.claude --include="*.md" --include="*.sh"
101
+ ```
102
+
103
+ ### Manual Check
104
+
105
+ Before committing changes to framework files:
106
+
107
+ ```bash
108
+ # Run validation
109
+ npm run validate:paths
110
+
111
+ # Or manually
112
+ ./scripts/validate-framework-paths.sh
113
+ ```
114
+
115
+ ## Common Mistakes
116
+
117
+ ### Mistake 1: Copy-Paste from Development Environment
118
+
119
+ ```bash
120
+ # ❌ Copying terminal command that worked in development
121
+ bash autopm/.claude/scripts/pm/epic-sync/create-epic-issue.sh "feature-name"
122
+
123
+ # ✅ Use project-relative path
124
+ bash .claude/scripts/pm/epic-sync/create-epic-issue.sh "feature-name"
125
+ ```
126
+
127
+ ### Mistake 2: Documentation Examples
128
+
129
+ ```markdown
130
+ ❌ WRONG:
131
+ To run the script:
132
+ `bash autopm/.claude/scripts/pm/issue-sync/preflight-validation.sh`
133
+
134
+ ✅ CORRECT:
135
+ To run the script:
136
+ `bash .claude/scripts/pm/issue-sync/preflight-validation.sh`
137
+ ```
138
+
139
+ ### Mistake 3: Relative Imports in Scripts
140
+
141
+ ```bash
142
+ # ❌ WRONG - hardcoded framework path
143
+ source autopm/.claude/scripts/lib/github-utils.sh
144
+
145
+ # ✅ CORRECT - relative to project root
146
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
147
+ source "${SCRIPT_DIR}/../lib/github-utils.sh"
148
+
149
+ # ✅ ALSO CORRECT - explicit project root
150
+ source .claude/scripts/lib/github-utils.sh
151
+ ```
152
+
153
+ ## Enforcement
154
+
155
+ This rule is enforced by:
156
+
157
+ 1. **Pre-commit hook** - Blocks commits with hardcoded `autopm/` paths
158
+ 2. **CI/CD validation** - GitHub Actions check on every PR
159
+ 3. **Installation tests** - Verify all paths work post-installation
160
+ 4. **Code review** - Reviewers check for path correctness
161
+
162
+ ## Quick Reference
163
+
164
+ | Context | Use | Don't Use |
165
+ |---------|-----|-----------|
166
+ | Shell scripts | `.claude/scripts/` | `autopm/.claude/scripts/` |
167
+ | Node.js scripts | `.claude/lib/` | `autopm/.claude/lib/` |
168
+ | Command files | `.claude/commands/` | `autopm/.claude/commands/` |
169
+ | Documentation | `.claude/agents/` | `autopm/.claude/agents/` |
170
+ | Comments | `autopm/` ✅ OK | N/A |
171
+
172
+ ## Related Rules
173
+
174
+ - `/rules/naming-conventions.md` - File and directory naming
175
+ - `/rules/development-workflow.md` - Development best practices
176
+ - `/rules/golden-rules.md` - Core framework principles
177
+
178
+ ---
179
+
180
+ **Remember:** If a user installs this framework, the `autopm/` directory will not exist in their project. All paths must work from their project root where `.claude/` is located.