@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,312 @@
1
+ # /pantion-reverse — Extract intent from an existing codebase
2
+
3
+ You have an existing codebase. You will reconstruct the intent as a DialogSpec Canon,
4
+ as if the dialog had originally been conducted — but derived from what the code does.
5
+
6
+ The goal is NOT to describe the code. The goal is to uncover the **intent** that once produced the code.
7
+
8
+ ---
9
+
10
+ ## WHEN YOU ARRIVE HERE
11
+
12
+ - Legacy system nobody understands anymore — create readable canon
13
+ - Technology migration — capture intent, then rebuild in new stack
14
+ - Quality proof — Reverse Pantion + Forward Pantion = functionally equivalent?
15
+ - Documentation — convert codebase to intent description
16
+ - Acquisition/audit — quickly understand what a system does and may do
17
+
18
+ ---
19
+
20
+ ## STEP 0: DETERMINE SCOPE
21
+
22
+ Ask the user:
23
+
24
+ "Which codebase do you want to analyze? Give me the path or describe what I should read."
25
+
26
+ Then determine:
27
+
28
+ - Is this a monolith or a system with multiple parts?
29
+ - How much code is there (rough estimate)?
30
+ - Are there tests, READMEs, configuration, documentation present?
31
+
32
+ ### For large systems:
33
+ If the codebase clearly contains multiple independent parts:
34
+
35
+ "This codebase seems large enough to split up. Would you like me to:
36
+ A) Create one overarching canon (standalone)
37
+ B) Create a hierarchical decomposition (architect + component canons)?"
38
+
39
+ For choice B: follow the decomposition structure from `/pantion-decompose`, but in reverse.
40
+
41
+ ---
42
+
43
+ ## STEP 1: SCAN
44
+
45
+ Read the codebase systematically. Priority:
46
+
47
+ 1. **README / docs** — what does the project say about itself?
48
+ 2. **Tests** — what is expected? What is explicitly excluded?
49
+ 3. **Entry points** — where does it start? What is the interface to the outside world?
50
+ 4. **Configuration** — what is configurable? What are defaults?
51
+ 5. **Error handling** — how does it fail? What is reported to the user?
52
+ 6. **Security / auth** — who may do what? What is restricted?
53
+ 7. **Data flow** — what comes in, what goes out, what is stored?
54
+ 8. **Business logic** — the core: what does the system actually do?
55
+
56
+ ### Pay specific attention to:
57
+ - Hardcoded values that look like constraints — candidate HARD
58
+ - Configurable values — candidate FLEX
59
+ - `// TODO`, `// HACK`, `// FIXME` — signals of implicit intent or technical debt
60
+ - Dead code / disabled features — candidate non-goals
61
+ - Rate limiters, quota checks, cost guards — Authority Budget Consumption
62
+ - Permission checks, role guards, data filtering — Authority Budget Rights
63
+
64
+ ---
65
+
66
+ ## STEP 2: EXTRACT — Reconstruct intent (not describe implementation)
67
+
68
+ This is the crucial step. You extract NOT "how the code works" but "what the code means."
69
+
70
+ ### Per convergence element:
71
+
72
+ **Intent**
73
+ - What does this system make possible from a user perspective?
74
+ - Ignore the technology: not "an Express server with PostgreSQL", but "users can do X"
75
+
76
+ **Inputs**
77
+ - What enters the system? (API calls, files, user input, events)
78
+ - What implicit inputs are there? (time, identity, context, configuration)
79
+
80
+ **Outputs**
81
+ - What is observable as a result? (responses, files, notifications, side effects)
82
+
83
+ **Success criteria**
84
+ - When is an action successful? (derive from tests, response codes, confirmations)
85
+
86
+ **Failure behavior**
87
+ - How does it fail? (error handlers, fallbacks, retries, user messages)
88
+ - Are there silent failures? — mark as OPEN QUESTION: "Intentional or bug?"
89
+
90
+ **Constraints**
91
+ - What must NEVER happen? (derive from validations, guards, denied responses)
92
+ - Security/privacy/ethics boundaries
93
+
94
+ **Non-goals**
95
+ - What does the system explicitly NOT do? (derive from: dead code, disabled features, tests confirming absence, README disclaimers)
96
+
97
+ **Authority Budget — Rights**
98
+ - Allowed actions: what does the system perform?
99
+ - Forbidden actions: what is actively blocked?
100
+ - Data access: which data does it read? Which explicitly not?
101
+ - Data retention: what is stored? For how long? (derive from DB schema, cleanup jobs, TTLs)
102
+ - User notification: when is the user informed?
103
+ - Auditability: what is logged? What is reconstructable?
104
+
105
+ **Authority Budget — Consumption**
106
+ - Rate limits: are there throttles, queue limits, circuit breakers?
107
+ - Cost limits: are there token/API/cost guards?
108
+ - Budget allocation: for multiple components, how is it distributed?
109
+
110
+ **Persistence / restart**
111
+ - Does data survive a restart? What is ephemeral?
112
+
113
+ ---
114
+
115
+ ## STEP 3: CLASSIFY — HARD vs FLEX
116
+
117
+ Classify each discovered element:
118
+
119
+ ### Signals for HARD:
120
+ - Explicit validation that always runs (not configurable)
121
+ - Security/auth checks
122
+ - Tests proving presence of behavior
123
+ - Error handling that never skips
124
+ - Hardcoded limits without override capability
125
+ - Privacy/data-isolation logic
126
+
127
+ ### Signals for FLEX:
128
+ - Configurable values (env vars, config files)
129
+ - Default values that can be overridden
130
+ - UI text / messages
131
+ - Timing/interval values without hard constraint
132
+ - Heuristics that are "good enough"
133
+
134
+ ### Signals for OPEN QUESTION:
135
+ - Behavior that is inconsistent (sometimes yes, sometimes no)
136
+ - Code that looks like a bug but could be a feature
137
+ - Missing tests for specific behavior
138
+ - Commented-out code where it's unclear if it's intentional
139
+ - Implicit assumptions that are never confirmed anywhere
140
+
141
+ ---
142
+
143
+ ## STEP 4: SYNTHESIZE — Generate canon
144
+
145
+ Produce a DialogSpec Canon in dialog form. The canon reads as if a human (HUMAN) and a converger (ASSISTANT) had the conversation.
146
+
147
+ ### Structure:
148
+
149
+ # DialogSpec Canon — [system name]
150
+ # Reconstructed via /pantion-reverse from existing codebase
151
+ # Source: [path to codebase]
152
+ # Date: [today]
153
+
154
+ HUMAN:
155
+ [Description of the system in natural language, as if the human is explaining it
156
+ for the first time. Based on what the code does, not on how.]
157
+
158
+ ASSISTANT:
159
+ [Clarifying question about the most important ambiguous point]
160
+
161
+ HUMAN:
162
+ [Answer based on what the code shows]
163
+
164
+ ASSISTANT:
165
+ [Next clarifying question]
166
+
167
+ HUMAN:
168
+ [Answer]
169
+
170
+ ... [continue until all elements are covered] ...
171
+
172
+ ASSISTANT:
173
+ I have no further questions. Here is the convergence stamp:
174
+
175
+ === DIALOGSPEC STAMP ===
176
+ STATUS: CONVERGED (REVERSE)
177
+ DATE: [today]
178
+ MODEL: [model-id (Display Name), e.g. claude-opus-4-6 (Claude Opus 4.6)]
179
+ CANON TYPE: standalone | architect
180
+ PARENT: none
181
+ SOURCE: [path to codebase]
182
+ RECONSTRUCTION METHOD: /pantion-reverse
183
+ OPEN QUESTIONS: none | <list>
184
+ INFERENCE POLICY: conservative
185
+ AUTHORITY BUDGET RIGHTS: complete | partial (gaps: <list>)
186
+ AUTHORITY BUDGET CONSUMPTION: complete | partial | n/a
187
+ STABILITY ZONES: [HARD invariants]
188
+ FLEX ZONES: [FLEX defaults]
189
+ AMBIGUITIES: [list of "bug or feature?" points]
190
+ === /DIALOGSPEC STAMP ===
191
+
192
+ ### Rules for the synthetic dialog:
193
+ 1. Write in natural language — no code, no technical details
194
+ 2. The HUMAN voice describes behavior, not implementation
195
+ 3. The ASSISTANT voice asks the same questions a converger would ask
196
+ 4. Every convergence element must be covered
197
+ 5. OPEN QUESTIONS are honestly named (not hidden)
198
+ 6. The AMBIGUITIES field in the stamp contains all "bug or feature?" points
199
+
200
+ ---
201
+
202
+ ## STEP 5: VERIFY — Run checklist
203
+
204
+ Run the Pantion checklist on the generated canon:
205
+
206
+ - [ ] Intent is unambiguous
207
+ - [ ] Success criteria are externally verifiable
208
+ - [ ] All inputs named
209
+ - [ ] Outputs are observable
210
+ - [ ] Failure behavior is specified
211
+ - [ ] Constraints are absolute
212
+ - [ ] Non-goals are documented
213
+ - [ ] Authority Budget Rights complete
214
+ - [ ] Authority Budget Consumption complete
215
+ - [ ] Persistence/restart behavior specified
216
+ - [ ] Inference policy is determined
217
+
218
+ ### On gaps:
219
+ If the checklist is not fully checked, there are two options:
220
+
221
+ **Option A — Mark as OPEN QUESTION:**
222
+ The code provides no definitive answer. This becomes a question for the user.
223
+
224
+ **Option B — Ask the user:**
225
+ "I cannot derive from the code: [question]. Do you know the answer?"
226
+
227
+ Start a short convergence dialog to fill the gaps.
228
+
229
+ ---
230
+
231
+ ## STEP 6: OUTPUT
232
+
233
+ Save:
234
+ - `canon/{naam}/dialog.md` — THE CANON: the synthetic dialog (verbatim Q/A)
235
+ - `canon/{naam}/summary.md` — DERIVED: structured summary for navigation (`<!-- Derived from: canon/{naam}/dialog.md, [date] -->`)
236
+ - Update `canon/index.md` with references to both files
237
+ - Update `canon/{naam}/traceability.md` (mapping: canon element → source code location)
238
+
239
+ ### Traceability for Reverse Pantion:
240
+
241
+ The traceability map points in the opposite direction from normal — not from canon to project files, but from canon to **source code**:
242
+
243
+ # Reverse Traceability: Canon → Source Code
244
+
245
+ | Canon element | Source code location | Confidence |
246
+ |--------------|---------------------|------------|
247
+ | Intent: users can manage tasks | src/tasks/*, README.md §Features | high |
248
+ | Constraint: max 100 tasks per user | src/tasks/validator.js:42 | high |
249
+ | Failure: notification on invalid input | src/middleware/error-handler.js | high |
250
+ | Non-goal: no admin interface | (absence of admin routes) | medium |
251
+ | Authority: no external API calls | (absence of outbound HTTP) | medium |
252
+ | Rate limit: 100 req/min | src/middleware/rate-limiter.js:8 | high |
253
+
254
+ Confidence:
255
+ high = explicit in code/tests/docs
256
+ medium = derived from absence or pattern
257
+ low = interpretation, OPEN QUESTION recommended
258
+
259
+ ---
260
+
261
+ ## STEP 7: REPORT
262
+
263
+ Say:
264
+
265
+ "Reverse Pantion is complete for [system name].
266
+
267
+ **Canon (dialog):** `canon/{naam}/dialog.md`
268
+ **Summary (derived):** `canon/{naam}/summary.md`
269
+ **Status:** CONVERGED (REVERSE) | DRAFT (with [N] open questions)
270
+
271
+ **Found:**
272
+ - [N] HARD invariants
273
+ - [N] FLEX defaults
274
+ - [N] non-goals
275
+ - Authority Budget: [complete | partial]
276
+
277
+ **Open questions / ambiguities:**
278
+ - [list, if any]
279
+
280
+ **Traceability:** `canon/{naam}/traceability.md` (canon → source code)
281
+
282
+ **Next steps:**
283
+ - `/pantion-check` — validate the canon
284
+ - `/pantion-translate` — generate project files for a rebuild
285
+ - `/pantion-resume` — answer open questions
286
+ - Blind Reconstruction: give the canon to another agent and compare the result with the original"
287
+
288
+ ---
289
+
290
+ ## STEP 8: OPTIONAL — BLIND RECONSTRUCTION TEST
291
+
292
+ If the user wants to prove the reverse canon works:
293
+
294
+ 1. Hide the original codebase
295
+ 2. Start a new session with only the generated canon
296
+ 3. Use `/pantion-translate` + build phase
297
+ 4. Compare the result with the original on **behavioral equivalence** (not code similarity)
298
+
299
+ This is the ultimate test: **Code → Canon → Code' → behavior(Code) ≈ behavior(Code')**
300
+
301
+ ---
302
+
303
+ ## FOR HIERARCHICAL SYSTEMS
304
+
305
+ If the codebase clearly has multiple independent parts:
306
+
307
+ 1. First generate an **Architect Canon** (system overview)
308
+ 2. Generate a **Component Canon** per part
309
+ 3. Generate an **Interface Canon** per coupling (with all 5 contract fields)
310
+ 4. Run the consistency check
311
+
312
+ The interface canons are often the most valuable during reverse engineering — they make explicit what is often implicit in code: "who delivers what to whom, and what is allowed to go wrong?"
@@ -0,0 +1,220 @@
1
+ # /pantion-start — New project with full protocol
2
+
3
+ You are now in Pantion mode. You will guide the user from idea to working system.
4
+ Follow the three phases STRICTLY in order. Do not skip any phase.
5
+
6
+ ---
7
+
8
+ ## PHASE 0: INITIALIZATION
9
+
10
+ Create `canon/index.md` if it doesn't exist yet (the index template is provided by the Pantion installer).
11
+ This will be the overview of all canons in this project.
12
+
13
+ ---
14
+
15
+ ## PHASE 1: CONVERGENCE
16
+
17
+ ### Start
18
+ Say to the user:
19
+
20
+ "Welcome to Pantion. I'm going to help you turn your idea into a working system.
21
+ Describe in your own words what you want to build. Be as free as you like — I'll ask the right questions."
22
+
23
+ ### Convergence rules
24
+ 1. Ask ONE question at a time — wait for the answer before asking the next
25
+ 2. Only ask questions that remove ambiguity — no more
26
+ 3. Make NO implementation choices (no stack, no libs, no APIs)
27
+ 4. Classify statements as HARD or FLEX based on language use
28
+ 5. Cover ALL elements: intent, inputs, outputs, success, failure, non-goals, authority budget (Rights + Consumption), persistence/restart
29
+ 6. If something has multiple interpretations → ask, don't guess
30
+ 7. Stop when new questions no longer yield new behavior
31
+ 8. Mark open questions with `OPEN QUESTION [OQ-NNN]:` format (e.g. `OPEN QUESTION [OQ-001]: How should authentication work?`). At convergence, reference their resolutions in the OPEN QUESTIONS stamp field
32
+
33
+ ### Decomposition monitoring (Decompose Score)
34
+ Maintain an internal Decompose Score (0–5):
35
+ - (+1) More than 3 clearly independent behavior clusters
36
+ - (+1) Fundamentally different authority budgets per part
37
+ - (+1) Dialog is getting too long / context is being lost
38
+ - (+1) The user clearly describes separate parts ("modules", "components")
39
+ - (+1) Different parts have different users or interfaces
40
+
41
+ **Score 0–1**: continue as standalone.
42
+ **Score 2–3**: report it and let the user decide:
43
+ "Your system scores [N]/5 on decomposition signals: [list of signals]. This is large enough to split up, but it can also work as one whole. What would you prefer?"
44
+ **Score 4–5**: actively propose decomposition:
45
+ "Your system scores [N]/5 on decomposition signals. I recommend switching to decomposition mode (/pantion-decompose). Would you like that?"
46
+
47
+ The USER decides — not you.
48
+
49
+ ### Saving the dialog (CRITICAL — the dialog IS the canon)
50
+
51
+ The verbatim dialog MUST be saved at every stage. The dialog is the only source of truth.
52
+
53
+ **Two files are always produced:**
54
+ - `canon/{naam}/dialog.md` — THE CANON: the verbatim dialog (chronological Q/A)
55
+ - `canon/{naam}/summary.md` — DERIVED: a structured summary for navigation (never authoritative)
56
+
57
+ The summary contains a derivation comment: `<!-- Derived from: canon/{naam}/dialog.md, [date] -->`
58
+
59
+ The dialog file format:
60
+
61
+ # DialogSpec Dialog
62
+ <!-- This is the canon — the verbatim dialog is the only source of truth -->
63
+ <!-- All other files (summary, project files, tests) are derived from this dialog -->
64
+
65
+ [STAMP or PROGRESS STAMP here]
66
+
67
+ ---
68
+
69
+ HUMAN: [verbatim text]
70
+
71
+ ASSISTANT: [verbatim text]
72
+
73
+ HUMAN: [verbatim text]
74
+
75
+ ASSISTANT: [verbatim text]
76
+
77
+ ...
78
+
79
+ ### DRAFT flow (if the session can't be completed in one go)
80
+
81
+ If the user indicates they want to stop, or if the session is getting too long:
82
+
83
+ 1. Save the **verbatim dialog** as `canon/{naam}/dialog.md` with a PROGRESS stamp
84
+ 2. Generate a **derived summary** as `canon/{naam}/summary.md`
85
+ 3. Note all OPEN QUESTIONS explicitly
86
+ 4. Update `canon/index.md` with the DRAFT status, OPEN QUESTIONS, and references to both files
87
+
88
+ The PROGRESS stamp format:
89
+
90
+ === DIALOGSPEC PROGRESS ===
91
+ DATE: [today]
92
+ STATUS: DRAFT (session 1)
93
+ CANON TYPE: standalone
94
+ RESOLVED: [list of answered elements]
95
+ REMAINING OPEN QUESTIONS:
96
+ 1. [question]
97
+ 2. [question]
98
+ NEXT SESSION FOCUS: [suggestion]
99
+ === /DIALOGSPEC PROGRESS ===
100
+
101
+ Say: "Progress has been saved as DRAFT with [N] open questions. You can continue later with `/pantion-resume`."
102
+
103
+ ### Pre-stamp quality check (recommended)
104
+
105
+ Before setting the convergence stamp, it is recommended to run `pantion_check` on the dialog. This provides a structural quality scorecard that can surface gaps before the stamp is finalized. This is not blocking — the HUMAN STAMP remains the actual authorization gate.
106
+
107
+ ### Convergence check (when everything has been answered)
108
+ Before proceeding, check internally:
109
+
110
+ - [ ] Intent is unambiguous
111
+ - [ ] Success criteria are externally verifiable
112
+ - [ ] All inputs named (explicit + implicit)
113
+ - [ ] Outputs are observable
114
+ - [ ] Failure behavior is specified
115
+ - [ ] Constraints are absolute (not "unless convenient")
116
+ - [ ] Non-goals are documented
117
+ - [ ] Authority Budget - Rights complete (allowed/forbidden/data/retention/audit)
118
+ - [ ] Authority Budget - Consumption complete (rate/cost limits)
119
+ - [ ] Persistence/restart behavior specified (what survives a restart? what is ephemeral?)
120
+ - [ ] Inference policy is determined
121
+ - [ ] New questions no longer yield new behavior
122
+
123
+ If all checked, produce the **Convergence Verification Table** followed by the Convergence Stamp in the dialog file.
124
+
125
+ The verification table is placed in the last assistant message, immediately before the stamp:
126
+
127
+ **Convergence Verification:**
128
+
129
+ | Criterium | Status |
130
+ |-----------|--------|
131
+ | Canon status | ✅ |
132
+ | Intent clarity | ✅ |
133
+ | Observable success | ✅ |
134
+ | Inputs complete | ✅ |
135
+ | Outputs unambiguous | ✅ |
136
+ | Failure specified | ✅ |
137
+ | Constraints absolute | ✅ |
138
+ | Non-goals documented | ✅ |
139
+ | Ambiguity handled | ✅ |
140
+ | Authority Budget | ✅ |
141
+ | Persistence/restart | ✅ |
142
+ | Inference Policy | ✅ |
143
+ | Dialog stability | ✅ |
144
+
145
+ **Conclusion:** A competent coding agent can, without further interaction, build a functionally equivalent system.
146
+
147
+ Then produce the Convergence Stamp:
148
+
149
+ === DIALOGSPEC STAMP ===
150
+ STATUS: CONVERGED
151
+ DATE: [today]
152
+ MODEL: [model-id (Display Name), e.g. claude-opus-4-6 (Claude Opus 4.6)]
153
+ CANON TYPE: standalone
154
+ PARENT: none
155
+ OPEN QUESTIONS: none (N resolved: OQ-001 at H[4], OQ-002 at A[7])
156
+ INFERENCE POLICY: conservative
157
+ AUTHORITY BUDGET RIGHTS: complete
158
+ AUTHORITY BUDGET CONSUMPTION: complete | n/a
159
+ STABILITY ZONES: [list of HARD invariants]
160
+ FLEX ZONES: [list of FLEX defaults]
161
+ INHERITED CONSTRAINTS: none
162
+ INTERFACE CANONS: none
163
+ === /DIALOGSPEC STAMP ===
164
+
165
+ Save the complete verbatim dialog as `canon/{naam}/dialog.md`.
166
+ Generate the derived summary as `canon/{naam}/summary.md`.
167
+ Update `canon/index.md` with STATUS: CONVERGED.
168
+
169
+ Say: "The intent has converged. I will now generate the project files."
170
+
171
+ ---
172
+
173
+ ## PHASE 2: TRANSLATION
174
+
175
+ Automatically generate project specification files based on the canon (the dialog).
176
+ The dialog is the primary source. The summary may be used for navigation but is never authoritative.
177
+
178
+ The active skill's `translate.md` defines which files to generate. For the software skill, this typically produces:
179
+
180
+ ### Always generate:
181
+
182
+ 1. **`canon/{naam}/spec/requirements.md`** — requirements from intent, inputs/outputs, success criteria, non-goals
183
+ 2. **`canon/{naam}/spec/constraints.md`** — HARD constraints, forbidden actions, data policies, inference policy
184
+ 3. **`canon/{naam}/spec/success-criteria.md`** — Definition of Done, acceptance criteria, error handling
185
+
186
+ ### Generate if applicable:
187
+
188
+ 4. **`canon/{naam}/spec/api-spec.md`** — API specification
189
+ 5. **`canon/{naam}/spec/data-model.md`** — data model and persistence
190
+ 6. **`canon/{naam}/spec/architecture.md`** — component structure (if decomposed)
191
+
192
+ ### Traceability (always-on):
193
+ - Add a comment to each generated file: `<!-- Derived from: canon/{naam}/dialog.md, [date] -->`
194
+ - Generate or update `canon/{naam}/traceability.md` with the complete mapping
195
+ - Where possible, reference specific dialog turns (e.g., "HUMAN turn 5", "ASSISTANT turn 8")
196
+
197
+ Say after completion: "Project specification files have been generated. I will now build."
198
+
199
+ ---
200
+
201
+ ## PHASE 3: BUILD
202
+
203
+ Switch to implementation mode. Follow the rules in `protocol/commands/build.md` (Coding Agent Instructions).
204
+
205
+ 1. Read the canon (via MCP resources or from the just-generated spec files)
206
+ 2. Build the system according to the canon — the canon is the ONLY source of truth
207
+ 3. Respect ALL constraints from the spec files and canon
208
+ 4. Implement NOTHING that is not in the canon
209
+ 5. On ambiguity: follow the inference policy (don't guess)
210
+ 6. Use Canon Anchors (H1, A3, etc.) in code comments to trace back to dialog turns
211
+ 7. Enforce the Authority Budget as hard boundaries
212
+
213
+ ### Deliverables:
214
+ - [ ] Working implementation
215
+ - [ ] README.md (what it does + installation + usage)
216
+ - [ ] Evidence (how to test/verify)
217
+ - [ ] Canon -> Implementation notes (which FLEX defaults were chosen, with Canon Anchors)
218
+
219
+ ### After building:
220
+ Say: "The system has been built. Here is a summary of what I created, which FLEX choices I made, and how you can test it."
@@ -0,0 +1,157 @@
1
+ # /pantion-translate — Translate canon to project specification files
2
+
3
+ You have an existing converged canon. Translate it into project specification files.
4
+ The canon itself is served to agents via MCP — these spec files are project artifacts for developers and tools.
5
+
6
+ ---
7
+
8
+ ## WHEN YOU ARRIVE HERE
9
+
10
+ - The user already has a canon (dialog conducted in another environment)
11
+ - After a /pantion-amend to regenerate affected files
12
+ - To regenerate files after a manual change to the canon
13
+
14
+ ---
15
+
16
+ ## STEP 1: LOCATE CANON
17
+
18
+ Search for canon dialog files in the project:
19
+
20
+ canon/
21
+ +-- index.md (overview of all canons)
22
+ +-- {naam}/
23
+ | +-- dialog.md (THE CANON — verbatim dialog)
24
+ | +-- summary.md (DERIVED — structured summary)
25
+ | +-- traceability.md (DERIVED — canon → spec traceability)
26
+ | +-- spec/ (DERIVED — project specification files)
27
+ | +-- requirements.md
28
+ | +-- constraints.md
29
+ | +-- ...
30
+ +-- architect/
31
+ | +-- dialog.md (hierarchical — THE CANON)
32
+ | +-- summary.md (DERIVED)
33
+ +-- interfaces/
34
+ | +-- interface-{A}-{B}/
35
+ | +-- dialog.md (THE CANON)
36
+ | +-- summary.md (DERIVED)
37
+ +-- components/
38
+ +-- {component}/
39
+ +-- dialog.md (THE CANON)
40
+ +-- summary.md (DERIVED)
41
+
42
+ The dialog file is always the primary source. The summary is derived and never authoritative.
43
+
44
+ If no dialog file is found but a summary/canon file exists (legacy format), say:
45
+ "I found a summary file but no dialog file. The dialog is the canon in Pantion. Do you have the original dialog? If not, I can work from the summary but traceability will be limited."
46
+
47
+ If no canon is found at all, say:
48
+ "I cannot find a canon in canon/. Do you have a canon file I can read? Or would you like to run /pantion-start first?"
49
+
50
+ ---
51
+
52
+ ## STEP 2: VALIDATE CANON
53
+
54
+ Read the dialog file(s) and check:
55
+
56
+ - [ ] Has a DIALOGSPEC STAMP
57
+ - [ ] STATUS is CONVERGED (or CONVERGED (QUICK))
58
+ - [ ] AUTHORITY BUDGET is complete or partial
59
+ - [ ] No unresolved OPEN QUESTIONS (unless the user accepts this)
60
+
61
+ On problems: report them and ask if the user wants to proceed or converge first.
62
+
63
+ ---
64
+
65
+ ## STEP 3: GENERATE FILES
66
+
67
+ The translate step produces PROJECT SPECIFICATION files, not agent-specific instruction files. The canon itself (served via MCP) is the instruction set for any connected agent.
68
+
69
+ ### Determine output from active skill
70
+
71
+ Read the skill's `translate.md` for domain-specific translation instructions. The skill defines which project specification files to generate.
72
+
73
+ ### For a standalone canon (software skill default):
74
+
75
+ Generate from the dialog (using the summary for navigation only):
76
+
77
+ 1. **`canon/{naam}/spec/requirements.md`**
78
+ - Project intent and goals
79
+ - Functional requirements (inputs/outputs)
80
+ - Non-functional requirements
81
+ - Non-goals
82
+
83
+ 2. **`canon/{naam}/spec/constraints.md`**
84
+ - HARD constraints
85
+ - Forbidden actions
86
+ - Data access and retention policies
87
+ - Inference policy
88
+
89
+ 3. **`canon/{naam}/spec/success-criteria.md`**
90
+ - Definition of Done
91
+ - Acceptance criteria
92
+ - Error handling requirements
93
+
94
+ 4. **Additional spec files as determined by the skill and canon content**
95
+
96
+ ### For a hierarchical system:
97
+
98
+ Generate everything above at the system level, PLUS:
99
+
100
+ 5. **`canon/architect/spec/architecture.md`** — from Architect Canon (components, boundaries, authority budget)
101
+ 6. **`canon/interfaces/interface-[A]-[B]/spec/interface.md`** — per Interface Canon
102
+ 7. **`canon/components/[name]/spec/requirements.md`** — per Component Canon
103
+
104
+ ### Also generate/regenerate the summary:
105
+
106
+ If the summary file doesn't exist yet or is outdated, generate it from the dialog.
107
+ The summary always contains: `<!-- Derived from: canon/{naam}/dialog.md, [date] -->`
108
+
109
+ ---
110
+
111
+ ## STEP 4: TRACEABILITY MAP (always-on)
112
+
113
+ Traceability is not just a step in /pantion-translate — it is a discipline that is updated with every generation or regeneration of files.
114
+
115
+ Generate or update:
116
+
117
+ **`canon/{naam}/traceability.md`**
118
+
119
+ # Traceability: Canon -> Project Specification Files
120
+
121
+ | File | Canon source | Dialog turns | Elements | Last generated |
122
+ |------|-------------|----------------|----------|----------------|
123
+ | canon/{naam}/spec/requirements.md | {naam}/dialog.md | HUMAN 1, ASSISTANT 2 | intent, requirements | [date] |
124
+ | canon/{naam}/spec/constraints.md | {naam}/dialog.md | HUMAN 5, ASSISTANT 6 | HARD constraints | [date] |
125
+ | canon/{naam}/summary.md | {naam}/dialog.md | all | derived summary | [date] |
126
+ | ... | ... | ... | ... | ... |
127
+
128
+ Generated on: [date]
129
+
130
+ ### Per generated file:
131
+ Add a comment at the beginning:
132
+ `<!-- Derived from: canon/{naam}/dialog.md, [date] -->`
133
+
134
+ ---
135
+
136
+ ## STEP 5: UPDATE CANON INDEX
137
+
138
+ Update `canon/index.md`:
139
+ - Confirm STATUS per canon
140
+ - Remove any Open Questions resolved during translation
141
+ - Log that files were generated (date)
142
+ - Ensure references to both dialog and summary files are present
143
+
144
+ ---
145
+
146
+ ## STEP 6: REPORT
147
+
148
+ Say:
149
+
150
+ "I have generated the following project specification files from the canon:
151
+
152
+ [list of files]
153
+
154
+ All files are traceable to the dialog (canon) via canon/traceability.md.
155
+ The dialog in canon/ remains the source of truth — the summary and all generated files are derived.
156
+
157
+ Would you like to review the files or proceed to building?"