@pedrocivita/tocket 2.4.0 → 2.6.3

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 (120) hide show
  1. package/README.md +229 -18
  2. package/dist/commands/agents-md.cmd.d.ts +2 -0
  3. package/dist/commands/agents-md.cmd.js +166 -0
  4. package/dist/commands/agents-md.cmd.js.map +1 -0
  5. package/dist/commands/dashboard.js +2 -0
  6. package/dist/commands/dashboard.js.map +1 -1
  7. package/dist/commands/decide.cmd.d.ts +2 -0
  8. package/dist/commands/decide.cmd.js +70 -0
  9. package/dist/commands/decide.cmd.js.map +1 -0
  10. package/dist/commands/diff.cmd.d.ts +15 -0
  11. package/dist/commands/diff.cmd.js +106 -0
  12. package/dist/commands/diff.cmd.js.map +1 -0
  13. package/dist/commands/doctor.cmd.d.ts +13 -0
  14. package/dist/commands/doctor.cmd.js +159 -11
  15. package/dist/commands/doctor.cmd.js.map +1 -1
  16. package/dist/commands/eject.cmd.d.ts +1 -1
  17. package/dist/commands/eject.cmd.js +3 -1
  18. package/dist/commands/eject.cmd.js.map +1 -1
  19. package/dist/commands/generate.cmd.js +7 -1
  20. package/dist/commands/generate.cmd.js.map +1 -1
  21. package/dist/commands/handoff.cmd.d.ts +14 -0
  22. package/dist/commands/handoff.cmd.js +131 -0
  23. package/dist/commands/handoff.cmd.js.map +1 -0
  24. package/dist/commands/init.cmd.js +64 -11
  25. package/dist/commands/init.cmd.js.map +1 -1
  26. package/dist/commands/scaffold.cmd.d.ts +2 -0
  27. package/dist/commands/scaffold.cmd.js +118 -0
  28. package/dist/commands/scaffold.cmd.js.map +1 -0
  29. package/dist/commands/suite.cmd.d.ts +2 -0
  30. package/dist/commands/suite.cmd.js +386 -0
  31. package/dist/commands/suite.cmd.js.map +1 -0
  32. package/dist/commands/validate.cmd.js +1 -0
  33. package/dist/commands/validate.cmd.js.map +1 -1
  34. package/dist/commands/work.cmd.d.ts +2 -0
  35. package/dist/commands/work.cmd.js +48 -0
  36. package/dist/commands/work.cmd.js.map +1 -0
  37. package/dist/eval/decide-eval.d.ts +28 -0
  38. package/dist/eval/decide-eval.js +34 -0
  39. package/dist/eval/decide-eval.js.map +1 -0
  40. package/dist/eval/triage-eval.d.ts +46 -0
  41. package/dist/eval/triage-eval.js +174 -0
  42. package/dist/eval/triage-eval.js.map +1 -0
  43. package/dist/index.js +15 -1
  44. package/dist/index.js.map +1 -1
  45. package/dist/mcp/index.d.ts +2 -0
  46. package/dist/mcp/index.js +7 -0
  47. package/dist/mcp/index.js.map +1 -0
  48. package/dist/mcp/server.d.ts +4 -0
  49. package/dist/mcp/server.js +360 -0
  50. package/dist/mcp/server.js.map +1 -0
  51. package/dist/templates/memory-bank.d.ts +11 -0
  52. package/dist/templates/memory-bank.js +456 -329
  53. package/dist/templates/memory-bank.js.map +1 -1
  54. package/dist/tests/agents.test.js +59 -1
  55. package/dist/tests/agents.test.js.map +1 -1
  56. package/dist/tests/decide.test.d.ts +1 -0
  57. package/dist/tests/decide.test.js +483 -0
  58. package/dist/tests/decide.test.js.map +1 -0
  59. package/dist/tests/diff.test.d.ts +1 -0
  60. package/dist/tests/diff.test.js +119 -0
  61. package/dist/tests/diff.test.js.map +1 -0
  62. package/dist/tests/doctor.test.js +73 -1
  63. package/dist/tests/doctor.test.js.map +1 -1
  64. package/dist/tests/eject.test.js +3 -0
  65. package/dist/tests/eject.test.js.map +1 -1
  66. package/dist/tests/git.test.js +32 -1
  67. package/dist/tests/git.test.js.map +1 -1
  68. package/dist/tests/handoff.test.d.ts +1 -0
  69. package/dist/tests/handoff.test.js +97 -0
  70. package/dist/tests/handoff.test.js.map +1 -0
  71. package/dist/tests/helpers.d.ts +4 -0
  72. package/dist/tests/helpers.js +9 -0
  73. package/dist/tests/helpers.js.map +1 -0
  74. package/dist/tests/helpers.test.d.ts +1 -0
  75. package/dist/tests/helpers.test.js +16 -0
  76. package/dist/tests/helpers.test.js.map +1 -0
  77. package/dist/tests/init.test.js +53 -2
  78. package/dist/tests/init.test.js.map +1 -1
  79. package/dist/tests/loop.test.d.ts +1 -0
  80. package/dist/tests/loop.test.js +153 -0
  81. package/dist/tests/loop.test.js.map +1 -0
  82. package/dist/tests/memory-bank.test.js +53 -1
  83. package/dist/tests/memory-bank.test.js.map +1 -1
  84. package/dist/tests/suite.test.d.ts +1 -0
  85. package/dist/tests/suite.test.js +199 -0
  86. package/dist/tests/suite.test.js.map +1 -0
  87. package/dist/tests/triage.test.d.ts +1 -0
  88. package/dist/tests/triage.test.js +152 -0
  89. package/dist/tests/triage.test.js.map +1 -0
  90. package/dist/tests/work.test.d.ts +1 -0
  91. package/dist/tests/work.test.js +276 -0
  92. package/dist/tests/work.test.js.map +1 -0
  93. package/dist/tests/xml.test.d.ts +1 -0
  94. package/dist/tests/xml.test.js +139 -0
  95. package/dist/tests/xml.test.js.map +1 -0
  96. package/dist/utils/agents.d.ts +23 -0
  97. package/dist/utils/agents.js +82 -0
  98. package/dist/utils/agents.js.map +1 -1
  99. package/dist/utils/appmaps.d.ts +65 -0
  100. package/dist/utils/appmaps.js +280 -0
  101. package/dist/utils/appmaps.js.map +1 -0
  102. package/dist/utils/decide.d.ts +178 -0
  103. package/dist/utils/decide.js +623 -0
  104. package/dist/utils/decide.js.map +1 -0
  105. package/dist/utils/git.d.ts +2 -0
  106. package/dist/utils/git.js +35 -1
  107. package/dist/utils/git.js.map +1 -1
  108. package/dist/utils/jev.d.ts +83 -0
  109. package/dist/utils/jev.js +190 -0
  110. package/dist/utils/jev.js.map +1 -0
  111. package/dist/utils/triage.d.ts +87 -0
  112. package/dist/utils/triage.js +241 -0
  113. package/dist/utils/triage.js.map +1 -0
  114. package/dist/utils/work.d.ts +72 -0
  115. package/dist/utils/work.js +225 -0
  116. package/dist/utils/work.js.map +1 -0
  117. package/dist/utils/xml.d.ts +22 -0
  118. package/dist/utils/xml.js +54 -0
  119. package/dist/utils/xml.js.map +1 -0
  120. package/package.json +53 -50
