Skip to content

Commit 17178d9

Browse files
committed
fix(docs): resolve consistency issues across all 6 rule documents
- Add missing `sleep 3 &&` to project-template.md Agent Automation commands - Add Terminal Delay guidance line to analyze-project.ts generated output - Rename make_plan.md "Integration with Other Rules" to "Cross-References" - Add `sleep 3 &&` prefix to all command examples in testing.md, git-commands.md - Add Quick Reference Card and .gitignore guidance to agents.md - Remove ghost plans.md references from README, analyze-project, get-setup-guide - Add exec/execution aliases for make_plan in types/index.ts - Update test fixtures to match new generated output format - All 106 tests passing
1 parent 80a4de1 commit 17178d9

11 files changed

Lines changed: 235 additions & 214 deletions

File tree

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ MCP (Model Context Protocol) server providing AI coding agents with universal, l
44

55
## What It Does
66

7-
**codeops-mcp** bundles 7 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 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.
88

99
### Rule Documents
1010

@@ -14,7 +14,6 @@ MCP (Model Context Protocol) server providing AI coding agents with universal, l
1414
| **testing** | Test commands, workflows, coverage requirements, debugging strategies |
1515
| **git-commands** | Git commit protocols (`gitcm`/`gitcmp`), message format, push workflow |
1616
| **make_plan** | Complete protocol for creating and executing multi-document implementation plans |
17-
| **plans** | 10 rules for structuring plans: phases, tasks, dependencies, architecture |
1817
| **agents** | Mandatory AI agent behavior: compliance, context management, multi-session execution |
1918
| **project-template** | Template for `.clinerules/project.md` — project-specific toolchain configuration |
2019

docs/agents.md

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ This file contains **universal agent rules** that work for any software project.
1919

2020
---
2121

22+
## **Quick Reference Card**
23+
24+
> **The 5 most critical rules at a glance — read the full sections below for details.**
25+
26+
| # | Rule | Key Point |
27+
|---|------|-----------|
28+
| 🔒 | **Mandatory Compliance** | Load `code.md` + `testing.md` before ANY work. All tests must pass. |
29+
| 📊 | **Context Window** | Continue until 90% of 200K input. Max 60K output per response. |
30+
| 📦 | **Script-First** | NEVER use inline scripts (`node -e`, `python -c`). Create files in `scripts/`. |
31+
| 🔒 | **Git Protocol** | NEVER use `git commit -m`. Always `gitcm`/`gitcmp` with file-based messages. |
32+
| 📜 | **No Complex Chains** | No `&&` + pipes/redirects combos. Use script files instead. |
33+
34+
---
35+
2236
## **🚨 ULTRA-CRITICAL: MANDATORY COMPLIANCE WITH CODING STANDARDS 🚨**
2337

2438
**Before ANY planning or implementation, you MUST consult `code.md` and `testing.md`.**
@@ -392,6 +406,19 @@ rm scripts/tmp-check-data-format.ts
392406

393407
Temporary scripts should NOT be committed to version control. If a temporary script proves useful, rename it to use a permanent prefix (`debug-`, `test-`, `verify-`, `run-`).
394408

409+
#### Git Tracking Recommendations for Generated Directories
410+
411+
| Directory | Recommendation | Rationale |
412+
|-----------|---------------|-----------|
413+
| `plans/` |**Commit** — these are project documentation | Plans are valuable context for future sessions and team members |
414+
| `scripts/tmp-*` |**Do NOT commit** — clean up after use | Temporary exploration scripts have no lasting value |
415+
| `scripts/debug-*`, `scripts/run-*`, etc. |**Commit if reusable** | Permanent utility scripts are project infrastructure |
416+
417+
Consider adding to your project's `.gitignore`:
418+
```
419+
scripts/tmp-*
420+
```
421+
395422
---
396423

397424
### **Rule 9: Compact Conversation After Task Completion**
@@ -412,40 +439,45 @@ Temporary scripts should NOT be committed to version control. If a temporary scr
412439

413440
---
414441

415-
### **Rule 11: Mandatory `gitcm`/`gitcmp` for All Git Operations — File-Based Commits ONLY**
442+
### **Rule 10: VS Code Settings Automation (Optional)**
416443

417-
**🚨 NEVER execute raw git staging, committing, or pushing commands. ALWAYS use `gitcm` or `gitcmp`.**
444+
If the project uses `scripts/agent.sh` for VS Code settings automation:
418445

419-
The `gitcm` and `gitcmp` protocols (defined in `git-commands.md`) are the **ONLY** permitted methods for git staging, committing, and pushing. Running loose git commands bypasses the required commit message format, verification steps, and workflow safeguards.
446+
**Act Mode Requirements:**
420447

