mod-bot 1.0.0 → 1.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 (2) hide show
  1. package/README.md +238 -61
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,103 +1,280 @@
1
- # mod-bot
1
+ <p align="center">
2
+ <img src="assets/mascot.png" alt="mod-bot mascot" width="200" />
3
+ </p>
2
4
 
3
- An adaptive code moderation MCP server that learns your preferences, understands your codebase, and tailors guidance to your experience level.
5
+ <h1 align="center">mod-bot</h1>
4
6
 
5
- ## What is mod-bot?
7
+ <p align="center">
8
+ <strong>An adaptive code moderation MCP server that learns your style.</strong>
9
+ </p>
6
10
 
7
- Mod-bot is a **code moderator** — not just another orchestrator or skill system. It sits between you and your codebase like a senior tech lead who:
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/mod-bot"><img src="https://img.shields.io/npm/v/mod-bot.svg" alt="npm version" /></a>
13
+ <a href="https://www.npmjs.com/package/mod-bot"><img src="https://img.shields.io/npm/dm/mod-bot.svg" alt="npm downloads" /></a>
14
+ <a href="https://github.com/MiguelSeglias/mod-bot/actions/workflows/ci.yml"><img src="https://github.com/MiguelSeglias/mod-bot/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
15
+ <a href="https://github.com/MiguelSeglias/mod-bot/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/mod-bot.svg" alt="license" /></a>
16
+ <a href="https://github.com/MiguelSeglias/mod-bot"><img src="https://img.shields.io/github/stars/MiguelSeglias/mod-bot.svg?style=social" alt="GitHub stars" /></a>
17
+ </p>
8
18
 
9
- - Knows your codebase inside out and keeps that knowledge current
10
- - Knows your skill level and adjusts guidance accordingly
11
- - Learns your patterns and preferences over time
12
- - Manages context so nothing falls through the cracks
13
- - Deploys multi-agent swarms only when genuinely needed
19
+ <p align="center">
20
+ <a href="#install">Install</a> &bull;
21
+ <a href="#what-it-does">What it does</a> &bull;
22
+ <a href="#tools">Tools</a> &bull;
23
+ <a href="#adaptive-output">Adaptive output</a> &bull;
24
+ <a href="#how-it-works">How it works</a> &bull;
25
+ <a href="#contributing">Contributing</a>
26
+ </p>
14
27
 
15
- ## Quick Start
28
+ ---
29
+
30
+ ## Why mod-bot?
31
+
32
+ Most AI coding tools treat every developer the same. A junior writing their first API gets the same terse response as a staff engineer. Mod-bot fixes that.
16
33
 
17
- ### Add to Claude Code
34
+ It's a **[Model Context Protocol](https://modelcontextprotocol.io/)** server for **[Claude Code](https://docs.anthropic.com/en/docs/claude-code)** that acts as your personal senior tech lead — one who knows your codebase, remembers your preferences, and adjusts their communication style to match your experience level.
35
+
36
+ ## Install
18
37
 
19
38
  ```bash
20
39
  claude mcp add --scope user mod-bot -- npx -y mod-bot@latest
21
40
  ```
22
41
 
23
- ### Initialize in your project
42
+ That's it. Restart Claude Code and you're ready to go.
43
+
44
+ ## What it does
45
+
46
+ **Adapts to you.** Tell mod-bot your experience level and it adjusts everything — a junior gets step-by-step walkthroughs with explanations, a senior gets terse one-liners. Working in a language you're learning? It automatically provides more detail.
47
+
48
+ **Learns your patterns.** Use early returns consistently? Prefer functional style? Skip reviews on small changes? Mod-bot notices and adapts. After enough sessions, it suggests workflow adjustments based on what it's learned.
49
+
50
+ **Knows your project.** On first run, mod-bot scans your codebase — languages, frameworks, test setup, CI/CD, project maturity. It keeps a living knowledge graph that updates as your project evolves.
51
+
52
+ **Manages context.** It tracks your current branch, task, decisions, and open questions across sessions. Pick up exactly where you left off.
53
+
54
+ **Respects your tokens.** Unlike tools that eagerly spawn agent swarms, mod-bot estimates cost first and asks before spending. Default budget is conservative.
55
+
56
+ ## Quick Start
57
+
58
+ ### 1. Initialize in your project
24
59
 
25
60
  ```
26
- init:setup --experienceLevel senior --name "Your Name"
61
+ > init_setup --name "Alex" --experienceLevel senior
27
62
  ```
28
63
 
29
- This scans your codebase, detects your tech stack, and creates a `.mod-bot/` config directory.
64
+ Mod-bot scans your project and creates a `.mod-bot/` config directory with your preferences.
65
+
66
+ ### 2. Get suggestions
67
+
68
+ ```
69
+ > mod_suggest --task "Add rate limiting to the API"
70
+ ```
71
+
72
+ ### 3. Review before committing
73
+
74
+ ```
75
+ > mod_review --changes "$(git diff --staged)"
76
+ ```
77
+
78
+ ### 4. Teach it your preferences
79
+
80
+ ```
81
+ > learn_pattern --id "early-returns" --type code_style --description "Always use early returns over nested if/else"
82
+ ```
30
83
 
