claude-mococo 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 (159) hide show
  1. package/LICENSE +21 -0
  2. package/README.ko.md +171 -0
  3. package/README.md +180 -0
  4. package/defaults/shared-rules.md +70 -0
  5. package/dist/bot/client.d.ts +10 -0
  6. package/dist/bot/client.d.ts.map +1 -0
  7. package/dist/bot/client.js +886 -0
  8. package/dist/bot/client.js.map +1 -0
  9. package/dist/bot/discord-commands.d.ts +36 -0
  10. package/dist/bot/discord-commands.d.ts.map +1 -0
  11. package/dist/bot/discord-commands.js +811 -0
  12. package/dist/bot/discord-commands.js.map +1 -0
  13. package/dist/bot/embeds.d.ts +5 -0
  14. package/dist/bot/embeds.d.ts.map +1 -0
  15. package/dist/bot/embeds.js +20 -0
  16. package/dist/bot/embeds.js.map +1 -0
  17. package/dist/bot/episode-writer.d.ts +5 -0
  18. package/dist/bot/episode-writer.d.ts.map +1 -0
  19. package/dist/bot/episode-writer.js +131 -0
  20. package/dist/bot/episode-writer.js.map +1 -0
  21. package/dist/bot/improvement-scanner.d.ts +5 -0
  22. package/dist/bot/improvement-scanner.d.ts.map +1 -0
  23. package/dist/bot/improvement-scanner.js +563 -0
  24. package/dist/bot/improvement-scanner.js.map +1 -0
  25. package/dist/bot/inbox-compactor.d.ts +6 -0
  26. package/dist/bot/inbox-compactor.d.ts.map +1 -0
  27. package/dist/bot/inbox-compactor.js +550 -0
  28. package/dist/bot/inbox-compactor.js.map +1 -0
  29. package/dist/bot/memory-consolidator.d.ts +4 -0
  30. package/dist/bot/memory-consolidator.d.ts.map +1 -0
  31. package/dist/bot/memory-consolidator.js +258 -0
  32. package/dist/bot/memory-consolidator.js.map +1 -0
  33. package/dist/bot/router.d.ts +4 -0
  34. package/dist/bot/router.d.ts.map +1 -0
  35. package/dist/bot/router.js +24 -0
  36. package/dist/bot/router.js.map +1 -0
  37. package/dist/cli/commands/add.d.ts +2 -0
  38. package/dist/cli/commands/add.d.ts.map +1 -0
  39. package/dist/cli/commands/add.js +203 -0
  40. package/dist/cli/commands/add.js.map +1 -0
  41. package/dist/cli/commands/dev.d.ts +2 -0
  42. package/dist/cli/commands/dev.d.ts.map +1 -0
  43. package/dist/cli/commands/dev.js +44 -0
  44. package/dist/cli/commands/dev.js.map +1 -0
  45. package/dist/cli/commands/edit.d.ts +2 -0
  46. package/dist/cli/commands/edit.d.ts.map +1 -0
  47. package/dist/cli/commands/edit.js +213 -0
  48. package/dist/cli/commands/edit.js.map +1 -0
  49. package/dist/cli/commands/init.d.ts +2 -0
  50. package/dist/cli/commands/init.d.ts.map +1 -0
  51. package/dist/cli/commands/init.js +126 -0
  52. package/dist/cli/commands/init.js.map +1 -0
  53. package/dist/cli/commands/list.d.ts +2 -0
  54. package/dist/cli/commands/list.d.ts.map +1 -0
  55. package/dist/cli/commands/list.js +21 -0
  56. package/dist/cli/commands/list.js.map +1 -0
  57. package/dist/cli/commands/remove.d.ts +2 -0
  58. package/dist/cli/commands/remove.d.ts.map +1 -0
  59. package/dist/cli/commands/remove.js +38 -0
  60. package/dist/cli/commands/remove.js.map +1 -0
  61. package/dist/cli/commands/restart.d.ts +2 -0
  62. package/dist/cli/commands/restart.d.ts.map +1 -0
  63. package/dist/cli/commands/restart.js +12 -0
  64. package/dist/cli/commands/restart.js.map +1 -0
  65. package/dist/cli/commands/start.d.ts +2 -0
  66. package/dist/cli/commands/start.d.ts.map +1 -0
  67. package/dist/cli/commands/start.js +33 -0
  68. package/dist/cli/commands/start.js.map +1 -0
  69. package/dist/cli/index.d.ts +3 -0
  70. package/dist/cli/index.d.ts.map +1 -0
  71. package/dist/cli/index.js +78 -0
  72. package/dist/cli/index.js.map +1 -0
  73. package/dist/cli/prompt-template.d.ts +18 -0
  74. package/dist/cli/prompt-template.d.ts.map +1 -0
  75. package/dist/cli/prompt-template.js +55 -0
  76. package/dist/cli/prompt-template.js.map +1 -0
  77. package/dist/cli/readline-utils.d.ts +5 -0
  78. package/dist/cli/readline-utils.d.ts.map +1 -0
  79. package/dist/cli/readline-utils.js +39 -0
  80. package/dist/cli/readline-utils.js.map +1 -0
  81. package/dist/cli/workspace.d.ts +7 -0
  82. package/dist/cli/workspace.d.ts.map +1 -0
  83. package/dist/cli/workspace.js +39 -0
  84. package/dist/cli/workspace.js.map +1 -0
  85. package/dist/config.d.ts +4 -0
  86. package/dist/config.d.ts.map +1 -0
  87. package/dist/config.js +96 -0
  88. package/dist/config.js.map +1 -0
  89. package/dist/index.d.ts +2 -0
  90. package/dist/index.d.ts.map +1 -0
  91. package/dist/index.js +34 -0
  92. package/dist/index.js.map +1 -0
  93. package/dist/orchestrator/claude-engine.d.ts +8 -0
  94. package/dist/orchestrator/claude-engine.d.ts.map +1 -0
  95. package/dist/orchestrator/claude-engine.js +94 -0
  96. package/dist/orchestrator/claude-engine.js.map +1 -0
  97. package/dist/orchestrator/codex-engine.d.ts +10 -0
  98. package/dist/orchestrator/codex-engine.d.ts.map +1 -0
  99. package/dist/orchestrator/codex-engine.js +82 -0
  100. package/dist/orchestrator/codex-engine.js.map +1 -0
  101. package/dist/orchestrator/engine-base.d.ts +21 -0
  102. package/dist/orchestrator/engine-base.d.ts.map +1 -0
  103. package/dist/orchestrator/engine-base.js +20 -0
  104. package/dist/orchestrator/engine-base.js.map +1 -0
  105. package/dist/orchestrator/engines.d.ts +5 -0
  106. package/dist/orchestrator/engines.d.ts.map +1 -0
  107. package/dist/orchestrator/engines.js +16 -0
  108. package/dist/orchestrator/engines.js.map +1 -0
  109. package/dist/orchestrator/gemini-engine.d.ts +10 -0
  110. package/dist/orchestrator/gemini-engine.d.ts.map +1 -0
  111. package/dist/orchestrator/gemini-engine.js +79 -0
  112. package/dist/orchestrator/gemini-engine.js.map +1 -0
  113. package/dist/orchestrator/mcp-config.d.ts +4 -0
  114. package/dist/orchestrator/mcp-config.d.ts.map +1 -0
  115. package/dist/orchestrator/mcp-config.js +23 -0
  116. package/dist/orchestrator/mcp-config.js.map +1 -0
  117. package/dist/orchestrator/prompt-builder.d.ts +3 -0
  118. package/dist/orchestrator/prompt-builder.d.ts.map +1 -0
  119. package/dist/orchestrator/prompt-builder.js +445 -0
  120. package/dist/orchestrator/prompt-builder.js.map +1 -0
  121. package/dist/server/hook-receiver.d.ts +5 -0
  122. package/dist/server/hook-receiver.d.ts.map +1 -0
  123. package/dist/server/hook-receiver.js +52 -0
  124. package/dist/server/hook-receiver.js.map +1 -0
  125. package/dist/teams/concurrency.d.ts +12 -0
  126. package/dist/teams/concurrency.d.ts.map +1 -0
  127. package/dist/teams/concurrency.js +43 -0
  128. package/dist/teams/concurrency.js.map +1 -0
  129. package/dist/teams/context.d.ts +5 -0
  130. package/dist/teams/context.d.ts.map +1 -0
  131. package/dist/teams/context.js +33 -0
  132. package/dist/teams/context.js.map +1 -0
  133. package/dist/teams/dispatch-ledger.d.ts +27 -0
  134. package/dist/teams/dispatch-ledger.d.ts.map +1 -0
  135. package/dist/teams/dispatch-ledger.js +90 -0
  136. package/dist/teams/dispatch-ledger.js.map +1 -0
  137. package/dist/teams/invoker.d.ts +9 -0
  138. package/dist/teams/invoker.d.ts.map +1 -0
  139. package/dist/teams/invoker.js +54 -0
  140. package/dist/teams/invoker.js.map +1 -0
  141. package/dist/types.d.ts +110 -0
  142. package/dist/types.d.ts.map +1 -0
  143. package/dist/types.js +2 -0
  144. package/dist/types.js.map +1 -0
  145. package/dist/utils/fs.d.ts +3 -0
  146. package/dist/utils/fs.d.ts.map +1 -0
  147. package/dist/utils/fs.js +17 -0
  148. package/dist/utils/fs.js.map +1 -0
  149. package/dist/utils/github-status.d.ts +25 -0
  150. package/dist/utils/github-status.d.ts.map +1 -0
  151. package/dist/utils/github-status.js +158 -0
  152. package/dist/utils/github-status.js.map +1 -0
  153. package/dist/utils/haiku.d.ts +6 -0
  154. package/dist/utils/haiku.d.ts.map +1 -0
  155. package/dist/utils/haiku.js +43 -0
  156. package/dist/utils/haiku.js.map +1 -0
  157. package/hooks/event-bridge.sh +21 -0
  158. package/hooks/permission-gate.sh +67 -0
  159. package/package.json +52 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 wodn5515
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.ko.md ADDED
@@ -0,0 +1,171 @@
1
+ # claude-mococo
2
+
3
+ **Discord 위의 AI 어시스턴트.** 각 어시스턴트는 AI 엔진(Claude, Codex, Gemini)으로 구동되는 실제 Discord 봇입니다. 고유한 GitHub 계정, 성격, 권한을 가집니다. 하나부터 시작해서 필요할 때 더 추가하세요.
4
+
5
+ ```
6
+ 나: "my-app에 로그인 페이지 만들어줘"
7
+
8
+ 어시스턴트 (봇): "알겠습니다. 인증 라우트와 로그인 폼을 만들게요."
9
+ → 코드 커밋 → 브랜치 푸시 → PR 생성
10
+ ```
11
+
12
+ ---
13
+
14
+ ## 빠른 시작
15
+
16
+ ### 1. 설치
17
+
18
+ ```bash
19
+ npm install -g claude-mococo
20
+ ```
21
+
22
+ AI 엔진도 최소 하나 필요합니다:
23
+
24
+ ```bash
25
+ claude --version # Claude CLI (추천)
26
+ npm install -g @openai/codex # Codex CLI (선택)
27
+ npm install -g @google/gemini-cli # Gemini CLI (선택)
28
+ ```
29
+
30
+ ### 2. Discord 봇 만들기
31
+
32
+ 1. [discord.com/developers/applications](https://discord.com/developers/applications) → **New Application**
33
+ 2. 이름 지정 (예: `my-assistant`)
34
+ 3. 사이드바 → **Bot**:
35
+ - 봇 토큰 복사
36
+ - **Privileged Gateway Intents** 3개 모두 활성화 (Presence, Server Members, **Message Content**)
37
+ 4. 사이드바 → **OAuth2**:
38
+ - Scopes: `bot`
39
+ - Permissions: `Send Messages`, `Read Message History`, `Embed Links`, `Attach Files`
40
+ - URL 복사 → 브라우저에서 열기 → 서버에 추가
41
+
42
+ ### 3. 워크스페이스 생성 및 어시스턴트 추가
43
+
44
+ ```bash
45
+ mkdir my-team && cd my-team
46
+ mococo init # 워크스페이스 생성 (Discord 채널 ID 입력)
47
+ mococo add # 대화형 마법사 — 이름, 엔진, 토큰 등 입력
48
+ ```
49
+
50
+ 커밋에는 어시스턴트 이름이 작성자로 표시됩니다 (`teams.json`의 `git.name`으로 설정). 어시스턴트가 푸시나 PR을 생성해야 하면 `mococo add` 시 GitHub PAT를 입력하세요.
51
+
52
+ ### 4. 저장소 연결 및 시작
53
+
54
+ ```bash
55
+ ln -s /경로/my-app repos/my-app
56
+ mococo start
57
+ ```
58
+
59
+ Discord 채널에서 봇에게 말을 걸면 됩니다.
60
+
61
+ ---
62
+
63
+ ## CLI 명령어
64
+
65
+ | 명령어 | 설명 |
66
+ |--------|------|
67
+ | `mococo init` | 현재 디렉토리에 워크스페이스 생성 |
68
+ | `mococo add` | 어시스턴트 추가 (대화형 마법사) |
69
+ | `mococo start` | 모든 어시스턴트 시작 |
70
+ | `mococo list` | 설정된 어시스턴트 목록 |
71
+ | `mococo remove <id>` | 어시스턴트 제거 |
72
+
73
+ ---
74
+
75
+ ## 어시스턴트 추가하기
76
+
77
+ ```bash
78
+ mococo add # 새 어시스턴트마다 반복
79
+ ```
80
+
81
+ 각 어시스턴트는:
82
+ - 고유한 Discord 봇 (채팅에서 별도 신원)
83
+ - 고유한 git 작성자 이름 (커밋 메시지에 표시)
84
+ - `teams.json`의 별도 항목 (엔진, 성격, 권한)
85
+
86
+ 이렇게 팀을 구성할 수 있습니다:
87
+
88
+ | 어시스턴트 | 엔진 | 역할 |
89
+ |-----------|------|------|
90
+ | Leader | Claude | 다른 어시스턴트에게 작업 위임 |
91
+ | Planner | Codex | 계획 및 스펙 작성 |
92
+ | Coder | Claude | 코드 작성 |
93
+ | Reviewer | Claude | 리뷰 및 PR 생성 |
94
+ | Designer | Gemini | UI/UX 가이드 |
95
+
96
+ 혼자 하나만 써도 됩니다. 선택은 자유입니다.
97
+
98
+ ---
99
+
100
+ ## 작동 방식
101
+
102
+ **메시지 라우팅:**
103
+ - 특정 봇을 `@멘션` → 해당 어시스턴트가 응답
104
+ - 멘션 없음 → `"isLeader": true`인 어시스턴트가 응답
105
+
106
+ **어시스턴트가 다른 어시스턴트를 멘션하면** (예: `@Reviewer 확인 부탁`) → 자동으로 호출됩니다.
107
+
108
+ **권한**은 `teams.json`에서 어시스턴트별로 제어합니다:
109
+
110
+ ```jsonc
111
+ "permissions": {
112
+ "allow": ["git push", "gh pr create"],
113
+ "deny": ["gh pr merge"]
114
+ }
115
+ ```
116
+
117
+ **엔진:** `"claude"`는 풀 에이전트(파일, git, 명령어). `"codex"`와 `"gemini"`는 텍스트 전용 어드바이저.
118
+
119
+ ---
120
+
121
+ ## 설정 레퍼런스
122
+
123
+ ### teams.json 필드
124
+
125
+ | 필드 | 설명 |
126
+ |------|------|
127
+ | `engine` | `"claude"`, `"codex"`, 또는 `"gemini"` |
128
+ | `model` | 모델명 (예: `"sonnet"`, `"opus"`, `"o3"`, `"gemini-2.5-pro"`) |
129
+ | `maxBudget` | 호출당 최대 비용 (Claude만 해당) |
130
+ | `prompt` | 성격/지시사항 파일 경로 |
131
+ | `isLeader` | `true`면 모든 메시지에 응답 (@멘션 불필요) |
132
+ | `git.name` / `git.email` | 커밋 작성자 정보 |
133
+ | `permissions.allow` / `permissions.deny` | 허용/차단 쉘 명령어 |
134
+
135
+ ### Discord 명령어
136
+
137
+ | 명령어 | 설명 |
138
+ |--------|------|
139
+ | `!status` | 모든 어시스턴트 상태 (작업 중/유휴, 온라인/오프라인) |
140
+ | `!teams` | 어시스턴트 목록과 엔진 |
141
+ | `!repos` | 연결된 저장소 목록 |
142
+
143
+ ---
144
+
145
+ ## 수동 설정 (CLI 없이)
146
+
147
+ 저장소를 직접 클론해서 설정할 수도 있습니다:
148
+
149
+ ```bash
150
+ git clone https://github.com/anthropics/claude-mococo.git
151
+ cd claude-mococo
152
+ npm install
153
+ ```
154
+
155
+ `teams.json`을 직접 편집하고, `prompts/`에 프롬프트 파일을 만들고, `.env`에 토큰을 설정한 후 `npm start`로 실행합니다.
156
+
157
+ ---
158
+
159
+ ## 문제 해결
160
+
161
+ | 문제 | 해결 |
162
+ |------|------|
163
+ | 봇이 응답 안 함 | Discord Developer Portal에서 **Message Content Intent** 활성화 |
164
+ | "No team has a Discord token" | `.env`에 토큰 환경변수 추가 |
165
+ | GitHub 푸시 불가 | `.env`의 GitHub PAT 확인 |
166
+ | 커밋 작성자 틀림 | `git.email`을 `USERNAME@users.noreply.github.com`으로 설정 |
167
+ | "command not found: codex" | 설치하거나 engine을 `"claude"`로 변경 |
168
+
169
+ ## 라이선스
170
+
171
+ MIT
package/README.md ADDED
@@ -0,0 +1,180 @@
1
+ # claude-mococo
2
+
3
+ **AI assistants on Discord.** Each assistant is a real Discord bot backed by an AI engine (Claude, Codex, Gemini). It has its own GitHub account, personality, and permissions. Start with one, add more when you need them.
4
+
5
+ ```
6
+ You: "Add a login page to my-app"
7
+
8
+ Assistant (bot): "On it. I'll create the auth routes and login form."
9
+ → commits code → pushes branch → opens PR
10
+ ```
11
+
12
+ ---
13
+
14
+ ## Quick Start
15
+
16
+ ### 1. Install
17
+
18
+ ```bash
19
+ npm install -g claude-mococo
20
+ ```
21
+
22
+ Or run directly without installing:
23
+
24
+ ```bash
25
+ npx claude-mococo init
26
+ npx claude-mococo add
27
+ npx claude-mococo start
28
+ ```
29
+
30
+ You also need at least one AI engine:
31
+
32
+ ```bash
33
+ claude --version # Claude CLI (recommended)
34
+ npm install -g @openai/codex # Codex CLI (optional)
35
+ npm install -g @google/gemini-cli # Gemini CLI (optional)
36
+ ```
37
+
38
+ ### 2. Create a Discord bot
39
+
40
+ 1. Go to [discord.com/developers/applications](https://discord.com/developers/applications) → **New Application**
41
+ 2. Name it anything (e.g. `my-assistant`)
42
+ 3. Sidebar → **Bot**:
43
+ - Copy the bot token
44
+ - Enable all three **Privileged Gateway Intents** (Presence, Server Members, **Message Content**)
45
+ 4. Sidebar → **OAuth2**:
46
+ - Scopes: `bot`
47
+ - Permissions: `Send Messages`, `Read Message History`, `Embed Links`, `Attach Files`
48
+ - Copy the URL → open in browser → add to your server
49
+
50
+ ### 3. Initialize and add your assistant
51
+
52
+ ```bash
53
+ mkdir my-team && cd my-team
54
+ mococo init # creates workspace (asks for Discord channel ID)
55
+ mococo add # interactive wizard — asks for name, engine, tokens, etc.
56
+ ```
57
+
58
+ Commits will show the assistant's name as the author (configured via `git.name` in `teams.json`). If you need assistants to push or create PRs, provide your GitHub PAT during `mococo add`.
59
+
60
+ ### 4. Link your repos and start
61
+
62
+ ```bash
63
+ ln -s /path/to/my-app repos/my-app
64
+ mococo start
65
+ ```
66
+
67
+ Talk to your bot in the Discord channel. Done.
68
+
69
+ ---
70
+
71
+ ## CLI Commands
72
+
73
+ | Command | Description |
74
+ |---------|-------------|
75
+ | `mococo init` | Create a new workspace in the current directory |
76
+ | `mococo add` | Add an assistant (interactive wizard) |
77
+ | `mococo start` | Start all assistants |
78
+ | `mococo list` | List configured assistants |
79
+ | `mococo remove <id>` | Remove an assistant |
80
+
81
+ ---
82
+
83
+ ## Adding More Assistants
84
+
85
+ ```bash
86
+ mococo add # repeat for each new assistant
87
+ ```
88
+
89
+ Each one gets:
90
+ - Its own Discord bot (separate identity in chat)
91
+ - Its own git author name (visible in commit messages)
92
+ - Its own entry in `teams.json` (engine, personality, permissions)
93
+
94
+ You can build a full team this way:
95
+
96
+ | Assistant | Engine | Role |
97
+ |-----------|--------|------|
98
+ | Leader | Claude | Delegates work to other assistants |
99
+ | Planner | Codex | Creates plans and specs |
100
+ | Coder | Claude | Writes code |
101
+ | Reviewer | Claude | Reviews and opens PRs |
102
+ | Designer | Gemini | UI/UX guidance |
103
+
104
+ Or just run a single assistant. It's up to you.
105
+
106
+ ---
107
+
108
+ ## How It Works
109
+
110
+ **Message routing:**
111
+ - If you `@mention` a specific bot → that assistant responds
112
+ - If no mention → the first assistant marked `"isLeader": true` responds
113
+
114
+ **When an assistant mentions another** (e.g. `@Reviewer please check this`) → that assistant is automatically invoked.
115
+
116
+ **Permissions** are controlled per-assistant in `teams.json`:
117
+
118
+ ```jsonc
119
+ "permissions": {
120
+ "allow": ["git push", "gh pr create"],
121
+ "deny": ["gh pr merge"]
122
+ }
123
+ ```
124
+
125
+ **Engines:** `"claude"` runs as a full agent (files, git, commands). `"codex"` and `"gemini"` run as text-only advisors.
126
+
127
+ ---
128
+
129
+ ## Configuration Reference
130
+
131
+ ### teams.json fields
132
+
133
+ | Field | Description |
134
+ |-------|-------------|
135
+ | `engine` | `"claude"`, `"codex"`, or `"gemini"` |
136
+ | `model` | Model name (e.g. `"sonnet"`, `"opus"`, `"o3"`, `"gemini-2.5-pro"`) |
137
+ | `maxBudget` | Max dollar spend per invocation (Claude only) |
138
+ | `prompt` | Path to the personality/instructions file |
139
+ | `isLeader` | If `true`, responds to all messages (not just @mentions) |
140
+ | `git.name` / `git.email` | Git author for commits |
141
+ | `permissions.allow` / `permissions.deny` | Allowed/denied shell commands |
142
+
143
+ ### Discord commands
144
+
145
+ | Command | Description |
146
+ |---------|-------------|
147
+ | `!status` | Show all assistants (busy/idle, online/offline) |
148
+ | `!teams` | List assistants and their engines |
149
+ | `!repos` | List linked repositories |
150
+
151
+ ---
152
+
153
+ ## Manual Setup (without CLI)
154
+
155
+ You can also set up manually by cloning the repo:
156
+
157
+ ```bash
158
+ git clone https://github.com/wodn5515/claude-mococo.git
159
+ cd claude-mococo
160
+ npm install
161
+ npm run build
162
+ ```
163
+
164
+ Edit `teams.json` directly, create prompt files in `prompts/`, set tokens in `.env`, then `npm start`.
165
+
166
+ ---
167
+
168
+ ## Troubleshooting
169
+
170
+ | Problem | Fix |
171
+ |---------|-----|
172
+ | Bot doesn't respond | Enable **Message Content Intent** in Discord Developer Portal |
173
+ | "No team has a Discord token" | Add the token env var to `.env` |
174
+ | Can't push to GitHub | Check the GitHub PAT in `.env` is valid |
175
+ | Wrong commit author | Set `git.email` to `USERNAME@users.noreply.github.com` |
176
+ | "command not found: codex" | Install it or change engine to `"claude"` |
177
+
178
+ ## License
179
+
180
+ MIT
@@ -0,0 +1,70 @@
1
+ ## Common Rules
2
+
3
+ ### Priority
4
+ **Rules > Role > Personality** — Rules always override personality when in conflict.
5
+ On conflict: stop → verify → propose alternative → execute after approval.
6
+
7
+ ### Hierarchy
8
+ {{humanTitle}} > {{leaderName}} > Self. Superiors' instructions always take priority.
9
+
10
+ ### Absolute Prohibitions
11
+ - PR merge — only {{humanTitle}} can do this
12
+ - Exposing tokens, passwords, or credentials
13
+ - Tagging your own Discord ID
14
+
15
+ ### Tag Response Judgment
16
+ Being tagged doesn't always require a response. Judge the context:
17
+ - **Speaking to me** (question, instruction, request) → respond
18
+ - **Merely mentioning me** (talking about me to a third party) → no response needed
19
+
20
+ ### Conversation End Judgment
21
+ Only tag someone when you **have something to say**. End without tagging if:
22
+ - Ceremonial responses (greetings, thanks, acknowledgments) → end without tag
23
+ - Other party already completed/approved and **no further discussion needed** → end
24
+ - **Repeating** the same topic → end
25
+ - No new information, questions, or work to delegate → end
26
+
27
+ **Principle: Tag = only when the other party needs to take action. A reaction emoji is enough otherwise.**
28
+
29
+ ### {{humanTitle}} Tagging Rules
30
+ Tag {{humanTitle}} **minimally**. Only tag when:
31
+ - Answering {{humanTitle}}'s **direct question/instruction**
32
+ - A matter **requiring approval** (PR merge, critical decisions)
33
+ - An **urgent issue** only {{humanTitle}} can resolve
34
+
35
+ For other reports, progress updates, general questions → **tag {{leaderName}}**. {{leaderName}} will relay to {{humanTitle}} if needed.
36
+
37
+ ### Behavior Principles
38
+ - **Stop if uncertain** — don't guess, ask {{leaderName}}
39
+ - **Report failures immediately** — explain the situation to {{leaderName}}
40
+ - **Be concise** — Discord messages should be to the point. No essays
41
+ - **When handing off work** — @mention + 1-line summary + background/requirements
42
+ - **Keep casual conversation natural** — In non-work conversations (greetings, welcomes, chat), don't use instructional or explanatory tone. Talk like a person. No directives like "please do X". If you have nothing to say, don't say it.
43
+
44
+ ### Memory Rules
45
+ - **All in-progress tasks and waiting items must include `#ch:channelId`.** The auto-loop needs the channel ID to determine where to continue work.
46
+ - Without a channel ID, the loop may skip or malfunction.
47
+
48
+ ### Default Honorifics
49
+ - {{humanTitle}}: respectful/formal language
50
+ - {{leaderName}}: defined per agent in Character section (default: respectful)
51
+ - Other agents: defined per agent in Character section
52
+
53
+ ### New Agent Welcome Protocol
54
+ When a new agent joins the server, the system generates a `[New Agent Joined]` message.
55
+ Follow this sequence strictly. **Do not tag multiple agents at once.**
56
+
57
+ **Step 1 — {{leaderName}} (on receiving system message):**
58
+ - Tag **only** the new agent and request an introduction
59
+ - Do not tag other agents at this step
60
+
61
+ **Step 2 — New agent (when tagged):**
62
+ - Self-introduction: name, role, responsibilities
63
+ - One-liner commitment: how they'll contribute to the team
64
+ - Tag {{leaderName}} to respond (tag rules auto-invoke {{leaderName}})
65
+
66
+ **Step 3 — {{leaderName}} (after confirming introduction):**
67
+ - Tag other agents and ask them to welcome the newcomer
68
+
69
+ **Step 4 — Other agents (when tagged):**
70
+ - Welcome message or a welcoming emoji reaction like `[discord:react emoji=👋]`
@@ -0,0 +1,10 @@
1
+ import { Client } from 'discord.js';
2
+ import type { TeamsConfig, TeamConfig, EnvConfig, ConversationMessage, ChainContext } from '../types.js';
3
+ export declare const teamClients: Map<string, Client<boolean>>;
4
+ export declare function appendToInbox(teamId: string, from: string, content: string, workspacePath: string, channelId: string): Promise<void>;
5
+ export declare function clearInbox(teamId: string, workspacePath: string): void;
6
+ export declare function newChain(): ChainContext;
7
+ export declare function sendAsTeam(channelId: string, team: TeamConfig, content: string): Promise<boolean>;
8
+ export declare function createBots(config: TeamsConfig, env: EnvConfig): Promise<void>;
9
+ export declare function handleTeamInvocation(team: TeamConfig, triggerMsg: ConversationMessage, channelId: string, config: TeamsConfig, env: EnvConfig, chain?: ChainContext, continuationCount?: number): Promise<void>;
10
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/bot/client.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,MAAM,EAEP,MAAM,YAAY,CAAC;AAcpB,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAUzG,eAAO,MAAM,WAAW,8BAA4B,CAAC;AA8CrD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAuCpH;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,QAS/D;AAMD,wBAAgB,QAAQ,IAAI,YAAY,CAOvC;AA4HD,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAqBvG;AAoBD,wBAAsB,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAkXnF;AAmFD,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,mBAAmB,EAC/B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,EACnB,GAAG,EAAE,SAAS,EACd,KAAK,GAAE,YAAyB,EAChC,iBAAiB,SAAI,iBA6BtB"}