You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description = "Analyze and propose refactoring plans to improve code readability and maintainability."
1
+
description = "Perform a deep, read-only audit of the codebase to identify technical debt and maintenance issues."
2
+
2
3
prompt = """
3
-
You are an expert software engineer performing a comprehensive codebase maintenance on the current workspace.
4
+
You are a Lead Maintenance Engineer. You are executing the custom `/maintenance` command workflow.
5
+
6
+
**CRITICAL MANDATE:** This command is strictly for analysis and reporting. You MUST NOT modify any source files. Your goal is to produce a "Maintenance Report Card."
7
+
8
+
Follow these phases strictly:
4
9
5
-
**Phase 1: Deep Analysis & Planning**
6
-
Run a deep analysis of the current codebase focusing on performance, security, readability, and overall maintainability.
7
-
**Crucial:** Do NOT propose changes that alter existing functionality or fix bugs. This is strictly a maintenance, clean-up, and refactoring operation.
10
+
### Phase 1: Clarification & Scope
11
+
1. **Analyze Request:** Identify if the user provided specific instructions or a target area for the maintenance audit.
12
+
2. **Clarify:** If the scope is ambiguous, use `ask_user` to define the focus (e.g., "Should I focus on DRY violations in the hooks, or general documentation coverage?").
8
13
9
-
Create a detailed and expressive plan with the following priorities:
10
-
1. **DRY (Don't Repeat Yourself):** Identify and extract duplicated or near-duplicated code.
11
-
2. **Documentation:** Add comprehensive, high-quality docstrings to all functions and classes following the project's conventions.
12
-
3. **Test Coverage:** Identify missing test coverage and propose adding robust tests for corner and edge cases.
13
-
4. **Simplification:** Split long, complex, or deeply nested logic into smaller, focused, and testable methods.
14
+
### Phase 2: Deep Analysis (Codebase Investigator)
15
+
1. **Invoke Investigator:** Invoke the `codebase_investigator` subagent to perform a comprehensive, non-destructive audit.
16
+
2. **Audit Priorities:**
17
+
- **DRY (Don't Repeat Yourself):** Identify logic duplication across files.
18
+
- **Documentation Coverage:** Check for missing docstrings or outdated comments.
19
+
- **Test Gaps:** Identify complex functions without corresponding tests.
20
+
- **Simplification:** Find deeply nested or overly long methods that need refactoring.
21
+
3. **User Context:** Ensure the investigator accounts for any specific instructions provided in Phase 1.
14
22
15
-
Your proposed plan must be highly expressive and detailed. List all intended changes *file by file*, explicitly explaining the rationale and expected benefit behind each refactoring step.
23
+
### Phase 3: Report Card Generation
24
+
1. **Synthesize Findings:** Consolidate the investigator's findings into a structured "Maintenance Report Card."
25
+
2. **Persistence:** Save the report to `research/maintainance-report-<date>.md` using `write_file`.
26
+
3. **Content:** Include a high-level summary, a file-by-file list of detected issues, and specific, actionable suggestions for fixing them.
16
27
17
-
**Phase 2: User Agreement**
18
-
Stop and present your complete plan to the user. Wait for their explicit agreement before making any file modifications.
28
+
### Phase 4: Advisory
29
+
1. **Next Steps:** Inform the user that the audit is complete and the report is saved.
30
+
2. **Orchestration Tip:** Advise the user to use the `/plan` command next, pointing to the generated report, to formulate a safe execution strategy for the identified improvements.
19
31
20
-
**Phase 3: Step-by-Step Implementation**
21
-
Upon user agreement, implement the plan iteratively, step by step. Ensure that after each logical change, the code is properly formatted, passes all linters, and all tests pass, using the appropriate command for the current project.
***`/draft`**: Multi-phase workflow to turn research and plans into detailed, high-quality technical documents or articles section-by-section using the `writer` subagent.
77
77
***`/review`**: Uses the `reviewer` subagent to perform non-destructive, multi-phase structural and linguistic audits based on the project's style guide.
78
-
***`/maintenance`**: Performs a deep scan of the codebase to identify technical debt, refactoring opportunities, and areas to improve test coverage.
78
+
***`/maintenance`**: Performs a deep, read-only audit of the codebase using the `codebase_investigator`to identify technical debt and generate a "Maintenance Report Card" in `research/`.
79
79
***`/document`**: Analyzes the codebase and journals to generate or update comprehensive project documentation in the `docs/` folder.
80
80
***`/cron`**: Manages repetitive background tasks (e.g., health checks, automated reports) using **systemd user timers**.
Copy file name to clipboardExpand all lines: docs/user-guide.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -198,7 +198,8 @@ Your background automation layer.
198
198
199
199
Your defense against context rot.
200
200
201
-
-**How it works:** Performs a comprehensive audit of the codebase to identify technical debt, outdated implementations, or deviations between code and documentation. It presents a detailed refactoring plan for your approval before making any changes, ensuring the repository remains a clean environment for the AI to operate within.
201
+
-**How it works:** Performs a comprehensive, read-only audit of the codebase to identify technical debt, outdated implementations, or documentation gaps using the `codebase_investigator`. It generates a "Maintenance Report Card" in the `research/` directory.
202
+
-**Why it works:** It separates the audit from the implementation, ensuring the codebase remains a clean environment. After an audit, use the `/plan` command to safely execute the suggested improvements.
0 commit comments