421-
**🚨 CRITICAL: The `-m` flag is BANNED.** Commit messages MUST be written to `/tmp/git_commit_msg.txt` using `write_to_file` and committed with `git commit -F /tmp/git_commit_msg.txt`. This is because inline `-m` messages fail due to shell escaping, length limits, and multi-line formatting issues. See `git-commands.md` for the full explanation.
448+
1. **✅ Execute `clear && sleep 3 && scripts/agent.sh start` as THE FIRST COMMAND of any Act Mode task**
449+
- Switches VS Code to development mode
422450

423-
#### PROHIBITED (NEVER DO):
451+
2. **✅ Execute `clear && sleep 3 && scripts/agent.sh finished` as THE LAST COMMAND of any Act Mode task**
452+
- Switches VS Code to completion mode (full linting, formatting, cleanup)
453+
454+
**Workflow Pattern:**
424455

425456
```bash
426-
❌ git commit -m "some message"
427-
❌ git commit -m 'some message'
428-
❌ git commit -am "some message"
429-
❌ git commit -m "feat(scope): ..." -m "- detail 1" -m "- detail 2"
430-
❌ ANY use of the -m flag with git commit
431-
❌ git push origin main
432-
❌ git add . && git commit -m "message" && git push
457+
# FIRST COMMAND - Start of any Act Mode task
458+
clear && sleep 3 && scripts/agent.sh start
459+
460+
# ... perform all task implementation work ...
461+
462+
# LAST COMMAND - End of any Act Mode task
463+
clear && sleep 3 && scripts/agent.sh finished
433464
```
434465

435-
#### REQUIRED (ALWAYS DO):
466+
**When NOT to Apply:**
436467

437-
- **To stage and commit:** Use the `gitcm` protocol (see `git-commands.md`)
438-
- **To stage, commit, and push:** Use the `gitcmp` protocol (see `git-commands.md`)
439-
- **ALWAYS** write the commit message to `/tmp/git_commit_msg.txt` using `write_to_file` first
440-
- **ALWAYS** commit using `git commit -F /tmp/git_commit_msg.txt`
441-
- **ALWAYS** clean up with `rm /tmp/git_commit_msg.txt` after committing
468+
- ❌ Do not use in Plan Mode
469+
- ❌ Do not use if `scripts/agent.sh` does not exist in the project
470+
- ❌ Do not use if already in the middle of a task (only at start/end boundaries)
471+
472+
---
442473

443-
**There are NO exceptions.** Even for "quick" or "small" commits, the agent MUST use `gitcm` or `gitcmp` with the file-based approach. These protocols ensure:
444-
- Proper commit message format with scope and prefix
445-
- Commit message written via temp file (no shell escaping issues)
446-
- Multi-line messages with special characters work reliably
447-
- Verification steps are followed
448-
- Consistent workflow across all sessions
474+
### **Rule 11: Mandatory `gitcm`/`gitcmp` for All Git Operations — File-Based Commits ONLY**
475+
476+
**🚨 NEVER execute raw git staging, committing, or pushing commands. ALWAYS use `gitcm` or `gitcmp`.**
477+
478+
All git operations MUST use the `gitcm`/`gitcmp` protocol defined in `git-commands.md`. **The `-m` flag is BANNED** — commit messages MUST be written to `/tmp/git_commit_msg.txt` via `write_to_file`, then committed with `git commit -F`. There are **NO exceptions**, even for "quick" or "small" commits.
479+
480+
> **📖 See `git-commands.md` for the full protocol**, including step-by-step instructions, commit message format, scope conventions, prohibited commands, and the rationale for file-based commits.
449481
450482
---
451483

@@ -526,38 +558,6 @@ Examples:
526558
527559
---
528560

529-
### **Rule 10: VS Code Settings Automation (Optional)**
530-
531-
If the project uses `scripts/agent.sh` for VS Code settings automation:
532-
533-
**Act Mode Requirements:**
534-
535-
1. **✅ Execute `clear && sleep 3 && scripts/agent.sh start` as THE FIRST COMMAND of any Act Mode task**
536-
- Switches VS Code to development mode
537-
538-
2. **✅ Execute `clear && sleep 3 && scripts/agent.sh finished` as THE LAST COMMAND of any Act Mode task**
539-
- Switches VS Code to completion mode (full linting, formatting, cleanup)
540-
541-
**Workflow Pattern:**
542-
543-
```bash
544-
# FIRST COMMAND - Start of any Act Mode task
545-
clear && sleep 3 && scripts/agent.sh start
546-
547-
# ... perform all task implementation work ...
548-
549-
# LAST COMMAND - End of any Act Mode task
550-
clear && sleep 3 && scripts/agent.sh finished
551-
```
552-
553-
**When NOT to Apply:**
554-
555-
- ❌ Do not use in Plan Mode
556-
- ❌ Do not use if `scripts/agent.sh` does not exist in the project
557-
- ❌ Do not use if already in the middle of a task (only at start/end boundaries)
558-
559-
---
560-
561561
## **Summary: Applying These Rules**
562562

