一键导入
5-maintain
Use when project is shipped — systematic debugging, structured log scan, bug triage, hotfix
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when project is shipped — systematic debugging, structured log scan, bug triage, hotfix
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when closing a finished milestone — writes MILESTONE.yml so /quangflow:status hides it from default view
Use when starting a new project or feature — scans codebase, creates CONTEXT.md, detects project type
Use when entering requirements phase — clarifying questions, edge cases, milestone splits, team composition
Use when entering execution handoff — ROADMAP generation, TDD/logging mandates, SHIP/REFINE gate
Use when entering verification — TDD compliance audit, evidence certification, gap detection
Use when running cook — auto-routes solo / light / team via Stage 0 complexity triage. Override with --solo / --light / --team flags.
| name | 5-maintain |
| description | Use when project is shipped — systematic debugging, structured log scan, bug triage, hotfix |
You are now entering Phase 5: Maintain — post-ship hotfix and maintenance workflow.
After all milestones are SHIPPED, the project enters maintenance mode. This phase handles: production bugs, dependency failures, performance regressions, and ad-hoc fixes. It is lighter than the full /quangflow:1 → 4 cycle but still structured.
All bug investigation and fixing in this phase follows _protocols/_systematic-debugging.md.
/quangflow:4-verify to verify and ship first."/quangflow:5-maintain — Enter maintain mode (auto-detect project)
/quangflow:5-maintain scan — Scan logs, build/refresh BUGLOG.md
/quangflow:5-maintain fix BUG-XXX — Start hotfix for a specific bug
The agent reads application logs from known locations. Convention:
./logs/ <- project log directory
├── backend/ <- BE logs
│ ├── error.log <- errors + exceptions
│ ├── app.log <- general application log
│ └── access.log <- HTTP access log (optional)
├── frontend/ <- FE logs (if captured)
│ ├── error.log <- JS errors, build failures
│ └── console.log <- browser console captures
└── infra/ <- infra logs (optional)
├── docker.log
└── ci.log
If project uses different log locations (e.g. /tmp/backend.log, nohup.out):
nohup.out, /tmp/*.log, *.log in project root./logs/ directory firstnohup.out, /tmp/*.log, *.log in rootWhen reading logs, classify entries:
| Severity | Pattern | Priority |
|---|---|---|
| CRITICAL | Unhandled exceptions, data loss, security breach, service down | Fix immediately |
| ERROR | Failed requests, broken features, exception traces | Fix in this session |
| WARNING | Deprecation, performance degradation, retry exhaustion | Triage — fix or defer |
| INFO | Expected behavior, debug traces | Skip unless user asks |
Do NOT dump entire log files. Read strategically:
log_bookmarks:
backend/error.log: { last_line: 1847, last_read: "2026-03-10T15:00:00" }
frontend/error.log: { last_line: 203, last_read: "2026-03-10T15:00:00" }
/quangflow:5-maintain scan: Read only lines AFTER the bookmark (new entries since last scan)/quangflow:5-maintain scan 7dSave to ./plans/{feature-slug}/BUGLOG.md:
# Bug Log — {feature-slug}
## Metadata
```yaml
last_scan: "2026-03-10T15:08:00+07:00"
log_bookmarks:
backend/error.log: { last_line: 2041, last_read: "2026-03-10T15:08:00" }
frontend/error.log: { last_line: 305, last_read: "2026-03-10T15:08:00" }
log_paths:
backend: ["./logs/backend/error.log", "/tmp/backend.log"]
frontend: ["./logs/frontend/error.log"]
(moved here after fix verified)
(moved here if user chooses DEFER)
---
## Scan Flow (`/quangflow:5-maintain scan`)
1. Discover log files (see Log Discovery Protocol)
2. Read new entries since last bookmark
3. Parse and classify by severity
4. Dedup by error signature
5. Map errors to requirements/files where possible (grep stack traces for known files)
6. Update or create BUGLOG.md
7. Present summary:
Scan complete. Found {N} new issues since last scan:
Top issues:
Actions:
/quangflow:5-maintain fix BUG-XXX — start hotfix for a specific bug
Agent waits. Does nothing until user responds.
---
## Autopilot Triage
See `_protocols/_autopilot.md → Phase 5 — Maintain`. If autopilot: auto-triage by severity, present plain summary, proceed on OK.
On user objection: fall through to manual Triage Flow below.
---
## Triage Flow (user types TRIAGE)
For each NEW bug, starting with highest severity:
Present bug details and ask via `AskUserQuestion`:
```json
{
"questions": [{
"question": "BUG-XXX [SEVERITY]: {description}\nSource: {file}:{line}\nOccurrences: {N}\n\nWhat should we do?",
"header": "Bug Triage",
"options": [
{ "label": "FIX NOW", "description": "Start hotfix immediately" },
{ "label": "FIX LATER", "description": "Keep in active bugs, fix in future session" },
{ "label": "DEFER", "description": "Move to deferred — known issue, not blocking" },
{ "label": "IGNORE", "description": "Not a real bug / expected behavior" }
],
"multiSelect": false
}]
}
Update BUGLOG.md status per decision. After triage, if any FIX NOW selected, proceed to Bug Dispatch.
Count how many bugs are marked FIX NOW. Choose execution mode:
Proceed directly to Hotfix Flow below. Main agent handles it.
Present dispatch options to user:
{N} bugs marked FIX NOW:
- BUG-001 [CRITICAL]: {desc} — affects backend (app/services/*)
- BUG-003 [ERROR]: {desc} — affects frontend (src/components/*)
- BUG-005 [ERROR]: {desc} — affects backend (app/api/*)
Execution mode:
1. **Sequential** — fix one at a time (safest, no conflicts)
2. **Parallel agents** — spawn debugger agents per domain (faster, needs distinct file ownership)
If Sequential (default): Fix highest-severity first, one by one via Hotfix Flow.
If Parallel agents:
debugger agent per domain group:
Task(subagent_type: "debugger", name: "fix-backend")
Prompt: BUGLOG.md context + BUG-001, BUG-005 details + file ownership: app/**
Task(subagent_type: "debugger", name: "fix-frontend")
Prompt: BUGLOG.md context + BUG-003 details + file ownership: src/**
When bugs are dispatched (sequential or parallel), update BUGLOG.md entries:
- **Status:** IN PROGRESS
- **Assigned:** {agent-name or "main"}
- **Started:** {timestamp}
During investigation, if a bug reveals a missing or incorrect requirement (not just a code bug):
Log it in BUGLOG.md with tag ESCALATION: requirement gap
Present to user: "This bug points to a requirement gap — not just a code issue:
Options:
/quangflow:1-brainstorm to properly scope this as a new requirement (uses the short milestone-2+ confirmation flow)"If user picks Escalate: stop maintain flow, tell user to run /quangflow:1-brainstorm {feature-slug} which will use the milestone-2+ short confirmation flow to add the new requirement properly
If user picks Fix here: proceed with the fix as a normal bug
/quangflow:5-maintain fix BUG-XXX)Lighter than full /quangflow:1 → 4 cycle. No brainstorm, no milestone, no team pipeline.
Follow _protocols/_systematic-debugging.md Phase 1 (Observe) and Phase 2 (Hypothesize):
.evidence/logs/ for relevant *.jsonl files, filter by correlation ID or timestamp.evidence/debug/BUG-{ID}-investigation.md**BUG-XXX Investigation:**
- **Root cause:** {explanation}
- **Affected files:** {list}
- **Proposed fix:** {brief description}
- **Risk:** {what else could break}
- **Tests needed:** {what to test after fix}
- **Evidence:** .evidence/debug/BUG-{ID}-investigation.md
Proceed with fix? (YES / ADJUST / SKIP)
Agent waits for user response.
.evidence/tdd/BUG-{ID}-red.log.evidence/tdd/BUG-{ID}-green.log### BUG-XXX [CRITICAL] — Service X returns 500 on endpoint Y
- **Status:** RESOLVED
- **Fixed:** 2026-03-10 15:30
- **Fix:** Replaced vnstock3 API with VNDirect direct API (dependency was IP-banned)
- **Files changed:** app/services/fundamental_service.py, tests/test_fundamental_service.py
- **Regression test:** test_fundamental_service.py::test_api_failure_returns_all_null
Save resolution to .evidence/debug/BUG-{ID}-resolution.md with: root cause, fix applied, files changed, tests added.
See _protocols/_shared.md → GOTCHAs System → Logging Protocol.
After each bug fix, auto-create a gotcha entry in plans/{feature-slug}/GOTCHAS.md:
phase-4 if tests should have caught it, phase-2 if design was flawed, etc.Ask user: "Fix verified. Commit? (YES / NO)"
If YES, create conventional commit: fix: {brief description} (BUG-XXX)
When a bug is caused by an external dependency breaking (API down, library deprecated, service IP-banned):
type: dependency-failureresearcher agent to find replacement APIs/librariesDependency failure: {library/API} — {what broke}
Alternatives:
1. {Alternative A}: {pros/cons}
2. {Alternative B}: {pros/cons}
3. {Workaround}: {temporary fix}
Which approach? (1/2/3)
When scanning, check for patterns:
Present recurring patterns in scan summary:
Recurring patterns detected:
- BUG-003 was resolved on 03/08 but reappeared (regression)
- BUG-007 only occurs between 09:00-15:00 (time-dependent)
When user is done:
phase: maintain, status: idle/quangflow:5-maintain next session."See _protocols/_shared.md → Output Rule.