@@ -1,171 +1,174 @@
1
- export const executorMd = (projectName, description, executorName = "Claude Code", architectFile = "GEMINI.md") => `# ${projectName} — Executor Instructions
2
-
3
- <!-- LLM_CONTEXT: Executor instructions for ${executorName} -->
4
- <!-- Generated by Tocket CLI -->
5
-
6
- ## Role
7
-
8
- You are the **Executor** (${executorName}) for **${projectName}**.
9
- ${description ? `\n> ${description}\n` : ""}
10
- Your job is to **implement**, not to plan. Read the Memory Bank before every session, follow the Architect's decisions, and write code.
11
-
12
- ---
13
-
14
- ## Rules
15
-
16
- 1. **Always read \`.context/\` first** — Start every session by reading activeContext.md and systemPatterns.md.
17
- 2. **Follow the Architect's plan** — Implementation decisions come from \`${architectFile}\` or mission briefs. Do not redesign.
18
- 3. **Ask before deviating** — If the plan is unclear or blocked, ask the user. Do not improvise architecture.
19
- 4. **Write code in English** — Variables, functions, comments, commits — all in \`en-US\`.
20
- 5. **Update Memory Bank on completion** — After finishing a task, update activeContext.md with what changed.
21
-
22
- ---
23
-
24
- ## Memory Bank
25
-
26
- | File | Purpose |
27
- |------|---------|
28
- | \`.context/activeContext.md\` | Current focus, recent changes, open decisions |
29
- | \`.context/systemPatterns.md\` | Architecture patterns, tech stack, conventions |
30
- | \`${architectFile}\` | Architect instructions (read-only for you) |
31
-
32
- ---
33
-
34
- ## Workflow
35
-
36
- \`\`\`
37
- 1. Read .context/ → 2. Receive task → 3. Implement → 4. Update .context/
38
- \`\`\`
1
+ export const executorMd = (projectName, description, executorName = "Claude Code", architectFile = "GEMINI.md") => `# ${projectName} — Executor Instructions
2
+
3
+ <!-- LLM_CONTEXT: Executor instructions for ${executorName} -->
4
+ <!-- Generated by Tocket CLI -->
5
+
6
+ ## Role
7
+
8
+ You are the **Executor** (${executorName}) for **${projectName}**.
9
+ ${description ? `\n> ${description}\n` : ""}
10
+ Your job is to **implement**, not to plan. Read the Memory Bank before every session, follow the Architect's decisions, and write code.
11
+
12
+ ---
13
+
14
+ ## Rules
15
+
16
+ 1. **Always read \`.context/\` first** — Start every session by reading activeContext.md and systemPatterns.md.
17
+ 2. **Follow the Architect's plan** — Implementation decisions come from \`${architectFile}\` or mission briefs. Do not redesign.
18
+ 3. **Ask before deviating** — If the plan is unclear or blocked, ask the user. Do not improvise architecture.
19
+ 4. **Write code in English** — Variables, functions, comments, commits — all in \`en-US\`.
20
+ 5. **Update Memory Bank on completion** — After finishing a task, update activeContext.md with what changed.
21
+ 6. **Before expensive tools** — Read \`AGENTS.md\` and \`.context/decisions/\` first. If a handoff exists, honor it (do not re-ask Jev). Else run \`tocket decide\`. Workers execute. Tocket does not.
22
+ 7. **Tool-risk gate** — Before bash, deploy, or browser: \`tocket decide --choice tool_gate:allow,block,ask\`, then \`tocket work\`. Honor \`allow|block|ask\`. Consume with \`tocket work\` (plan) or \`tocket work --apply\` (receipt).
23
+
24
+ ---
25
+
26
+ ## Memory Bank
27
+
28
+ | File | Purpose |
29
+ |------|---------|
30
+ | \`.context/activeContext.md\` | Current focus, recent changes, open decisions |
31
+ | \`.context/systemPatterns.md\` | Architecture patterns, tech stack, conventions |
32
+ | \`${architectFile}\` | Architect instructions (read-only for you) |
33
+
34
+ ---
35
+
36
+ ## Workflow
37
+
38
+ \`\`\`
39
+ 1. Read .context/ → 2. Receive task → 3. Implement → 4. Update .context/
40
+ \`\`\`
39
41
  `;
