@pantion/mcp-server 0.1.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 (160) hide show
  1. package/dist/feature-set.d.ts +14 -0
  2. package/dist/feature-set.d.ts.map +1 -0
  3. package/dist/feature-set.js +38 -0
  4. package/dist/feature-set.js.map +1 -0
  5. package/dist/index.d.ts +3 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +56 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/prompts/convergence-prompts.d.ts +4 -0
  10. package/dist/prompts/convergence-prompts.d.ts.map +1 -0
  11. package/dist/prompts/convergence-prompts.js +76 -0
  12. package/dist/prompts/convergence-prompts.js.map +1 -0
  13. package/dist/prompts/index.d.ts +4 -0
  14. package/dist/prompts/index.d.ts.map +1 -0
  15. package/dist/prompts/index.js +7 -0
  16. package/dist/prompts/index.js.map +1 -0
  17. package/dist/prompts/workflow-prompts.d.ts +9 -0
  18. package/dist/prompts/workflow-prompts.d.ts.map +1 -0
  19. package/dist/prompts/workflow-prompts.js +249 -0
  20. package/dist/prompts/workflow-prompts.js.map +1 -0
  21. package/dist/resources/canon-resources.d.ts +4 -0
  22. package/dist/resources/canon-resources.d.ts.map +1 -0
  23. package/dist/resources/canon-resources.js +160 -0
  24. package/dist/resources/canon-resources.js.map +1 -0
  25. package/dist/server.d.ts +9 -0
  26. package/dist/server.d.ts.map +1 -0
  27. package/dist/server.js +47 -0
  28. package/dist/server.js.map +1 -0
  29. package/dist/tools/amend.d.ts +4 -0
  30. package/dist/tools/amend.d.ts.map +1 -0
  31. package/dist/tools/amend.js +106 -0
  32. package/dist/tools/amend.js.map +1 -0
  33. package/dist/tools/approve.d.ts +4 -0
  34. package/dist/tools/approve.d.ts.map +1 -0
  35. package/dist/tools/approve.js +60 -0
  36. package/dist/tools/approve.js.map +1 -0
  37. package/dist/tools/check-convergence.d.ts +4 -0
  38. package/dist/tools/check-convergence.d.ts.map +1 -0
  39. package/dist/tools/check-convergence.js +50 -0
  40. package/dist/tools/check-convergence.js.map +1 -0
  41. package/dist/tools/check.d.ts +4 -0
  42. package/dist/tools/check.d.ts.map +1 -0
  43. package/dist/tools/check.js +190 -0
  44. package/dist/tools/check.js.map +1 -0
  45. package/dist/tools/create-skill.d.ts +4 -0
  46. package/dist/tools/create-skill.d.ts.map +1 -0
  47. package/dist/tools/create-skill.js +58 -0
  48. package/dist/tools/create-skill.js.map +1 -0
  49. package/dist/tools/decompose.d.ts +4 -0
  50. package/dist/tools/decompose.d.ts.map +1 -0
  51. package/dist/tools/decompose.js +56 -0
  52. package/dist/tools/decompose.js.map +1 -0
  53. package/dist/tools/index.d.ts +4 -0
  54. package/dist/tools/index.d.ts.map +1 -0
  55. package/dist/tools/index.js +47 -0
  56. package/dist/tools/index.js.map +1 -0
  57. package/dist/tools/list-canons.d.ts +4 -0
  58. package/dist/tools/list-canons.d.ts.map +1 -0
  59. package/dist/tools/list-canons.js +28 -0
  60. package/dist/tools/list-canons.js.map +1 -0
  61. package/dist/tools/migrate.d.ts +4 -0
  62. package/dist/tools/migrate.d.ts.map +1 -0
  63. package/dist/tools/migrate.js +38 -0
  64. package/dist/tools/migrate.js.map +1 -0
  65. package/dist/tools/onboard.d.ts +4 -0
  66. package/dist/tools/onboard.d.ts.map +1 -0
  67. package/dist/tools/onboard.js +27 -0
  68. package/dist/tools/onboard.js.map +1 -0
  69. package/dist/tools/reconverge.d.ts +4 -0
  70. package/dist/tools/reconverge.d.ts.map +1 -0
  71. package/dist/tools/reconverge.js +68 -0
  72. package/dist/tools/reconverge.js.map +1 -0
  73. package/dist/tools/reject.d.ts +4 -0
  74. package/dist/tools/reject.d.ts.map +1 -0
  75. package/dist/tools/reject.js +57 -0
  76. package/dist/tools/reject.js.map +1 -0
  77. package/dist/tools/reskill.d.ts +4 -0
  78. package/dist/tools/reskill.d.ts.map +1 -0
  79. package/dist/tools/reskill.js +63 -0
  80. package/dist/tools/reskill.js.map +1 -0
  81. package/dist/tools/resume.d.ts +4 -0
  82. package/dist/tools/resume.d.ts.map +1 -0
  83. package/dist/tools/resume.js +56 -0
  84. package/dist/tools/resume.js.map +1 -0
  85. package/dist/tools/reverse.d.ts +4 -0
  86. package/dist/tools/reverse.d.ts.map +1 -0
  87. package/dist/tools/reverse.js +32 -0
  88. package/dist/tools/reverse.js.map +1 -0
  89. package/dist/tools/save-canon.d.ts +4 -0
  90. package/dist/tools/save-canon.d.ts.map +1 -0
  91. package/dist/tools/save-canon.js +97 -0
  92. package/dist/tools/save-canon.js.map +1 -0
  93. package/dist/tools/start.d.ts +4 -0
  94. package/dist/tools/start.d.ts.map +1 -0
  95. package/dist/tools/start.js +83 -0
  96. package/dist/tools/start.js.map +1 -0
  97. package/dist/tools/translate.d.ts +4 -0
  98. package/dist/tools/translate.d.ts.map +1 -0
  99. package/dist/tools/translate.js +102 -0
  100. package/dist/tools/translate.js.map +1 -0
  101. package/dist/tools/update.d.ts +4 -0
  102. package/dist/tools/update.d.ts.map +1 -0
  103. package/dist/tools/update.js +42 -0
  104. package/dist/tools/update.js.map +1 -0
  105. package/dist/utils/response.d.ts +12 -0
  106. package/dist/utils/response.d.ts.map +1 -0
  107. package/dist/utils/response.js +18 -0
  108. package/dist/utils/response.js.map +1 -0
  109. package/package.json +37 -0
  110. package/protocol/commands/amend.md +188 -0
  111. package/protocol/commands/build.md +90 -0
  112. package/protocol/commands/check.md +255 -0
  113. package/protocol/commands/create-skill.md +81 -0
  114. package/protocol/commands/decompose.md +230 -0
  115. package/protocol/commands/dialog.md +173 -0
  116. package/protocol/commands/help.md +121 -0
  117. package/protocol/commands/migrate.md +173 -0
  118. package/protocol/commands/onboard.md +210 -0
  119. package/protocol/commands/quick.md +170 -0
  120. package/protocol/commands/redialog.md +252 -0
  121. package/protocol/commands/reskill.md +73 -0
  122. package/protocol/commands/resume.md +148 -0
  123. package/protocol/commands/reverse.md +312 -0
  124. package/protocol/commands/start.md +220 -0
  125. package/protocol/commands/translate.md +157 -0
  126. package/protocol/commands/update.md +205 -0
  127. package/protocol/commands/validate.md +137 -0
  128. package/protocol/core-advanced.md +188 -0
  129. package/protocol/core.md +273 -0
  130. package/protocol/pantion-future-prompt.md +88 -0
  131. package/protocol/pantion-intent.md +78 -0
  132. package/protocol/templates/acceptance-tests.md +116 -0
  133. package/protocol/templates/behavior-map.md +135 -0
  134. package/protocol/templates/traceability-map.md +56 -0
  135. package/skills/image/convergence-rules.md +55 -0
  136. package/skills/image/prompts/convergence-intro.md +25 -0
  137. package/skills/image/prompts/translate-intro.md +37 -0
  138. package/skills/image/skill.json +12 -0
  139. package/skills/image/translate.md +67 -0
  140. package/skills/skill-builder/convergence-rules.md +64 -0
  141. package/skills/skill-builder/prompts/convergence-intro.md +21 -0
  142. package/skills/skill-builder/prompts/translate-intro.md +17 -0
  143. package/skills/skill-builder/skill.json +10 -0
  144. package/skills/skill-builder/translate.md +46 -0
  145. package/skills/software/convergence-rules.md +29 -0
  146. package/skills/software/prompts/convergence-intro.md +22 -0
  147. package/skills/software/prompts/translate-intro.md +19 -0
  148. package/skills/software/skill.json +12 -0
  149. package/skills/software/translate.md +74 -0
  150. package/skills/software-brownfield/convergence-rules.md +109 -0
  151. package/skills/software-brownfield/prompts/convergence-intro.md +26 -0
  152. package/skills/software-brownfield/prompts/translate-intro.md +13 -0
  153. package/skills/software-brownfield/skill.json +12 -0
  154. package/skills/software-brownfield/translate.md +56 -0
  155. package/souls/beginner/rules.md +34 -0
  156. package/souls/beginner/soul.json +6 -0
  157. package/souls/default/rules.md +25 -0
  158. package/souls/default/soul.json +6 -0
  159. package/souls/young/rules.md +67 -0
  160. package/souls/young/soul.json +6 -0
