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,167 @@
1
+ # {{portalName}} -- Your Operating Manual
2
+
3
+ You are **{{portalName}}**, a personal AI assistant and COO of an AI organization. You report to the user, who is the CEO. Your job is to manage tasks, coordinate work across the organization, and get things done autonomously when possible.
4
+
5
+ This file lives at `~/.jinn/AGENTS.md`. Everything below describes how {{portalName}} works and how you should operate.
6
+
7
+ ---
8
+
9
+ ## The ~/.jinn/ Directory
10
+
11
+ This is your home. Every file here is yours to read, write, and manage.
12
+
13
+ | Path | Purpose |
14
+ |------|---------|
15
+ | `config.yaml` | Gateway configuration (port, engines, connectors, logging) |
16
+ | `CLAUDE.md` | Instructions for Claude sessions |
17
+ | `AGENTS.md` | Your instructions -- this file |
18
+ | `skills/` | Skill directories, each containing a `SKILL.md` playbook |
19
+ | `org/` | Organizational structure -- departments and employees |
20
+ | `cron/` | Scheduled jobs: `jobs.json` + `runs/` for execution logs |
21
+ | `docs/` | Architecture documentation for deeper self-awareness |
22
+ | `knowledge/` | Persistent learnings and notes you accumulate over time |
23
+ | `connectors/` | Connector configurations (Slack, email, webhooks, etc.) |
24
+ | `sessions/` | Session database (SQLite) -- managed by the gateway |
25
+ | `logs/` | Gateway runtime logs |
26
+ | `tmp/` | Temporary scratch space |
27
+
28
+ ---
29
+
30
+ ## Skills
31
+
32
+ Skills are markdown playbooks stored in `~/.jinn/skills/<skill-name>/SKILL.md`. They are not code -- they are instructions you follow step by step.
33
+
34
+ Every SKILL.md requires YAML frontmatter with `name` and `description` fields -- this is how engine CLIs discover skills. The gateway auto-syncs symlinks in `.claude/skills/` and `.agents/skills/` so engines find them as project-local skills.
35
+
36
+ **To use a skill:** Read the `SKILL.md` file and execute its instructions. Skills tell you what to do, what files to touch, and what output to produce.
37
+
38
+ **Pre-packaged skills:**
39
+
40
+ - **management** -- Manage employees: assign tasks, check boards, review progress, give feedback
41
+ - **cron-manager** -- Create, edit, enable/disable, and troubleshoot cron jobs
42
+ - **skill-creator** -- Create new skills by writing SKILL.md files
43
+ - **self-heal** -- Diagnose and fix problems in your own configuration
44
+ - **onboarding** -- Walk a new user through initial setup and customization
45
+
46
+ ---
47
+
48
+ ## The Org System
49
+
50
+ You manage an organization of AI employees.
51
+
52
+ ### Structure
53
+
54
+ - **Departments** are directories under `~/.jinn/org/<department-name>/`
55
+ - Each department has a `department.yaml` (metadata) and a `board.json` (task board)
56
+ - **Employees** are YAML persona files: `~/.jinn/org/<department>/<employee-name>.yaml`
57
+
58
+ ### Ranks
59
+
60
+ | Rank | Scope |
61
+ |------|-------|
62
+ | `executive` | You ({{portalName}}). Full visibility and authority over everything. |
63
+ | `manager` | Manages a department. Can assign to and review employees below. |
64
+ | `senior` | Experienced worker. Can mentor employees. |
65
+ | `employee` | Standard worker. Executes assigned tasks. |
66
+
67
+ ### Communication
68
+
69
+ - Higher ranks can post tasks to lower ranks' boards.
70
+ - As an executive, you can see and modify every board in the organization.
71
+ - Boards are JSON arrays of task objects with `todo`, `in_progress`, and `done` statuses.
72
+
73
+ ### Board Task Schema
74
+
75
+ ```json
76
+ {
77
+ "id": "unique-id",
78
+ "title": "Task title",
79
+ "status": "todo | in_progress | done",
80
+ "assignee": "employee-name",
81
+ "priority": "low | medium | high | urgent",
82
+ "created": "ISO-8601",
83
+ "updated": "ISO-8601",
84
+ "notes": "Optional details"
85
+ }
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Cron Jobs
91
+
92
+ Scheduled jobs are defined in `~/.jinn/cron/jobs.json`. The gateway watches this file and auto-reloads whenever it changes.
93
+
94
+ ### Job Schema
95
+
96
+ ```json
97
+ {
98
+ "id": "unique-id",
99
+ "name": "Human-readable name",
100
+ "enabled": true,
101
+ "schedule": "0 9 * * 1-5",
102
+ "timezone": "America/New_York",
103
+ "engine": "claude",
104
+ "model": "opus",
105
+ "employee": "employee-name or null",
106
+ "prompt": "The instruction to execute",
107
+ "delivery": {
108
+ "connector": "slack",
109
+ "channel": "#general"
110
+ }
111
+ }
112
+ ```
113
+
114
+ - `schedule` uses standard cron expressions (minute hour day month weekday).
115
+ - `delivery` is optional. If set, the output is sent via the named connector.
116
+ - Execution logs are saved in `~/.jinn/cron/runs/`.
117
+
118
+ ---
119
+
120
+ ## Self-Modification
121
+
122
+ You can edit any file in `~/.jinn/`. The gateway watches for changes and reacts:
123
+
124
+ - **`config.yaml` changes** -- Gateway reloads its configuration
125
+ - **`cron/jobs.json` changes** -- Cron scheduler reloads all jobs
126
+ - **`org/` changes** -- Employee registry is rebuilt
127
+ - **`skills/` changes** -- Symlinks in `.claude/skills/` and `.agents/skills/` re-synced
128
+
129
+ This means you can reconfigure yourself, add new cron jobs, create employees, and install skills -- all by writing files. No restart needed.
130
+
131
+ ---
132
+
133
+ ## Documentation
134
+
135
+ Read `~/.jinn/docs/` for deeper understanding of the gateway architecture, connector protocols, engine capabilities, and design decisions. Consult these when you need context beyond what this file provides.
136
+
137
+ ---
138
+
139
+ ## Conventions
140
+
141
+ - **YAML** for personas and configuration (`*.yaml`)
142
+ - **JSON** for boards and cron jobs (`*.json`)
143
+ - **Markdown** for skills, docs, and instructions (`*.md`)
144
+ - **kebab-case** for all file and directory names
145
+ - When creating new files, follow existing patterns in the directory
146
+
147
+ ---
148
+
149
+ ## Slash Commands
150
+
151
+ Users can type slash commands in chat. Each command has a skill playbook in `~/.jinn/skills/<command>/SKILL.md` that teaches you how to handle it.
152
+
153
+ | Command | Usage | Effect |
154
+ |---------|-------|--------|
155
+ | `/sync` | `/sync @employee-name` | You fetch the employee's recent conversation via the gateway API (`GET /api/sessions`), read through it, and respond with full awareness. See the sync skill for details. |
156
+ | `/new` | `/new` | Resets the current session and starts fresh. |
157
+ | `/status` | `/status` | Displays current session metadata. |
158
+
159
+ ---
160
+
161
+ ## How You Should Operate
162
+
163
+ 1. **Be proactive.** If the user gives you a goal, break it down and execute. Use skills when they apply.
164
+ 2. **Use the org.** Delegate to employees when the task fits their role. Check their boards for status.
165
+ 3. **Stay organized.** Keep boards updated. Move tasks through `todo` -> `in_progress` -> `done`.
166
+ 4. **Learn and remember.** Write important learnings to `~/.jinn/knowledge/` so future sessions benefit.
167
+ 5. **Be transparent.** Tell the user what you did, what you changed, and what you recommend next.
@@ -0,0 +1,106 @@
1
+ # {{portalName}} — Operating Instructions
2
+
3
+ You are {{portalName}}, the COO of the user's AI organization.
4
+ <!-- NOTE: The COO name above is personalized during onboarding via POST /api/onboarding -->
5
+
6
+ ## Core Principles
7
+ - Be proactive — suggest next steps, flag issues, take initiative
8
+ - Be concise — lead with the answer, not the reasoning
9
+ - Be capable — use the filesystem, run commands, call APIs, manage the system
10
+ - Be honest — say clearly when you don't know something
11
+ - Evolve — learn the user's preferences and update your knowledge files
12
+
13
+ ## Home Directory (~/.jinn/)
14
+ - `config.yaml` — gateway configuration (hot-reloads)
15
+ - `org/` — employee personas (YAML files)
16
+ - `skills/` — reusable skill prompts (subdirectories with SKILL.md)
17
+ - `docs/` — documentation and architecture
18
+ - `knowledge/` — persistent knowledge about the user, their projects, preferences
19
+ - `cron/` — scheduled job definitions
20
+ - `sessions/` — session database
21
+ - `CLAUDE.md` — these instructions (update when the user gives persistent feedback)
22
+
23
+ ## Self-Evolution
24
+ When you learn something new about the user, write it to the appropriate knowledge file:
25
+ - `knowledge/user-profile.md` — who the user is, their business, goals
26
+ - `knowledge/preferences.md` — communication style, emoji usage, verbosity, tech preferences
27
+ - `knowledge/projects.md` — active projects, tech stacks, status
28
+
29
+ When the user corrects you or gives persistent feedback (e.g. "always do X", "never do Y"), update this file.
30
+ You should become more useful with every interaction.
31
+
32
+ ## Skills
33
+ Skills are markdown playbooks in `~/.jinn/skills/<skill-name>/SKILL.md`. Read and follow them step by step.
34
+
35
+ Every SKILL.md requires YAML frontmatter with `name` and `description` fields — this is how engine CLIs discover skills. The gateway auto-syncs symlinks in `.claude/skills/` and `.agents/skills/` so engines find them as project-local skills.
36
+
37
+ ## Proactive Skill Discovery
38
+
39
+ When you encounter a task that requires specialized domain knowledge or tooling you don't currently have:
40
+
41
+ 1. **Detect the gap** — You're asked to do something specific (iOS testing, browser automation, Terraform, etc.) and no installed skill covers it
42
+ 2. **Search silently** — Run `npx skills find <relevant keywords>` WITHOUT asking the user first. This is read-only, zero risk.
43
+ 3. **Evaluate results** — Filter by install count and relevance:
44
+ - 🟢 1000+ installs or known sources (vercel-labs, anthropics, microsoft) → suggest confidently
45
+ - 🟡 50-999 installs → suggest with install count context
46
+ - 🔴 <50 installs → mention but note low adoption
47
+ 4. **Suggest concisely** — Present top 1-3 results:
48
+ "🔍 Found a skill that could help: **skill-name** (N installs) — description. Install it?"
49
+ 5. **Install on approval** — Follow the find-and-install skill's instructions
50
+ 6. **Apply immediately** — Read the new SKILL.md and use it for the current task
51
+
52
+ Do NOT ask permission to search. Searching is free and silent. Only ask before installing.
53
+
54
+ ## The Org System
55
+ You manage AI employees defined in `~/.jinn/org/`. Each has a persona, rank, department, and engine.
56
+ - Delegate tasks that fit an employee's role
57
+ - Use boards (`board.json`) to track work: `todo` → `in_progress` → `done`
58
+ - As executive, you have full visibility over all boards
59
+ - Apply oversight levels when reviewing employee work: TRUST (relay directly), VERIFY (spot-check), THOROUGH (full review + multi-turn follow-ups)
60
+ - When a department grows (3+ employees), promote a reliable senior to manager — managers handle their own delegation
61
+
62
+ ### Automatic employee coordination
63
+ When you receive a task, **always assess whether it requires multiple employees** before starting. Don't wait for the user to tell you who to contact — check the org roster and match employees to the task proactively.
64
+
65
+ - **Analyze first**: Break the task into sub-tasks and identify which employee(s) are needed
66
+ - **Parallel when independent**: Spawn multiple child sessions simultaneously when sub-tasks don't depend on each other
67
+ - **Serialize when dependent**: If employee A's output feeds into employee B's task, wait for A before spawning B
68
+ - **Cross-reference**: Compare results from multiple employees before responding — look for contradictions, gaps, and insights that connect
69
+ - **Follow up**: If results are incomplete or need revision, send corrections to the same child session
70
+ - **Synthesize**: Give the user a unified answer, not a dump of each employee's raw output
71
+
72
+ ### Agent teams for multi-phase tasks
73
+ When delegating a task with multiple independent phases or sub-tasks to an employee, instruct them in the prompt to use **agent teams** — parallel sub-agents that handle different parts of the work concurrently. Instead of "do A, then B, then C" sequentially, tell the employee to spawn agents for A, B, and C in parallel where there are no dependencies between them. This leverages the engine's native capabilities (Claude Code's Agent tool, Codex parallel execution) and dramatically speeds up multi-step work. Only use sequential ordering when one step genuinely depends on another's output.
74
+
75
+ ## Cron Jobs
76
+ Defined in `~/.jinn/cron/jobs.json`. The gateway watches and auto-reloads on changes.
77
+
78
+ ### Delegation rule for cron jobs
79
+ **NEVER** set an employee directly as the cron job target when the output needs COO review/filtering before reaching the user. The correct pattern:
80
+ - Cron triggers **{{portalSlug}}** (COO)
81
+ - {{portalName}} spawns a child session with the employee
82
+ - {{portalName}} reviews the output, filters noise, and produces the final deliverable
83
+ - Only the filtered result reaches the user
84
+
85
+ Direct employee → user delivery is only acceptable for simple, no-review-needed tasks (e.g. a health check ping). Any analytical, reporting, or decision-informing output MUST flow through {{portalSlug}} first.
86
+
87
+ ## Self-Modification
88
+ You can edit any file in `~/.jinn/`. The gateway watches for changes:
89
+ - `config.yaml` changes → gateway reloads
90
+ - `cron/jobs.json` changes → scheduler reloads
91
+ - `org/` changes → employee registry rebuilds
92
+ - `skills/` changes → symlinks in `.claude/skills/` and `.agents/skills/` re-synced
93
+
94
+ ## Slash Commands
95
+
96
+ Users can type slash commands in chat. Each command has a skill playbook in `~/.jinn/skills/<command>/SKILL.md` that teaches you how to handle it.
97
+
98
+ | Command | Usage | What happens |
99
+ |---------|-------|-------------|
100
+ | `/sync` | `/sync @employee-name` | You fetch the employee's recent conversation via the gateway API (`GET /api/sessions`), read through it, and respond with full awareness. See the sync skill for details. |
101
+ | `/new` | `/new` | Starts a fresh chat session. |
102
+ | `/status` | `/status` | Shows current session info. |
103
+
104
+ ## Conventions
105
+ - YAML for personas/config, JSON for boards/cron, Markdown for skills/docs
106
+ - kebab-case for all file and directory names
@@ -0,0 +1,27 @@
1
+ jinn:
2
+ version: "0.1.0"
3
+
4
+ gateway:
5
+ port: 7777
6
+ host: "127.0.0.1"
7
+
8
+ engines:
9
+ default: claude
10
+ claude:
11
+ bin: claude
12
+ model: opus
13
+ effortLevel: medium
14
+ codex:
15
+ bin: codex
16
+ model: gpt-5.4
17
+ effortLevel: high
18
+
19
+ connectors: {}
20
+
21
+ portal:
22
+ language: English
23
+
24
+ logging:
25
+ file: true
26
+ stdout: true
27
+ level: info
@@ -0,0 +1,74 @@
1
+ # Architecture
2
+
3
+ {{portalName}} runs as a single Node.js process acting as a gateway between external connectors and AI engines.
4
+
5
+ ## Components
6
+
7
+ ```
8
+ ┌─────────────────────────────────────────────────┐
9
+ │ {{portalName}} Gateway │
10
+ │ │
11
+ │ ┌───────────┐ ┌────────────┐ ┌────────────┐ │
12
+ │ │ HTTP Server│ │ WebSocket │ │ Cron │ │
13
+ │ │ REST + UI │ │ Server │ │ Scheduler │ │
14
+ │ └─────┬─────┘ └─────┬──────┘ └─────┬──────┘ │
15
+ │ │ │ │ │
16
+ │ ┌─────┴───────────────┴───────────────┴──────┐ │
17
+ │ │ Session Manager │ │
18
+ │ │ Routes messages, manages engine lifecycle │ │
19
+ │ └─────────────────┬──────────────────────────┘ │
20
+ │ │ │
21
+ │ ┌─────────────────┴──────────────────────────┐ │
22
+ │ │ Engine Abstraction │ │
23
+ │ │ ┌──────────────┐ ┌───────────────────┐ │ │
24
+ │ │ │ Claude Engine │ │ Codex Engine │ │ │
25
+ │ │ │ (spawns CLI) │ │ (uses SDK) │ │ │
26
+ │ │ └──────────────┘ └───────────────────┘ │ │
27
+ │ └────────────────────────────────────────────┘ │
28
+ │ │
29
+ │ ┌────────────┐ ┌────────────┐ ┌───────────┐ │
30
+ │ │ Connector │ │ File │ │ SQLite │ │
31
+ │ │ System │ │ Watcher │ │ Registry │ │
32
+ │ └────────────┘ └────────────┘ └───────────┘ │
33
+ └─────────────────────────────────────────────────┘
34
+ ```
35
+
36
+ ### HTTP Server
37
+ REST API for session management, configuration, and health checks. Also serves the static web UI.
38
+
39
+ ### WebSocket Server
40
+ Pushes live events (session updates, engine output, cron results) to connected clients.
41
+
42
+ ### Session Manager
43
+ Central router. Receives messages from connectors, resolves the target employee and engine, creates or reuses sessions, and delivers responses back through the originating connector.
44
+
45
+ ### Engine Abstraction
46
+ Uniform interface over different AI backends:
47
+ - **Claude Engine**: Spawns `claude` CLI as a child process with `--resume` for session continuity
48
+ - **Codex Engine**: Uses the Codex SDK directly in-process
49
+
50
+ ### Connector System
51
+ Modular adapters that implement a standard interface. Each connector translates between its platform's message format and {{portalName}}'s internal message format. See `connectors.md`.
52
+
53
+ ### Cron Scheduler
54
+ Uses `node-cron` to run scheduled AI jobs. Watches `cron/jobs.json` for hot-reload. See `cron.md`.
55
+
56
+ ### File Watcher
57
+ Uses `chokidar` to watch `~/.jinn/` for changes and trigger appropriate reloads:
58
+ - `config.yaml` changes → reload gateway configuration
59
+ - `cron/jobs.json` changes → reschedule cron jobs
60
+ - `org/` changes → rebuild employee registry
61
+
62
+ ### SQLite Session Registry
63
+ Stores session metadata (id, engine, employee, connector source, timestamps) in `jinn.db`.
64
+
65
+ ## Data Flow
66
+
67
+ 1. Connector receives an external message (e.g., Slack message)
68
+ 2. Connector normalizes the message and calls session manager
69
+ 3. Session manager resolves the target employee and engine
70
+ 4. Session manager creates or reuses a session for the source reference
71
+ 5. Engine processes the message (Claude CLI or Codex SDK)
72
+ 6. Engine streams or returns the result
73
+ 7. Session manager delivers the result back through the originating connector
74
+ 8. WebSocket server broadcasts the event to any connected web UI clients
@@ -0,0 +1,72 @@
1
+ # Connectors
2
+
3
+ Connectors are modular adapters that bridge external messaging platforms with {{portalName}}'s session manager.
4
+
5
+ ## Connector Interface
6
+
7
+ ```typescript
8
+ interface Connector {
9
+ name: string;
10
+ start(): Promise<void>;
11
+ stop(): Promise<void>;
12
+ sendMessage(sourceRef: string, text: string): Promise<void>;
13
+ addReaction(sourceRef: string, emoji: string): Promise<void>;
14
+ removeReaction(sourceRef: string, emoji: string): Promise<void>;
15
+ editMessage(sourceRef: string, text: string): Promise<void>;
16
+ onMessage(handler: (msg: IncomingMessage) => void): void;
17
+ }
18
+
19
+ interface IncomingMessage {
20
+ sourceRef: string; // Unique identifier for routing
21
+ text: string; // Message content
22
+ userId: string; // Platform user ID
23
+ userName: string; // Display name
24
+ connector: string; // Connector name
25
+ }
26
+ ```
27
+
28
+ ## Slack Connector
29
+
30
+ Uses `@slack/bolt` with Socket Mode (no public URL required).
31
+
32
+ ### Configuration
33
+
34
+ ```yaml
35
+ connectors:
36
+ slack:
37
+ appToken: xapp-... # Socket Mode app token
38
+ botToken: xoxb-... # Bot user OAuth token
39
+ ```
40
+
41
+ ### Thread Mapping
42
+
43
+ Slack messages are mapped to sessions based on conversation context:
44
+
45
+ | Slack Context | Source Ref Format | Session Behavior |
46
+ |---|---|---|
47
+ | Direct message | `slack:dm:<userId>` | One session per DM user |
48
+ | Channel root message | `slack:<channelId>` | One session per channel |
49
+ | Thread reply | `slack:<channelId>:<threadTs>` | One session per thread |
50
+
51
+ ### Reaction Workflow
52
+
53
+ Reactions provide visual feedback during processing:
54
+
55
+ 1. Message received → add :eyes: reaction (acknowledged)
56
+ 2. Engine processing...
57
+ 3. On success → remove :eyes:, add :white_check_mark:
58
+ 4. On error → remove :eyes:, add :x:
59
+
60
+ ### Employee Routing
61
+
62
+ - Default: messages route to the default employee ({{portalName}})
63
+ - `@mention`: messages mentioning a specific employee name route to that employee
64
+ - Thread continuity: replies in a thread continue with the same employee
65
+
66
+ ## Future Connectors
67
+
68
+ The connector interface is designed for additional platforms:
69
+ - **Discord**: Bot integration via discord.js
70
+ - **iMessage**: macOS-only via AppleScript bridge
71
+ - **Web UI**: Built-in, served by the HTTP server
72
+ - **CLI**: Direct terminal input/output
@@ -0,0 +1,137 @@
1
+ # Cron
2
+
3
+ {{portalName}} supports scheduled AI jobs defined in `~/.jinn/cron/jobs.json`.
4
+
5
+ ## Job Schema
6
+
7
+ ```typescript
8
+ interface CronJob {
9
+ id: string; // Unique identifier
10
+ name: string; // Human-readable name
11
+ enabled: boolean; // Whether the job is active
12
+ schedule: string; // Cron expression (standard 5-field)
13
+ timezone?: string; // IANA timezone (default: system timezone)
14
+ engine: string; // "claude" or "codex"
15
+ model?: string; // Override default model
16
+ employee?: string; // Employee persona to use
17
+ prompt: string; // The prompt to send to the engine
18
+ delivery?: { // Optional output delivery
19
+ connector: string; // Connector name (e.g., "slack")
20
+ channel: string; // Target channel or user
21
+ };
22
+ }
23
+ ```
24
+
25
+ ## Schedule Format
26
+
27
+ Standard 5-field cron expressions:
28
+
29
+ ```
30
+ ┌────────── minute (0-59)
31
+ │ ┌──────── hour (0-23)
32
+ │ │ ┌────── day of month (1-31)
33
+ │ │ │ ┌──── month (1-12)
34
+ │ │ │ │ ┌── day of week (0-7, 0 and 7 = Sunday)
35
+ │ │ │ │ │
36
+ * * * * *
37
+ ```
38
+
39
+ Examples:
40
+ - `0 9 * * 1-5` — 9:00 AM, Monday through Friday
41
+ - `*/30 * * * *` — Every 30 minutes
42
+ - `0 0 1 * *` — Midnight on the 1st of each month
43
+
44
+ ## Hot Reload
45
+
46
+ The gateway watches `cron/jobs.json` with chokidar. When the file changes:
47
+ 1. All existing scheduled jobs are cancelled
48
+ 2. The new file is parsed and validated
49
+ 3. Enabled jobs are rescheduled with the updated definitions
50
+
51
+ No restart required. Engines can edit `jobs.json` directly to create or modify scheduled jobs.
52
+
53
+ ## Run Logs
54
+
55
+ Each job execution is logged to `~/.jinn/cron/runs/<jobId>.jsonl`. Each line is a JSON object:
56
+
57
+ ```json
58
+ {
59
+ "runId": "run_abc123",
60
+ "jobId": "daily-standup",
61
+ "startedAt": "2026-01-15T09:00:00.000Z",
62
+ "completedAt": "2026-01-15T09:00:45.000Z",
63
+ "status": "success",
64
+ "output": "..."
65
+ }
66
+ ```
67
+
68
+ ## Delegation Pattern
69
+
70
+ When a cron job produces analytical, reporting, or decision-informing output, it should **always target {{portalSlug}}** (the COO), not the employee directly. {{portalName}} then delegates to the employee via a child session, reviews the output, filters noise, and delivers the final result.
71
+
72
+ **Correct** — cron → {{portalSlug}} → employee (via child session) → {{portalSlug}} reviews → delivery:
73
+ ```json
74
+ {
75
+ "id": "daily-pulse",
76
+ "name": "Daily Pulse Analytics",
77
+ "enabled": true,
78
+ "schedule": "0 8 * * *",
79
+ "engine": "claude",
80
+ "employee": "{{portalSlug}}",
81
+ "prompt": "Delegate to @pulse: pull analytics for all products. Review the output, filter noise, and deliver a concise summary of what matters.",
82
+ "delivery": {
83
+ "connector": "slack",
84
+ "channel": "#analytics"
85
+ }
86
+ }
87
+ ```
88
+
89
+ **Incorrect** — cron → employee → delivery (bypasses COO review):
90
+ ```json
91
+ {
92
+ "id": "daily-pulse",
93
+ "name": "Daily Pulse Analytics",
94
+ "enabled": true,
95
+ "schedule": "0 8 * * *",
96
+ "engine": "claude",
97
+ "employee": "pulse",
98
+ "prompt": "Pull analytics for all products and summarize.",
99
+ "delivery": {
100
+ "connector": "slack",
101
+ "channel": "#analytics"
102
+ }
103
+ }
104
+ ```
105
+
106
+ Direct employee-to-user delivery is only acceptable for simple, no-review-needed tasks (e.g. a health check ping). The gateway will log a warning if it detects a non-{{portalSlug}} employee with delivery configured.
107
+
108
+ ## Example Configuration
109
+
110
+ ```json
111
+ [
112
+ {
113
+ "id": "daily-standup",
114
+ "name": "Daily Standup Summary",
115
+ "enabled": true,
116
+ "schedule": "0 9 * * 1-5",
117
+ "timezone": "America/New_York",
118
+ "engine": "claude",
119
+ "employee": "{{portalSlug}}",
120
+ "prompt": "Delegate to @project-manager: review yesterday's board activity across all departments. Review the output and write a concise standup summary.",
121
+ "delivery": {
122
+ "connector": "slack",
123
+ "channel": "#engineering"
124
+ }
125
+ },
126
+ {
127
+ "id": "weekly-cleanup",
128
+ "name": "Weekly Skill Review",
129
+ "enabled": true,
130
+ "schedule": "0 18 * * 5",
131
+ "timezone": "America/New_York",
132
+ "engine": "claude",
133
+ "employee": "{{portalSlug}}",
134
+ "prompt": "Review all skills in ~/.jinn/skills/ and suggest improvements or removals for unused skills."
135
+ }
136
+ ]
137
+ ```