40
42
  /** @deprecated Use executorMd instead */
41
43
  export const claudeMd = executorMd;
42
- export const architectMd = (projectName, description, architectName = "Gemini", executorName = "Claude Code", executorFile = "CLAUDE.md") => `# ${projectName} — Architect Instructions
43
-
44
- <!-- LLM_CONTEXT: Architect instructions for ${architectName} -->
45
- <!-- Generated by Tocket CLI -->
46
-
47
- ## Role
48
-
49
- You are the **Architect** (${architectName}) for **${projectName}**.
50
- ${description ? `\n> ${description}\n` : ""}
51
- Your job is to **analyze, plan, and decide**. You do not write code directly — you produce structured mission briefs that the Executor (${executorName}) implements.
52
-
53
- ---
54
-
55
- ## Rules
56
-
57
- 1. **Read \`.context/\` first** — Understand current state before planning.
58
- 2. **Produce payloads** — Use \`<payload version="2.0">\` XML format for handoff to the Executor.
59
- 3. **Never write code inline** — Provide specs, not implementations. The Executor handles code.
60
- 4. **Update systemPatterns.md** — When you make architectural decisions, record them.
61
- 5. **Think in constraints** — Define what the system should and should not do.
62
-
63
- ---
64
-
65
- ## Memory Bank
66
-
67
- | File | Purpose |
68
- |------|---------|
69
- | \`.context/activeContext.md\` | Current focus, recent changes, open decisions |
70
- | \`.context/systemPatterns.md\` | Architecture patterns, tech stack, conventions |
71
- | \`${executorFile}\` | Executor instructions (read-only for you) |
72
-
73
- ---
74
-
75
- ## Payload Format
76
-
77
- \`\`\`xml
78
- <payload version="2.0">
79
- <meta>
80
- <intent>What needs to happen</intent>
81
- <scope>Which files/modules are affected</scope>
82
- <priority>high | medium | low</priority>
83
- </meta>
84
- <context>
85
- <summary>Background and reasoning</summary>
86
- <architect-decisions>Key decisions made</architect-decisions>
87
- </context>
88
- <tasks>
89
- <task id="1" type="create|edit|delete">
90
- <target>file/path</target>
91
- <action>What to do</action>
92
- <spec>Detailed specification</spec>
93
- <done>Definition of done</done>
94
- </task>
95
- </tasks>
96
- <validate>
97
- <check>Verification step</check>
98
- </validate>
99
- </payload>
100
- \`\`\`
44
+ export const architectMd = (projectName, description, architectName = "Gemini", executorName = "Claude Code", executorFile = "CLAUDE.md") => `# ${projectName} — Architect Instructions
45
+
46
+ <!-- LLM_CONTEXT: Architect instructions for ${architectName} -->
47
+ <!-- Generated by Tocket CLI -->
48
+
49
+ ## Role
50
+
51
+ You are the **Architect** (${architectName}) for **${projectName}**.
52
+ ${description ? `\n> ${description}\n` : ""}
53
+ Your job is to **analyze, plan, and decide**. You do not write code directly — you produce structured mission briefs that the Executor (${executorName}) implements.
54
+
55
+ ---
56
+
57
+ ## Rules
58
+
59
+ 1. **Read \`.context/\` first** — Understand current state before planning.
60
+ 2. **Produce payloads** — Use \`<payload version="2.0">\` XML format for handoff to the Executor.
61
+ 3. **Never write code inline** — Provide specs, not implementations. The Executor handles code.
62
+ 4. **Update systemPatterns.md** — When you make architectural decisions, record them.
63
+ 5. **Think in constraints** — Define what the system should and should not do.
64
+ 6. **Jev is the judge, not the writer** — Cheap next-move Choice goes to \`tocket decide\`. Do not ask Jev to write prose or run tools.
65
+
66
+ ---
67
+
68
+ ## Memory Bank
69
+
70
+ | File | Purpose |
71
+ |------|---------|
72
+ | \`.context/activeContext.md\` | Current focus, recent changes, open decisions |
73
+ | \`.context/systemPatterns.md\` | Architecture patterns, tech stack, conventions |
74
+ | \`${executorFile}\` | Executor instructions (read-only for you) |
75
+
76
+ ---
77
+
78
+ ## Payload Format
79
+
80
+ \`\`\`xml
81
+ <payload version="2.0">
82
+ <meta>
83
+ <intent>What needs to happen</intent>
84
+ <scope>Which files/modules are affected</scope>
85
+ <priority>high | medium | low</priority>
86
+ </meta>
87
+ <context>
88
+ <summary>Background and reasoning</summary>
89
+ <architect-decisions>Key decisions made</architect-decisions>
90
+ </context>
91
+ <tasks>
92
+ <task id="1" type="create|edit|delete">
93
+ <target>file/path</target>
94
+ <action>What to do</action>
95
+ <spec>Detailed specification</spec>
96
+ <done>Definition of done</done>
97
+ </task>
98
+ </tasks>
99
+ <validate>
100
+ <check>Verification step</check>
101
+ </validate>
102
+ </payload>
103
+ \`\`\`
101
104
  `;