31
84
  ## Tools
32
85
 
33
- ### Init (3 tools)
34
- | Tool | Description |
86
+ ### Init
87
+ | Tool | What it does |
35
88
  |------|-------------|
36
- | `init:setup` | Initialize mod-bot: scan project, set preferences, get recommendations |
37
- | `init:reconfig` | Update your preferences without re-scanning |
38
- | `init:migrate` | Migrate config to latest version |
89
+ | `init_setup` | Scan project, set your preferences, get tailored recommendations |
90
+ | `init_reconfig` | Update preferences without re-scanning |
91
+ | `init_migrate` | Migrate config when mod-bot updates |
39
92
 
40
- ### Moderation (5 tools)
41
- | Tool | Description |
93
+ ### Moderation
94
+ | Tool | What it does |
42
95
  |------|-------------|
43
- | `mod:suggest` | Get approach suggestions adapted to your level |
44
- | `mod:review` | Review changes before committing |
45
- | `mod:plan` | Create an implementation plan |
46
- | `mod:checkpoint` | Save progress, decisions, and open questions |
47
- | `mod:retro` | Run a brief retrospective |
48
-
49
- ### Context (4 tools)
50
- | Tool | Description |
96
+ | `mod_suggest` | Suggest an approach for a task, adapted to your level |
97
+ | `mod_review` | Review staged changes catches issues calibrated to your skill |
98
+ | `mod_plan` | Create an implementation plan with appropriate detail |
99
+ | `mod_checkpoint` | Snapshot progress, decisions made, and open questions |
100
+ | `mod_retro` | Quick retrospective after completing a task |
101
+
102
+ ### Context
103
+ | Tool | What it does |
51
104
  |------|-------------|
52
- | `ctx:status` | Show current project state (branch, task, health) |
53
- | `ctx:refresh` | Force full context refresh |
54
- | `ctx:focus` | Set current focus area |
55
- | `ctx:history` | Show session history and decision log |
105
+ | `ctx_status` | Current state: branch, task, health metrics, recent commits |
106
+ | `ctx_refresh` | Force a full codebase re-scan |
107
+ | `ctx_focus` | Set a focus area (e.g., "auth module") for prioritized context |
108
+ | `ctx_history` | Session history and decision log |
56
109
 
57
- ### Learning (4 tools)
58
- | Tool | Description |
110
+ ### Learning
111
+ | Tool | What it does |
59
112
  |------|-------------|
60
- | `learn:pattern` | Teach mod-bot a pattern or preference |
61
- | `learn:show` | Show what mod-bot has learned |
62
- | `learn:reset` | Reset specific or all patterns |
63
- | `learn:suggest-workflow` | Get workflow adjustment suggestions |
113
+ | `learn_pattern` | Teach a coding pattern or preference |
114
+ | `learn_show` | See everything mod-bot has learned about you |
115
+ | `learn_reset` | Remove specific patterns or reset all |
116
+ | `learn_suggest-workflow` | Get workflow adjustment suggestions based on your habits |
64
117
 
65
- ### Swarm (3 tools)
66
- | Tool | Description |
118
+ ### Swarm
119
+ | Tool | What it does |
67
120
  |------|-------------|
68
- | `swarm:estimate` | Estimate token cost before spawning |
69
- | `swarm:analyze` | Spawn a focused analysis swarm |
70
- | `swarm:refactor` | Coordinate multi-file refactoring |
121
+ | `swarm_estimate` | Estimate token cost before spawning agents |
122
+ | `swarm_analyze` | Spawn a focused analysis swarm (code + tests + architecture) |
123
+ | `swarm_refactor` | Coordinate multi-file refactoring with one agent per concern |
71
124
 
72
125
  ## Adaptive Output
73
126
 
74
- Mod-bot adapts its output based on your experience level:
127
+ The same tool produces different output depending on who's using it:
75
128
 
76
- | Scenario | Junior | Senior |
77
- |----------|--------|--------|
78
- | New endpoint | Full step-by-step with code snippets | "Add POST /users in routes/users.ts, follow posts.ts pattern" |
79
- | Bug in auth | "Let's debug together. First, check the error..." | "Race condition in token refresh. Check auth/refresh.ts:47" |
80
- | PR review | Explains each issue with "why" and docs links | "L23: null check. L45: extract helper. L67: add test." |
129
+ <table>
130
+ <tr><th>Scenario</th><th>Junior</th><th>Senior</th></tr>
131
+ <tr>
132
+ <td><strong>New endpoint</strong></td>
133
+ <td>
81
134
 
