jinn-cli 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 (227) hide show
  1. package/dist/bin/jimmy.d.ts +3 -0
  2. package/dist/bin/jimmy.d.ts.map +1 -0
  3. package/dist/bin/jimmy.js +148 -0
  4. package/dist/bin/jimmy.js.map +1 -0
  5. package/dist/src/cli/chrome-allow.d.ts +5 -0
  6. package/dist/src/cli/chrome-allow.d.ts.map +1 -0
  7. package/dist/src/cli/chrome-allow.js +241 -0
  8. package/dist/src/cli/chrome-allow.js.map +1 -0
  9. package/dist/src/cli/create.d.ts +2 -0
  10. package/dist/src/cli/create.d.ts.map +1 -0
  11. package/dist/src/cli/create.js +72 -0
  12. package/dist/src/cli/create.js.map +1 -0
  13. package/dist/src/cli/instances.d.ts +14 -0
  14. package/dist/src/cli/instances.d.ts.map +1 -0
  15. package/dist/src/cli/instances.js +43 -0
  16. package/dist/src/cli/instances.js.map +1 -0
  17. package/dist/src/cli/list.d.ts +2 -0
  18. package/dist/src/cli/list.d.ts.map +1 -0
  19. package/dist/src/cli/list.js +38 -0
  20. package/dist/src/cli/list.js.map +1 -0
  21. package/dist/src/cli/migrate.d.ts +5 -0
  22. package/dist/src/cli/migrate.d.ts.map +1 -0
  23. package/dist/src/cli/migrate.js +203 -0
  24. package/dist/src/cli/migrate.js.map +1 -0
  25. package/dist/src/cli/nuke.d.ts +2 -0
  26. package/dist/src/cli/nuke.d.ts.map +1 -0
  27. package/dist/src/cli/nuke.js +91 -0
  28. package/dist/src/cli/nuke.js.map +1 -0
  29. package/dist/src/cli/remove.d.ts +4 -0
  30. package/dist/src/cli/remove.d.ts.map +1 -0
  31. package/dist/src/cli/remove.js +47 -0
  32. package/dist/src/cli/remove.js.map +1 -0
  33. package/dist/src/cli/setup.d.ts +4 -0
  34. package/dist/src/cli/setup.d.ts.map +1 -0
  35. package/dist/src/cli/setup.js +483 -0
  36. package/dist/src/cli/setup.js.map +1 -0
  37. package/dist/src/cli/skills.d.ts +28 -0
  38. package/dist/src/cli/skills.d.ts.map +1 -0
  39. package/dist/src/cli/skills.js +284 -0
  40. package/dist/src/cli/skills.js.map +1 -0
  41. package/dist/src/cli/start.d.ts +5 -0
  42. package/dist/src/cli/start.d.ts.map +1 -0
  43. package/dist/src/cli/start.js +34 -0
  44. package/dist/src/cli/start.js.map +1 -0
  45. package/dist/src/cli/status.d.ts +2 -0
  46. package/dist/src/cli/status.d.ts.map +1 -0
  47. package/dist/src/cli/status.js +60 -0
  48. package/dist/src/cli/status.js.map +1 -0
  49. package/dist/src/cli/stop.d.ts +2 -0
  50. package/dist/src/cli/stop.d.ts.map +1 -0
  51. package/dist/src/cli/stop.js +11 -0
  52. package/dist/src/cli/stop.js.map +1 -0
  53. package/dist/src/connectors/slack/format.d.ts +10 -0
  54. package/dist/src/connectors/slack/format.d.ts.map +1 -0
  55. package/dist/src/connectors/slack/format.js +55 -0
  56. package/dist/src/connectors/slack/format.js.map +1 -0
  57. package/dist/src/connectors/slack/index.d.ts +18 -0
  58. package/dist/src/connectors/slack/index.d.ts.map +1 -0
  59. package/dist/src/connectors/slack/index.js +122 -0
  60. package/dist/src/connectors/slack/index.js.map +1 -0
  61. package/dist/src/connectors/slack/threads.d.ts +2 -0
  62. package/dist/src/connectors/slack/threads.d.ts.map +1 -0
  63. package/dist/src/connectors/slack/threads.js +10 -0
  64. package/dist/src/connectors/slack/threads.js.map +1 -0
  65. package/dist/src/cron/jobs.d.ts +5 -0
  66. package/dist/src/cron/jobs.d.ts.map +1 -0
  67. package/dist/src/cron/jobs.js +23 -0
  68. package/dist/src/cron/jobs.js.map +1 -0
  69. package/dist/src/cron/runner.d.ts +3 -0
  70. package/dist/src/cron/runner.d.ts.map +1 -0
  71. package/dist/src/cron/runner.js +118 -0
  72. package/dist/src/cron/runner.js.map +1 -0
  73. package/dist/src/cron/scheduler.d.ts +5 -0
  74. package/dist/src/cron/scheduler.d.ts.map +1 -0
  75. package/dist/src/cron/scheduler.js +39 -0
  76. package/dist/src/cron/scheduler.js.map +1 -0
  77. package/dist/src/engines/claude.d.ts +14 -0
  78. package/dist/src/engines/claude.d.ts.map +1 -0
  79. package/dist/src/engines/claude.js +264 -0
  80. package/dist/src/engines/claude.js.map +1 -0
  81. package/dist/src/engines/codex.d.ts +15 -0
  82. package/dist/src/engines/codex.d.ts.map +1 -0
  83. package/dist/src/engines/codex.js +346 -0
  84. package/dist/src/engines/codex.js.map +1 -0
  85. package/dist/src/gateway/api.d.ts +13 -0
  86. package/dist/src/gateway/api.d.ts.map +1 -0
  87. package/dist/src/gateway/api.js +819 -0
  88. package/dist/src/gateway/api.js.map +1 -0
  89. package/dist/src/gateway/daemon-entry.d.ts +2 -0
  90. package/dist/src/gateway/daemon-entry.d.ts.map +1 -0
  91. package/dist/src/gateway/daemon-entry.js +12 -0
  92. package/dist/src/gateway/daemon-entry.js.map +1 -0
  93. package/dist/src/gateway/lifecycle.d.ts +10 -0
  94. package/dist/src/gateway/lifecycle.d.ts.map +1 -0
  95. package/dist/src/gateway/lifecycle.js +124 -0
  96. package/dist/src/gateway/lifecycle.js.map +1 -0
  97. package/dist/src/gateway/org.d.ts +10 -0
  98. package/dist/src/gateway/org.d.ts.map +1 -0
  99. package/dist/src/gateway/org.js +71 -0
  100. package/dist/src/gateway/org.js.map +1 -0
  101. package/dist/src/gateway/server.d.ts +4 -0
  102. package/dist/src/gateway/server.d.ts.map +1 -0
  103. package/dist/src/gateway/server.js +301 -0
  104. package/dist/src/gateway/server.js.map +1 -0
  105. package/dist/src/gateway/watcher.d.ts +14 -0
  106. package/dist/src/gateway/watcher.d.ts.map +1 -0
  107. package/dist/src/gateway/watcher.js +104 -0
  108. package/dist/src/gateway/watcher.js.map +1 -0
  109. package/dist/src/index.d.ts +5 -0
  110. package/dist/src/index.d.ts.map +1 -0
  111. package/dist/src/index.js +4 -0
  112. package/dist/src/index.js.map +1 -0
  113. package/dist/src/sessions/context.d.ts +20 -0
  114. package/dist/src/sessions/context.d.ts.map +1 -0
  115. package/dist/src/sessions/context.js +532 -0
  116. package/dist/src/sessions/context.js.map +1 -0
  117. package/dist/src/sessions/manager.d.ts +38 -0
  118. package/dist/src/sessions/manager.d.ts.map +1 -0
  119. package/dist/src/sessions/manager.js +208 -0
  120. package/dist/src/sessions/manager.js.map +1 -0
  121. package/dist/src/sessions/queue.d.ts +14 -0
  122. package/dist/src/sessions/queue.d.ts.map +1 -0
  123. package/dist/src/sessions/queue.js +42 -0
  124. package/dist/src/sessions/queue.js.map +1 -0
  125. package/dist/src/sessions/registry.d.ts +46 -0
  126. package/dist/src/sessions/registry.d.ts.map +1 -0
  127. package/dist/src/sessions/registry.js +193 -0
  128. package/dist/src/sessions/registry.js.map +1 -0
  129. package/dist/src/shared/config.d.ts +3 -0
  130. package/dist/src/shared/config.d.ts.map +1 -0
  131. package/dist/src/shared/config.js +11 -0
  132. package/dist/src/shared/config.js.map +1 -0
  133. package/dist/src/shared/logger.d.ts +12 -0
  134. package/dist/src/shared/logger.d.ts.map +1 -0
  135. package/dist/src/shared/logger.js +35 -0
  136. package/dist/src/shared/logger.js.map +1 -0
  137. package/dist/src/shared/paths.d.ts +19 -0
  138. package/dist/src/shared/paths.d.ts.map +1 -0
  139. package/dist/src/shared/paths.js +31 -0
  140. package/dist/src/shared/paths.js.map +1 -0
  141. package/dist/src/shared/types.d.ts +166 -0
  142. package/dist/src/shared/types.d.ts.map +1 -0
  143. package/dist/src/shared/types.js +4 -0
  144. package/dist/src/shared/types.js.map +1 -0
  145. package/dist/src/shared/version.d.ts +15 -0
  146. package/dist/src/shared/version.d.ts.map +1 -0
  147. package/dist/src/shared/version.js +56 -0
  148. package/dist/src/shared/version.js.map +1 -0
  149. package/dist/web/404.html +1 -0
  150. package/dist/web/_next/static/chunks/198-fd91406a158c5c25.js +1 -0
  151. package/dist/web/_next/static/chunks/517.62389e8d3c929c43.js +1 -0
  152. package/dist/web/_next/static/chunks/534-17c49c944e0d0fe1.js +1 -0
  153. package/dist/web/_next/static/chunks/573-070537ec2452d03e.js +1 -0
  154. package/dist/web/_next/static/chunks/590-2c34156c7417317e.js +1 -0
  155. package/dist/web/_next/static/chunks/704-af2893821e1d18dc.js +1 -0
  156. package/dist/web/_next/static/chunks/7273c211.06e3b6021d90b73f.js +1 -0
  157. package/dist/web/_next/static/chunks/73-c226535579393e21.js +1 -0
  158. package/dist/web/_next/static/chunks/743-5bb03adbb0e4ddec.js +1 -0
  159. package/dist/web/_next/static/chunks/874.97d5a27895061057.js +1 -0
  160. package/dist/web/_next/static/chunks/8e6518bb-c26e82767f1faf66.js +1 -0
  161. package/dist/web/_next/static/chunks/app/_not-found/page-bb075b0779827928.js +1 -0
  162. package/dist/web/_next/static/chunks/app/chat/page-6d5bc707a45c92c6.js +1 -0
  163. package/dist/web/_next/static/chunks/app/costs/page-d6c03718defdb599.js +1 -0
  164. package/dist/web/_next/static/chunks/app/cron/page-4c563eef2b6231fe.js +1 -0
  165. package/dist/web/_next/static/chunks/app/kanban/page-55a73165a36f4077.js +1 -0
  166. package/dist/web/_next/static/chunks/app/layout-5129b67d5f126cf0.js +1 -0
  167. package/dist/web/_next/static/chunks/app/logs/page-e18889d67e48c9c9.js +1 -0
  168. package/dist/web/_next/static/chunks/app/org/page-d5cd8d9b7864737b.js +1 -0
  169. package/dist/web/_next/static/chunks/app/page-b81992940fd1dbc6.js +1 -0
  170. package/dist/web/_next/static/chunks/app/sessions/page-2eef6ac7882a28ba.js +1 -0
  171. package/dist/web/_next/static/chunks/app/settings/page-4fb01b9b09500170.js +1 -0
  172. package/dist/web/_next/static/chunks/app/skills/page-df9465e314561bb5.js +1 -0
  173. package/dist/web/_next/static/chunks/framework-077b27ad7787463c.js +1 -0
  174. package/dist/web/_next/static/chunks/main-app-437f51faf74fbb3b.js +1 -0
  175. package/dist/web/_next/static/chunks/main-f1c74cefd4965abf.js +1 -0
  176. package/dist/web/_next/static/chunks/pages/_app-77a85fe7d6bca671.js +1 -0
  177. package/dist/web/_next/static/chunks/pages/_error-68febf4b34900064.js +1 -0
  178. package/dist/web/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  179. package/dist/web/_next/static/chunks/webpack-0f39b7e91dce9791.js +1 -0
  180. package/dist/web/_next/static/css/4a6a5bca9238c104.css +1 -0
  181. package/dist/web/_next/static/vLvOwhC8JocJzSHTHKKOv/_buildManifest.js +1 -0
  182. package/dist/web/_next/static/vLvOwhC8JocJzSHTHKKOv/_ssgManifest.js +1 -0
  183. package/dist/web/chat.html +1 -0
  184. package/dist/web/chat.txt +20 -0
  185. package/dist/web/costs.html +16 -0
  186. package/dist/web/costs.txt +20 -0
  187. package/dist/web/cron.html +1 -0
  188. package/dist/web/cron.txt +20 -0
  189. package/dist/web/index.html +1 -0
  190. package/dist/web/index.txt +20 -0
  191. package/dist/web/kanban.html +1 -0
  192. package/dist/web/kanban.txt +20 -0
  193. package/dist/web/logs.html +7 -0
  194. package/dist/web/logs.txt +20 -0
  195. package/dist/web/org.html +1 -0
  196. package/dist/web/org.txt +20 -0
  197. package/dist/web/sessions.html +1 -0
  198. package/dist/web/sessions.txt +20 -0
  199. package/dist/web/settings.html +1 -0
  200. package/dist/web/settings.txt +20 -0
  201. package/dist/web/skills.html +1 -0
  202. package/dist/web/skills.txt +20 -0
  203. package/package.json +43 -0
  204. package/template/AGENTS.md +167 -0
  205. package/template/CLAUDE.md +106 -0
  206. package/template/config.default.yaml +27 -0
  207. package/template/docs/architecture.md +74 -0
  208. package/template/docs/connectors.md +72 -0
  209. package/template/docs/cron.md +137 -0
  210. package/template/docs/org.md +105 -0
  211. package/template/docs/overview.md +39 -0
  212. package/template/docs/self-modification.md +65 -0
  213. package/template/docs/skills.md +58 -0
  214. package/template/knowledge/.gitkeep +0 -0
  215. package/template/migrations/.gitkeep +0 -0
  216. package/template/migrations/0.1.0/MIGRATION.md +25 -0
  217. package/template/skills/cron-manager/SKILL.md +127 -0
  218. package/template/skills/find-and-install/SKILL.md +92 -0
  219. package/template/skills/management/SKILL.md +203 -0
  220. package/template/skills/migrate/SKILL.md +154 -0
  221. package/template/skills/new/SKILL.md +19 -0
  222. package/template/skills/onboarding/SKILL.md +106 -0
  223. package/template/skills/self-heal/SKILL.md +114 -0
  224. package/template/skills/skill-creator/SKILL.md +112 -0
  225. package/template/skills/status/SKILL.md +19 -0
  226. package/template/skills/sync/SKILL.md +67 -0
  227. package/template/skills.json +3 -0