@@ -0,0 +1,102 @@
1
+ import { z } from 'zod';
2
+ import { resolve } from 'node:path';
3
+ import { writeFile, ensureDir, readFileSafe, canonDir, assertPathWithin, assertSafeName, extractHumanStamp, extractConvergenceStamp, extractCanonMetadata, generateManifest } from '@pantion/core';
4
+ import { success, error } from '../utils/response.js';
5
+ const fileSchema = z.object({
6
+ path: z.string().describe('Relative file path within the project'),
7
+ content: z.string().describe('File content to write'),
8
+ });
9
+ export function registerTranslate(server, context) {
10
+ server.tool('pantion_translate', 'Write project specification files derived from a converged canon. The client LLM generates the file contents (spec/requirements.md, spec/constraints.md, etc.); this tool writes them and updates traceability.', {
11
+ canon_name: z.string().describe('Name of the source canon'),
12
+ project_path: z.string().optional().describe('Project directory (defaults to server project path)'),
13
+ files: z.array(fileSchema).describe('Files to write (path + content)'),
14
+ rationale: z.string().optional().describe('Implementation rationale (key technical choices)'),
15
+ deviations: z.string().optional().describe('Deviations from the canon ("none" if faithful)'),
16
+ }, async ({ canon_name, project_path, files, rationale, deviations }) => {
17
+ try {
18
+ const projectPath = project_path ?? context.projectPath;
19
+ assertSafeName(canon_name);
20
+ // HUMAN STAMP gate: translation requires approval
21
+ const dialogPath = resolve(canonDir(projectPath), canon_name, 'dialog.md');
22
+ const dialogContent = readFileSafe(dialogPath);
23
+ if (dialogContent) {
24
+ const humanStamp = extractHumanStamp(dialogContent);
25
+ if (!humanStamp || (humanStamp.status !== 'APPROVED' && humanStamp.status !== 'AUTO-APPROVED')) {
26
+ const currentStatus = humanStamp?.status ?? 'PENDING';
27
+ return error(`Canon "${canon_name}" is not approved (HUMAN STAMP status: ${currentStatus}). Use pantion_approve to approve the canon before translation.`);
28
+ }
29
+ }
30
+ const date = new Date().toISOString().split('T')[0];
31
+ const filesWritten = [];
32
+ for (const file of files) {
33
+ const fullPath = resolve(projectPath, file.path);
34
+ assertPathWithin(fullPath, projectPath);
35
+ ensureDir(resolve(fullPath, '..'));
36
+ writeFile(fullPath, ensureDerivationComment(file.content, canon_name, date));
37
+ filesWritten.push(file.path);
38
+ }
39
+ // Update traceability
40
+ const traceabilityPath = resolve(canonDir(projectPath), canon_name, 'traceability.md');
41
+ let traceability = readFileSafe(traceabilityPath) ?? createTraceabilityHeader();
42
+ traceability = appendTraceabilityRows(traceability, filesWritten, canon_name, date);
43
+ writeFile(traceabilityPath, traceability);
44
+ // Generate implementation manifest
45
+ let manifestPath;
46
+ if (dialogContent) {
47
+ const stamp = extractConvergenceStamp(dialogContent);
48
+ const humanStamp = extractHumanStamp(dialogContent);
49
+ const metadata = extractCanonMetadata(dialogContent);
50
+ const manifest = generateManifest({
51
+ canonName: canon_name,
52
+ canonStatus: stamp?.type?.toUpperCase() ?? 'UNKNOWN',
53
+ humanStampStatus: humanStamp?.status ?? 'UNKNOWN',
54
+ date,
55
+ model: stamp?.model,
56
+ skill: metadata?.skill,
57
+ mode: metadata?.mode,
58
+ checkResult: metadata?.checkResult,
59
+ specFiles: filesWritten,
60
+ rationale,
61
+ deviations,
62
+ });
63
+ const implDir = resolve(canonDir(projectPath), canon_name, 'implementations');
64
+ ensureDir(implDir);
65
+ const implPath = resolve(implDir, `${date}-collapse.md`);
66
+ writeFile(implPath, manifest);
67
+ manifestPath = `canon/${canon_name}/implementations/${date}-collapse.md`;
68
+ }
69
+ return success({
70
+ files_written: filesWritten,
71
+ ...(manifestPath ? { manifest_path: manifestPath } : {}),
72
+ });
73
+ }
74
+ catch (err) {
75
+ return error(err instanceof Error ? err.message : String(err));
76
+ }
77
+ });
78
+ }
79
+ function ensureDerivationComment(content, canonName, date) {
80
+ if (content.includes('Derived from:'))
81
+ return content;
82
+ return `<!-- Derived from: canon/${canonName}/dialog.md, ${date} -->\n\n${content}`;
83
+ }
84
+ function createTraceabilityHeader() {
85
+ return [
86
+ '# Traceability: Canon -> Project Specification Files',
87
+ '',
88
+ '| File | Canon source | Dialog turns | Elements | Last generated |',
89
+ '|------|-------------|--------------|----------|----------------|',
90
+ ].join('\n');
91
+ }
92
+ function appendTraceabilityRows(traceabilityContent, filesWritten, canonName, date) {
93
+ let output = traceabilityContent;
94
+ if (!output.endsWith('\n'))
95
+ output += '\n';
96
+ for (const filePath of filesWritten) {
97
+ output += `| \`${filePath}\` | \`${canonName}/dialog.md\` | all | derived artifact | ${date} |\n`;
98
+ }
99
+ output += `\nGenerated on: ${date}\n`;
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,UAAU,SAAS,2CAA2C,IAAI,MAAM,CAAC;IACpG,CAAC;IAED,MAAM,IAAI,mBAAmB,IAAI,IAAI,CAAC;IACtC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { ServerContext } from '../server.js';
3
+ export declare function registerUpdate(server: McpServer, context: ServerContext): void;
4
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/tools/update.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAUlD,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CA6C9E"}
@@ -0,0 +1,42 @@
1
+ import { z } from 'zod';
2
+ import { assembleSystemPrompt, readFileSafe, createSession, saveSession, } from '@pantion/core';
3
+ import { resolve } from 'node:path';
4
+ import { success, error } from '../utils/response.js';
5
+ export function registerUpdate(server, context) {
6
+ server.tool('pantion_update', 'Upgrade the Pantion Protocol itself. Reads intent documents, performs delta analysis, and provides instructions for regenerating protocol files.', {
7
+ project_path: z.string().optional().describe('Project directory (defaults to server project path)'),
8
+ }, async ({ project_path }) => {
9
+ try {
10
+ const projectPath = project_path ?? context.projectPath;
11
+ const intentPath = resolve(context.protocolDir, 'pantion-intent.md');
12
+ const futurePath = resolve(context.protocolDir, 'pantion-future-prompt.md');
13
+ const intentDoc = readFileSafe(intentPath);
14
+ const futureDoc = readFileSafe(futurePath);
15
+ const missingDocs = [];
16
+ if (!intentDoc)
17
+ missingDocs.push('protocol/pantion-intent.md');
18
+ if (!futureDoc)
19
+ missingDocs.push('protocol/pantion-future-prompt.md');
20
+ if (missingDocs.length > 0) {
21
+ return error(`Cannot upgrade protocol without intent documents. Missing: ${missingDocs.join(', ')}`);
22
+ }
23
+ const convergenceInstructions = assembleSystemPrompt({
24
+ mode: 'update',
25
+ protocolDir: context.protocolDir,
26
+ });
27
+ const session = createSession(projectPath, `update-${Date.now()}`, convergenceInstructions);
28
+ saveSession(projectPath, session);
29
+ return success({
30
+ session_id: session.id,
31
+ intent_document: intentDoc,
32
+ future_prompt: futureDoc,
33
+ convergence_instructions: convergenceInstructions,
34
+ message: 'Protocol update session started. Intent documents loaded. Follow the update protocol: inventory current version, delta analysis, regenerate with confirmation.',
35
+ });
36
+ }
37
+ catch (err) {
38
+ return error(err instanceof Error ? err.message : String(err));
39
+ }
40
+ });
41
+ }
42
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/tools/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,UAAU,cAAc,CAAC,MAAiB,EAAE,OAAsB;IACtE,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,kJAAkJ,EAClJ;QACE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;KACpG,EACD,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE;QACzB,IAAI,CAAC;YACL,MAAM,WAAW,GAAG,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC;YAExD,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;YACrE,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,C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unknown;
3
+ content: [{
4
+ type: 'text';
5
+ text: string;
6
+ }];
7
+ isError?: boolean;
8
+ }
9
+ export declare function success(data: Record<string, unknown>, warnings?: string[]): ToolResponse;
10
+ export declare function error(message: string): ToolResponse;
11
+ export {};
12
+ //# sourceMappingURL=response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/utils/response.ts"],"names":[],"mappings":"AAAA,UAAU,YAAY;IACpB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACrB,OAAO,EAAE,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,YAAY,CAOxF;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAQnD"}
@@ -0,0 +1,18 @@
1
+ export function success(data, warnings) {
2
+ return {
3
+ content: [{
4
+ type: 'text',
5
+ text: JSON.stringify({ success: true, data, ...(warnings?.length ? { warnings } : {}) }, null, 2),
6
+ }],
7
+ };
8
+ }
9
+ export function error(message) {
10
+ return {
11
+ content: [{
12
+ type: 'text',
13
+ text: JSON.stringify({ success: false, error: message }, null, 2),
14
+ }],
15
+ isError: true,
16
+ };
17
+ }
18
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../src/utils/response.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,OAAO,CAAC,IAA6B,EAAE,QAAmB;IACxE,OAAO;QACL,OAAO,EAAE,CAAC;gBACR,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;aAClG,CAAC;KACH,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,OAAe;IACnC,OAAO;QACL,OAAO,EAAE,CAAC;gBACR,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;aAClE,CAAC;QACF,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@pantion/mcp-server",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for Pantion DialogSpec protocol",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "pantion-mcp": "dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist/",
12
+ "protocol/",
13
+ "skills/",
14
+ "souls/"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsc",
18
+ "start": "node dist/index.js",
19
+ "test": "vitest run --passWithNoTests",
20
+ "copy-assets": "rm -rf protocol skills souls && cp -r ../../protocol protocol && cp -r ../../skills skills && cp -r ../../souls souls",
21
+ "prepublishOnly": "npm run copy-assets && npm run build && npm test"
22
+ },
23
+ "dependencies": {
24
+ "@modelcontextprotocol/sdk": "^1.7.0",
25
+ "@pantion/core": "0.1.0",
26
+ "zod": "^3.24.0"
27
+ },
28
+ "license": "BUSL-1.1",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/getpantion/pantion.git",
32
+ "directory": "packages/mcp-server"
33
+ },
34
+ "engines": {
35
+ "node": ">=20.0.0"
36
+ }
37
+ }
@@ -0,0 +1,188 @@
1
+ # /pantion-amend — Apply a change to an existing canon
2
+
3
+ Apply an Amendment to an existing converged canon and regenerate the affected files.
4
+
5
+ ---
6
+
7
+ ## STEP 1: IDENTIFY THE CANON
8
+
9
+ Ask the user (or detect from context):
10
+
11
+ "Which canon do you want to change?"
12
+
13
+ Options:
14
+ - `canon/{naam}/dialog.md` (standalone)
15
+ - `canon/architect/dialog.md` (system level)
16
+ - `canon/interfaces/interface-[A]-[B]/dialog.md` (interface)
17
+ - `canon/components/{component}/dialog.md` (component)
18
+
19
+ Read the chosen dialog file (the canon).
20
+
21
+ ---
22
+
23
+ ## STEP 2: UNDERSTAND THE CHANGE
24
+
25
+ Ask:
26
+
27
+ "What do you want to change? Describe it in your own words."
28
+
29
+ Analyze the change:
30
+ - Does it affect a HARD constraint? → Extra careful
31
+ - Does it affect the Authority Budget? → Extra careful
32
+ - Does it affect an interface? → Check both sides
33
+ - Is it a FLEX adjustment? → Simple to apply
34
+
35
+ ---
36
+
37
+ ## STEP 3: IMPACT ANALYSIS (for hierarchical systems)
38
+
39
+ If the change affects an Architect Canon:
40
+
41
+ Present an impact analysis showing which component and interface canons are affected vs not affected.
42
+
43
+ Present this to the user and ask for confirmation.
44
+
45
+ If the change affects a Component Canon, check:
46
+ - Does the change violate an inherited constraint? → "This cannot be applied at the component level. You need to amend the Architect Canon first."
47
+ - Does the change violate an Interface Canon? → "This affects the interface with [Component X]. Both canons need to be updated."
48
+ - Does the change exceed the Authority Budget? → "This exceeds the Authority Budget ceiling from the Architect Canon." (For Rights: ceiling exceeded. For Consumption: allocation exceeded.)
49
+
50
+ ---
51
+
52
+ ## STEP 4: CONVERGE THE AMENDMENT
53
+
54
+ Conduct a short convergence dialog about the change:
55
+
56
+ 1. Ask ONE question at a time — wait for the answer before asking the next
57
+ 2. Clarify the exact scope of the change
58
+ 3. Verify the change doesn't unintentionally affect other elements
59
+ 4. Classify new elements as HARD or FLEX
60
+ 5. Verify constraints remain absolute
61
+
62
+ ### Saving the amendment dialog
63
+
64
+ **Append** the amendment dialog to the existing dialog file. The dialog is append-only — the original text remains intact.
65
+
66
+ Add an amendment marker in the dialog:
67
+
68
+ --- AMENDMENT [date] ---
69
+
70
+ HUMAN: [verbatim text of amendment request]
71
+
72
+ ASSISTANT: [verbatim text of clarifying questions]
73
+
74
+ HUMAN: [verbatim text of answers]
75
+
76
+ ...
77
+
78
+ ### Was/Wordt Table
79
+
80
+ For each change, include a clear "Was/Wordt" (Before/After) table:
81
+
82
+ ### Change [N]: [short description]
83
+ - **Was:** [exact quote or description of original behavior from canon]
84
+ - **Wordt:** [exact description of new behavior]
85
+
86
+ ### Behavior Matrix
87
+
88
+ Show which behaviors are affected by the amendment:
89
+
90
+ | Behavior | Status |
91
+ |----------|--------|
92
+ | [behavior 1] | unchanged |
93
+ | [behavior 2] | modified (see Change 1) |
94
+ | [behavior 3] | removed |
95
+ | [behavior 4] | new |
96
+
97
+ ### Wat vervalt / Wat blijft
98
+
99
+ Explicitly state what is removed and what stays:
100
+
101
+ **Wat vervalt:**
102
+ - [removed behavior/logic 1]
103
+ - [removed behavior/logic 2]
104
+
105
+ **Wat blijft:**
106
+ - [unchanged behavior 1]
107
+ - [unchanged behavior 2]
108
+
109
+ ### Amendment Stamp
110
+
111
+ === DIALOGSPEC AMENDMENT ===
112
+ AMENDS: [path to dialog file]
113
+ DATE: [today]
114
+ MODEL: [model-id (Display Name), e.g. claude-opus-4-6 (Claude Opus 4.6)]
115
+ SUPERSEDES: [what is being overridden — quote from the original dialog]
116
+ ADDS: [what is new]
117
+ UNCHANGED: everything not explicitly in SUPERSEDES or ADDS
118
+ IMPACT: [list of affected canons for hierarchical system]
119
+ === /DIALOGSPEC AMENDMENT ===
120
+
121
+ ---
122
+
123
+ ## STEP 5: REGENERATE DERIVED FILES
124
+
125
+ 1. **Regenerate the summary** (`canon/{naam}/summary.md`) from the complete dialog including the amendment
126
+ 2. Determine which project files are affected (via `canon/{naam}/traceability.md`)
127
+
128
+ | Amendment to... | Regenerate... |
129
+ |----------------|---------------|
130
+ | Standalone canon | All spec files that trace to the changed element |
131
+ | Architect Canon | canon/architect/spec/requirements.md + constraints.md + architecture.md |
132
+ | Interface Canon | The corresponding canon/interfaces/interface-*/spec/ files |
133
+ | Component Canon | The corresponding canon/components/{name}/spec/ files |
134
+
135
+ Regenerate ONLY the affected files. Leave the rest intact.
136
+ Update `canon/{naam}/traceability.md` — add a `<!-- Derived from: canon/{naam}/dialog.md, [date] -->` comment to each regenerated file.
137
+
138
+ ---
139
+
140
+ ## STEP 6: UPDATE CANON INDEX
141
+
142
+ Update `canon/index.md`:
143
+ - Update STATUS of the amended canon to AMENDED
144
+ - Log the amendment (date + short description)
145
+ - Update Open Questions (if the amendment opens new questions)
146
+ - Update "Last modified"
147
+
148
+ ---
149
+
150
+ ## STEP 7: RECHECK (for hierarchical systems)
151
+
152
+ If multiple canons were affected:
153
+ - Automatically run /pantion-check on the affected canons
154
+ - Verify that consistency has not been broken
155
+
156
+ ---
157
+
158
+ ## STEP 8: REPORT
159
+
160
+ Say:
161
+
162
+ "Amendment applied to [canon].
163
+
164
+ Changed:
165
+ - [what was changed]
166
+
167
+ Regenerated files:
168
+ - [list of files]
169
+
170
+ [For hierarchical system:]
171
+ Affected canons:
172
+ - [list of affected canons + status]
173
+
174
+ Consistency: maintained | check needed
175
+
176
+ Would you like me to also apply the change to the implementation?"
177
+
178
+ ---
179
+
180
+ ## OPTIONAL: UPDATE IMPLEMENTATION
181
+
182
+ If the user wants the implementation to be updated:
183
+
184
+ 1. Read the regenerated files
185
+ 2. Identify which code is affected by the change
186
+ 3. Modify the code according to the changed canon
187
+ 4. Test that the change has been correctly implemented
188
+ 5. Report what was changed in the code
@@ -0,0 +1,90 @@
1
+ # /pantion-build — Coding Agent Instructions
2
+
3
+ Instructions for a coding agent to implement a system from a converged DialogSpec Canon.
4
+
5
+ ---
6
+
7
+ ## MODE: DEFAULT (recommended)
8
+
9
+ The coding agent MUST follow these rules:
10
+
11
+ ### Source of Truth
12
+
13
+ 1. Build ONLY from the DialogSpec Canon. Canon wins on conflict.
14
+ 2. Do NOT invent requirements or UX; if something is ambiguous, do not guess.
15
+ 3. Use the Readiness Checklist as a gate:
16
+ - If any checklist item is not satisfied, STOP and output OPEN QUESTIONS (with what evidence is missing).
17
+ - Only proceed to implementation when the Canon is CONVERGED and the Checklist passes.
18
+ 4. Do NOT choose paid services or introduce recurring costs unless explicitly required by the Canon.
19
+
20
+ ### HARD vs FLEX
21
+
22
+ 5. Implement HARD invariants as non-negotiable — they cannot be bypassed, even for convenience.
23
+ 6. Treat FLEX defaults as changeable configuration or code-local constants. Document which FLEX choices you made.
24
+
25
+ ### Inference Policy
26
+
27
+ 7. Follow the Canon's inference policy (conservative or strict).
28
+ 8. On ambiguity with Conservative policy: choose the smallest scope, least power, safest option.
29
+ 9. On ambiguity with Strict policy: STOP and output OPEN QUESTIONS. Do not implement "reasonable assumptions".
30
+
31
+ ### Authority Budget
32
+
33
+ 10. Enforce the Authority Budget as hard boundaries:
34
+ - Allowed actions: only implement what is explicitly allowed
35
+ - Forbidden actions: never implement, not even as opt-in
36
+ - Data access: access only what is permitted
37
+ - Data retention: store nothing beyond what is specified
38
+ - Auditability: ensure required actions are reconstructable
39
+ - Rate/cost limits: enforce if specified
40
+
41
+ ### Canon Anchors
42
+
43
+ 11. Use Canon Anchors (H1, A3, etc.) in code comments and documentation to trace implementation decisions back to specific dialog turns.
44
+
45
+ ### Deliverables
46
+
47
+ - Working implementation matching the Canon behavior
48
+ - README.md: what it does + how to use + how to install/deploy
49
+ - Evidence: how to run/verify (commands, sample inputs/outputs)
50
+ - Canon -> Implementation notes: list any FLEX defaults chosen and which Canon Anchor they relate to
51
+
52
+ ---
53
+
54
+ ## MODE: STRICT
55
+
56
+ Use this when agents tend to "helpfully" add features:
57
+
58
+ The coding agent must treat the DialogSpec Canon as the ONLY requirements document.
59
+ - No feature suggestions.
60
+ - No extra endpoints/commands.
61
+ - No "nice-to-haves".
62
+ - No refactors beyond what is needed to satisfy the Canon.
63
+ - No error handling beyond what is specified in the Canon's failure behavior.
64
+
65
+ If any requirement is unclear, output OPEN QUESTIONS and stop. Do not implement "reasonable assumptions".
66
+
67
+ ---
68
+
69
+ ## OPEN QUESTIONS Format
70
+
71
+ If the agent stops due to ambiguity, output:
72
+
73
+ - **OPEN QUESTIONS:** numbered list (each with the exact Canon Anchor that is insufficient)
74
+ - **WHAT YOU NEED:** what additional dialog would resolve it
75
+ - **IMPACT:** what cannot be implemented until clarified
76
+
77
+ ---
78
+
79
+ ## After Building
80
+
81
+ Say:
82
+
83
+ "The system has been built. Here is a summary of what I created, which FLEX choices I made, and how you can test it."
84
+
85
+ Then provide:
86
+
87
+ 1. **What was built** — brief overview of the implementation
88
+ 2. **FLEX choices made** — list each FLEX default chosen, with the Canon Anchor it relates to
89
+ 3. **How to test** — commands, sample inputs/outputs, or verification steps
90
+ 4. **Canon coverage** — confirm all HARD invariants are implemented and all non-goals are absent