102
105
  /** @deprecated Use architectMd instead */
103
106
  export const geminiMd = architectMd;
104
- export const activeContextMd = (projectName) => `# Active Context - ${projectName}
105
-
106
- <!-- Updated by both Architect and Executor after each session -->
107
-
108
- ## Current Focus
109
-
110
- _No active tasks yet. Run \`tocket generate\` to create your first mission brief._
111
-
112
- ## Recent Changes
113
-
114
- | Date | Change | Agent |
115
- |------|--------|-------|
116
- | ${new Date().toISOString().split("T")[0]} | Initialized agentic workspace | Tocket CLI |
117
-
118
- ## Open Decisions
119
-
120
- _None yet._
107
+ export const activeContextMd = (projectName) => `# Active Context - ${projectName}
108
+
109
+ <!-- Updated by both Architect and Executor after each session -->
110
+
111
+ ## Current Focus
112
+
113
+ _No active tasks yet. Run \`tocket generate\` to create your first mission brief._
114
+
115
+ ## Recent Changes
116
+
117
+ | Date | Change | Agent |
118
+ |------|--------|-------|
119
+ | ${new Date().toISOString().split("T")[0]} | Initialized agentic workspace | Tocket CLI |
120
+
121
+ ## Open Decisions
122
+
123
+ _None yet._
121
124
  `;
122
- export const systemPatternsMd = (projectName, architectName = "Gemini", executorName = "Claude Code") => `# System Patterns - ${projectName}
123
-
124
- <!-- Architectural decisions and conventions. Updated by the Architect. -->
125
-
126
- ## Tech Stack
127
-
128
- _To be defined by the Architect._
129
-
130
- ## Architecture Patterns
131
-
132
- _To be defined._
133
-
134
- ## Conventions
135
-
136
- - Code language: \`en-US\`
137
- - Commit language: \`en-US\`
138
- - Triangulation: ${architectName} (Architect) + ${executorName} (Executor)
139
-
140
- ## Key Decisions
141
-
142
- | Decision | Rationale | Date |
143
- |----------|-----------|------|
144
- | Adopted Tocket triangulation | Structured multi-agent workflow | ${new Date().toISOString().split("T")[0]} |
125
+ export const systemPatternsMd = (projectName, architectName = "Gemini", executorName = "Claude Code") => `# System Patterns - ${projectName}
126
+
127
+ <!-- Architectural decisions and conventions. Updated by the Architect. -->
128
+
129
+ ## Tech Stack
130
+
131
+ _To be defined by the Architect._
132
+
133
+ ## Architecture Patterns
134
+
135
+ _To be defined._
136
+
137
+ ## Conventions
138
+
139
+ - Code language: \`en-US\`
140
+ - Commit language: \`en-US\`
141
+ - Triangulation: ${architectName} (Architect) + ${executorName} (Executor)
142
+
143
+ ## Key Decisions
144
+
145
+ | Decision | Rationale | Date |
146
+ |----------|-----------|------|
147
+ | Adopted Tocket triangulation | Structured multi-agent workflow | ${new Date().toISOString().split("T")[0]} |
145
148
  `;
146
- export const productContextMd = (projectName, description) => `# Product Context - ${projectName}
147
-
148
- <!-- What the product is, who it's for, and why it exists. Updated by the Architect. -->
149
-
150
- ## What is ${projectName}?
151
-
152
- ${description || "_Describe your product here._"}
153
-
154
- ## Problem
155
-
156
- _What problem does this project solve?_
157
-
158
- ## Solution
159
-
160
- _How does it solve it?_
161
-
162
- ## Target Users
163
-
164
- _Who is this for?_
165
-
166
- ## Design Principles
167
-
168
- - _List the guiding principles for this project_
149
+ export const productContextMd = (projectName, description) => `# Product Context - ${projectName}
150
+
151
+ <!-- What the product is, who it's for, and why it exists. Updated by the Architect. -->
152
+
153
+ ## What is ${projectName}?
154
+
155
+ ${description || "_Describe your product here._"}
156
+
157
+ ## Problem
158
+
159
+ _What problem does this project solve?_
160
+
161
+ ## Solution
162
+
163
+ _How does it solve it?_
164
+
165
+ ## Target Users
166
+
167
+ _Who is this for?_
168
+
169
+ ## Design Principles
170
+
171
+ - _List the guiding principles for this project_
169
172
  `;
170
173
  export const techContextMd = (projectName, stack) => {
171
174
  const lang = stack?.language || "";
@@ -175,178 +178,302 @@ export const techContextMd = (projectName, stack) => {
175
178
  const extras = stack?.extras?.length
176
179
  ? `\n### Notable Dependencies\n\n${stack.extras.map((d) => `- \`${d}\``).join("\n")}\n`
177
180
  : "";