82
- ## Development
135
+ Step-by-step walkthrough:
136
+ 1. Create route file
137
+ 2. Add handler with validation
138
+ 3. Write tests first
139
+ 4. Register the route
140
+ 5. Test manually
141
+
142
+ Each step includes code snippets and explanations of *why*.
143
+
144
+ </td>
145
+ <td>
146
+
147
+ `Add POST /users in routes/users.ts, follow the pattern from routes/posts.ts. Don't forget validation middleware.`
148
+
149
+ </td>
150
+ </tr>
151
+ <tr>
152
+ <td><strong>Bug in auth</strong></td>
153
+ <td>
154
+
155
+ "Let's debug this together. First, let's look at the error message and trace it back to the source..."
156
+
157
+ </td>
158
+ <td>
159
+
160
+ "Race condition in token refresh. Check `auth/refresh.ts:47` — the mutex doesn't cover the full critical section."
161
+
162
+ </td>
163
+ </tr>
164
+ <tr>
165
+ <td><strong>Code review</strong></td>
166
+ <td>
167
+
168
+ Explains each issue with *why it matters*, links to relevant docs, and suggests how to fix it.
169
+
170
+ </td>
171
+ <td>
172
+
173
+ `L23: null check missing. L45: extract to helper. L67: add test.`
174
+
175
+ </td>
176
+ </tr>
177
+ </table>
178
+
179
+ Working in a language you're learning? Mod-bot automatically downshifts one level — a senior learning Rust gets mid-level guidance for Rust code.
180
+
181
+ ## How it works
83
182
 
84
- ```bash
85
- pnpm install # Install dependencies
86
- pnpm build # Build all packages
87
- pnpm test # Run tests (67 tests)
183
+ ```
184
+ Input (task/question)
185
+ -> User Profile Lookup (experience level, preferences)
186
+ -> Project State Lookup (branch, focus area, recent changes)
187
+ -> Complexity Assessment (trivial -> epic, scored 0-100)
188
+ -> Strategy Selection (junior / mid / senior)
189
+ -> Response Generation (adapted to user)
190
+ -> Pattern Recording (update learning memory)
191
+ -> Output
88
192
  ```
89
193
 
90
- ## Architecture
194
+ ### Architecture
91
195
 
92
196
  ```
93
197
  packages/
94
- core/ -- Types, config, moderator engine, workflow engine
95
- server/ -- MCP server, 17 tool definitions
96
- memory/ -- File-based persistent storage
97
- analyzer/ -- Codebase scanner, complexity estimator
98
- strategies/ -- Adaptive output (junior/mid/senior)
198
+ core/ Types, config (YAML + Zod), moderator engine, workflow engine
199
+ server/ MCP server entry point, 17 tool definitions
200
+ memory/ File-based persistent storage (project, user, session)
201
+ analyzer/ Codebase scanner, tech detector, complexity estimator
202
+ strategies/ Adaptive output formatting (junior, mid, senior)
203
+ ```
204
+
205
+ ### What gets stored
206
+
207
+ All data lives in `.mod-bot/` at your project root (add to `.gitignore`):
208
+
209
+ ```
210
+ .mod-bot/
211
+ config.yaml # Your preferences
212
+ state.json # Current project state
213
+ memory/
214
+ project.json # Codebase knowledge
215
+ user.json # Learned patterns
216
+ sessions.json # Session history
217
+ ```
218
+
219
+ No databases. No external services. Everything is local JSON and YAML.
220
+
221
+ ## Configuration
222
+
223
+ After `init_setup`, your `.mod-bot/config.yaml` looks like:
224
+
225
+ ```yaml
226
+ version: "1.0.0"
227
+ user:
228
+ name: Alex
229
+ experienceLevel: senior # junior | mid | senior | lead
230
+ primaryLanguages:
231
+ - TypeScript
232
+ - Python
233
+ learningLanguages:
234
+ - Rust # Gets extra guidance here
235
+ visualPreference: minimal # minimal | moderate | verbose
236
+ explanationDepth: terse # terse | standard | detailed
237
+ workflowPreference: autonomous # guided | autonomous | adaptive
238
+
239
+ project:
240
+ status: brownfield # greenfield | brownfield | fork
241
+ type: team # personal | team | enterprise
242
+ priorities:
243
+ - quality
244
+ - speed
245
+
246
+ moderation:
247
+ autoSuggest: true
248
+ learnPatterns: true
249
+ swarmBudget: conservative # conservative | moderate | unlimited
250
+ tddEnforcement: suggest # off | suggest | enforce
251
+ reviewBeforeCommit: true
252
+ ```
253
+
254
+ Edit it directly or use `init_reconfig` to update specific fields.
255
+
256
+ ## Contributing
257
+
258
+ ```bash
259
+ git clone https://github.com/MiguelSeglias/mod-bot.git
260
+ cd mod-bot
261
+ pnpm install
262
+ pnpm build
263
+ pnpm test # 67 tests across 4 packages
264
+ ```
265
+
266
+ ### Project structure
267
+
268
+ This is a pnpm monorepo. The `tsup` bundler produces a single `dist/index.js` for npm distribution.
269
+
270
+ ```bash
271
+ pnpm build # Build all packages (tsc)
272
+ pnpm build:dist # Bundle for distribution (tsup)
273
+ pnpm test # Run all tests (vitest)
99
274
  ```
100
275
 
276
+ PRs welcome. Please include tests for new tools.
277
+
101
278
  ## License
102
279
 
103
280
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-bot",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "Adaptive code moderation MCP server that learns your preferences and tailors guidance to your experience level",
6
6
  "author": "Miguel Seglias",