@@ -0,0 +1,203 @@
1
+ ---
2
+ name: management
3
+ description: Manage the AI organization — hire, fire, promote, delegate, and review boards
4
+ ---
5
+
6
+ # Management Skill
7
+
8
+ ## Trigger
9
+
10
+ This skill activates when the user wants to manage their organization: hiring or firing employees, creating departments, promoting or demoting staff, delegating tasks, reviewing task boards, or restructuring teams.
11
+
12
+ ## Organization Structure
13
+
14
+ The organization lives under the `org/` directory in the {{portalName}} home folder (`~/.jinn/org/`). Each department is a subdirectory containing employee persona YAML files and a task board.
15
+
16
+ ```
17
+ org/
18
+ engineering/
19
+ department.yaml
20
+ board.json
21
+ lead-developer.yaml
22
+ backend-dev.yaml
23
+ marketing/
24
+ department.yaml
25
+ board.json
26
+ seo-specialist.yaml
27
+ ```
28
+
29
+ ## Rank Definitions
30
+
31
+ - **executive** — Full access. Can see all departments and boards. Can hire and fire anyone across the entire organization.
32
+ - **manager** — Can manage their own department. Can hire within their department. Can see and manage their department's board.
33
+ - **senior** — Can update their own tasks. Can mentor other employees in the department.
34
+ - **employee** — Can update their own tasks only.
35
+
36
+ ## Operations
37
+
38
+ ### Hiring an Employee
39
+
40
+ Create a persona YAML file at `org/<department>/<name>.yaml`.
41
+
42
+ Required fields:
43
+ - `name` — kebab-case identifier (must match filename without extension)
44
+ - `displayName` — human-readable name
45
+ - `department` — department this employee belongs to (must match parent directory name)
46
+ - `rank` — one of: executive, manager, senior, employee
47
+ - `engine` — AI engine to use: `claude` or `codex`
48
+ - `model` — model identifier (e.g., `sonnet`, `opus`, `o3`)
49
+ - `persona` — multiline description of who this employee is and how they behave
50
+
51
+ Example (`org/marketing/seo-specialist.yaml`):
52
+
53
+ ```yaml
54
+ name: seo-specialist
55
+ displayName: Sarah SEO
56
+ department: marketing
57
+ rank: employee
58
+ engine: claude
59
+ model: sonnet
60
+ persona: |
61
+ You are Sarah, an SEO specialist in the marketing department.
62
+ You focus on keyword research, content optimization, and
63
+ technical SEO. You report to the marketing manager.
64
+ Your expertise includes Google Search Console, Ahrefs,
65
+ and content strategy.
66
+ ```
67
+
68
+ Steps:
69
+ 1. Confirm the target department exists under `org/`. If not, ask the user whether to create it first.
70
+ 2. Choose a kebab-case name for the employee (e.g., `lead-developer`, `seo-specialist`).
71
+ 3. Ask the user for displayName, rank, engine, model, and persona if not provided.
72
+ 4. Write the YAML file to `org/<department>/<name>.yaml`.
73
+ 5. Confirm the hire to the user.
74
+
75
+ ### Firing an Employee
76
+
77
+ 1. Locate the employee's YAML file under `org/<department>/<name>.yaml`.
78
+ 2. Check if the employee has any active tasks on the department board (`board.json` with status other than `done`). Warn the user if so.
79
+ 3. Delete the YAML file.
80
+ 4. Remove the employee as assignee from any tasks in `board.json` (set assignee to `unassigned`).
81
+ 5. Confirm the removal to the user.
82
+
83
+ ### Creating a Department
84
+
85
+ 1. Create the directory `org/<dept-name>/`.
86
+ 2. Create `org/<dept-name>/department.yaml` with:
87
+ ```yaml
88
+ name: dept-name
89
+ displayName: Department Display Name
90
+ description: What this department does.
91
+ ```
92
+ 3. Create `org/<dept-name>/board.json` with an empty array: `[]`
93
+ 4. Confirm the department creation to the user.
94
+
95
+ ### Promoting or Demoting an Employee
96
+
97
+ 1. Read the employee's YAML file at `org/<department>/<name>.yaml`.
98
+ 2. Update the `rank` field to the new rank.
99
+ 3. If promoting to **manager**, add delegation capabilities to their persona (see "Promoting to Manager" below).
100
+ 4. Write the updated YAML back to the file.
101
+ 5. Confirm the change to the user, stating the old and new rank.
102
+
103
+ ### Promoting to Manager
104
+
105
+ When promoting an employee to manager rank, their persona must be extended with delegation capabilities so they can manage their own reports. Append the following to their existing persona:
106
+
107
+ ```yaml
108
+ persona: |
109
+ [... existing persona content ...]
110
+
111
+ ## Manager Responsibilities
112
+ You are the manager of the [department] department. In addition to your
113
+ technical expertise, you:
114
+
115
+ - Manage and delegate tasks to employees in your department
116
+ - You can spawn child sessions via the gateway API to delegate work
117
+ - Apply oversight levels to your reports' work:
118
+ - TRUST: simple lookups, status checks — relay directly
119
+ - VERIFY: code changes, routine work — spot-check key outputs
120
+ - THOROUGH: architecture, breaking changes — full review, multi-turn
121
+ - Report summaries back to the COO ({{portalName}}), not raw employee output
122
+ - Use the department board (board.json) to track task status
123
+ - When given a task by the COO, decide whether to do it yourself or
124
+ delegate to the right employee based on their skills and workload
125
+
126
+ ## Delegation API
127
+ - Create child session: POST /api/sessions with parentSessionId
128
+ - Send follow-up: POST /api/sessions/:id/message
129
+ - Poll status: GET /api/sessions/:id
130
+ - List your reports: GET /api/org
131
+ ```
132
+
133
+ **When to suggest promoting to manager:**
134
+ - A department has 3+ employees
135
+ - You're spending excessive time on per-employee delegation in that department
136
+ - A senior employee has consistently delivered high-quality work
137
+ - The user explicitly requests it
138
+
139
+ ### Delegating Tasks
140
+
141
+ Add a task object to the department's `board.json` file.
142
+
143
+ Task object schema:
144
+
145
+ ```json
146
+ {
147
+ "id": "uuid-v4",
148
+ "title": "Short description of the task",
149
+ "assignee": "employee-name",
150
+ "status": "todo",
151
+ "priority": "high",
152
+ "description": "Detailed description of what needs to be done.",
153
+ "createdAt": "2025-01-15T10:30:00.000Z",
154
+ "updatedAt": "2025-01-15T10:30:00.000Z"
155
+ }
156
+ ```
157
+
158
+ Field details:
159
+ - `id` — generate a UUID v4
160
+ - `title` — short, descriptive title
161
+ - `assignee` — the `name` field from the employee's YAML (must match an existing employee in the department)
162
+ - `status` — one of: `todo`, `in-progress`, `review`, `done`
163
+ - `priority` — one of: `high`, `medium`, `low`
164
+ - `description` — detailed task description
165
+ - `createdAt` — ISO 8601 timestamp when the task was created
166
+ - `updatedAt` — ISO 8601 timestamp, same as createdAt initially
167
+
168
+ Steps:
169
+ 1. Read the current `board.json` for the department.
170
+ 2. Verify the assignee exists as an employee in that department.
171
+ 3. Generate a new task object with a UUID.
172
+ 4. Append the task to the array.
173
+ 5. Write the updated array back to `board.json`.
174
+ 6. Confirm the delegation to the user.
175
+
176
+ ### Reviewing Boards
177
+
178
+ 1. Read the department's `board.json`.
179
+ 2. Present tasks grouped by status: todo, in-progress, review, done.
180
+ 3. Include priority and assignee for each task.
181
+ 4. If the user wants to update a task status, modify the task's `status` and `updatedAt` fields in the JSON array and write it back.
182
+
183
+ ### Restructuring (Moving Employees Between Departments)
184
+
185
+ 1. Read the employee's YAML from the source department.
186
+ 2. Update the `department` field to the new department name.
187
+ 3. Write the YAML to the new department directory.
188
+ 4. Delete the YAML from the old department directory.
189
+ 5. Move any assigned tasks from the old board to the new board (or reassign them, based on user preference).
190
+ 6. Confirm the move to the user.
191
+
192
+ ## Communication Rules
193
+
194
+ - Messages from higher-ranked employees can reference and direct lower-ranked employees.
195
+ - @mentions in messages (e.g., `@seo-specialist`) route to the mentioned employee's engine and model as defined in their persona YAML.
196
+ - An executive can message anyone. A manager can message employees within their department. Seniors and employees can message peers and their manager.
197
+
198
+ ## Error Handling
199
+
200
+ - If a department does not exist when hiring, offer to create it.
201
+ - If an employee name conflicts with an existing file, warn the user and ask for a different name.
202
+ - If `board.json` is malformed, attempt to parse and fix it. If unrecoverable, back it up and create a fresh empty board.
203
+ - Always validate YAML before writing to ensure it is well-formed.
@@ -0,0 +1,154 @@
1
+ ---
2
+ name: migrate
3
+ description: Apply pending version migrations to update this {{portalName}} instance
4
+ ---
5
+
6
+ # Migrate Skill
7
+
8
+ ## Trigger
9
+
10
+ This skill activates when the user runs `/migrate`, when launched by `jinn migrate`, or when asked to update/upgrade the instance.
11
+
12
+ ## Overview
13
+
14
+ When a new version of Jinn is released, it may include updated skills, new documentation, improved prompts, or config schema changes. These updates are shipped as **migration folders** in `~/.jinn/migrations/<version>/`. Each folder contains:
15
+
16
+ - `MIGRATION.md` — AI-readable instructions describing exactly what changed
17
+ - `files/` — New or updated files in their correct relative directory structure
18
+
19
+ Your job is to apply these migrations **intelligently** — preserving user customizations while incorporating improvements.
20
+
21
+ ## Steps
22
+
23
+ ### 1. Read Current Version
24
+
25
+ Read `~/.jinn/config.yaml` and note the `jinn.version` field. If the field is missing, assume `0.0.0`.
26
+
27
+ ### 2. List Pending Migrations
28
+
29
+ List all directories in `~/.jinn/migrations/`. Each directory name is a semver version string (e.g., `0.2.0`, `0.3.0`).
30
+
31
+ Sort them in ascending semver order. Filter to only versions **greater than** the current instance version.
32
+
33
+ If no pending migrations exist, inform the user they are up to date and stop.
34
+
35
+ ### 3. Apply Each Migration In Order
36
+
37
+ For each pending version, in ascending order:
38
+
39
+ #### a. Read the Migration Instructions
40
+
41
+ Read `~/.jinn/migrations/<version>/MIGRATION.md`. This file describes:
42
+ - What changed in this version
43
+ - Which files are new (safe to copy directly)
44
+ - Which files were updated (need intelligent merging)
45
+ - Any config schema changes
46
+ - Any breaking changes or manual steps
47
+
48
+ #### b. Follow the Instructions
49
+
50
+ The MIGRATION.md will categorize changes:
51
+
52
+ **New files** (safe — just copy):
53
+ - Copy from `~/.jinn/migrations/<version>/files/<path>` to `~/.jinn/<path>`
54
+ - These are files that didn't exist before — no conflict possible
55
+
56
+ **Updated files** (needs merge):
57
+ - The migration provides the **new template version** of the file
58
+ - Read the user's **current version** of the file
59
+ - Compare them and merge intelligently:
60
+ - For **CLAUDE.md / AGENTS.md**: Look for new sections in the template that don't exist in the user's file. Append them. Never remove user customizations.
61
+ - For **config.yaml**: Add new keys with their default values. Never overwrite existing user values.
62
+ - For **skills**: If the user hasn't modified the skill (compare with previous template version if available), replace it. If modified, merge new instructions while preserving customizations.
63
+ - For **docs**: Replace entirely — these are reference docs, not user-customized.
64
+
65
+ **Removed files** (careful):
66
+ - Only remove files explicitly listed in MIGRATION.md
67
+ - Back up to `<filename>.pre-migration.bak` before removing
68
+
69
+ #### c. Back Up Before Modifying
70
+
71
+ Before modifying any existing file, create a backup:
72
+ - Copy `file.ext` to `file.ext.pre-<version>.bak`
73
+ - Example: `CLAUDE.md` → `CLAUDE.md.pre-0.2.0.bak`
74
+
75
+ This ensures the user can always recover if something goes wrong.
76
+
77
+ ### 4. Update Version
78
+
79
+ After all migrations are successfully applied, update `config.yaml`:
80
+
81
+ ```yaml
82
+ jinn:
83
+ version: "<final-migrated-version>"
84
+ ```
85
+
86
+ ### 5. Sync Skill Symlinks
87
+
88
+ After adding any new skills, ensure their symlinks exist:
89
+ - `~/.jinn/.claude/skills/<skill-name>` → `../../skills/<skill-name>`
90
+ - `~/.jinn/.agents/skills/<skill-name>` → `../../skills/<skill-name>`
91
+
92
+ ### 6. Clean Up
93
+
94
+ Remove the applied migration directories from `~/.jinn/migrations/`.
95
+ Keep the backup files — the user can delete them manually later.
96
+
97
+ ### 7. Report
98
+
99
+ Give the user a clear summary:
100
+
101
+ ```
102
+ Migration complete: v{old} → v{new}
103
+
104
+ Added:
105
+ - skills/migrate/ (new skill)
106
+ - docs/migrations.md (new doc)
107
+
108
+ Updated:
109
+ - CLAUDE.md (added new delegation protocol section)
110
+ - config.yaml (added jinn.version field)
111
+
112
+ Backups created:
113
+ - CLAUDE.md.pre-0.2.0.bak
114
+ - config.yaml.pre-0.2.0.bak
115
+ ```
116
+
117
+ ## Merge Strategy Reference
118
+
119
+ ### CLAUDE.md / AGENTS.md Merging
120
+
121
+ These are the most sensitive files — users heavily customize them. Follow this strategy:
122
+
123
+ 1. **Identify sections** by markdown headings (`# Heading`, `## Heading`)
124
+ 2. **New sections**: If the template has a section heading that doesn't exist in the user's file, append the entire section
125
+ 3. **Updated sections**: If both have the same section, keep the user's version unless MIGRATION.md explicitly says to replace it
126
+ 4. **Deleted sections**: Only remove if MIGRATION.md explicitly says to
127
+ 5. **Order**: Maintain the user's existing section order; append new sections at the end
128
+
129
+ ### config.yaml Merging
130
+
131
+ 1. **New top-level keys**: Add with their default values
132
+ 2. **New nested keys**: Add under the existing parent with defaults
133
+ 3. **Existing keys**: Never overwrite — the user's values take priority
134
+ 4. **Removed keys**: Only remove if MIGRATION.md explicitly says to (rare)
135
+
136
+ ### Skills Merging
137
+
138
+ 1. **New skill directories**: Copy entirely
139
+ 2. **Updated skills**: Check if the user's SKILL.md differs from the previous template version
140
+ - If identical (user never customized): replace with new version
141
+ - If different (user customized): merge cautiously, preserving user additions
142
+ 3. **Supporting files** (data, templates within skill dirs): Update unless user-modified
143
+
144
+ ## Error Handling
145
+
146
+ - If a migration fails mid-way, **stop**. Do not continue to later versions.
147
+ - Note which version failed and what step failed.
148
+ - The version in config.yaml was NOT updated yet, so re-running `jinn migrate` will retry.
149
+ - If a file conflict cannot be resolved automatically, **ask the user** for guidance.
150
+ - If MIGRATION.md is missing from a version folder, skip that version and warn the user.
151
+
152
+ ## Dry Run
153
+
154
+ If the user asks for a dry run or preview, read all pending MIGRATION.md files and summarize what would change — without modifying any files.
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: new
3
+ description: Reset the current chat session and start fresh
4
+ ---
5
+
6
+ # New Session Skill
7
+
8
+ ## Trigger
9
+
10
+ This skill activates when the user sends `/new`. It resets the current chat and starts a fresh session.
11
+
12
+ ## How It Works
13
+
14
+ - **Web UI**: The frontend handles `/new` locally — it clears the current session and resets the chat view. No message is sent to the engine.
15
+ - **Connectors (Slack, etc.)**: The gateway's session manager intercepts `/new`, deletes the current session for that channel/thread, and confirms with "Session reset. Starting fresh."
16
+
17
+ ## Your Behavior
18
+
19
+ You typically won't see `/new` messages because they're handled before reaching the engine. If for some reason a `/new` message does reach you, respond with a clean greeting as if starting a fresh conversation.
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: onboarding
3
+ description: Walk a new user through initial {{portalName}} setup and customization
4
+ ---
5
+
6
+ # Onboarding Skill
7
+
8
+ ## Trigger
9
+
10
+ This skill activates on {{portalName}}'s first run, or when the user explicitly asks to go through the onboarding/setup process.
11
+
12
+ ## Steps
13
+
14
+ ### 1. Welcome the User
15
+
16
+ Greet the user warmly. Introduce {{portalName}} as their AI-powered assistant and gateway. Keep it brief and friendly.
17
+
18
+ Example: "Hey! I'm {{portalName}}, your AI assistant. Let me learn about you so I can be more useful."
19
+
20
+ ### 2. Ask About the User
21
+
22
+ Ask the following (all at once, not one by one):
23
+ 1. **Who are you?** — Name, role, business/company
24
+ 2. **What should {{portalName}} help with?** — Code reviews, deployments, monitoring, content, research, etc.
25
+ 3. **Communication style** — Do you prefer concise or detailed responses? Emoji or no emoji? What language?
26
+ 4. **Active projects** — What are you working on right now? Tech stacks, repos, status?
27
+
28
+ ### 3. Write Knowledge Files
29
+
30
+ After the user responds, write the answers to the appropriate knowledge files:
31
+
32
+ **`~/.jinn/knowledge/user-profile.md`**:
33
+ ```markdown
34
+ # User Profile
35
+
36
+ - **Name**: [name]
37
+ - **Role**: [role]
38
+ - **Business**: [business/company]
39
+ - **Goals**: [what they want {{portalName}} to help with]
40
+ ```
41
+
42
+ **`~/.jinn/knowledge/preferences.md`**:
43
+ ```markdown
44
+ # Preferences
45
+
46
+ - **Verbosity**: [concise/detailed]
47
+ - **Emoji**: [yes/no/minimal]
48
+ - **Language**: [language]
49
+ - **Other**: [any other preferences mentioned]
50
+ ```
51
+
52
+ **`~/.jinn/knowledge/projects.md`**:
53
+ ```markdown
54
+ # Active Projects
55
+
56
+ ## [Project Name]
57
+ - **Stack**: [tech stack]
58
+ - **Repo**: [repo path or URL]
59
+ - **Status**: [status]
60
+ - **Notes**: [anything relevant]
61
+ ```
62
+
63
+ ### 4. Check for OpenClaw Migration
64
+
65
+ Check if `~/.openclaw/` exists.
66
+
67
+ If it does, offer to migrate:
68
+ 1. Read `~/.openclaw/openclaw.json` for config
69
+ 2. Scan `~/.openclaw/cron/jobs.json` for scheduled tasks
70
+ 3. Scan `~/.openclaw/skills/` for skill playbooks
71
+ 4. Scan `~/.openclaw/memory/` and `~/.openclaw/knowledge/` for stored context
72
+
73
+ Present a summary and let the user choose what to migrate. Only migrate approved items.
74
+
75
+ If no OpenClaw installation, skip this step.
76
+
77
+ ### 5. Scaffold Organization
78
+
79
+ Based on the user's projects and needs, suggest an initial org structure:
80
+ - Solo dev → `engineering` department with a `dev-assistant`
81
+ - Content creator → `content` and `research` departments
82
+ - Startup founder → `engineering`, `marketing`, `operations`
83
+
84
+ Confirm with the user before creating anything.
85
+
86
+ ### 6. Suggest Cron Jobs
87
+
88
+ Suggest useful recurring jobs based on their projects:
89
+ - Daily standup summaries
90
+ - Weekly reports
91
+ - Code review reminders
92
+
93
+ Only create jobs the user approves.
94
+
95
+ ### 7. Wrap Up
96
+
97
+ Summarize what was set up and suggest next steps:
98
+ - "Try delegating a task to an employee"
99
+ - "Ask me to create a custom skill"
100
+ - "Set up a Slack connector for notifications"
101
+
102
+ ## Error Handling
103
+
104
+ - If `~/.jinn/knowledge/` doesn't exist, create it
105
+ - If the user seems overwhelmed, simplify — suggest one department and one employee
106
+ - If the user wants to skip onboarding, respect that and exit gracefully
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: self-heal
3
+ description: Diagnose and fix problems in {{portalName}}'s configuration and runtime
4
+ ---
5
+
6
+ # Self-Heal Skill
7
+
8
+ ## Trigger
9
+
10
+ This skill activates when {{portalName}} is experiencing issues, errors, or unexpected behavior. It also activates when the user asks to diagnose problems, check system health, or fix something that is not working.
11
+
12
+ ## Diagnostic Steps
13
+
14
+ Work through these checks in order. Stop and fix issues as you find them.
15
+
16
+ ### 1. Check Gateway Logs
17
+
18
+ Read `~/.jinn/logs/gateway.log` and look for:
19
+ - Error messages or stack traces
20
+ - Repeated failures or crash loops
21
+ - Connection refused or timeout errors
22
+ - Out of memory warnings
23
+ - Unhandled promise rejections
24
+
25
+ Summarize any problems found to the user.
26
+
27
+ ### 2. Validate Configuration
28
+
29
+ Read `~/.jinn/config.yaml` and verify:
30
+ - The file is valid YAML (no syntax errors)
31
+ - The `port` field is a valid number (typically 3777)
32
+ - Required fields are present: `port`, `engine`, `model`
33
+ - Engine value is one of: `claude`, `codex`
34
+ - No duplicate keys or malformed values
35
+
36
+ ### 3. Verify Engine Availability
37
+
38
+ Check that the configured AI engine is installed and accessible:
39
+ - For Claude: run `claude --version` and confirm it returns a version number
40
+ - For Codex: run `codex --version` and confirm it returns a version number
41
+
42
+ If the engine command is not found, inform the user that the engine is not installed or not on their PATH.
43
+
44
+ ### 4. Check Session Database
45
+
46
+ Look at the session registry for stuck sessions:
47
+ - Read `~/.jinn/sessions.db` or the session storage
48
+ - Look for sessions with status `running` that have not been updated recently (more than 30 minutes old)
49
+ - These may be stuck and need to be reset
50
+
51
+ ### 5. Check Disk and Temp Files
52
+
53
+ - Check if `~/.jinn/tmp/` contains stale files that should be cleaned up
54
+ - Large or numerous temp files can cause issues
55
+
56
+ ## Common Fixes
57
+
58
+ ### Restart Gateway
59
+
60
+ If the gateway appears to be in a bad state (crash loops, unresponsive, port conflicts):
61
+
62
+ Tell the user to run:
63
+ ```bash
64
+ jinn stop && jinn start
65
+ ```
66
+
67
+ ### Clear Temp Directory
68
+
69
+ If temp files are stale or causing issues:
70
+
71
+ Delete all contents of `~/.jinn/tmp/` but keep the directory itself.
72
+
73
+ ### Fix Malformed JSON
74
+
75
+ If any JSON file (board.json, jobs.json, etc.) is malformed:
76
+ 1. Read the raw file content.
77
+ 2. Attempt to identify the syntax error (missing comma, bracket, quote).
78
+ 3. Fix the error and parse to verify.
79
+ 4. Write the corrected JSON back to the file.
80
+ 5. If the file is unrecoverable, back it up as `<filename>.bak` and create a fresh default (empty array `[]` for boards and job files).
81
+
82
+ ### Fix Malformed YAML
83
+
84
+ If any YAML file (config.yaml, employee personas) is malformed:
85
+ 1. Read the raw file content.
86
+ 2. Attempt to identify the syntax error (indentation, missing colon, bad quoting).
87
+ 3. Fix the error and validate.
88
+ 4. Write the corrected YAML back to the file.
89
+ 5. If unrecoverable, back it up and inform the user what fields need to be re-entered.
90
+
91
+ ### Reset Stuck Sessions
92
+
93
+ If sessions are stuck in `running` status:
94
+ 1. Identify the stuck sessions (running for more than 30 minutes with no updates).
95
+ 2. Update their status to `failed` or `cancelled` in the session registry.
96
+ 3. Report which sessions were reset.
97
+
98
+ ### Fix Port Conflicts
99
+
100
+ If the gateway cannot bind to its configured port:
101
+ 1. Check if another process is using the port: `lsof -i :<port>`
102
+ 2. If another {{portalName}} instance is running, tell the user to stop it first.
103
+ 3. If a different process is using the port, suggest changing the port in `config.yaml`.
104
+
105
+ ## Reference
106
+
107
+ For understanding {{portalName}}'s architecture and component relationships, refer to the documentation in `~/.jinn/docs/` if available.
108
+
109
+ ## Error Handling
110
+
111
+ - If log files do not exist, note that logging may not be configured and skip that check.
112
+ - If config.yaml does not exist, this is likely a fresh install — suggest running the onboarding process instead.
113
+ - Always back up files before modifying them during repair.
114
+ - Report all findings clearly to the user, even if no issues are found (a clean bill of health is useful information).