563563
**Every Single Time You Respond:**

docs/code.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ These rules are **mandatory** and must be applied **strictly and consistently**
114114
- Methods and properties must be either:
115115
- `public`, or
116116
- `protected` (used instead of `private`)
117+
- **Override:** If `private` is idiomatic for your language/framework (e.g., Java, C#, Kotlin), this convention can be overridden in `.clinerules/project.md` under "Special Rules".
117118

118119
13. **Encapsulation Through Convention**
119120
- `protected` members are considered internal and must not be accessed outside subclasses.
@@ -391,4 +392,4 @@ These rules are **mandatory** and must be applied **strictly and consistently**
391392
- See **agents.md** for verification procedures and task completion criteria
392393
- See **testing.md** for test commands and AI testing workflow
393394
- See **git-commands.md** for git workflow instructions
394-
- See **agents.md Rule 8** for debugging rules (NO inline debug scripts — ALWAYS create script files)
395+
- See **agents.md** — Script-First Execution rule for debugging rules (NO inline debug scripts — ALWAYS create script files)

docs/git-commands.md

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,60 @@ git push
162162

163163
---
164164

165+
## **Conflict Resolution Protocol**
166+
167+
When `git pull --rebase` encounters conflicts during `gitcmp`:
168+
169+
1. **🛑 STOP** — Do not attempt automatic conflict resolution
170+
2. **📋 Report** — List the conflicting files and the nature of the conflict
171+
3. **❓ Ask the user** — Present the situation and ask how to proceed:
172+
- **Option 1:** "Abort rebase and keep local commit" (`git rebase --abort`)
173+
- **Option 2:** "I'll resolve manually — show me the conflicts"
174+
- **Option 3:** "Abort and discard my commit" (rarely wanted)
175+
4. **⏳ Wait** — Do not proceed until the user responds
176+
5. **✅ After resolution** — Run the project's verify command before pushing
177+
178+
**The agent MUST NOT:**
179+
- ❌ Automatically resolve merge conflicts
180+
- ❌ Accept "theirs" or "ours" without user approval
181+
- ❌ Force-push to bypass conflicts
182+
- ❌ Delete or reset commits without explicit user instruction
183+
184+
---
185+
186+
## **Push Failure Recovery**
187+
188+
If `git push` fails after a successful commit:
189+
190+
| Failure | Cause | Recovery |
191+
|---------|-------|----------|
192+
| Authentication error | SSH key or token issue | Report to user — cannot fix programmatically |
193+
| Remote rejection | Branch protection rules | Report to user — may need PR workflow |
194+
| Non-fast-forward | Remote has new commits | Run `git pull --rebase`, resolve conflicts if any, then retry push |
195+
| Network error | Connectivity issue | Wait briefly, retry once. If still failing, report to user |
196+
197+
**In all cases:**
198+
- ✅ The local commit is safe — no work is lost
199+
- ✅ Report the error clearly to the user
200+
- ✅ Suggest the most likely fix
201+
- ❌ Do NOT retry more than once without user approval
202+
- ❌ Do NOT force-push (`git push --force`) unless explicitly instructed
203+
204+
---
205+
165206
## **Important Notes**
166207

167208
1. **Always perform `gitcmp` or `gitcm` in a new Cline task with context** when possible — this creates a clean task boundary for git operations while maintaining previous context.
168209

169210
2. **Always run the project's verify command before committing:**
170211
```bash
171-
# Use the verify command from .clinerules/project.md
172-
# Examples:
173-
# clear && yarn build && yarn test
174-
# clear && cargo build && cargo test
175-
# clear && docker compose config && docker compose build
176-
# clear && pytest
177-
```
212+
# Use the verify command from .clinerules/project.md
213+
# Examples:
214+
# clear && sleep 3 && yarn build && yarn test
215+
# clear && sleep 3 && cargo build && cargo test
216+
# clear && sleep 3 && docker compose config && docker compose build
217+
# clear && sleep 3 && pytest
218+
```
178219
Only commit if verification passes.
179220

180221
3. **Never force-push** unless explicitly asked by the user.

0 commit comments

Comments
 (0)