@@ -4,24 +4,26 @@ MCP (Model Context Protocol) server providing AI coding agents with universal, l
44
55## What It Does
66
7- ** codeops-mcp** bundles 6 curated rule documents that teach AI agents how to code, test, plan, commit, and behave — across any programming language and project type. It exposes these rules via 5 MCP tools.
7+ ** codeops-mcp** bundles 8 curated rule documents that teach AI agents how to code, test, plan, commit, gather requirements, reverse-engineer codebases , and behave — across any programming language and project type. It exposes these rules via 5 MCP tools.
88
99### Rule Documents
1010
11- | Rule | Description |
12- | -------------------- | ------------------------------------------------------------------------------------ |
13- | ** code** | 30 coding standards: DRY, testing, documentation, architecture, type safety |
14- | ** testing** | Test commands, workflows, coverage requirements, debugging strategies |
15- | ** git-commands** | Git commit protocols (` gitcm ` /` gitcmp ` ), message format, push workflow |
16- | ** make_plan** | Complete protocol for creating and executing multi-document implementation plans |
17- | ** agents** | Mandatory AI agent behavior: compliance, context management, multi-session execution |
18- | ** project-template** | Template for ` .clinerules/project.md ` — project-specific toolchain configuration |
11+ | Rule | Description |
12+ | ------------------------ | ------------------------------------------------------------------------------------ |
13+ | ** code** | 30 coding standards: DRY, testing, documentation, architecture, type safety |
14+ | ** testing** | Test commands, workflows, coverage requirements, debugging strategies |
15+ | ** git-commands** | Git commit protocols (` gitcm ` /` gitcmp ` ), message format, push workflow |
16+ | ** make_plan** | Complete protocol for creating and executing multi-document implementation plans |
17+ | ** requirements** | Requirements gathering & documentation protocol (` make_requirements ` ) |
18+ | ** retro_requirements** | Reverse-engineer an existing codebase into structured requirements |
19+ | ** agents** | Mandatory AI agent behavior: compliance, context management, multi-session execution |
20+ | ** project-template** | Template for ` .clinerules/project.md ` — project-specific toolchain configuration |
1921
2022### MCP Tools
2123
2224| Tool | Description |
2325| ----------------- | ---------------------------------------------------------------------------- |
24- | ` get_rule ` | Get any rule document by name (supports aliases like "git", "test") |
26+ | ` get_rule ` | Get any rule document by name (supports aliases like "git", "test", "retro") |
2527| ` list_rules ` | List all available rules grouped by category |
2628| ` search_rules ` | Full-text search across all rules with TF-IDF ranking |
2729| ` analyze_project ` | ** Killer feature** — Scan a project directory and auto-generate ` project.md ` |
@@ -83,7 +85,7 @@ Or via environment variable:
8385
8486The two-layer architecture:
8587
86- 1 . ** Layer 1: Universal rules** (bundled in this package) — Language-agnostic standards
88+ 1 . ** Layer 1: Universal rules** (bundled in this package) — Language-agnostic standards for coding, testing, git, planning, and requirements
87892 . ** Layer 2: Project-specific config** (` .clinerules/project.md ` in your project) — Toolchain, commands, conventions
8890
8991All generic rules reference ` project.md ` for project-specific settings like build commands, test commands, package manager, etc.
@@ -94,6 +96,249 @@ All generic rules reference `project.md` for project-specific settings like buil
94962 . Save the output to ` .clinerules/project.md ` in your project
95973 . The AI agent automatically applies universal rules using your project's settings
9698
99+ ---
100+
101+ ## Usage Guide
102+
103+ ### Trigger Keywords
104+
105+ codeops-mcp defines ** trigger keywords** — when you type these phrases, the AI agent executes sophisticated multi-step protocols:
106+
107+ | Keyword | What It Does |
108+ | ---------| -------------|
109+ | ` make_plan ` | Creates a detailed multi-document implementation plan for a feature |
110+ | ` exec_plan [name] ` | Executes an existing plan step by step |
111+ | ` make_requirements ` | Discovers, structures, and documents project requirements |
112+ | ` add_requirement ` | Adds a new requirement to an existing requirements set |
113+ | ` review_requirements ` | Health-checks existing requirements for gaps and inconsistencies |
114+ | ` retro_requirements ` | Reverse-engineers an existing codebase into structured requirements |
115+ | ` gitcm ` | Stages all changes and commits with a detailed conventional commit message |
116+ | ` gitcmp ` | Same as ` gitcm ` plus rebase and push |
117+
118+ ### Workflow Overview
119+
120+ The protocols form a complete development pipeline:
121+
122+ ```
123+ ┌──────────────────────────────────────────────────────────────────┐
124+ │ REVERSE PATH (existing codebase → requirements → rebuild) │
125+ │ │
126+ │ retro_requirements → make_requirements → make_plan → exec_plan │
127+ └──────────────────────────────────────────────────────────────────┘
128+
129+ ┌──────────────────────────────────────────────────────────────────┐
130+ │ FORWARD PATH (new project → requirements → implementation) │
131+ │ │
132+ │ make_requirements → make_plan → exec_plan │
133+ └──────────────────────────────────────────────────────────────────┘
134+
135+ ┌──────────────────────────────────────────────────────────────────┐
136+ │ QUICK PATH (add a feature to existing codebase) │
137+ │ │
138+ │ make_plan → exec_plan │
139+ └──────────────────────────────────────────────────────────────────┘
140+ ```
141+
142+ You can use any part of the pipeline independently — they're designed to work together but none requires the others.
143+
144+ ---
145+
146+ ### Coding Standards & Testing
147+
148+ The agent automatically loads coding standards and testing rules at the start of every task. These enforce:
149+
150+ - ** 30 coding rules** : DRY, single responsibility, documentation, type safety, 500-line file limit
151+ - ** Testing workflow** : Write tests first, run verification before every commit
152+ - ** Test coverage** : Unit, integration, and end-to-end tests required
153+
154+ You don't need to do anything — just have codeops-mcp installed and the agent follows these rules automatically.
155+
156+ ---
157+
158+ ### Planning & Execution (` make_plan ` / ` exec_plan ` )
159+
160+ Create and execute structured implementation plans for features of any size.
161+
162+ ** Creating a plan:**
163+
164+ ```
165+ User: make_plan
166+
167+ Agent: What feature would you like to plan?
168+
169+ User: Add JWT authentication to our API
170+
171+ Agent: [Asks clarifying questions, analyzes codebase, then creates:]
172+ plans/jwt-auth/
173+ ├── 00-index.md
174+ ├── 01-requirements.md
175+ ├── 02-current-state.md
176+ ├── 03-auth-middleware.md
177+ ├── 04-token-service.md
178+ ├── 07-testing-strategy.md
179+ └── 99-execution-plan.md
180+ ```
181+
182+ ** Executing a plan:**
183+
184+ ```
185+ User: exec_plan jwt-auth
186+
187+ Agent: [Reads the execution plan, implements tasks one by one,
188+ runs verification after each task, updates progress,
189+ asks about commits after each verified task]
190+ ```
191+
192+ ** Commit modes for ` exec_plan ` :**
193+
194+ | Flag | Behavior |
195+ | ------| ----------|
196+ | * (default)* | Ask before each commit |
197+ | ` --no-commit ` | Never commit — you handle git yourself |
198+ | ` --auto-commit ` | Automatically commit and push after each task |
199+
200+ ---
201+
202+ ### Requirements Engineering (` make_requirements ` )
203+
204+ Transform a rough project idea into formal requirement documents through guided discovery.
205+
206+ ** Example:**
207+
208+ ```
209+ User: I want to build a university lab management SaaS. Researchers book lab rooms,
210+ ethics committee approves studies, participants sign up on a public page.
211+ Built with Node, TypeScript, PostgreSQL.
212+
213+ make_requirements
214+
215+ Agent: [Conducts multi-turn discovery interview]
216+ - Maps stakeholders and user types
217+ - Analyzes comparable systems (suggests features you haven't thought of)
218+ - Walks through user journeys to find hidden requirements
219+ - Explores "what happens when..." edge cases
220+ - Produces formal requirement documents:
221+
222+ requirements/
223+ ├── README.md # Index, glossary, dependency graph
224+ ├── RD-01-scaffolding.md # Project setup
225+ ├── RD-02-data-model.md # Database schema
226+ ├── RD-03-auth.md # Authentication & RBAC
227+ ├── RD-04-lab-booking.md # Core booking functionality
228+ ├── ...
229+ └── RD-12-deployment.md # Production deployment
230+ ```
231+
232+ Each RD document can then be fed into ` make_plan ` for implementation:
233+
234+ ```
235+ User: make_plan
236+ Agent: I found requirement documents. Which RD would you like to implement?
237+ User: RD-04-lab-booking.md
238+ Agent: [Creates implementation plan based on the requirement document]
239+ ```
240+
241+ ** Additional keywords:**
242+ - ` add_requirement ` — Add a new RD to an existing set
243+ - ` review_requirements ` — Run a health check on all requirements (gaps, inconsistencies, scope creep)
244+
245+ ---
246+
247+ ### Reverse Requirements Engineering (` retro_requirements ` )
248+
249+ Analyze an existing codebase and produce a reconstruction brief — detailed enough to rebuild the entire application.
250+
251+ ** Example:**
252+
253+ ```
254+ User: retro_requirements
255+
256+ Agent: [Systematically analyzes the codebase in 10 phases:]
257+ Phase 0: Reconnaissance — manifests, directory structure, tech stack
258+ Phase 1: Structural Analysis — layers, modules, entry points, patterns
259+ Phase 2: Data Model — entities, relationships, constraints
260+ Phase 3: API Surface — endpoints, CLI commands, public interfaces
261+ Phase 4: Behavior Catalog — features translated to requirement statements
262+ Phase 5: Business Rules — validation, authorization, domain logic
263+ Phase 6: Cross-Cutting — auth, errors, logging, caching
264+ Phase 7: Integrations — external APIs, databases, services
265+ Phase 8: Gaps & Debt — TODOs, missing tests, security gaps
266+ Phase 9: Synthesis — produces the reconstruction brief
267+
268+ Output:
269+ requirements/_retro/
270+ ├── 00-project-profile.md
271+ ├── 01-architecture-analysis.md
272+ ├── ...
273+ ├── 08-gaps-and-debt.md
274+ └── 09-reconstruction-brief.md ← Feed this to make_requirements
275+ ```
276+
277+ ** Scope control for large codebases:**
278+
279+ ```
280+ retro_requirements --scope src/auth # Analyze only the auth module
281+ retro_requirements --continue # Resume an interrupted session
282+ ```
283+
284+ The reconstruction brief is designed as input for ` make_requirements ` , completing the full reverse → forward pipeline.
285+
286+ ---
287+
288+ ### Git Workflow (` gitcm ` / ` gitcmp ` )
289+
290+ Safe, structured git commits with detailed conventional commit messages.
291+
292+ ```
293+ User: gitcm
294+
295+ Agent: [Stages all changes, writes a detailed commit message to a temp file,
296+ commits using git commit -F, cleans up]
297+
298+ Result:
299+ feat(auth): add JWT token refresh endpoint
300+
301+ - Add POST /api/auth/refresh endpoint
302+ - Implement token rotation with refresh token family tracking
303+ - Add rate limiting (5 refreshes per minute per user)
304+ - Tests added for all edge cases
305+ ```
306+
307+ ```
308+ User: gitcmp
309+
310+ Agent: [Same as gitcm, plus rebase and push. Reports conflicts if any.]
311+ ```
312+
313+ ** Key safety rules:**
314+ - Commit messages are ALWAYS written to a file (never inline ` -m ` flag)
315+ - Verification (build + test) runs before every commit
316+ - Conflicts are reported to the user — never auto-resolved
317+
318+ ---
319+
320+ ### Project Configuration (` analyze_project ` )
321+
322+ Auto-detect your project's toolchain and generate a configuration file:
323+
324+ ```
325+ User: analyze_project /path/to/my/project
326+
327+ Agent: [Reads package.json/Cargo.toml/go.mod/pyproject.toml, scans directory
328+ structure, detects language, framework, test runner, build tools]
329+
330+ Output: A complete .clinerules/project.md with:
331+ - Build, test, and verify commands
332+ - Directory layout
333+ - Coding conventions
334+ - Git conventions
335+ - Cross-references to all rule documents
336+ ```
337+
338+ ** Incremental updates:** If ` .clinerules/project.md ` already exists, ` analyze_project ` merges the fresh scan with your existing file — auto-detectable sections are refreshed while user-customized sections (coding conventions, special rules) are preserved verbatim.
339+
340+ ---
341+
97342## Development
98343
99344``` bash
@@ -103,7 +348,7 @@ yarn install
103348# Build
104349yarn build
105350
106- # Run tests
351+ # Run tests (107 tests across 4 test files)
107352yarn test
108353
109354# Watch mode
130375└── __tests__/
131376 ├── store/ # Store & search engine tests
132377 └── tools/ # Tool integration tests
133- docs/ # Bundled rule markdown files
378+ docs/ # 8 bundled rule markdown files
134379```
135380
136381## License
0 commit comments