178
- return `# Tech Context - ${projectName}
179
-
180
- <!-- Stack, build tools, and critical rules. Updated by the Architect. -->
181
-
182
- ## Stack
183
-
184
- | Layer | Technology | Notes |
185
- |-------|-----------|-------|
186
- | Language | ${lang} | ${lang ? "Auto-detected by Tocket" : ""} |
187
- | Runtime | ${rt} | ${rt ? "Auto-detected by Tocket" : ""} |
188
- | Build | ${bld} | ${bld ? "Auto-detected by Tocket" : ""} |
189
- | Framework | ${fw} | ${fw ? "Auto-detected by Tocket" : ""} |
190
- ${extras}
191
- ## Critical Rules
192
-
193
- _Document any rules that agents must follow (e.g., import conventions, naming patterns)._
194
-
195
- ## Project Structure
196
-
197
- \`\`\`
198
- ${projectName}/
199
- src/ # Source code
200
- .context/ # Memory Bank
201
- \`\`\`
181
+ return `# Tech Context - ${projectName}
182
+
183
+ <!-- Stack, build tools, and critical rules. Updated by the Architect. -->
184
+
185
+ ## Stack
186
+
187
+ | Layer | Technology | Notes |
188
+ |-------|-----------|-------|
189
+ | Language | ${lang} | ${lang ? "Auto-detected by Tocket" : ""} |
190
+ | Runtime | ${rt} | ${rt ? "Auto-detected by Tocket" : ""} |
191
+ | Build | ${bld} | ${bld ? "Auto-detected by Tocket" : ""} |
192
+ | Framework | ${fw} | ${fw ? "Auto-detected by Tocket" : ""} |
193
+ ${extras}
194
+ ## Critical Rules
195
+
196
+ _Document any rules that agents must follow (e.g., import conventions, naming patterns)._
197
+
198
+ ## Project Structure
199
+
200
+ \`\`\`
201
+ ${projectName}/
202
+ src/ # Source code
203
+ .context/ # Memory Bank
204
+ \`\`\`
202
205
  `;
203
206
  };
204
- export const progressMd = (projectName) => `# Progress Log - ${projectName}
205
-
206
- <!-- Appended by tocket sync and manual updates -->
207
-
208
- ## Milestone: Project Initialization
209
-
210
- **Status**: Complete
211
-
212
- - [x] Agentic workspace scaffolded with Tocket CLI
213
- - [x] Memory Bank initialized (\`.context/\`)
214
-
215
- ## Next Up
216
-
217
- - [ ] _Define your first milestone here_
207
+ export const progressMd = (projectName) => `# Progress Log - ${projectName}
208
+
209
+ <!-- Appended by tocket sync and manual updates -->
210
+
211
+ ## Milestone: Project Initialization
212
+
213
+ **Status**: Complete
214
+
215
+ - [x] Agentic workspace scaffolded with Tocket CLI
216
+ - [x] Memory Bank initialized (\`.context/\`)
217
+
218
+ ## Next Up
219
+
220
+ - [ ] _Define your first milestone here_
218
221
  `;
219
- export const cursorrulesMd = (projectName, description, architectFile = "ARCHITECT.md") => `# .cursorrules - ${projectName}
220
-
221
- # Generated by Tocket CLI — compatible with Cursor IDE
222
-
223
- ## Role
224
-
225
- You are the **Executor** (Cursor) for **${projectName}**.
226
- ${description ? `\n> ${description}\n` : ""}
227
- Your job is to **implement**, not to plan. Read the Memory Bank before every session, follow the Architect's decisions, and write code.
228
-
229
- ## Rules
230
-
231
- 1. **Always read \`.context/\` first** — Start every session by reading activeContext.md and systemPatterns.md.
232
- 2. **Follow the Architect's plan** — Implementation decisions come from \`${architectFile}\` or mission briefs. Do not redesign.
233
- 3. **Ask before deviating** — If the plan is unclear or blocked, ask the user. Do not improvise architecture.
234
- 4. **Write code in English** — Variables, functions, comments, commits — all in \`en-US\`.
235
- 5. **Update Memory Bank on completion** — After finishing a task, update activeContext.md with what changed.
236
-
237
- ## Memory Bank
238
-
239
- | File | Purpose |
240
- |------|---------|
241
- | \`.context/activeContext.md\` | Current focus, recent changes, open decisions |
242
- | \`.context/systemPatterns.md\` | Architecture patterns, tech stack, conventions |
243
- | \`${architectFile}\` | Architect instructions (read-only for you) |
244
-
245
- ## Workflow
246
-
247
- \`\`\`
248
- 1. Read .context/ → 2. Receive task → 3. Implement → 4. Update .context/
249
- \`\`\`
222
+ export const cursorrulesMd = (projectName, description, architectFile = "ARCHITECT.md") => `# .cursorrules - ${projectName}
223
+
224
+ # Generated by Tocket CLI — compatible with Cursor IDE
225
+
226
+ ## Role
227
+
228
+ You are the **Executor** (Cursor) for **${projectName}**.
229
+ ${description ? `\n> ${description}\n` : ""}
230
+ Your job is to **implement**, not to plan. Read the Memory Bank before every session, follow the Architect's decisions, and write code.
231
+
232
+ ## Rules
233
+
234
+ 1. **Always read \`.context/\` first** — Start every session by reading activeContext.md and systemPatterns.md.
235
+ 2. **Follow the Architect's plan** — Implementation decisions come from \`${architectFile}\` or mission briefs. Do not redesign.
236
+ 3. **Ask before deviating** — If the plan is unclear or blocked, ask the user. Do not improvise architecture.
237
+ 4. **Write code in English** — Variables, functions, comments, commits — all in \`en-US\`.
238
+ 5. **Update Memory Bank on completion** — After finishing a task, update activeContext.md with what changed.
239
+ 6. **Before expensive tools** — Read \`AGENTS.md\` and \`.context/decisions/\` first. If a handoff exists, honor it (do not re-ask Jev). Else run \`tocket decide\`.
240
+ 7. **Tool-risk gate** — Before bash, deploy, or browser: \`tocket decide --choice tool_gate:allow,block,ask\`, then \`tocket work\`. Honor \`allow|block|ask\`.
241
+
242
+ ## Memory Bank
243
+
244
+ | File | Purpose |
245
+ |------|---------|
246
+ | \`.context/activeContext.md\` | Current focus, recent changes, open decisions |
247
+ | \`.context/systemPatterns.md\` | Architecture patterns, tech stack, conventions |
248
+ | \`${architectFile}\` | Architect instructions (read-only for you) |
249
+
250
+ ## Workflow
251
+
252
+ \`\`\`
253
+ 1. Read .context/ → 2. Receive task → 3. Implement → 4. Update .context/
254
+ \`\`\`
250
255
  `;
251
- export const tocketMd = (projectName, executorFile = "CLAUDE.md", architectFile = "GEMINI.md") => `# Tocket Protocol Specification
252
-
253
- > How any AI agent should operate in **${projectName}**.
254
-
255
- This file is **agent-agnostic**. Whether you are Claude, Gemini, GPT, Cursor, Cline, Copilot, or any future AI — if you see this file, follow these rules.
256
-
257
- ---
258
-
259
- ## 1. Memory Bank
260
-
261
- Project context lives in \`.context/\`, not in chat history. **Read it before doing anything.**
262
-
263
- \`\`\`
264
- .context/
265
- activeContext.md <- Start here. Current focus, recent changes, open decisions.
266
- systemPatterns.md <- Architecture patterns, conventions, key decisions.
267
- techContext.md <- Tech stack, build tools, critical rules.
268
- productContext.md <- What the product is, who it's for, why it exists.
269
- progress.md <- What's done, what's next.
270
- \`\`\`
271
-
272
- ### Rules
273
-
274
- - **Read before acting** — Always read \`activeContext.md\` and \`systemPatterns.md\` before your first action in a session.
275
- - **Write before leaving** — Update \`activeContext.md\` with what changed after completing significant work.
276
- - **Trust the files** — If \`.context/\` says the project uses ESM, it uses ESM. Don't second-guess documented decisions.
277
- - **Don't duplicate** — Context belongs in \`.context/\`, not scattered in code comments or chat summaries.
278
-
279
- ---
280
-
281
- ## 2. Triangulation
282
-
283
- Tocket separates **planning** from **implementation** across two agent roles:
284
-
285
- \`\`\`
286
- ┌─────────────────┐ ┌─────────────────┐
287
- │ ARCHITECT │ │ EXECUTOR │
288
- │ (Planner) │ payload │ (Implementer) │
289
- │ │─────────>│ │
290
- Analyzes task │ │ Receives plan
291
- Designs approach Writes code
292
- Generates XML │ Runs tests │
293
- Updates patterns│ │ Updates context
294
- └─────────────────┘ └─────────────────┘
295
- \`\`\`
296
-
297
- ### Architect
298
-
299
- - Reads \`.context/\` to understand current state
300
- - Produces structured payloads (see Section 3) with clear tasks
301
- - Makes architectural decisions and records them in \`systemPatterns.md\`
302
- - **Does not write code** only specs and constraints
303
-
304
- ### Executor
305
-
306
- - Reads \`.context/\` and the Architect's payload
307
- - Implements tasks exactly as specified
308
- - Asks when the plan is unclear — does not improvise architecture
309
- - Updates \`activeContext.md\` and \`progress.md\` after completing work
310
-
311
- ### Solo Mode
312
-
313
- Not every task needs triangulation. For simple, well-defined changes, a single agent can act as both Architect and Executor. The Memory Bank rules still apply.
314
-
315
- ---
316
-
317
- ## 3. Payloads
318
-
319
- A payload is the structured handoff from Architect to Executor.
320
-
321
- ### Minimal Example
322
-
323
- \`\`\`xml
324
- <payload version="2.0">
325
- <meta>
326
- <intent>Goal in one line</intent>
327
- <scope>Files affected</scope>
328
- <priority>high | medium | low</priority>
329
- </meta>
330
- <tasks>
331
- <task id="1" type="create | edit | delete">
332
- <target>file/path</target>
333
- <action>What to do</action>
334
- <done>Definition of done</done>
335
- </task>
336
- </tasks>
337
- <validate>
338
- <check>How to verify success</check>
339
- </validate>
340
- </payload>
341
- \`\`\`
342
-
343
- ---
344
-
345
- ## Quick Start
346
-
347
- 1. Read this file (\`TOCKET.md\`)
348
- 2. Read \`.context/activeContext.md\` for current state
349
- 3. Read your role-specific config (\`${executorFile}\` or \`${architectFile}\`)
350
- 4. Proceed with your task, following the Memory Bank rules above
256
+ export const tocketMd = (projectName, executorFile = "CLAUDE.md", architectFile = "GEMINI.md") => `# Tocket Protocol Specification
257
+
258
+ > How any AI agent should operate in **${projectName}**.
259
+
260
+ This file is **agent-agnostic**. Whether you are Claude, Gemini, GPT, Cursor, Cline, Copilot, or any future AI — if you see this file, follow these rules.
261
+
262
+ ---
263
+
264
+ ## 1. Memory Bank
265
+
266
+ Project context lives in \`.context/\`, not in chat history. **Read it before doing anything.**
267
+
268
+ \`\`\`
269
+ .context/
270
+ activeContext.md <- Start here. Current focus, recent changes, open decisions.
271
+ systemPatterns.md <- Architecture patterns, conventions, key decisions.
272
+ techContext.md <- Tech stack, build tools, critical rules.
273
+ productContext.md <- What the product is, who it's for, why it exists.
274
+ progress.md <- What's done, what's next.
275
+ \`\`\`
276
+
277
+ ### Rules
278
+
279
+ - **Read before acting** — Always read \`activeContext.md\` and \`systemPatterns.md\` before your first action in a session.
280
+ - **Write before leaving** — Update \`activeContext.md\` with what changed after completing significant work.
281
+ - **Trust the files** — If \`.context/\` says the project uses ESM, it uses ESM. Don't second-guess documented decisions.
282
+ - **Don't duplicate** — Context belongs in \`.context/\`, not scattered in code comments or chat summaries.
283
+ - **Decide is a file** — \`tocket decide\` writes the next move into \`.context/decisions/\`. Before expensive tools, run it or read the latest decision. Consume it with \`tocket work\` (plan) or \`tocket work --apply\` (notebook receipt). Workers (Cursor, Claude, GrokBot, CI) execute. Tocket does not re-decide.
284
+ - **Do not re-ask Jev** — If a decision file already exists, honor \`choice\`, \`destination\`, \`gated\`, and \`tool_gate\`. Call \`tocket work\`, not \`tocket decide\` again.
285
+ - **Tool-risk gate** — \`tool_gate\` / \`action_gate\` is \`allow|block|ask\`. \`tocket work --apply\` refuses \`block\` and \`ask\` unless \`--force\`. Shadow / log-only still needs \`--force\`.
286
+
287
+ ---
288
+
289
+ ## 2. Triangulation
290
+
291
+ Tocket separates **planning** from **implementation** across two agent roles:
292
+
293
+ \`\`\`
294
+ ┌─────────────────┐ ┌─────────────────┐
295
+ ARCHITECT │ │ EXECUTOR
296
+ (Planner) payload (Implementer) │
297
+ │─────────>│
298
+ Analyzes task │ │ Receives plan
299
+ │ Designs approach│ │ Writes code │
300
+ │ Generates XML │ │ Runs tests │
301
+ │ Updates patterns│ │ Updates context │
302
+ └─────────────────┘ └─────────────────┘
303
+ \`\`\`
304
+
305
+ ### Architect
306
+
307
+ - Reads \`.context/\` to understand current state
308
+ - Produces structured payloads (see Section 3) with clear tasks
309
+ - Makes architectural decisions and records them in \`systemPatterns.md\`
310
+ - **Does not write code** — only specs and constraints
311
+
312
+ ### Executor
313
+
314
+ - Reads \`.context/\` and the Architect's payload
315
+ - Implements tasks exactly as specified
316
+ - Asks when the plan is unclear — does not improvise architecture
317
+ - Updates \`activeContext.md\` and \`progress.md\` after completing work
318
+
319
+ ### Solo Mode
320
+
321
+ Not every task needs triangulation. For simple, well-defined changes, a single agent can act as both Architect and Executor. The Memory Bank rules still apply.
322
+
323
+ ---
324
+
325
+ ## 3. Payloads
326
+
327
+ A payload is the structured handoff from Architect to Executor.
328
+
329
+ ### Minimal Example
330
+
331
+ \`\`\`xml
332
+ <payload version="2.0">
333
+ <meta>
334
+ <intent>Goal in one line</intent>
335
+ <scope>Files affected</scope>
336
+ <priority>high | medium | low</priority>
337
+ </meta>
338
+ <tasks>
339
+ <task id="1" type="create | edit | delete">
340
+ <target>file/path</target>
341
+ <action>What to do</action>
342
+ <done>Definition of done</done>
343
+ </task>
344
+ </tasks>
345
+ <validate>
346
+ <check>How to verify success</check>
347
+ </validate>
348
+ </payload>
349
+ \`\`\`
350
+
351
+ ---
352
+
353
+ ## 4. Decide and work
354
+
355
+ Jev (or the stub) is the **judge**, not the writer. \`tocket decide\` writes JSON. \`tocket work\` plans (default) then \`--apply\` stamps a notebook receipt. Tocket does not run tools.
356
+
357
+ | Step | Command | Rule |
358
+ | --- | --- | --- |
359
+ | Judge | \`tocket decide\` | Writes \`.context/decisions/\`. Shadow-first: \`--dry-run\` / \`--shadow\` is log-only. Optional \`TYPESAFE_API_KEY\` (stub without it). |
360
+ | Gate | \`--choice tool_gate:allow,block,ask\` | Before bash, deploy, or browser. |
361
+ | Plan | \`tocket work --from <decision>\` | Dry-run. Never calls Jev. |
362
+ | Apply | \`tocket work --apply\` | Receipt only if gate is \`allow\` or missing. \`block\`/\`ask\` exit 2 unless \`--force\`. |
363
+ | Fork | \`--fork agent\\|model\\|tool\\|action\\|human\` | Bounded. \`--fork model\` is the cheap model-router hook. \`human\` always reviews. |
364
+
365
+ ---
366
+
367
+ ## Quick Start
368
+
369
+ 1. Read \`AGENTS.md\` (single source agents read first), then this file (\`TOCKET.md\`)
370
+ 2. Read \`.context/activeContext.md\` for current state
371
+ 3. Read your role-specific config (\`${executorFile}\` or \`${architectFile}\`)
372
+ 4. If \`.context/decisions/\` already has a handoff, honor it. Do not re-ask Jev.
373
+ 5. Proceed with your task, following the Memory Bank rules above
374
+ `;
375
+ /** Shared decide/work/gate rules for AGENTS.md (init template and `tocket agents-md`). */
376
+ export function agentsProtocolSection() {
377
+ return `## How Tocket works
378
+
379
+ Tocket is the shared notebook (\`.context/\`). Agents work. Tocket remembers. Jev only chooses the next step.
380
+
381
+ 1. Read this file, then \`.context/activeContext.md\` and \`.context/systemPatterns.md\`, before expensive tools.
382
+ 2. If \`.context/decisions/\` already has a handoff, honor \`choice\`, \`destination\`, \`gated\`, and \`tool_gate\`. Do not call \`tocket decide\` again (do not re-ask Jev).
383
+ 3. \`tocket decide\` is the judge (Jev or stub). \`tocket work\` is the plan (dry-run). \`tocket work --apply\` stamps a notebook receipt. Never re-decide.
384
+ 4. Honor \`tool_gate\`: \`allow\` proceeds, \`block\` stops, \`ask\` escalates to a human. Shadow / log-only is advice unless \`--force\`.
385
+ 5. Before bash, deploy, or browser: \`tocket decide --choice tool_gate:allow,block,ask\`, then \`tocket work\`.
386
+
387
+ Optional \`TYPESAFE_API_KEY\` for live Jev. Without it, decide uses the stub. Prefer \`--dry-run\` or \`--shadow\` first.
388
+ `;
389
+ }
390
+ export const agentsMd = (projectName, description, executorName = "Claude Code", architectName = "Gemini") => `# AGENTS.md — ${projectName}
391
+
392
+ > Written by \`tocket init\`. Refresh project facts with \`tocket agents-md\`. Keep the decide/work rules below.
393
+
394
+ ## About this project
395
+
396
+ ${description || "_No description provided._"}
397
+
398
+ ## Instructions for AI agents
399
+
400
+ 1. Read this file first, then \`.context/activeContext.md\`
401
+ 2. Read \`.context/systemPatterns.md\` for architecture decisions and conventions
402
+ 3. Update \`.context/activeContext.md\` after completing significant work
403
+ 4. Follow the full protocol in \`TOCKET.md\`
404
+
405
+ ${agentsProtocolSection()}
406
+ ## Current Focus
407
+
408
+ _Generated from .context/activeContext.md. Run \`tocket agents-md\` to update._
409
+
410
+ ## Tech Stack
411
+
412
+ _Generated from .context/techContext.md. Run \`tocket agents-md\` to update._
413
+
414
+ ## Architecture & Conventions
415
+
416
+ _Generated from .context/systemPatterns.md. Run \`tocket agents-md\` to update._
417
+
418
+ ## Key Rules
419
+
420
+ - Write all code, comments, and commits in \`en-US\`
421
+ - Do not improvise architecture. Follow documented decisions
422
+ - Context belongs in \`.context/\`, not in code comments or chat
423
+ - Triangulation: ${architectName} (Architect) + ${executorName} (Executor)
424
+ `;
425
+ /** Official portable skill for Cursor / Claude / Codex. Written by `tocket init`. */
426
+ export const TOCKET_SKILL_REL = ".agents/skills/tocket/SKILL.md";
427
+ /** Catalog path so `npx skills add pedrocivita/tocket --skill tocket` can discover it. */
428
+ export const TOCKET_SKILL_CATALOG_REL = "skills/tocket/SKILL.md";
429
+ export const TOCKET_SKILLS_ADD = "npx skills add pedrocivita/tocket --skill tocket";
430
+ export const TOCKET_AGENT_PHRASE = "Before expensive tools: tocket decide --dry-run, or read .context/decisions/.";
431
+ export function tocketConventionsHint() {
432
+ return [
433
+ "On disk (agents already read these):",
434
+ " AGENTS.md start here (any agent)",
435
+ " .context/ shared notebook",
436
+ " .context/decisions/ next move (tocket decide)",
437
+ ` ${TOCKET_SKILL_REL} official skill`,
438
+ `One-shot: ${TOCKET_SKILLS_ADD}`,
439
+ `Phrase: ${TOCKET_AGENT_PHRASE}`,
440
+ ].join("\n");
441
+ }
442
+ export const tocketSkillMd = () => `---
443
+ name: tocket
444
+ description: Shared .context/ notebook. Before expensive tools, run tocket decide --dry-run or read .context/decisions/. Workers execute; Tocket does not.
445
+ ---
446
+
447
+ # Tocket
448
+
449
+ Tocket is the shared project notebook (\`.context/\`). Agents read and write those files. \`tocket decide\` writes the next move as JSON. Workers (Cursor, Claude, GrokBot, CI) execute. Tocket does not.
450
+
451
+ **${TOCKET_AGENT_PHRASE}**
452
+
453
+ ## When to use
454
+
455
+ - Read \`AGENTS.md\` and \`.context/\` before expensive tools.
456
+ - If \`.context/decisions/\` already has a handoff, honor it. Do not re-ask Jev.
457
+ - \`tocket decide\` = judge (Jev or stub). \`tocket work\` = plan. \`tocket work --apply\` = receipt.
458
+ - Honor \`tool_gate\` (\`allow|block|ask\`). Before bash/deploy/browser: \`--choice tool_gate:allow,block,ask\`, then \`tocket work\`.
459
+ - After work: update \`.context/activeContext.md\`.
460
+
461
+ ## Setup
462
+
463
+ \`\`\`bash
464
+ npx @pedrocivita/tocket init
465
+ ${TOCKET_SKILLS_ADD}
466
+ tocket doctor
467
+ tocket decide --dry-run --state '{"goal":"docs"}' --choice next:research,write,review
468
+ \`\`\`
469
+
470
+ - Optional \`TYPESAFE_API_KEY\` for live Jev. Never paste API keys into chat.
471
+ - Prefer \`--dry-run\` or \`--shadow\` first.
472
+ - Run \`tocket doctor\` for green/yellow/red setup checks.
473
+
474
+ ## Do not
475
+
476
+ - Do not ask Tocket to write prose, do math, or run workers.
477
+ - Do not rebuild the app around Jev. Swap this decision node in.
351
478
  `;
352
479
  //# sourceMappingURL=memory-bank.js.map